Issue with Mixer Pressure

未关闭
#84 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
backend

调研方向

Start with the supplied mixer test case and inspect the Mixer design branch, especially Fl_I1_stat_calc, Fl_I2_stat_calc, and MixImpulse.compute. Trace how each subsystem's Ps input is connected to Fl_I1:stat:P or Fl_I2:stat:P, then compare the calculated pressures with the configured inputs. Done means establishing whether the connection is intentional and documenting or testing the expected behavior.

由索引模型根据 Issue 内容生成。

描述

Hi,

I've been working on building a mixed turbofan model and encountered some issues with the mixer.
While investigating the mixer module, I noticed something unusual when printing the incoming flow properties.

Consider the following test case:

def test_mix_air_with_airfuel(self):
    p = Problem()

    cycle = p.model = Cycle()
    cycle.options['thermo_method'] = 'CEA'
    cycle.options['thermo_data'] = janaf

    cycle.set_input_defaults('start1.P', 22.838, units='psi')
    cycle.set_input_defaults('start1.T', 1718.825, units='degR')
    cycle.set_input_defaults('start1.MN', 0.800)
    cycle.set_input_defaults('start1.W', 187.893, units='lbm/s')

    cycle.set_input_defaults('start2.P', 11.708, units='psi')
    cycle.set_input_defaults('start2.T', 522.821, units='degR')
    cycle.set_input_defaults('start2.MN', 0.600)
    cycle.set_input_defaults('start2.W', 66.176, units='lbm/s')

    cycle.add_subsystem('start1', FlowStart(composition=CEA_AIR_FUEL_COMPOSITION))
    cycle.add_subsystem('start2', FlowStart(composition=CEA_AIR_COMPOSITION))

    cycle.add_subsystem('mixer', Mixer(design=True, designed_stream=1))

    cycle.pyc_connect_flow('start1.Fl_O', 'mixer.Fl_I1')
    cycle.pyc_connect_flow('start2.Fl_O', 'mixer.Fl_I2')

    p.setup(force_alloc_complex=True)
    p.set_solver_print(level=-1)
    p.run_model()

    tol = 1e-6
    print(p['mixer.Fl_O:stat:area'])
    print(p['mixer.Fl_O:tot:P'])
    print(p['mixer.ER'])
    print(p['mixer.Fl_O:stat:MN'])

When printing the variables used in the MixImpulse class compute function:

def compute(self, inputs, outputs):
    outputs['impulse_mix'] = (inputs['Fl_I1:stat:P'] * inputs['Fl_I1:stat:area'] + inputs['Fl_I1:stat:W'] * inputs['Fl_I1:stat:V']) + \
                             (inputs['Fl_I2:stat:P'] * inputs['Fl_I2:stat:area'] + inputs['Fl_I2:stat:W'] * inputs['Fl_I2:stat:V'])

    print("Mix Impulse computations:")
    print('Fl_I1:stat:W', inputs['Fl_I1:stat:W'])
    print('Fl_I1:stat:P', inputs['Fl_I1:stat:P'])
    print('Fl_I1:stat:V', inputs['Fl_I1:stat:V'])
    print('Fl_I1:stat:area', inputs['Fl_I1:stat:area'])
    print('Fl_I2:stat:W', inputs['Fl_I2:stat:W'])
    print('Fl_I2:stat:P', inputs['Fl_I2:stat:P'])
    print('Fl_I2:stat:V', inputs['Fl_I2:stat:V'])
    print('Fl_I2:stat:area', inputs['Fl_I2:stat:area'])

I get the following output:

Mix Impulse computations:
Fl_I1:stat:W [85.22683118]
Fl_I1:stat:P [63282.44448509]
Fl_I1:stat:V [461.46240572]
Fl_I1:stat:area [0.43591669]
Fl_I2:stat:W [30.01692868]
Fl_I2:stat:P [63282.44448509]
Fl_I2:stat:V [198.01842072]
Fl_I2:stat:area [0.18629003]
[964.42234196]
[19.03367286]
[1.95063205]
[0.90091354]

Both incoming flows have the same pressure. I'm not sure if this is expected, but I don't fully understand the physics behind it.

Looking further into the Mixer class code, I found this:

if design:
    ...
    self.add_subsystem('Fl_I1_stat_calc', Fl1_stat,
                       promotes_inputs=[('composition', 'Fl_I1:tot:composition'), ('S', 'Fl_I1:tot:S'),
                                        ('ht', 'Fl_I1:tot:h'), ('W', 'Fl_I1:stat:W'), ('Ps', 'Fl_I2:stat:P')],
                       promotes_outputs=['Fl_I1_calc:stat*'])
    ...
else:
    ...
    self.add_subsystem('Fl_I2_stat_calc', Fl2_stat,
                       promotes_inputs=[('composition', 'Fl_I2:tot:composition'), ('S', 'Fl_I2:tot:S'),
                                        ('ht', 'Fl_I2:tot:h'), ('W', 'Fl_I2:stat:W'), ('Ps', 'Fl_I1:stat:P')],
                       promotes_outputs=['Fl_I2_calc:stat:*'])
    ...

After modifying the connections between Ps and Fl_Ix:stat:P, I obtained the following output:

Mix Impulse computations:
Fl_I1:stat:W [85.22683118]
Fl_I1:stat:P [104599.90621965]
Fl_I1:stat:V [461.46240572]
Fl_I1:stat:area [0.43591669]
Fl_I2:stat:W [30.01692868]
Fl_I2:stat:P [63282.44448509]
Fl_I2:stat:V [198.01842072]
Fl_I2:stat:area [0.18629003]
[964.42234196]
[19.03367286]
[1.95063205]
[0.90091354]

Now, the pressure of flow_1 is nearly twice that of flow_2, which matches the input values I initially set.

Is this a potential issue, or am I simply misunderstanding something?

Thanks! :)

主要语言
Python
星标
212
派生
101
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenMDAO/pyCycle 的其他 Issue

查看 OpenMDAO/pyCycle 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。