CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

how to set up Hydrostatic pressure distribution in interFoam?

Register Blogs Community New Posts Updated Threads Search

Like Tree35Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 25, 2013, 06:37
Default how to set up Hydrostatic pressure distribution in interFoam?
  #1
New Member
 
Baek, Donghae
Join Date: Jan 2013
Location: Seoul
Posts: 24
Rep Power: 13
wes1204 is on a distinguished road
hello foamer

I am simulating 2d hydraulic jump using interFoam.

inlet velocity is subcritical condition and I know only velocity and water depth at inlet.

this subcritical flow will be changed to supercritical flow when flow pass semi circular shaped weir.

To make hydraulic jump, I want to specify Hydrostatic pressure distribution at outlet boundary condition.

but in case of interfoam, we should set up "p_rgh "not "p".

as far as i know, p_rgh is p - rgh but i don't understand what it mean exactly.

anyway I want to input Hydrostatic pressure into boundary condition of p_rgh at outlet.

how can I do it??

please help me.
ABgabriel13 likes this.
wes1204 is offline   Reply With Quote

Old   May 6, 2014, 06:14
Default
  #2
New Member
 
maxonline's Avatar
 
Max
Join Date: May 2011
Location: Nuremberg
Posts: 17
Rep Power: 15
maxonline is on a distinguished road
Hey, have you found an answer to your problem?
maxonline is offline   Reply With Quote

Old   May 7, 2014, 11:04
Default hey
  #3
New Member
 
Baek, Donghae
Join Date: Jan 2013
Location: Seoul
Posts: 24
Rep Power: 13
wes1204 is on a distinguished road
Quote:
Originally Posted by maxonline View Post
Hey, have you found an answer to your problem?
hello Max.

in my view, fixedvalue uniform 0 for p_rgh represent hydrostatic pressure

the reason is that :

we can see the mathematic definition of p_rgh in pEqn.H file.

that is,

p_rgh = p - rho*gh;


"p" is total pressure

"rho" is density of fluid

and the meaning of "gh" exist in createFields.H file.

that is,

volScalarField gh("gh", g & mesh.C());

it mean dot product gravitational acceleration and cell centres.

so rho*gh term represent hydrostatic pressure.

when we set p_rgh to fixedvalue 0, its expression is mathematically like

p_rgh = p - rho*gh = 0

"rho*gh" move to right side. it yields

p = rho*gh

"rho*gh" is hydrostatic pressure as i mentioned above.

I hope it help you
wes1204 is offline   Reply With Quote

Old   May 8, 2014, 05:05
Default
  #4
New Member
 
maxonline's Avatar
 
Max
Join Date: May 2011
Location: Nuremberg
Posts: 17
Rep Power: 15
maxonline is on a distinguished road
Thank you! Ok that makes sense.
So if I set p_rgh to fixedValue uniform 0, what value does the hydrostatic pressure have then?

I want to define a permanent water level at a certain height as a BC, so I would need to set a certain hydrostatic pressure for this water level. How can I do that if I have to set p_rgh BC to fixedValue uniform 0?

Do you know if that is possible? Is my thinking wrong?
lourencosm and Chit like this.
maxonline is offline   Reply With Quote

Old   May 12, 2014, 08:53
Default
  #5
New Member
 
Benjamin
Join Date: Apr 2014
Location: Zürich
Posts: 27
Rep Power: 12
Benji is on a distinguished road
Hello,
I'm having similar problems here. Same as Max, I need to define a water level at the outlet, so I would need to give a certain pressure and not just let it calculate.

And for p_rgh: When set to 0, then there is ONLY hydrostatic pressure at the outlet (no more dynamic pressure), right? What I'd like is to know/define the hydrostatic pressure and still have dynamic pressure
Benji is offline   Reply With Quote

Old   May 12, 2014, 13:06
Default
  #6
New Member
 
Matej Muller
Join Date: Oct 2011
Location: Slovenia
Posts: 25
Rep Power: 15
matejmuller is on a distinguished road
If you use the totalPressure boundary type, the value is 0,but then the flow is considered as a free outflow.

To define a water level at the outlet (if I have the same patch at the boundary for water and air) I usually use the type calculated, then i set the initial fields of p_rgh with the utility setFields (where you define p_rgh as the hydrostatic pressure at the bottom, for example, for the water level 1m, p_rgh=10000). After setting the fields with setFields i change the type calculated in the initial conditions to fixedValue. I do the same for the alpha1 fields. I my case it works pretty well.
Bashar, LeOtTeRz and SHANRU like this.
matejmuller is offline   Reply With Quote

Old   May 13, 2014, 01:15
Default re
  #7
New Member
 
Baek, Donghae
Join Date: Jan 2013
Location: Seoul
Posts: 24
Rep Power: 13
wes1204 is on a distinguished road
sorry max and benji

