CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Piston-fluid simulation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2020, 12:16
Default Setup Issues
  #101
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
There are a multiple issues and shortcomings with the setup.

1. Set Operating Pressure to 0 under Operating Conditions.
2. You are using a constant density material. That will not work. It has to be defined as compressible liquid.
3. The profile you are using at the inlet must provide absolute pressure value and not gauge pressure. So, it must start from a positive value and the value should be high enough to stop the piston movement or slow it down.
4. Do NOT set CG as 0.03 in Dynamic Mesh settings. Leave it at 0.
5. During initialization, set all velocities to 0 and pressure equal to first value in your profile. Use standard initialization.
6. Do NOT save case and data files every time-step. On one hand, this will require huge space on your hard-drive but that's a smaller issue. Larger issue is that the simulation will take ages to complete because I/O takes time.

A few suggestions

1. Use Coupled scheme instead of PISO. PISO might or might not work.
2. Use Least-Square for gradient calculation. Node based will slow down the system without any extra advantage.
3. You can use time-step of 1 ms, except in the beginning. In the beginning, keep it at 0.1 ms and after 10-20 time-steps you can increase it to 1 ms or even larger.
4. I have not checked but you should check it at your end if the flow is really laminar. If not, enable turbulence.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 14, 2020, 13:13
Default
  #102
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
hey again,
2- the material of the fluid is oil , it's incompressible, why should i define it as compressible
3- i don't understand what u have said about absolute pressure
RJE is offline   Reply With Quote

Old   April 14, 2020, 13:23
Default Compressibility
  #103
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
There is no incompressible fluid. All fluids are compressible; some are less compressible while some are more. You can use it as incompressible but then it would lead to oscillations in the movement and it won't be smooth because the speed of sound in an incompressible fluid is infinite.

Fluent and most of the CFD tools work in gauge pressure. However, the density of compressible fluids always depend on absolute pressure and not on gauge pressure. Therefore, the operating pressure should be set to 0 so that Fluent starts working in absolute pressure. In your profile, the value of the pressure starts from 0. However, there is no absolute 0 pressure. The absolute pressure in atmosphere is 101325 Pa. So, you should add 101325 Pa to all the values in your profile. And I am assuming that the values in the profile are in Pa. That's what Fluent assumes the unit to be; SI.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 14, 2020, 13:33
Default
  #104
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
thanks for the explanation, i'll try those tips.
RJE is offline   Reply With Quote

Old   April 14, 2020, 14:05
Default
  #105
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
i change it ti compressible fluid but it still show gauge total pressure
Attached Images
File Type: jpg 11.jpg (128.4 KB, 3 views)
RJE is offline   Reply With Quote

Old   April 14, 2020, 14:31
Default Label
  #106
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Don't worry about the labels. Those don't change. You just need to change it to compressible liquid and set operating pressure to 0. Do note that the coefficients given for the compressible liquid are for water. You can use those to test your case but you will require coefficients for the oil to get accurate results.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 14, 2020, 15:32
Default
  #107
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
i tried all those tips for a laminar flow , it works for 10 steps and then i get the usual error (negative vol;ume cell )
it seems like this (the pressure)
Attached Images
File Type: gif p.GIF (62.4 KB, 3 views)
RJE is offline   Reply With Quote

Old   April 14, 2020, 15:42
Default Domain
  #108
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
It's not just the pressure but the domain itself has gone wrong. You can clearly observe that the piston has gone above and beyond the top most boundary itself. That can happen only under one condition, the spring force at the piston bottom is too high and is pushing it against the oil pressure. You can try using the constraints available in the SixDOF settings. You can constrain the piston movement within certain bounds of z-coordinate, say, between 0 and 0.1 m, so that the piston stops moving if it reaches either 0 or 0.1 m. You should also check if the spring constant is correct or not. Secondly, it is possible that the direction of the preload is wrong. Preload can be negative or positive; because spring could be in pulled or pushed state.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 14, 2020, 16:29
Default
  #109
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
i sent u a PM to explain more
RJE is offline   Reply With Quote

Old   April 15, 2020, 05:17
Default Suggestions
  #110
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Initial volume or mass of the fluid in the cylinder does not matter. All that matters is the force balance. One force acting on the piston is fluid pressure. The other force is spring force. Since there is a preload on the spring, it is pushing the piston upward with a force of 877 N. To counter it, you need minimum pressure of the fluid in the cylinder to be

\frac{877\times 4}{\pi 0.12^2} = 77543 Pa

