Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Div by zero error in simple heat flow model

Div by zero error in simple heat flow model

Hi! I'm trying to run the simple model below in OpenModelica. But I get an error like below. I can't fingure out what I'm doing wrong. Any ideas?

Error:
solver will try to handle division by zero at time 0: if (-pump.flowPort_a.m_flow) >= 0.0 then -pump.flowPort_a.m_flow else -0.0

Code:

model test

    parameter Modelica.Thermal.FluidHeatFlow.Media.Medium medium=Modelica.Thermal.FluidHeatFlow.Media.Medium()
    "Cooling medium"
    annotation(choicesAllMatching=true);
  parameter Modelica.SIunits.Temperature TAmb(displayUnit="degC")=293.15
    "Ambient temperature";
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient2(constantAmbientPressure = 0, constantAmbientTemperature = TAmb, medium = medium) annotation(
    Placement(visible = true, transformation(extent = {{40, -10}, {60, 10}}, rotation = 0)));
  Modelica.Thermal.FluidHeatFlow.Sources.Ambient ambient1(constantAmbientPressure = 0, constantAmbientTemperature = TAmb, medium = medium) annotation(
    Placement(visible = true, transformation(extent = {{-60, -10}, {-80, 10}}, rotation = 0)));
  Modelica.Thermal.FluidHeatFlow.Components.Pipe pipe(T0 = TAmb, T0fixed = true, V_flowLaminar = 0.1, V_flowNominal = 1, dpLaminar(displayUnit = "Pa") = 0.1, dpNominal(displayUnit = "Pa") = 1, h_g = 0, m = 0.1, medium = medium, useHeatPort = false) annotation(
    Placement(visible = true, transformation(extent = {{0, -10}, {20, 10}}, rotation = 0)));
  Modelica.Thermal.FluidHeatFlow.Sources.VolumeFlow pump(T0 = TAmb, constantVolumeFlow = 1, m = 0, medium = medium, useVolumeFlowInput = true) annotation(
    Placement(visible = true, transformation(extent = {{-40, -10}, {-20, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant volumeFlow(k = 1) annotation(
    Placement(visible = true, transformation(extent = {{-60, 10}, {-40, 30}}, rotation = 0)));
equation
  connect(ambient1.flowPort, pump.flowPort_a) annotation(
    Line(points = {{-60, 0}, {-40, 0}}, color = {255, 0, 0}));
  connect(volumeFlow.y, pump.volumeFlow) annotation(
    Line(points = {{-39, 20}, {-30, 20}, {-30, 10}}, color = {0, 0, 127}));
  connect(pump.flowPort_b, pipe.flowPort_a) annotation(
    Line(points = {{-20, 0}, {0, 0}}, color = {255, 0, 0}));
  connect(pipe.flowPort_b, ambient2.flowPort) annotation(
    Line(points = {{20, 0}, {40, 0}}, color = {255, 0, 0}));
  annotation(
    uses(Modelica(version = "3.2.3")));
end test;

Re: Div by zero error in simple heat flow model

Hi,

I receive no error when running your model. I am using OpenModelica 1.15-dev-48, 64 bits on Windows10.

Regards

Re: Div by zero error in simple heat flow model

Thanks I upgraded from v.1.14.0-Dev beta 3 and now it works

There are 0 guests and 0 other users also viewing this topic
You are here: