I'd like to create an OpenMDAO om.Group
that rearranges a some scalar variables into arrays. I'd like it to have a certain set of named inputs and outputs, like
class IonMixMux(om.Group):
r"""Multiplex ion data into arrays
Inputs
------
nA : float
m**-3, Species A density
nB : float
m**-3, Species B density
nC : float
m**-3, Species C density
AC : float
kg, Mass of species C
Outputs
-------
n : array
m**-3, Species densities
A : array
kg, Species masses
"""
The output n
should equal [nA, nB, nC]
, and the output A
should equal [1, 2, AC]
, since species A and B always have masses 1 and 2, respectively.
As I understand it, joining values together into an array can (only?) be done using MuxComp
. However, I'm not sure how to build a Group that does this. Normally I make a Group
of ExplicitComponent
s that have their own inputs and outputs, which then may be promoted so that it looks like the Group itself has these inputs or outputs.
I'm not sure how to make the promotion of named inputs without having a subcomponent to the group, and also not sure how to set individual indices of an OpenMDAO array.
Is this in fact not a job for MuxComp
at all? Can I instead simply build an ExplicitComponent that build arrays 'from scratch'?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…