我有一个带ParallelGroup的工作流程。我在其中多次实例化相同的Component并传递每个不同的输入。
我正在使用示例中的prob.setup(vector_class=PETScVector, check=False, mode='fwd')
选项。
我收到以下错误:
Traceback (most recent call last):
File "workflow.py", line 73, in <module>
prob.run_model()
File "/usr/local/lib/python2.7/dist-packages/openmdao/core/problem.py", line 282, in run_model
self.final_setup()
File "/usr/local/lib/python2.7/dist-packages/openmdao/core/problem.py", line 423, in final_setup
model._final_setup(comm, vector_class, 'full', force_alloc_complex=force_alloc_complex)
File "/usr/local/lib/python2.7/dist-packages/openmdao/core/system.py", line 787, in _final_setup
force_alloc_complex=force_alloc_complex)
File "/usr/local/lib/python2.7/dist-packages/openmdao/core/system.py", line 586, in _get_root_vectors
ncol=ncol, relevant=rel)
File "/usr/local/lib/python2.7/dist-packages/openmdao/vectors/vector.py", line 160, in __init__
self._initialize_views()
File "/usr/local/lib/python2.7/dist-packages/openmdao/vectors/default_vector.py", line 320, in _initialize_views
v.shape = shape
ValueError: cannot reshape array of size 0 into shape (4,3)
具有形状(4,3)的变量是由外部IndepVarComp赋予ParallelGroup(通过其每个组件的提升)的“全局”变量。
编辑:仅当分配的节点数小于ParallelGroup中的组件数时才会发生这种情况。