Developer API¶
-
class
atomics.pde_problem.
PDEProblem
(mesh)¶ PDEProblem is a class containing the mesh and the dictionaries of the boundary conditions, inputs, states, and outputs.
-
class
atomics.atomics_group.
AtomicsGroup
(**kwargs)¶ The AtomicsGroup is a OpenMDAO Group object that wraps the assembly of OpenMDAO components. Within
AtomicsGroup
, the users can choose thepde_problem
,linear_solver_
(for the solution total derivatives), the`` problem_type``, and whether to turn on thevisualization
option. problem. Parameters ———-linear_solver_
solver for the total derivatives default=’petsc_cg_ilu’, values=[‘fenics_direct’, ‘scipy_splu’, ‘fenics_krylov’, ‘petsc_gmres_ilu’, ‘scipy_cg’,’petsc_cg_ilu’]problem_type
solver for the FEA problem default=’nonlinear_problem’, values=[‘linear_problem’, ‘nonlinear_problem’, ‘nonlinear_problem_load_stepping’]visualization
whether to save the iteration histories default=’False’, values=[‘True’, ‘False’],-
initialize
()¶ Perform any one-time initialization run at instantiation.
-
setup
()¶ Build this group.
This method should be overidden by your Group’s method. The reason for using this method to add subsystem is to save memory and setup time when using your Group while running under MPI. This avoids the creation of systems that will not be used in the current process.
You may call ‘add_subsystem’ to add systems to this group. You may also issue connections, and set the linear and nonlinear solvers for this group level. You cannot safely change anything on children systems; use the ‘configure’ method instead.
- Available attributes:
name pathname comm options
-
-
class
atomics.states_comp.
StatesComp
(**kwargs)¶ StatesComp is a OpenMDAO implicit component, which wraps the FEniCS PDE solver. The total derivatives are also calculated in StatesComp. problem. The users do not need to modify StatesComp ideally. The same settings can be modified in AtomicsGroup() from the run file. Parameters ———-
linear_solver_
solver for the total derivatives values=[‘fenics_direct’, ‘scipy_splu’, ‘fenics_krylov’, ‘petsc_gmres_ilu’, ‘scipy_cg’,’petsc_cg_ilu’]problem_type
solver for the FEA problem values=[‘linear_problem’, ‘nonlinear_problem’, ‘nonlinear_problem_load_stepping’]visualization
whether to save the iteration histories values=[‘True’, ‘False’], Returns ——- outputs[‘state_name’] : numpy arraystates
-
apply_nonlinear
(inputs, outputs, residuals)¶ Compute residuals given inputs and outputs.
The model is assumed to be in an unscaled state.
- Parameters
- inputsVector
unscaled, dimensional input variables read via inputs[key]
- outputsVector
unscaled, dimensional output variables read via outputs[key]
- residualsVector
unscaled, dimensional residuals written to via residuals[key]
- discrete_inputsdict or None
If not None, dict containing discrete input values.
- discrete_outputsdict or None
If not None, dict containing discrete output values.
-
initialize
()¶ Perform any one-time initialization run at instantiation.
-
linearize
(inputs, outputs, partials)¶ Compute sub-jacobian parts and any applicable matrix factorizations.
The model is assumed to be in an unscaled state.
- Parameters
- inputsVector
unscaled, dimensional input variables read via inputs[key]
- outputsVector
unscaled, dimensional output variables read via outputs[key]
- jacobianJacobian
sub-jac components written to jacobian[output_name, input_name]
- discrete_inputsdict or None
If not None, dict containing discrete input values.
- discrete_outputsdict or None
If not None, dict containing discrete output values.
-
setup
()¶ Declare inputs and outputs.
- Available attributes:
name pathname comm options
-
solve_linear
(d_outputs, d_residuals, mode)¶ Apply inverse jac product. The model is assumed to be in an unscaled state.
- If mode is:
‘fwd’: d_residuals |-> d_outputs
‘rev’: d_outputs |-> d_residuals
Note : this is not the linear solution for the implicit component. We use identity so that simple implicit components can function in a preconditioner under linear gauss-seidel. To correctly solve this component, you should slot a solver in linear_solver or override this method.
- Parameters
- d_outputsVector
unscaled, dimensional quantities read via d_outputs[key]
- d_residualsVector
unscaled, dimensional quantities read via d_residuals[key]
- modestr
either ‘fwd’ or ‘rev’
-
solve_nonlinear
(inputs, outputs)¶ Compute outputs given inputs. The model is assumed to be in an unscaled state.
- Parameters
- inputsVector
unscaled, dimensional input variables read via inputs[key]
- outputsVector
unscaled, dimensional output variables read via outputs[key]
-