to use fixedvalue, your geometry should be adjusted to locate free surface z=0.

It is troublesome work.

instead of that

I tried to use totalpressure as Muller mentioned above.

I split outlet patch because of fixed elevation.

outlet_water
{
type totalPressure;
p0 uniform 2943;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
value uniform 0;
}

and p0 is calculated as water depth * rho * g
(in my case, water depth is 0.3m)

i checked it worked well.

but I think Muller's approach is more clear.
wes1204 is offline   Reply With Quote

Old   May 13, 2014, 06:16
Default
  #8
New Member
 
Benjamin
Join Date: Apr 2014
Location: Zürich
Posts: 27
Rep Power: 12
Benji is on a distinguished road
Thanks for your replies!

@matejmuller: I don't understand completely how you exactly do that. Please correct me if I'm wrong:
1. with p_rgh at the outlet set to "calculated", you use setFields (but without actually
starting the calculation) similar to this (so p_rgh is the same in the whole system, =1000 but just in the bottom cells):
Code:
        boxToCell
    {
        box (0 0 -3) (10 2 -2.9);
        fieldValues
        (
            volScalarFieldValue p_rgh 10000
        );
    }
2. You set p_rgh at the outlet to a fixed value, but which one? 0 would mean there is no dynamic pressure left, and wouldn't necessarily correspond to your initial water level of 1m, or am I wrong?

@wes1204: How do you define the other parameter for outlet_water? and what does your other outlet look like? Because if I set a value for p0 in outlet_water, I get a flux in the opposite direction
Benji is offline   Reply With Quote

Old   May 13, 2014, 08:50
Default
  #9
New Member
 
Matej Muller
Join Date: Oct 2011
Location: Slovenia
Posts: 25
Rep Power: 15
matejmuller is on a distinguished road
The utility setFields only prescribes the initial values of the variables. When you change the boundary type calculated to fixedValue, you fix those values on the outlet boundary that setFields automatically prescribed. Don't bother with the dynamic pressure, the whole idea of p_rgh is that you don't have to define it, the solver calculates it from the velocities.


1. set boundary type on the outlet boundary patch of p_rgh to calculated

outlet
{
type calculated;
}

2. use setFields to prescribe the INITIAL VALUES of p_rgh in the internal field and on the boundaries (set the box coordinates in the file setFields only for the area with water)

For example if you have a channel with horizontal dimensions 10x1 m and with the initial water level 0,5m :

boxToCell
{
box (0 0 0) (10 1 0.5);
fieldValues
(
volScalarFieldValue p_rgh 5000
);
}


3. run setFields
4. change the boundary type calculated on the outlet boundary to fixedValue (you will see, that the setFields utility has prescribed the p_rgh values 5000 on the outlet boundary on every cell face that lies inside your box from setFields).

