fastoad.model_base.openmdao.group module
Convenience classes to be used in OpenMDAO components.
- class fastoad.model_base.openmdao.group.CycleGroup(**kwargs)[source]
Bases:
Group
,ABC
Use this class as a base class if your model should contain solvers.
This class defines standard options to control inner solvers.
Please be sure to call the super() method when using initialize() and setup() in the derived class.
By default, the inner solver is activated. If you want your subclass to deactivate the solver by default, you can define it when subclassing:
class MyGroup(CycleGroup, use_solver_by_default=False): ...
You may also specify default solver settings for your subclass. They will be used when adding the solver, unless overwritten through OpenMDAO options when instantiating:
class MyGroup( CycleGroup, default_linear_solver="om.ScipyKrylov", default_nonlinear_solver="om.NewtonSolver", default_nonlinear_options={"maxiter": 50, "iprint": 0}, default_linear_options={"maxiter": 100, "rtol": 1.e-6}, ): ...
Set the solvers to nonlinear and linear block Gauss–Seidel by default.
- setup()[source]
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 fastoad.model_base.openmdao.group.BaseCycleGroup(**kwargs)[source]
Bases:
CycleGroup
Inherited from
CycleGroup
with no modification of default behavior.Set the solvers to nonlinear and linear block Gauss–Seidel by default.
- default_linear_solver = 'om.DirectSolver'
- default_nonlinear_solver = 'om.NonlinearBlockGS'
- default_solver_options = {'linear_solver_options': {}, 'nonlinear_solver_options': {}}
- use_solvers_by_default = True