chain module¶
Chains of disciplines: sequential and parallel execution processes¶
-
class
gemseo.core.chain.
MDOAdditiveChain
(disciplines, outputs_to_sum, name=None, grammar_type='JSON', use_threading=True)[source]¶ Bases:
gemseo.core.chain.MDOParallelChain
Chain of processes that executes disciplines in parallel and sums specified outputs across disciplines
Constructor.
- Parameters
disciplines (list(MDODiscipline)) – the disciplines list
outputs_to_sum (list(str)) – names list of the outputs to sum
name (str) – name of the discipline
grammar_type (str) – the type of grammar to use for IO declaration either JSON_GRAMMAR_TYPE or SIMPLE_GRAMMAR_TYPE
use_threading (bool) – if True, use Threads instead of processes to parallelize the execution
-
class
gemseo.core.chain.
MDOChain
(disciplines, name=None, grammar_type='JSON')[source]¶ Bases:
gemseo.core.discipline.MDODiscipline
Chain of processes that is based on a predefined order of execution.
Constructor of the chain
- Parameters
disciplines – the disciplines list
name – the name of the discipline
grammar_type – the type of grammar to use for IO declaration either JSON_GRAMMAR_TYPE or SIMPLE_GRAMMAR_TYPE
-
AVAILABLE_MODES
= ['direct', 'reverse', 'auto']¶
-
static
copy_jacs
(jac_dict)[source]¶ Hard copies Jacobian dict
- Parameters
jac_dict – dict of dict of ndarrays, or dict of ndarrays
- Returns
deepcopy of the input
-
get_expected_dataflow
()[source]¶ Returns the expected data exchange sequence, used for xdsm representation See MDOFormulation.get_expected_dataflow
-
get_expected_workflow
()[source]¶ Returns the expected execution sequence, used for xdsm representation. See MDOFormulation.get_expected_workflow.
-
reverse_chain_rule
(chain_outputs, discipline)[source]¶ Chains derivatives of self, with a new discipline in the chain in reverse mode
Performs chain ruling: (notation: D is total derivative, d is partial derivative)
D out d out dinpt_1 d output dinpt_2 —– = ——– . ——- + ——– . ——– D new_in d inpt_1 d new_in d inpt_2 d new_in
D out d out d out dinpt_2 —– = ——– + ——– . ——– D z d z d inpt_2 d z
D out d out [dinpt_1 d out d inpt_1 dinpt_2 ] —– = ——– . [——- + ——– . ——– . ——–] D z d inpt_1 [d z d inpt_1 d inpt_2 d z ]
- Parameters
discipline – new discipline to compose in the chain
chain_outputs – the chain_outputs to linearize
-
class
gemseo.core.chain.
MDOParallelChain
(disciplines, name=None, grammar_type='JSON', use_threading=True)[source]¶ Bases:
gemseo.core.discipline.MDODiscipline
Chain of processes that executes disciplines in parallel
Constructor of the chain
- Parameters
disciplines – the disciplines list
name – the name of the discipline
grammar_type – the type of grammar to use for IO declaration either JSON_GRAMMAR_TYPE or SIMPLE_GRAMMAR_TYPE
use_threading – if True, use Threads instead of processes to parallelize the execution
-
add_differentiated_inputs
(inputs=None)[source]¶ Add inputs to the differentiation list.
This method updates self._differentiated_inputs with inputs
- Parameters
inputs – list of inputs variables to differentiate if None, all inputs of discipline are used (Default value = None)
-
add_differentiated_outputs
(outputs=None)[source]¶ Add outputs to the differentiation list.
Update self._differentiated_inputs with inputs.
- Parameters
outputs – list of output variables to differentiate if None, all outputs of discipline are used
-
get_expected_dataflow
()[source]¶ Returns the expected data exchange sequence, used for xdsm representation See MDOFormulation.get_expected_dataflow