outlet
{
type fixedValue;

value nonuniform List<scalar>

1500 //number of cell faces//
(
5000
5000
5000
.
.
.
);

5. Do the same for alpha1
6. start simulation


matej
Bashar and LeOtTeRz like this.
matejmuller is offline   Reply With Quote

Old   May 13, 2014, 09:48
Default
  #10
New Member
 
Benjamin
Join Date: Apr 2014
Location: Zürich
Posts: 27
Rep Power: 12
Benji is on a distinguished road
Hey matej, thanks a lot for your help!

I think I got it now, finally So far, the results seem to make sense, although I get problems with my courant-number pretty frequently now...

Thanks again,
Benji
Benji is offline   Reply With Quote

Old   May 14, 2014, 03:09
Default
  #11
New Member
 
maxonline's Avatar
 
Max
Join Date: May 2011
Location: Nuremberg
Posts: 17
Rep Power: 15
maxonline is on a distinguished road
Hey,
I played with groovyBC and I basically did the same thing:

p_rgh:
Quote:
outlet
{
type groovyBCFixedValue;
valueExpression "(pos().z<0.32) ? 1000*9.81*0.32 : 1*9.81*(0.72-0.32) ";
}
alpha.water
Quote:
outlet
{
type groovyBCFixedValue;
valueExpression "(pos().z<0.32) ? 1 : 0";
}
My water level is 0.32 m and the modell hight is 0.72 m.

So I have the solution to hold the water level at the outlet but the calculation is not working anyway. But my calculation fails after a few seconds when a small wave hits the outlet boundary.

Does anyone know a solution for that problem?

Thx - Max
lourencosm likes this.
maxonline is offline   Reply With Quote

Old   May 14, 2014, 04:09
Default
  #12
New Member
 
Benjamin
Join Date: Apr 2014
Location: Zürich
Posts: 27
Rep Power: 12
Benji is on a distinguished road
I have a similar problem, it doesn't matter whether I use groovyBC or not, after a few seconds the calculation fails
And there is something I don't understand: Why is p_rgh = hydrostatic pressure in this case? (It does not make sense, looking at the equation and the fact that hydrostatic pressure would not be constant over height....)

Thanks for the help!
Benji is offline   Reply With Quote

Old   May 16, 2014, 11:22
Default
  #13
New Member
 
Matej Muller
Join Date: Oct 2011
Location: Slovenia
Posts: 25
Rep Power: 15
matejmuller is on a distinguished road
p_rgh is not the hydrostatic pressure, it's the openfoams way to simplify things. p_rgh=p-rgh (where the g component is negative). You'll find a better explanation under this link (see drawing):

http://www.cfd-online.com/Forums/ope...rgh-1-7-a.html

This method with the calculated boundary type always worked for me...maybe there is an error elsewhere (mesh, patches, time step..?).

best regards, matej
matejmuller is offline   Reply With Quote

Old   May 19, 2014, 12:02
Default
  #14
New Member
 
Benjamin
Join Date: Apr 2014
Location: Zürich
Posts: 27
Rep Power: 12
Benji is on a distinguished road
Thanks matej again for the reply!
Yes I figured the p_rgh and it also works, more or less... I set the outlet water level to z=0 which worked well for a rectangular channel. If I take a trapeze-shaped channel with the same BC's and the calculation stops after ~40 seconds and I get some weird and really high velocities at the inlet, does anyone have an idea why this could be? I guess it might have to do sth with the now non-orthogonal cell shapes...
Benji is offline   Reply With Quote

Old   January 17, 2015, 23:59
Default
  #15
Senior Member
 
Matthew Denno
Join Date: Feb 2010
Posts: 138
Rep Power: 16
mgdenno is on a distinguished road
I know this tread is a little old, but matej, what type of boundary condition do you use for U at the outlet when you fix alpha and p_rgh? I have tried zeroGradient, inletOutlet and pressureInletOutletVelocity, without much success. Just wondering what has worked for you.
mgdenno is offline   Reply With Quote

Old   July 29, 2016, 06:29
Default InterFoam fixed height outlet approach
  #16
Member
 
Lourenço SM
Join Date: Jul 2014
Location: Lisboa, Portugal
Posts: 41
Rep Power: 12
lourencosm is on a distinguished road
Hey,

I have found a solution that is working for me, very similar to the ones described here.
It is capable of gently ensure a water level but still absorbs some surface waves.

1) Outlet is divided in 2 patches: outlet_top (air), outlet_bottom (water);

2) Outlet_top is all zeroGradient (U, alpha.water, p_rgh);

3) Outlet_bottom:
  • a) Z coords max limit should be similar to desired water surface level (WSL) (better if it is a some cells smaller)
    b) alpha-water - fixedValue, uniform 1;
    c) U - pressureInletOutletVelocity;
    d) p_rgh - fixedValue, uniform P_RGH_OUTLET;
    P_RGH_OUTLET=g* rho_water*WSL_inMeters

It works and also is quite nice to let go all the surface waves.

BUT:
-it explodes if the water surface level goes below the top of the outlet_bottom patch;
-so... I set the max Z of the outlet_bottom patch always some cells bellow the desired WSL and, sometimes, I also increase a little bit the initial value of P_RGH_OUTLET;

CONCLUSION:
- it is a solution with a strong discontinuity (2 different patches) although the zeroGradient helps to smooth it;
- it may fail suddenly;
- maybe a U limiter/smoother could be applied to prevent those very high velocities when the water surface drops too much;
- i guess it lacks a calculation of the dynamic pressure;

Does any one tried something similar?

Does anyone knows another solution that works (probably much better)?

Cheers,
Lourenço
Willy_Lamothe likes this.
lourencosm is offline   Reply With Quote

Old   February 21, 2017, 17:53
Default
  #17
Member
 
Bashar
Join Date: Jul 2015
Posts: 74
Rep Power: 11
Bashar is on a distinguished road
Quote:
Originally Posted by matejmuller View Post
The utility setFields only prescribes the initial values of the variables. When you change the boundary type calculated to fixedValue, you fix those values on the outlet boundary that setFields automatically prescribed. Don't bother with the dynamic pressure, the whole idea of p_rgh is that you don't have to define it, the solver calculates it from the velocities.


1. set boundary type on the outlet boundary patch of p_rgh to calculated

outlet
{
type calculated;
}

2. use setFields to prescribe the INITIAL VALUES of p_rgh in the internal field and on the boundaries (set the box coordinates in the file setFields only for the area with water)

For example if you have a channel with horizontal dimensions 10x1 m and with the initial water level 0,5m :

