0

I'm really new to OpenModelica. I'm a student and most of the time I used Finite elements softawres. I'm currently in my final intership and have to use OpenModelica to model a system. No one in the company is currently using it so they can't really help me about the tool.

So here I'm trying to model a fluid flowing through a pipe (forced convection) surrounded by another fluid called fluid2 (convection). Around fluid2, we have ambient condition with fixed temperature, and I consider conduction in the wall between ambient and fluid2 which will create an heat flux between the ambient and fluid 2. Here's a picture to show the configuration : enter image description here

My model looks like this :

 model BT_V4

  //Define the properties of Fluid1 and Fluid2
  replaceable package Medium=Modelica.Media.Water.StandardWater constrainedby
    Modelica.Media.Interfaces.PartialMedium;
  
  //Define the type of heat transfer for forced convection
  replaceable model HeatTransfer_1 =
      Modelica.Fluid.Pipes.BaseClasses.HeatTransfer.LocalPipeFlowHeatTransfer;
  
  //Define the flow for pressure loss  
  replaceable model FlowModel_1 =
      Modelica.Fluid.Pipes.BaseClasses.FlowModels.DetailedPipeFlow;

  inner Modelica.Fluid.System system;
  
  //Definition of Fluid1
  Modelica.Fluid.Pipes.DynamicPipe pipe(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, redeclare final model FlowModel = FlowModel_1, T_start = 318.15, diameter = 12.8e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, nParallel = 1, p_a_start = 14.6e5, use_HeatTransfer = true);
  
  //Definition of Fluid2
  Modelica.Fluid.Pipes.DynamicPipe pipe1(redeclare package Medium = Medium, redeclare final model HeatTransfer = HeatTransfer_1, redeclare final model FlowModel = FlowModel_1, T_start = 328.15, diameter = 12.8e-3, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, length = 15, massDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, momentumDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, nNodes = 10, nParallel = 1, p_a_start = 14.6e5, use_HeatTransfer = true);
  
  //Define the properties of the wall of the tube of Fluid1
  Modelica.Fluid.Examples.HeatExchanger.BaseClasses.WallConstProps wallConstProps( T_start = 318.15,area_h = 0.89535390627, c_wall = 510, dT = 273.15, energyDynamics = Modelica.Fluid.Types.Dynamics.SteadyState, k_wall = 60.5, n = 10, rho_wall = 7850, s = 6e-3);
  
  //Inlet limit conditions for Fluid1
  Modelica.Fluid.Sources.Boundary_pT boundary(redeclare package Medium = Medium,T = 318.15, nPorts = 1, p = 14.6e5);
  
  //Outlet limit conditions for Fluid1
  Modelica.Fluid.Sources.Boundary_pT boundary1(redeclare package Medium = Medium,T = 328.15, p = 14e5, nPorts = 1);
  
  //Inlet limit conditions for Fluid2
  Modelica.Fluid.Sources.Boundary_pT boundary2(redeclare package Medium = Medium, T = 328.15,nPorts = 1, p = 14.6e5);
  
  //Outlet limit conditions for Fluid2
  Modelica.Fluid.Sources.Boundary_pT boundary3(redeclare package Medium = Medium, T = 328.15,nPorts = 1, p = 14e5);
  
  //Convection around the tube (between the wall and Fluid2)
  Modelica.Thermal.HeatTransfer.Components.Convection[pipe.nNodes] convection;

  Modelica.Blocks.Sources.Constant[pipe.nNodes] const(each k = 179);
 
  //Heat transfer between the ambient and Fluid2
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor[pipe.nNodes] conductor(each G=10);
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature[pipe.nNodes] fixedTemp(each T=293.15);
  
equation

  connect(boundary.ports[1], pipe.port_a);
  connect(pipe.port_b, boundary1.ports[1]);
  connect(boundary2.ports[1], pipe1.port_a);
  connect(pipe1.port_b, boundary3.ports[1]);  
  connect(wallConstProps.heatPort_b, pipe.heatPorts);
  connect(convection.fluid,pipe1.heatPorts);
  connect(convection.solid,wallConstProps.heatPort_a);
  connect(const.y,convection.Gc);
  connect(conductor.port_a,fixedTemp.port);
  connect(conductor.port_b,pipe1.heatPorts);
end BT_V4;

My model is running. I also didn't really consider proper values for some parameters. I just wanted to see if the model was running. I don't have access to another software right now (and for some time) to compare the results and see if the model is correct.

Can I have your opinion is this model a correct way to simulate my problem in a physical point of view ?

Best regards, Maxime

maxime3359
  • 75
  • 6
  • 3
    Adding annotations to the code or a screenshot of the graphical representation would help quite a bit... – Markus A. Mar 07 '22 at 15:38
  • 1
    Is fluid 2 moving as well? As suggested in my answer to another question from you, you will need another convective heat transfer model for the heat flow from the wall to fluid 2. The diameter of the two pipes are identical, that doesn't seem correct to me (influences the temperature change in fluid 2). – Imke Krueger Mar 08 '22 at 08:22
  • Yes fluid2 is moving. I think you're right. As I'm pretty new in coding, do you think it is possible to create a pipe with a hole inside of the diameter of the first pipe by modifying the geometry of the dynamic pipe. With heatports in the inner diameter to connect it to the wall of the fluid1 ? or do you think there is a better solution ? – maxime3359 Mar 08 '22 at 09:02
  • you can adapt the dynamic pipe, you will have to change the calculation of all volumes and areas to use the formulas for a hollow cylinder, keep the wall model inbetween both fluids and connect it to the model for the inner pipe you used until now. – Imke Krueger Mar 08 '22 at 10:42

1 Answers1

3

I suggest looking at Modelica.Fluid.Examples.HeatExchanger.HeatExchangerSimulation as an example that is more or less an implementation of what you are doing. At the very least it is a good starting point if you are looking to make some tweaks.

The model looks like the following: enter image description here

Matt
  • 363
  • 1
  • 7
  • Hi, I looked at it but I have a question. Is the fluid in the pipe connected to ambient2 all around the wall ? Like a fluid hollow cylinder and the first pipe is inside it ? Because according to the scheme it looks like it is the case – maxime3359 Mar 09 '22 at 08:02
  • The outer pipe/shell is not in thermal communication with the ambient, rather it is adiabatic, so the model would need to be modified if you required that functionality. Also, potentially the "ThermoPower" open source library might be another decent starting point for your purposes as I think there are some pipe/thermal elements which effectively have two sides (could be used for outer ambient side and inner wall side potentially). – Matt Mar 09 '22 at 22:59