Message Boards Message Boards

0
|
2487 Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

How to Mix Different Fluids in System Modeler

Posted 1 year ago

I am trying to mix 2 different fluids in a system. Gas should be injected through a valve into another pipe that contains oil, and the result will have a mixture of oil and gas, just like this image:

enter image description here

However, System modeler keeps giving me errors. How do I do this?

2 Replies

One way to solve this problem might be to break it into injection gas and fluid sub-circuits. Then add a logic to represent their interaction. Perhaps something like the following diagram: enter image description here

model GasLiquidMixture
  inner Modelica.Fluid.System system(m_flow_start = 1) annotation(Placement(visible = true, transformation(origin = {170, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe1(length = 20, diameter = 0.25, redeclare replaceable package Medium = Modelica.Media.IdealGases.SingleGases.Ar) annotation(Placement(visible = true, transformation(origin = {-90, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.ClosedVolume mixingVolume(V = 1000, use_portsData = false, nPorts = 3, redeclare replaceable package Medium = Modelica.Media.IdealGases.SingleGases.Ar, p_start = 100000) annotation(Placement(visible = true, transformation(origin = {-10, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Valves.ValveIncompressible valve(redeclare replaceable package Medium = Modelica.Media.IdealGases.SingleGases.Ar, dp_nominal = 10000, m_flow_nominal = 10) annotation(Placement(visible = true, transformation(origin = {-50, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Pipes.StaticPipe pipe2(length = 20, diameter = 0.25, redeclare replaceable package Medium = Modelica.Media.Examples.TwoPhaseWater) annotation(Placement(visible = true, transformation(origin = {120, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.ClosedVolume liquidSink(nPorts = 1, use_portsData = false, V = 1000, redeclare replaceable package Medium = Modelica.Media.Examples.TwoPhaseWater) annotation(Placement(visible = true, transformation(origin = {170, 50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Blocks.Sources.Ramp ramp1(offset = 0.01, height = 0.95, startTime = 2, duration = 5) annotation(Placement(visible = true, transformation(origin = {-90, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT liquidSource(use_p_in = true, nPorts = 1, redeclare replaceable package Medium = Modelica.Media.Examples.TwoPhaseWater) annotation(Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sensors.Pressure gasPressure(redeclare replaceable package Medium = Modelica.Media.IdealGases.SingleGases.Ar) annotation(Placement(visible = true, transformation(origin = {20, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Vessels.ClosedVolume gasSink(nPorts = 1, use_portsData = false, V = 1000, redeclare replaceable package Medium = Modelica.Media.IdealGases.SingleGases.Ar) annotation(Placement(visible = true, transformation(origin = {50, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Fluid.Sources.Boundary_pT compressedGasSource(redeclare replaceable package Medium = Modelica.Media.IdealGases.SingleGases.Ar, nPorts = 1, p = 500000, T = 298.15) annotation(Placement(visible = true, transformation(origin = {-130, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(compressedGasSource.ports[1], pipe1.port_a) annotation(Line(visible = true, origin = {-110, -60}, points = {{-10, 0}, {10, 0}}, color = {0, 127, 255}));
  connect(pipe1.port_b, valve.port_a) annotation(Line(visible = true, origin = {-70, -60}, points = {{-10, 0}, {10, 0}}, color = {0, 127, 255}));
  connect(ramp1.y, valve.opening) annotation(Line(visible = true, origin = {-59.667, -37.333}, points = {{-19.333, 7.333}, {9.667, 7.333}, {9.667, -14.667}}, color = {1, 37, 163}));
  connect(valve.port_b, mixingVolume.ports[1]) annotation(Line(visible = true, origin = {-20, -53.333}, points = {{-20, -6.667}, {10, -6.667}, {10, 13.333}}, color = {0, 127, 255}));
  connect(mixingVolume.ports[3], gasSink.ports[1]) annotation(Line(visible = true, origin = {80, -45}, points = {{-90, 5}, {-90, -30}, {-30, -30}, {-30, 5}}, color = {0, 127, 255}));
  connect(mixingVolume.ports[2], gasPressure.port) annotation(Line(visible = true, origin = {5, -25}, points = {{-15, -15}, {-15, -20}, {15, -20}, {15, 55}}, color = {0, 127, 255}));
  connect(gasPressure.p, liquidSource.p_in) annotation(Line(visible = true, origin = {40.25, 39}, points = {{-9.25, 1}, {-4.25, 1}, {-4.25, -1}, {17.75, -1}}, color = {1, 37, 163}));
  connect(liquidSource.ports[1], pipe2.port_a) annotation(Line(visible = true, origin = {95, 30}, points = {{-15, 0}, {15, -0}}, color = {0, 127, 255}));
  connect(pipe2.port_b, liquidSink.ports[1]) annotation(Line(visible = true, origin = {156.667, 33.333}, points = {{-26.667, -3.333}, {13.333, -3.333}, {13.333, 6.667}}, color = {0, 127, 255}));
  annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {190, 75}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5}), graphics = {Text(visible = true, origin = {98.324, 59.557}, extent = {{-23.324, -4.557}, {23.324, 4.557}}, textString = "Fluid"), Text(visible = true, origin = {-90, 0}, extent = {{-23.324, -4.557}, {23.324, 4.557}}, textString = "Injection gas")}), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}}, radius = 25), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name")}));
end GasLiquidMixture;
POSTED BY: Ankit Naik

Thank you for the reply. I think this is a good start, but I am still facing some difficulty with the flow. Specifically, I am trying to simulate an oil well like this one:

enter image description here

I need to manually control the injection of the gas through the gas choke valve, when goes down the annulus and through the injection valve. Then it mixes with the oil from the well and is lifted upwards. In my simulation, the flow doesn't seem to be logical. Any ideas?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract