You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OpenModelica模型报Assertion has been violated错误,请求技术支持

OpenModelica流体模型断言错误排查求助

我是OpenModelica新手,搭建了一个流体模型,将Modelica.Fluid.Vessels.ClosedVolume与Modelica.Fluid.Sources.Boundary_pT通过StaticPipe和自定义CurvedBendModel组件连接,但运行时出现Assertion has been violated Pipe/ClosedVolume错误,恳请协助排查解决。

主模型代码

model TestComposant
Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, V = 6e-4, nPorts = 1, p_start = 40e5, use_portsData = false) annotation(
    Placement(visible = true, transformation(origin = {-84, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-170, 150}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, nPorts = 1, p = 100000) annotation(
    Placement(visible = true, transformation(origin = {82, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, diameter = 8e-3, length = 351.4e-3, nParallel = 1) annotation(
    Placement(visible = true, transformation(origin = {-44, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  CurvedBendModel curvedBendModel(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, geometry = Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.Geometry(d_hyd = 8e-3, R_0 = 25.5e-3, delta = 90)) annotation(
    Placement(visible = true, transformation(origin = {-2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Modelica.Media.IdealGases.SingleGases.N2, diameter = 8e-3, length = 166e-3, nParallel = 1) annotation(
    Placement(visible = true, transformation(origin = {38, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(volume.ports[1], pipe.port_a) annotation(
    Line(points = {{-74, 0}, {-54, 0}}, color = {0, 127, 255}));
  connect(pipe.port_b, curvedBendModel.port_a) annotation(
    Line(points = {{-34, 0}, {-12, 0}}, color = {0, 127, 255}));
  connect(curvedBendModel.port_b, pipe1.port_a) annotation(
    Line(points = {{8, 0}, {28, 0}}, color = {0, 127, 255}));
  connect(pipe1.port_b, boundary1.ports[1]) annotation(
    Line(points = {{48, 0}, {72, 0}}, color = {0, 127, 255}));
end TestComposant;

模型示意图

模型截图

自定义组件代码

因原有CurvedBend组件无法正常工作,我修改并自定义了CurvedBendModel组件,代码如下:

model CurvedBendModel
 extends Modelica.Fluid.Dissipation.Utilities.Icons.PressureLoss.Bend_i;
  extends Modelica.Fluid.Interfaces.PartialPressureLoss;
  
  parameter Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.Geometry geometry
    "Geometry of curved bend"
      annotation (Placement(transformation(extent={{-20,0},{0,20}})));

protected
  parameter Medium.AbsolutePressure dp_small(min=0)=
              Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_DP(
               Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
                   d_hyd=geometry.d_hyd,
                   delta=geometry.delta,
                   K=geometry.K,
                   R_0=geometry.R_0),
                Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(
                  rho=Medium.density(state_dp_small),
                  eta=Medium.dynamicViscosity(state_dp_small)),
                m_flow_small)
    "Default small pressure drop for regularization of laminar and zero flow (calculated from m_flow_small)";

equation
  if allowFlowReversal then
     m_flow =  Modelica.Fluid.Fittings.BaseClasses.Bends.CurvedBend.massFlowRate(
                dp, geometry, d_a, d_b, eta_a, eta_b, dp_small, m_flow_small);
  else
     m_flow = Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_MFLOW(
               Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_con(
                   d_hyd=geometry.d_hyd,
                   delta=geometry.delta,
                   K=geometry.K,
                   R_0=geometry.R_0),
                Modelica.Fluid.Dissipation.PressureLoss.Bend.dp_curvedOverall_IN_var(rho=d_a, eta=eta_a), dp);
  end if;
end CurvedBendModel;

报错信息截图

报错截图

内容的提问来源于stack exchange,提问作者Emma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 16:43:12