Search code examples
modelicaopenmodelica

Changing the Heat transfer model of the ClosedVolume of the Modelica Standard Library lead to an unbalanced model


The documentation of the Modelica.Fluid.Vessels.ClosedVolume says that IdealHeatTransfer is considered by default. I'd like to use ConstantFlowHeatTransfer instead. I declare it in the Text View. However, doing so leads to an unbalanced model : 939 equations and 943 variables.

Here is the model :

enter image description here

And here is the code used :

model Closed_volume_test

replaceable package Medium=Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium;

replaceable model HeatTransfer_1 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=1800);

replaceable model HeatTransfer_2 = Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.ConstantFlowHeatTransfer(alpha0=8000);


  Modelica.Fluid.Vessels.ClosedVolume volume(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, V = 20, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nPorts= 2, use_HeatTransfer = true,  use_portsData = false)  annotation(
    Placement(visible = true, transformation(origin = {0, -36}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Pipes.StaticPipe pipe(redeclare package Medium = Medium,diameter = 0.15, length = 1)  annotation(
    Placement(visible = true, transformation(origin = {26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Sources.MassFlowSource_T boundary1(redeclare package Medium = Medium, T = 328.15, m_flow = 1,nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {-56, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 328.15, nPorts = 1, p = 1e5)  annotation(
    Placement(visible = true, transformation(origin = {56, -54}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  
  inner Modelica.Fluid.System system annotation(
    Placement(visible = true, transformation(origin = {-88, 32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Pipes.StaticPipe pipe1(redeclare package Medium = Medium,diameter = 0.15, length = 1) annotation(
    Placement(visible = true, transformation(origin = {-26, -54}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Pipes.DynamicPipe pipe2(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_2, diameter = 38e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, use_HeatTransfer = true)  annotation(
    Placement(visible = true, transformation(origin = {0, 28}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
  
  Modelica.Fluid.Sources.Boundary_pT boundary2(redeclare package Medium = Medium,T = 311.15, nPorts = 1, p = 14.6e5)  annotation(
    Placement(visible = true, transformation(origin = {-36, 28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Sources.MassFlowSource_T boundary3(redeclare package Medium = Medium,m_flow = -0.25, nPorts = 1)  annotation(
    Placement(visible = true, transformation(origin = {36, 28}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  
  Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps(area_h = 0.89, c_wall = 510, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, k_wall = 60.5, n = 10, rho_wall = 7850, s = 3e-3)  annotation(
    Placement(visible = true, transformation(origin = {0, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  
  Modelica.Thermal.HeatTransfer.Components.ThermalCollector thermalCollector(m = 10)  annotation(
    Placement(visible = true, transformation(origin = {0, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

equation
  connect(boundary1.ports[1], pipe1.port_a) annotation(
    Line(points = {{-46, -54}, {-36, -54}}, color = {0, 127, 255}));
  connect(pipe.port_b, boundary.ports[1]) annotation(
    Line(points = {{36, -54}, {46, -54}}, color = {0, 127, 255}));
  connect(volume.ports[1], pipe1.port_b) annotation(
    Line(points = {{0, -46}, {-16, -46}, {-16, -54}}, color = {0, 127, 255}));
  connect(volume.ports[2], pipe.port_a) annotation(
    Line(points = {{0, -46}, {16, -46}, {16, -54}}, color = {0, 127, 255}));
  connect(boundary2.ports[1], pipe2.port_a) annotation(
    Line(points = {{-26, 28}, {-10, 28}}, color = {0, 127, 255}));
  connect(pipe2.port_b, boundary3.ports[1]) annotation(
    Line(points = {{10, 28}, {26, 28}}, color = {0, 127, 255}));
  connect(pipe2.heatPorts, wallConstProps.heatPort_a) annotation(
    Line(points = {{0, 24}, {0, 13}}, color = {127, 0, 0}, thickness = 0.5));
  connect(wallConstProps.heatPort_b, thermalCollector.port_a) annotation(
    Line(points = {{0, 3}, {0, 0}}, color = {191, 0, 0}, thickness = 0.5));
  connect(thermalCollector.port_b, volume.heatPort) annotation(
    Line(points = {{0, -20}, {-10, -20}, {-10, -36}}, color = {191, 0, 0}));
  annotation(
    uses(Modelica(version = "3.2.3")));

end Closed_volume_test;

Is it possible to use another model for the heat transfer for the ClosedVolume ? If so, does anyone know how can I solve this problem?

Best regards Maxime


Solution

  • ConstantFlowHeatTransfer is inherited from PartialFlowHeatTransfer which uses quantities such as length and nParallel which are not defined (and have no meaning) in the volume model. This is why you cannot use it.

    ClosedVolume uses heat transfer models that inherit from PartialVesselHeatTransfer. You can build your own heat transfer model based on this.

    If you need to consider the convective heat transfer in the "lower" medium of your model you could replace pipe, pipe1 and volume with a DynamicPipe model (with modelStructure=a_v_b and nNodes=1).