CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   inlet boundary condition based on specified water level (https://www.cfd-online.com/Forums/openfoam-pre-processing/122819-inlet-boundary-condition-based-specified-water-level.html)

Hale August 28, 2013 16:37

inlet boundary condition based on specified water level
 
Hi,

I am dealing with a two phase flow problem where I need to specify a constant water level for the inlet. I do not want to do it by specifying a velocity or flux.

I tried to do it by specifying a hydrostatic pressure (rho*g*h) for p_rgh and zeroGradient for U but it blows up!

Is there any way to specify the height of the water at the inlet?

Thanks
Hale

nimasam August 29, 2013 15:30

well i guess you can do it via non-uniform alpha1 (i assumed you use interFoam as solver ;) )

Hale August 30, 2013 04:53

Quote:

Originally Posted by nimasam (Post 448776)
well i guess you can do it via non-uniform alpha1 (i assumed you use interFoam as solver ;) )

Hi Nima,

Thanks for the reply. Yes, I use interFoam. For the inlet where I need a constant water level I have defined alpha1=1 and zeroGradient for everwhere else. What did you mean with non-uniform alpha1?

nimasam August 30, 2013 05:05

well you can put a non-uniform alpha
something similar this :
Quote:

y < h ? 1 : 0
where h is water level

you can used:

1- code stream
2: groovyBC

to create such nonuniform BC

Hale August 30, 2013 05:16

This is too complicated for me :) but would you please explain what will this non-uniform alpha1 do? I need a uniform water level at the inlet so why should I changed alpha1 to non-uniform?

nimasam August 30, 2013 05:41

in your post #1, you said you want a constant water level!, so i assumed! a portion of your inlet fill with water! if the whole inlet is water! then specify the velocity or flux whats wrong then? ;)

Hale August 30, 2013 10:52

The problem is that I'm simulating a real life problem where the flux is not known but the water level can be adjusted. Therefore I want to specify the water level in terms of hydrostatic pressure or something else that can allow the model to find the flux/velocity by itself.

Sim81 April 10, 2014 12:18

Different water levels; BCs OpenFOAM
 
I have a similar problem. I have two water tanks connected by a pipe. The tanks have two different water levels. I want to keep this difference constant but I do not know the flow rate at the inlet and outlet. Therefore I should find the BCs that allows me to keep the water levels constant in the tanks. Any help?

Thank you

tinu80 December 22, 2016 05:10

I have a very similar problem for open channel flows
What I need is an upstream boundary that physically behaves like there would be an unlimited reservoir of water with a fixed water level and no prescribed flow rate / velocity at the boundary. Velocity at the upstream boundary should develop as a consequence of the velocities in the model.
I have tried to fix upstream water level with groovyBC:

Upstream BC
------------------
alpha.water: pos().z <= waterlevel ? 1:0
U: zeroGradient
p_rgh: fixedFluxPressure


Downstream BC (simulating free outflow)
-------------------
alpha.water: inletOutlet, inletValue uniform 0;
U: pressureInletOutletVelocity
p_rgh: totalPressure p0 uniform 0;

Atmosphere
----------------------
alpha.water: inletOutlet, inletValue uniform 0;
U: pressureInletOutletVelocity
p_rgh: totalPressure p0 uniform 0;

These BC seem to work nicely with a very simple rectangular open channel flow. With more complicated meshes the simulation seemed to blow up, developing unphysical pressure/velocity from one point near the fixed inlet water level. I suspect the combination of zeroGradient for U and fixedFluxPressure for p_rgh at inlet is not stable.
Any ideas which combinations for p_rgh and U could work when fixing the inlet alpha.water level with groovyBC?
Hints are highly welcome!
Tinu

Bashar February 15, 2017 22:14

Quote:

Originally Posted by tinu80 (Post 630892)
I have a very similar problem for open channel flows

What I need is an upstream boundary that physically behaves like there would be an unlimited reservoir of water with a fixed water level and no prescribed flow rate / velocity at the boundary. Velocity at the upstream boundary should develop as a consequence of the velocities in the model.

I have tried to fix upstream water level with groovyBC:



Upstream BC

------------------

alpha.water: pos().z <= waterlevel ? 1:0

U: zeroGradient

p_rgh: fixedFluxPressure





Downstream BC (simulating free outflow)

-------------------

alpha.water: inletOutlet, inletValue uniform 0;

U: pressureInletOutletVelocity

p_rgh: totalPressure p0 uniform 0;



Atmosphere

----------------------

alpha.water: inletOutlet, inletValue uniform 0;

U: pressureInletOutletVelocity

p_rgh: totalPressure p0 uniform 0;



These BC seem to work nicely with a very simple rectangular open channel flow. With more complicated meshes the simulation seemed to blow up, developing unphysical pressure/velocity from one point near the fixed inlet water level. I suspect the combination of zeroGradient for U and fixedFluxPressure for p_rgh at inlet is not stable.

Any ideas which combinations for p_rgh and U could work when fixing the inlet alpha.water level with groovyBC?

Hints are highly welcome!

Tinu



Thanks for sharing the BC.I am simulating flow past plate with free surface.I will try your BC.



Sent from my iPhone using CFD Online Forum mobile app

burbur May 27, 2021 11:26

Defininig flow depth as a boundary condition
 
Quote:

Originally Posted by tinu80 (Post 630892)
alpha.water: pos().z <= waterlevel ? 1:0

Hi Tinu,
I am trying to define flow depth as boundary condition for an open channel model. This suggestion of yours seem reasonable. However, I could not find out how to apply this in the alpha.water file. Can you or anyone help on this issue?

Thanks.

Tobermory May 28, 2021 11:00

Quote:

Originally Posted by burbur (Post 804801)
Hi Tinu,
I am trying to define flow depth as boundary condition for an open channel model. This suggestion of yours seem reasonable. However, I could not find out how to apply this in the alpha.water file. Can you or anyone help on this issue?

Thanks.

Tinu80's post is using the (fantastic) swak4Foam utility by Bernhard Gschaider (which is now integrated within v2021 I believe, if you are using that branch of OF). I heartily recommend that you check that out if you are planning to use OpenFOAM a lot, since I find it a really useful tool, and it provides a quick and intuitive method for applying BCs.

Failing that, as someone at the start of the thread mentioned, you can do the same with some pretty codeStream coding. Check out the following:
http://www.wolfdynamics.com/wiki/pro...streamINIT.pdf


All times are GMT -4. The time now is 16:48.