Solver Common
This page describes some functions that are used by all physics modules as part of initialization of a simulation
SolverCommon.call_nlsolver
— Function.This function takes in the 4 principle object, fully initialized, and calls a nonlinear solver on them, according to the options in the dictionary. The evalResidual function is passed to the nonlinear solver Inputs: mesh: a mesh object sbp: an SBP operator eqn: an equation object opts: options dictionary, used to determine which nonlinear solver to call pmesh: mesh used for calculating preconditioning jacobian in Newton's method, default to using mesh if not specified Outputs: none Aliasing restrictions: none (specificaly, mesh and pmesh can be the same object)
SolverCommon.createMeshAndOperator
— Method.Create a SBP operator and a mesh. This is used by all physics modules to create the right type of operator and mesh based on the input options. It is type unstable, but that is ok.
If the options dictionary specifies a second SBP operator type, a second mesh and SBP operator will be created and stored in the mesh2
and sbp2
Inputs: opts: options dictonary dofpernode: number of degrees of freedom on each node
Outputs sbp : an AbstractSBP mesh : an AbstractMesh pmesh : an AbstractMesh, used for preconditioning, may be same object as mesh Tsol : DataType that should be used for eqn.q Tres : DataType that should be used for eqn.res Tmsh : DataType of mesh.dxidx and friends mesh_time : time in seconds for creation of mesh (Float64)
SolverCommon.getDataTypes
— Method.This function determines the datatypes of the elements of the arrays of the mesh quantities, sbp operator, solution variables and residual.
If the datatypes cannot be determined, an error is thrown.
Inputs: opts: the options dictionary
Outputs Tmsh Tsbp Tsol Tres
Options Keys
run_type
jac_method
force_solution_complex
force_mesh_complex
SolverCommon.loadRestartState
— Function.This function is used by all physics modules to load the most recently saved state when restarting.
Inputs
mesh: the mesh
sbp: AbstractSBP
eqn: AbstractSolutionData, eqn.q_vec is overwritten with the saved state
opts: options dictionary
The keys described in the Checkpointer
documentation are used to determine the most recent complete checkpoint.
Implementation notes: currently pmesh isn't used for anything because checkpointing does not support mesh adaptation. When this changes, this function will have to be updated.
SolverCommon.createMesh
— Function.This function creates the mesh object and, optionally, a second mesh used for preconditioning
Inputs: opts: the options dictionary sbp: an SBP operator sbpface: an SBP face operator topo: an ElementTopology describing the SBP reference element. Only needed for 3D DG, otherwise can be any value Tmsh: the DataType of the elements of the mesh arrays (dxidx, jac, etc.) dofpernode: number of degrees of freedom on every node suffix: suffix added to options dictionary keys that describe the SBP operator. See createSBPOperator
All arguments except opts are typically provided by createSBPOperator
and getDataTypes
SolverCommon.createSBPOperator
— Function.This function constructs the SBP operator and the associated SBP face operator, as specified by the options dictionary. It also determines the shape_type that PumiInterface uses to describe the SBP operator to Pumi.
Inputs
opts: the options dictionary
Tsbp: the DataType specifying the Tsbp passed to the SBP operator constructor
suffix: this suffix is added to all keys accessed in the options dictionary. Usually the suffix is either the empty string or an integer. This provides a convenient way for the input file to specify several different SBP operator and have this operator construct them. Default value is the empty string.
Outputs
sbp: the SBP operator
sbpface: the SBP face operator
shape_type: an integer passed to the mesh constructor to describe the operator
topo: in the 3D DG case, an ElementTopology describing the SBP reference element, otherwise the integer 0.
DG Operator Names
SBPOmega: nodes on the interior of the element only
SBPGamma: nodes on the faces of the element and the interior (similar to Lagrange finite elements)
SBPDiagonalE: operator with diagonal E matrix, with nodes on vertices, faces, and interior (similar to Lagrange FE)
SBPDiagonalE2: operator with diagonal E matrix, with nodes on faces (but not vertices)
SBPOmega2: attempt at optimized SBP Omega-type operators, probably not working
SBPOmega3: SBP Omega-type operator with degree 2p cubature rule for all degree operators (p=1 and 2 are the same as SBPOmega), unlike
SBPOmega2
, not optimized
CG Operator Names
SBPGamma: see above, this operator can be used to CG as well