boxToCell
{
box (0 0 0) (10 1 0.5);
fieldValues
(
volScalarFieldValue p_rgh 5000
);
}


3. run setFields
4. change the boundary type calculated on the outlet boundary to fixedValue (you will see, that the setFields utility has prescribed the p_rgh values 5000 on the outlet boundary on every cell face that lies inside your box from setFields).

outlet
{
type fixedValue;

value nonuniform List<scalar>

1500 //number of cell faces//
(
5000
5000
5000
.
.
.
);

5. Do the same for alpha1
6. start simulation


matej
Thank you ! Its really a good option .
Bashar is offline   Reply With Quote

Old   February 21, 2017, 20:45
Default
  #18
New Member
 
Matej Muller
Join Date: Oct 2011
Location: Slovenia
Posts: 25
Rep Power: 15
matejmuller is on a distinguished road
I'm sorry I didn't saw your question Matthew... I use inletOutlet at the outlet boundary for U. But it is a bit tricky, as some high (unrealistic) velocities can appear due to the high gradient values of alpha and p_rgh between the neighboring cells on the interphase at the outlet. This can cause some instabilities and sometimes it blows up. For this I've added to the solver interFoam some new code, which limits the maximal velocities in the phase air according to the maximal velocities in the phase water. With this new solver, the calculation newer blows up, furthermore, it’s a bit more economical as the simulation time is a bit shorter (around 10 to 20%). Will post the new code online as soon as I find some extra time.

Otherwise, you can fix only the alpha values on the outlet boundary and define fixedFluxPressure for p_rgh, then the calculation is usually more stable. However, in this case the accuracy of the defined water surface at the outlet is only as much as your numerical mesh is dense (if the height of your cells at the outlet is 1cm, you can define the water level at the outlet boundary with the accuracy of 1cm).

Regards, Matej
Bashar and Willy_Lamothe like this.
matejmuller is offline   Reply With Quote

Old   May 2, 2017, 13:23
Default
  #19
New Member
 
Guillaume Lamothe
Join Date: Apr 2017
Posts: 1
Rep Power: 0
Willy_Lamothe is on a distinguished road
Hi everyone,

I'm trying to simulate a free surface flow with interFoam, on OpenFoam 4.1. At the moment, the geometry is a simple rectangular channel, with a submerge inlet with a fixed velocity.I'm trying to understand how to fixed the water level at the outlet. Currently, the left outlet is define as a wall, only the right outlet is tested. At the end, my goal is to impose a different water level at each outlet, to study the flow distribution between the two outlets.

1- During my tests, I tried everything you wrote on this thread. But the only stable (ish!) boundary conditions are a fixed velocity and a totalPressure of 0. Every time I tried to fixed the Alpha the velocity increase drastically and the k-epsilon solver diverge.

2- I'm not a fan of the fixed velocity, I would prefer to have a fully develop velocity profile at the outlet. I would like to try groovyBC, but swak4Foam is not available for OF4.1.

3- TotalPressure of 0Pa work "OK" if I translate my mesh, so that the free surface is at the elevation z=0. But I end up with weird fluctuations of the water level and p_rgh near the outlet, as you can see in the picture.

Did someone tried interFoam with OpenFoam 4.1?

How did you impose the water level at the outlet?

Thanks in advance.

Guillaume
Attached Images
File Type: png Top.png (84.8 KB, 309 views)
File Type: png Side.png (76.3 KB, 230 views)
File Type: png Outlet.png (147.3 KB, 273 views)
File Type: png Iso.png (81.8 KB, 239 views)
Willy_Lamothe is offline   Reply With Quote

Old   May 3, 2017, 03:34
Default
  #20
New Member
 
maxonline's Avatar
 
Max
Join Date: May 2011
Location: Nuremberg
Posts: 17
Rep Power: 15
maxonline is on a distinguished road
Hey, regarding the outlet bc you can manipulate the totalPressure bc so it will fit your needs and compile it as a new bc (only applicable for interFoam). I did the same for OF 2.3.1 and it works really fine!

I added the term "rho*9.81*zFS" with zFS = z-coordinate of the desired free surface in the solved equation in totalPressureFvPatchScalarField.C and adjusted the .H-File accordingly.

operator==(p0p + rho*9.81*zFSp - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));

In this way you can specify the water level with the parameter zFS in your p_rgh file.

Best regards - Max
maxonline 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
Pressure Outlet Guage pressure Mohsin FLUENT 36 April 29, 2016 18:16
Bad pressure distribution in pump oringo FLUENT 2 March 2, 2013 11:38
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15
hydrostatic and static pressure pi CFX 3 May 26, 2004 11:35
Definition of pressure Ola Nordblom FLUENT 1 August 16, 2001 16:58


All times are GMT -4. The time now is 14:50.