首页 > 解决方案 > 如何为自动连接的输出设置别名?

问题描述

我目前有这个代码:

self.add_subsystem('IntegrateForTheta2Ue6', utilities.CumulativeIntegrateTrapeziums(n=n),
                               promotes_inputs=[('x', 'panel_lengths'),
                                                ('x0', 'stagnation_point_position'),
                                                ('y', 'ue5'),
                                                ('y0', 'panel_start_external_tangential_velocity')],
                               promotes_outputs=[('cumulative_integral', 'intue5')])

self.add_subsystem('ThwaitesCalculateMomentumThickness', ThwaitesCalculateMomentumThickness(n=n),
                               promotes_inputs=['external_tangential_velocities',
                                                'intue5',
                                                'kinematic_viscosity'],
                               promotes_outputs=['momentum_thickness'])

它在运行时不会抛出任何错误,但在调试时很明显intue5aka的输出cumulative_integral没有被传递到 ThwaitesCalculateMomentumThickness - 它显示为所有错误。当我尝试上述方法时self.connect('IntegrateForTheta2Ue6.intue5', 'ThwaitesCalculateMomentumThickness.intue5'),我得到Attempted to connect from 'IntegrateForTheta2Ue6.intue5' to 'ThwaitesCalculateMomentumThickness.intue5', but 'IntegrateForTheta2Ue6.intue5' doesn't exist.

我在输出别名中犯了错误,还是这是一个错误?

标签: openmdao

解决方案


更新到最新版本的 OpenMDAO 有效。我相信我已经在调用 run_model(),所以我不确定它为什么不起作用。


推荐阅读