Anything more than this will force the piston down, however, that will certainly compress the spring. Since the spring is very stiff, a small movement, say of 1 mm, increases the pressure requirement a lot on the fluid side. If the fluid pressure is not increasing at the required rate, the piston will push through the head of the cylinder and that's what you observed. Try to debug one thing at a time. I'd suggest you use a spring with lesser stiffness or with 0 preload.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 15, 2020, 06:32
Default A solution
  #111
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
There is another way of solving your problem. Instead of using pressure inlet, use mass flow inlet. In that case, you can work with constant density oil. I tried with a mass flow rate of 0.0005 kg/s and it works very nicely. You can use a profile for mass flow inlet. This mass flow rate could be determined using pressure inside the chamber and the pressure profile you have. For the testing purpose, just try with a simple profile. Once you get it working, then you can work on developing a mass flow rate profile.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 15, 2020, 06:56
Default
  #112
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
but pressure inside the chamber it's an unkown of the simulation and i want it as a solution for the problem (i know that pressure won't vary much comparing with the pressure of the inlet)
also for the sectin, we talk about S of the orifice
as i know this is the relation ?
Attached Images
File Type: jpg 93149860_535239190508032_1249369028212817920_n.jpg (80.8 KB, 5 views)
RJE is offline   Reply With Quote

Old   April 15, 2020, 07:13
Default Pressure in the Chamber
  #113
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
The chamber pressure would be more or less uniform. With constant density fluid, it would be exactly same everywhere since information is transferred instantly. You can plot the volume averaged pressure while running at a constant or variable mass flow rate and then use it to determine a mass flow rate profile. An easier approach is to use UDF. You can use DEFINE_PROFILE to apply mass flow rate and the value of mass flow rate could be function of pressure inside. You can use the average pressure on the inlet to define mass flow rate at the inlet.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 15, 2020, 07:52
Default
  #114
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
but i have only a table of values of pressure in function of time ?
how could i use that in a udf ? ,(don't know how to define a udf properly)
RJE is offline   Reply With Quote

Old   April 15, 2020, 08:11
Default Udf
  #115
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Here is a sample that you will have to modify as per your simulation

Code:
#include "udf.h"
#define refP 101325  /* This is just a reference pressure. In reality, this should correspond to the absolute value of the pressure profile you have */

DEFINE_PROFILE(massflowrate, t, i)
{
  real f; /* face index. Fluent automatically provides this in the loop below */
  real pin; /* pressure at the inlet */
  begin_f_loop(f, t)
  {
    pin = F_P(f, t); /* This is a macro that provides pressure for a face f */
    F_PROFILE(f, t, i) = ((refP - pin)/refP) * 0.0001; 
  }
  end_f_loop(f, t)
}
Compile or interpret the code above and then you can hook it at the inlet. However, the equation I have used for applying the mass flow profile is just a sample. You may want to use a proper equation so that mass flow rate is what it should be for a given pressure drop.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 15, 2020, 08:46
Default
  #116
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
so i have to enter every value of pressure i have ?
for the equation i have to enter qm= (2*(S pow2)*rou*pressure)pow0.5 ?
RJE is offline   Reply With Quote

Old   April 15, 2020, 09:00
Default Pressure profile and mass flow rate
  #117
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Pressure profile can be read from the file. If the data contains only a small number of points, say 100-200, then those can be copied in the UDF and assigned to a variable. However, if those are in thousands, then that can be read via fscanf in C. It is very simple and need to be done only once. Look at the example below.

https://www.geeksforgeeks.org/scanf-...e-yet-poweful/

As far as equation for the mass flow rate is concerned, I can only give one comment - it must be a function of pressure inside the chamber as well as pressure outside the chamber. You can try with the equation you have.

Actually, your system will work even with the pressure profile you have, however, that pressure profile must be such that the pressure is close to the pressure in the chamber at a particular instant, such as, if at time 1 s, pressure in the chamber is 80000 Pa the pressure value in the profile should be slightly smaller or larger than this; if it is way off then the piston will move all of a sudden and cause negative volume to appear.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 15, 2020, 09:18
Default
  #118
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
that's mean it will always give that error
this is pressure inlet given by a sensor
Attached Images
File Type: gif 2.GIF (8.4 KB, 4 views)
RJE is offline   Reply With Quote

Old   April 15, 2020, 09:24
Default Pressure Profile
  #119
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
This is gauge pressure. Add 101325 Pa to each value and then apply that pressure profile and see if it works. Is the piston always supposed to move downward, i.e., always away from the head?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 15, 2020, 09:27
Default
  #120
RJE
Senior Member
 
Jedidi
Join Date: Mar 2020
Posts: 142
Rep Power: 6
RJE is on a distinguished road
this is what they give me in the begining
i have added 101325 Pa as u have said but it still move away from the head,
and the piston is supposed to move only 2 mm the right (the stroke)
RJE is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AVL FIRE ESE Diesel piston simulation initial condition rdrd4u AVL FIRE 1 July 15, 2015 01:53
Simple piston movement simulation ReVl27 FLUENT 1 February 20, 2015 08:28
variable density in single fluid simulation not running with total energy viking CFX 2 September 18, 2012 20:19
Expert parameter to stop the fluid flow simulation KK CFX 1 February 25, 2008 16:29
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 23:31.