Is it possible to have lists or arrays passed as outputs of components in openMDAO?
Since my problem relies on 6x6 matrices to solve an equation of motion in 6 degrees of freedom, I would like to be able to do the following:
M = np.ones([6, 6])
outputs['M'] = M
However, that results in an error:
ValueError: cannot reshape array of size 36 into shape (1,)
Is there any way to avoid passing each of 36 values seperately?
CodePudding user response:
Yes, you can declare an output of any size or shape in your component's setup
method by doing the following:
self.add_output('M', shape=(6, 6))
or
self.add_output('M', val=np.ones((6, 6)))