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

Fluid system

Fluid system

Hello,

I build the attached fluid system. However it is extremely slow or does not converge at all. When removing the pipe called "Schlauch" then it works nicely.
Can somebody explain why or how to circumvent this?
Does it have to do with modelStructure?

Another question: As I am not interested in temperatures, is it possible to neglect energy balance equation? Furthermore I don't need two-phase material, nor do I need compressibility of the water? So, if that helps to make the model more stable how can I achieve this?
(I tried to change the medium from StandardWater to StandardWaterOnePhase or even ConstantPropertyLiquid, but none worked due to initialization issues)

I am a real beginner and hope somebody can light me up how all these things work together.

Regards Steffen

Re: Fluid system

Re: Fluid system


Test.mo

Attachments:

Re: Fluid system

I would say that you are doing fine. It seems to me a convergence problem due to the sudden change in flow. The problem disappears if you change the frequency up or down, no problem at 100 Hz nor at 5 Hz. It disappears also increasing the damper volume to 3e-4 m3.
I do not understand why you are declaring your Sinus block inside Modelica.Blocks.
I have needed to add the full path to Sinus and Sine inside the System7 model in order to make it runnable.

Regards

Carlos

Re: Fluid system

I wrote my own Sinus block as I want to enlarge the model after it runs stable and need the startTime parameter that I found is buggy in the Modelica.Blocks sine routine, i.e. I want the value at time<startTime to be identical to the value at startTime (as I use the parameter phase also), see attached file test.mo.
But I think that's not the point (or do I understand you wrong?)

Isn't there a way to reduce the complexity of the model by making the water incompressible, one-phase, neglecting the energy balance as temperature is not important etc.?

As I want to model a real physical device I don't want to change the geometrical parameters or the frequency.

Steffen

Edited by: Steffen - Mar-01-21 15:40:25

Re: Fluid system

I tried your model with ConstantPropertyLiquidWater and it runs, with some difficulties but runs. As you told that you had tried it, it could be related with the OpenModelica version you are using. I use 1.16.5 on Windows.
Regarding the Sinus block, my comment was just related with the placement of the model inside the MSL instead of in your own package. Of course it is optional.

Re: Fluid system

Thanks for your reply.
Okay it seems not to be trivial to increase the numerical robustness/speed.

As this is work in progress, in a next step I wanted to replace the massflow-boundary condition with swept volumes.
Therefor I built a test example and played with phase-parameter of the sine function.

However I encountered some errors while initialization. Can you help me again?

Kolbentest.mo


PS: If one changes the paramter phase in sine function to pi/2 it works; that's why I tried to give an initialization value for m, but it didn't work neither.

Best, Steffen

Attachments:

Re: Fluid system

Hi Steffen,
I'm sorry, but I can't help too much here. You are having the normal problems to expect in this type of simulations. The Modelica.Fluid is a highly complex libray, I think that too much for this type of applications, and with complex libraries convergence is always an issue. It seems that when you start at low flow change it converges, but when you go away from this point not. I would have tried what you did, start flow at the expected level for the sinus phase. Another possibility is to record all the values we obtain at 0 radians and enter them as start values.

Re: Fluid system

Hi Carlos,
thanks for this honest reply. That was also my impression with this model. And that's why my questions went in the direction of how to neglect energy balance, compressibility, temperature effects on material parameters etc. I thought there would be an easy way to circumvent all these numerical difficulties.

Can you recommend any other library that would fit for such type of models, i.e. highly instationary fluid dynamics models? Or any clue what one could do? Is modelica the right choice at all?

Best, Steffen

Re: Fluid system

Hi Steffen,
I would say that Modelica is the correct tool. I know not too much about the Modelica.Fluid library, that I find too complex for my daily work. There is the possibility of using Modelica.Fluid.Pipes.StaticPipes instead of the DynamicPipe model, but I tested it and gave the same problem. I normally work with my own library , based on static (steady state) approach. There is no problem to share it,  but I do not have the damper model, although it is easy to create, and I do not know if it will converge with your test. Normally it converges much more easily than Modelica.Fluid. Let me take some days, I will create the closed volume damper and test your model. I will inform you in this post.

Regards

Carlos

Re: Fluid system

Hi Steffen,
I would like to clarify a point. I think you are trying to simulate a dosing pump with its pipe and a flow dampener. If it is the case, I would say that the volume you are defining can't act as dampener. It is declared a constant volume filled with water, but taking into account the water compressibility.... For a dampener we would need a constant initial volume  and a calculation of pressure as a function of the liquid filled volume. Am I right?

Best

Carlos

Re: Fluid system

Hi Carlos,
I am trying to model a pump of a high pressure device. The volumes are no dampeners but constant volumes. The first volumes after the swept voluems represent the dead volume of the cylinder space. I now this is also a parameter in the library model swept volume but I found out that with this closed volume it is more robust from numerical side.
The second closed volume is a space where after the high pressure valves where all three cylinder spaces come together.

Best  Steffen

Re: Fluid system

Hi Steffen,
I had never played for a while with Modelica.Fluid and I must acknowledge that it is really confusing, at least in combination with OpenModelica. I understand that the model you are trying is really simple.  As the use of a closed volume is only for taking into account the accumulation of mass (due to density changes) or energy (due to enthalpy changes) I took it out, I replaced also the pipe by an static pipe for the same reason. But two problems remain, one is that it continues to initialize only at sinus of pi/2. I tried to change the dynamics of the swept volume to steady state and it was still worse. The second remaining point is that the swept volume is not a complete possitive displacement pump, as it pushes volume when is shaft possition is going in one way, but it is suctioning when going in the opposite. it is necessary to add check valves, and to connect to a boundary for the suction cycle. If not, we would vaporize the water. It has been impossible for me to make it work.
After this, I have simulated the system with my library with no problem, but I have discovered a point that could be also at the base of some of the problems with Modelica.Fluid. I mounted an integrator in order to be able to record the pumped volume, but it was not working. Finally I discovered that it is due to a numerical problem related to the very low mass pumped when the pump is inverting the movement. I have needed to integrate the mass, and later to pass the mass to volume.
I will try to post part of my library, at least the part related with fluid flow, and the implementation of your test in a few days.

Regards

Carlos

Re: Fluid system

Hi Steffen,
I have actualized my library with a model for a piston/diafragm pump, and I have updated it at GitHub, including now the fluid flow related packages. If you want to have a look, you will find it  here. Inside the package Pumps/Examples you will find the model PistonPumpTest, with an implementation of one of yours models. It is using the Modelica.Blocks.Sources.Sine block, but you can change it for your Sinus block. I do not know if it is what you need, I hope so.

Regards

Carlos

There are 0 guests and 0 other users also viewing this topic