pyfurc API Reference#

This is the reference page for classes and methods in the pyfurc package. It is automatically rendered from docstrings in the source code.

pyfurc.core module#

class pyfurc.core.BifurcationProblem(energy, name='pyfurc_problem', params=None)#

Bases: object

Class for holding information on a bifurcation problem.

Objects of this class are defined by their pyfurc.core.Energy expression and their name. Upon instantiation a pyfurc.util.AutoParameters is created that holds default values for the calculations in AUTO-07p.

Parameters:
  • energy (pyfurc.core.Energy) – The energy of the system containing at least one dof and one load.

  • name (str, optional) – Name of the bifurcation problem. The calculation output folder will contain this name and a timestamp.

  • Variables

  • ———

  • ivar pyfurc.core.Energy energy: The energy expression passed on instantiation.

  • ivar dict dofs: Reference to energy.dofs, dictionary holding dof names and values.

  • ivar pyfurc.util.ProblemParameters problem_parameters: AUTO-7p calculation parameters.

  • ivar str problem_name: Name of the bifurcation problem passed on instantiation. The calculation output folder will contain this name.

set_parameter(param, value)#

Recommended way of changing values in problem_parameters.

Parameters:
  • param (str) – Name of the parameter to change. See pyfurc.util.AutoParameters for details.

  • value – The value to set param to.

Raises:
  • TypeError – If value has the wrong type.

  • KeyError – If param is not a valid parameter name.

Note

You can also directly change the keys in problem_parameters, e.g. bf.problem_parameters[param] = value. This will, however, bypass the type and key checks.

Example

>>> print(bf.problem_parameters["RL1"])
0.0
>>> bf.set_parameter("RL1", 1.0)
>>> print(bf.problem_parameters["RL1"])
1.0
set_quantity_value(param, value)#

Set values for a pyfurc.core.PhysicalQuantity which is contained in the BifurcationProblem.energy expression. Shortcut for BifurcationProblem.energy.set_quantity_value.

Parameters:
class pyfurc.core.BifurcationProblemSolution#

Bases: object

read_solution(dirc)#
class pyfurc.core.BifurcationProblemSolver(bf_problem)#

Bases: object

delete_last_solution()#
run_auto(dirc)#
solve()#
write_const_file(basedir='./', silent=False)#
write_func_file(basedir='./', silent=False)#
class pyfurc.core.Dof(name, value=0.0)#

Bases: PhysicalQuantity

Class used for defining degrees of freedom. Shortcut for PhysicalQuantity(name, quantity_type="dof")

Parameters:
  • name (str) – The name that will be displayed in outputs. When working in a jupyter notebook, LaTeX symbols can be displayed, e.g. \varphi.

  • value (float, optional) – Initial value of the degree of freedom. Default is 0.0.

Example

Define a degree of freedom with an initial value of 1.0 and a display name “\varphi”:

phi = Dof("\\varphi", value=1.0)
default_assumptions = {}#
name: str#
class pyfurc.core.Energy(*args)#

Bases: Expr

Container class for energy expressions.

Parameters:

expr (valid sympy Expression e.g. sympy.Mul or sympy.Add containing exactly one pyfurc.core.PhysicalQuantity with quantity_type="load")

default_assumptions = {}#
equilibrium()#
info()#
set_quantity_value(key, value)#
class pyfurc.core.Load(name, value=0.0)#

Bases: PhysicalQuantity

Class used for defining degrees of freedom. Shortcut for PhysicalQuantity(name, quantity_type="load")

Parameters:
  • name (str) – The name that will be displayed in outputs. When working in a jupyter notebook, LaTeX symbols can be displayed, e.g. \varphi.

  • value (float, optional) – Initial value of the load. Default is 0.0.

Example

Define a Load with display name “P”:

phi = Load("P")
default_assumptions = {}#
name: str#
class pyfurc.core.Parameter(name, value=0.0)#

Bases: PhysicalQuantity

default_assumptions = {}#
name: str#
class pyfurc.core.PhysicalQuantity(name, quantity_type, value=0.0)#

Bases: Symbol

Fundamental class for degrees of freedom, loads and parameters.

Using the shortcut classes pyfurc.Dof, pyfurc.Load and pyfurc.Parameter is recommended.

Parameters:
  • name (str) – The name that will be displayed in outputs. When working in a jupyter notebook, LaTeX symbols can be displayed, e.g. \varphi.

  • quantity_type (str, optional) – One of load, dof, or parameter, by default parameter

  • value (float, optional) – Initial value if quantity_type is load or dof. Value if quantity_type is parameter. Default is 0.0.

default_assumptions = {}#
name: str#

pyfurc.tools module#

pyfurc.tools.setup_auto_exec_env()#

Sets up AUTO-07p executable PATHs and returns an environment for use with subprocess

pyfurc.util module#

class pyfurc.util.AutoCodePrinter#

Bases: FCodePrinter

Subclass of sympy.FCodePrinter with necessary parameters set for printing AUTO-07p FORTRAN code.

class pyfurc.util.AutoOutputReader(dirc)#

Bases: object

find_table_lines()#
read_raw_data()#
class pyfurc.util.AutoParameters#

Bases: ParamDict

Dictionary holding the AUTO-07p calculation parameters. Upon instantiation default values will be set.

The following table gives a list of parameter names and their default values. The short explanations are taken from the AUTO-07p manual. Please refer to the AUTO-07p manual for more detailed explanations.

Parameter

Default

Explanation

NTST

50

The number of mesh intervals used for discretization.

IAD

3

This constant controls the mesh adaption. IAD=3 is the strongly recommended value.

EPSL

1e-07

Relative convergence criterion for equation parameters in the Newton/Chord method. Recommended value range: 10E-7 to 10E-6.

EPSU

1e-07

Relative convergence criterion for solution components in the Newton/Chord method. Recommended value range: 10E-7 to 10E-6.

EPSS

1e-05

Relative arclength convergence criterion for the detection of special solutions. Recommended value range: 10E-5 to 10E-4. Generally, EPSS should be approximately 100 to 1000 times the value of EPSL, EPSU.

ITMX

8

The maximum number of iterations allowed in the accurate location of special solutions, such as bifurcations, folds, and user output points, by Müller’s method with bracketing. The recommended value is ITMX=8

ITNW

5

The maximum number of combined Newton-Chord iterations. When this maximum is reached, the step will be retried with half the stepsize. The recommended value is ITNW=5, but ITNW=7 may be used for “difficult” problems

DS

0.1

Pseudo-arclength stepsize to be used for the first attempted step along any family. DSMIN ≤ | DS | ≤ DSMAX must hold.

DSMIN

0.001

Minimum allowable absolute value of the pseudo-arclength stepsize.

DSMAX

0.2

Maximum allowable absolute value of the pseudo-arclength stepsize.

IADS

1

This constant controls the frequency of adaption of the pseudo-arclength stepsize.

  • IADS=0: fixed pseudo-arclength stepsize DS.

  • IADS>0: Adapt the pseudo-arclength stepsize after every IADS steps.

ICP

[1]

For each equation type and for each continuation calculation there is a typical (“ge The array ICP designates these free parameters. The parameter that appears first in the ICP list is called the “principal continuation parameter”.

STOP

[]

This constant adds stopping conditions

NMX

200

The maximum number of steps to be taken along any family.

RL0

0.0

The lower bound on the principal continuation parameter. Typically this will be the load.

RL1

0.0

The upper bound on the principal continuation parameter.

MXBF

10

Maximum number of bifurcations to be treated.

NPR

200

This constant can be used to regularly write fort.8 plotting and restart data. IF NPR>0 then such output is written every NPR steps. If NPR=0 or if NPR``≥``NMX then no such output is written.

IID

2

This constant controls the amount of diagnostic output printed in fort.9. See the AUTO-07p manual for details.

IPLT

0

This constant allows redefinition of the principal solution measure, i.e. the error norm. See the AUTO-07p manual for details.

UZR

{}

This constant allows the setting of parameter values which labeled plotting and restart information is to be written in the fort.8 output-file. See the AUTO-07p manual for details.

UZSTOP

{}

This constant specifies parameter values in the same way as UZR above, but the computation will always terminate if any solution point that is specified is encountered.

class pyfurc.util.DataDir(base_dir='./', name='')#

Bases: object

create_dir()#
create_subdir(name)#
dir()#
class pyfurc.util.HiddenAutoParameters#

Bases: ParamDict

class pyfurc.util.ParamDict#

Bases: dict