fastoad.openmdao.problem module

class fastoad.openmdao.problem.FASTOADProblem(*args, **kwargs)[source]

Bases: openmdao.core.problem.Problem

Vanilla OpenMDAO Problem except that it can write its outputs to a file.

It also runs ValidityDomainChecker after each run_model() or run_driver() (but it does nothing if no check has been registered).

Initialize attributes.

Parameters
  • model (<System> or None) – The top-level <System>. If not specified, an empty <Group> will be created.

  • driver (<Driver> or None) – The driver for the problem. If not specified, a simple “Run Once” driver will be used.

  • comm (MPI.Comm or <FakeComm> or None) – The global communicator.

  • name (str) – Problem name. Can be used to specify a Problem instance when multiple Problems exist.

  • **options (named args) – All remaining named args are converted to options.

input_file_path

File path where read_inputs() will read inputs

output_file_path

File path where write_outputs() will write outputs

additional_variables

Variables that are not part of the problem but that should be written in output file.

run_model(case_prefix=None, reset_iter_counts=True)[source]

Run the model by calling the root system’s solve_nonlinear.

Parameters
  • case_prefix (str or None) – Prefix to prepend to coordinates when recording.

  • reset_iter_counts (bool) – If True and model has been run previously, reset all iteration counters.

run_driver(case_prefix=None, reset_iter_counts=True)[source]

Run the driver on the model.

Parameters
  • case_prefix (str or None) – Prefix to prepend to coordinates when recording.

  • reset_iter_counts (bool) – If True and model has been run previously, reset all iteration counters.

Returns

Failure flag; True if failed to converge, False is successful.

Return type

boolean

setup(*args, **kwargs)[source]

Set up the problem before run.

write_outputs()[source]

Writes all outputs in the configured output file.

read_inputs()[source]

Reads inputs of the problem.

class fastoad.openmdao.problem.AutoUnitsDefaultGroup(**kwargs)[source]

Bases: openmdao.core.group.Group

OpenMDAO group that automatically use self.set_input_defaults() to resolve declaration conflicts in variable units.

Set the solvers to nonlinear and linear block Gauss–Seidel by default.

Parameters

**kwargs (dict) – dict of arguments available here and in all descendants of this Group.

configure()[source]

Configure this group to assign children settings.

This method may optionally be overidden by your Group’s method.

You may only use this method to change settings on your children subsystems. This includes setting solvers in cases where you want to override the defaults.

You can assume that the full hierarchy below your level has been instantiated and has already called its own configure methods.

Available attributes:

name pathname comm options system hieararchy with attribute access

class fastoad.openmdao.problem.FASTOADModel(**kwargs)[source]

Bases: fastoad.openmdao.problem.AutoUnitsDefaultGroup

OpenMDAO group that defines active submodels after the initialization of all its subsystems, and inherits from AutoUnitsDefaultGroup for resolving declaration conflicts in variable units.

It allows to have a submodel choice in the initialize() method of a FAST-OAD module, but to possibly override it with the definition of active_submodels (i.e. from the configuration file).

Set the solvers to nonlinear and linear block Gauss–Seidel by default.

Parameters

**kwargs (dict) – dict of arguments available here and in all descendants of this Group.

active_submodels

Definition of active submodels that will be applied during setup()

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