Extending the Scenario Library¶
Coupling Groups¶
In initialize
, the coupling group needs to have the required builders declared as options.
In the setup phase, get_coupling_group_subsystem()
is used to get subsystems from the builders,
and self.mphys_add_subsystem
is used to add them.
Other components like balance components can be added directly.
Setting a default linear and nonlinear solver suitable for this type of problem is also helpful in setup
.
In most cases using a configure phase is not necessary for the scenario, but if you do implement a configure
method, you must call super().configure()
to do the tagged promotion of variables from the scenario’s subsystems.
Scenarios¶
Your custom Scenario should at least implement the initialize
and setup
methods.
As with the CouplingGroup
, you must call the configure
method of the parent class if you implement a
configure
method in the Scenario.
Initialize¶
The Scenario’s initialize
method should declare the necessary builders as options.
An in_MultipointParallel
option should also be included if that mode of operation will be implemented.
Otherwise the developer is free to add options specific to the scenario type.
Setup¶
The basic pattern for the scenario group’s setup method is:
If
in_MultipointParallel
, initialize all the buildersCall
mphys_add_pre_coupling_subsystem()
for each builder.Instantiate the associated
CouplingGroup
.Call
mphys_add_post_coupling_subsystem()
for each builder.
- class mphys.scenario.Scenario(**kwargs)[source]¶
A group to represent a specific analysis condition or point of the MPhys multipoint groups.
To make a Scenario for a particular type of multiphysics problem, subclass the Scenario, and implement the initialize and setup phases of the Group.
Set the solvers to nonlinear and linear block Gauss–Seidel by default.
- setup()[source]¶
The main setup call for all multiphysics scenarios. Multiphysics scenarios should implement setup-type operations in _mphys_scenario_setup(). Adds the builder subsystems, then adds user-defined post subsystems.
- mphys_add_post_subsystem(name, subsystem, promotes_inputs=None, promotes_outputs=None, promotes=None)[source]¶
Add a user-defined subsystem at the end of a Scenario. Tag variables with mphys tags to promote or use the optional promotes argument.
- Parameters:
- name: str
Name of the subsystem
- subsystem: <System>
The
- promotes: iter of (str or tuple), optional
If None, variables will be promoted using mphys_* tags, else variables will be promoted by this input