CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Inlet Boundary Condition for Open Channel type flow

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By Akshay_11235
  • 1 Post By J.H.59
  • 1 Post By gkarlsen
  • 1 Post By Pellet_time

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2018, 07:21
Unhappy Inlet Boundary Condition for Open Channel type flow
  #1
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Hello everyone,


I have been stuck with a problem for a while now. The problem involves free surface flow under the influence of gravity. As described in the picture (see attachment), the water level difference should drive the flow downstream. I am using interFoam to investigate such flows.



I cannot figure out what inlet boundary conditions should be used for


1. p_rgh
2. U
3. alpha.air and alpha.water


The way I would like to setup the problem is as follows:


Specify an initial water level (using setFields). I do not know the mass flow rate or the velocity at the inlet. I would like OpenFOAM to compute the velocity or/and mass flow rate at the inlet. This should be possible as the flow is pressure driven. The only information I provide at the inlet is the initial water level (pressure). At the downstream I would like to set either zeroGradient (outflow) or a specified water level (using setFields).



I have tried a few combinations for the inlet boundary conditions. However, nothing seems to be working. The deltaT simply keeps on decreasing. I am aware that this is due to ill-defined boundary conditions. However, Using this setup as described above, I have no idea which boundary condition to employ as the inlet face.



I know that this is fundamentally possible as Ansys-Fluent has an option of Open Channel Flow where you can provide the water surface elevation, bottom reference, and inlet velocity (as 0) and it initiates the solution. I would like to know if this is possible in OpenFOAM. If yes, what boundary conditions should be used at the inlet.



I am quite sure that its the inlet boundary condition that is causing the problem.



Any help will be appreaciated.
Attached Images
File Type: jpg openChannelFlowDrawing.jpg (28.2 KB, 362 views)
ahparvin likes this.
Akshay_11235 is offline   Reply With Quote

Old   December 7, 2018, 09:54
Default
  #2
New Member
 
Johannes Voß
Join Date: May 2018
Posts: 13
Rep Power: 7
J.H.59 is on a distinguished road
I'm not quite sure if this helps since I'm not familiar with interFoam but if I understand you correct you want a coupling BC for pressure and velocity at the inlet.

I'm using for the velocity the "pressureInletOutletVelocity" BC which calculats the velocity from the pressure. You only need to specify the pressure at the inlet for example with "fixedValue" or "uniformFixedValue".
Akshay_11235 likes this.
J.H.59 is offline   Reply With Quote

Old   December 7, 2018, 13:11
Default p_rgh
  #3
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
The current struggle is with specification of p_rgh.
By definition p_rgh = Total Pressure - rho*g*h, which takes away the hydrostatic part of the pressure. So basically it is the dynamic head. The problem is, I do not have the velocity/flow rate information at the inlet boundary. This velocity should be calculated based on the flow that exits the domain. Or in other words, the mass flow rate should be predicted based on the balance



Pressure head at inlet (total) = head loss (due to friction + other losses) + Pressure head at outlet ( total )


Now the trouble for me to setup this model is,
I do not know the dynamic head (velocity/mass flow rate) at the inlet. I want OpenFOAM to calculate this for me. At the same time, I have to specify a pressure p_rgh at the inlet which is basically the Total head - static head = Kinetic head proportional to U^2. This makes the problem inconsistent for me. Please correct me if I am wrong. Its like I am telling OpenFOAM that Kinetic head is 0 and asking it to calculate the velocity and it says sorry cant do that because you just specified kinetic head as zero. This is what I think is happening. It could be completely wrong.


The method you mention about a "fixedValue" will also probably not work as the entire inlet face will then have a constant pressure which is not right. I have tried it and the solution diverges. I need some boudnary condition where


1. The pressure is calculated based on the water surface level just next to the inlet
2. The velocity is computed based on this pressure.


Some kind of iteration I think which solves for the velocity and pressure at the same time.



Thanks for the help. I shall try a few things and will post back if I make any progress.



Let me know what you think. I have been interested in this problem for a long time now, however I am unable to find a solution. Would be nice to have further discussions.
Akshay_11235 is offline   Reply With Quote

Old   December 10, 2018, 05:41
Default
  #4
New Member
 
Johannes Voß
Join Date: May 2018
Posts: 13
Rep Power: 7
J.H.59 is on a distinguished road
To your second Problem:
Quote:
2. The velocity is computed based on this pressure.
This should be done with "pressureInletOutletVelocity". In my case I have a sinus-pressure wave at the inlet and the velocity at the inlet is also a sinus-wave with the amplitude


U = dp / (rho * c_f)


which should be always the case (c_f is the sound velocity in the fluid). But what I do not know is what dp is in your case. Normally this is the difference between the pressure and the reference pressure (e.g. normal pressure of 101325 Pa).



Do you have a possibility to acces the values of the water surface level next to the inlet? And do you know the relation of the pressure and the surface level? Because then you could define your own BC for example with groovyBC.
http://openfoamwiki.net/index.php/Co...Usage_Examples


Another method could be to make your own solver out of interFoam. There you could define your own values which OpenFOAM calculates. And then you could calculate the flow that exits the domain with "surfaceFieldValue" in your controlDict (but I'm not sure if you can use this values while the simulation runs) or even directly in OpenFOAM (but I'm not quite sure of this works completely).


You are right with the "fixedValue". I did mean the "uniformFixedValue" BC. There you have some possibilities. Again in my case I have


Code:
        type            uniformFixedValue;
        uniformValue    sine;
        uniformValueCoeffs
        {
            t0              0;
            amplitude       constant 100;
            frequency       constant 1e+07;
            scale           constant  1;
            level           constant 101325;
        }
        value           uniform 101325;
For more examples see
https://cfd.direct/openfoam/user-guide/v6-boundaries/
But again you could use just groovyBC to define your own BC.


I hope this helps somehow.
J.H.59 is offline   Reply With Quote

Old   December 10, 2018, 06:14
Default pressure definition
  #5
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
This makes a lot more sense.


I am trying to figure out how I could just keep the water level at the inlet constant and let openfoam compute the velocity and pressure.



I am very sure you already see a problem with the proposed appraoch.


Assume the velocity at inlet is 0, then there is no incoming flux into the domain. Thus the discharging leaving is not replaced and the problem becomes a tank draining problem. Which is definitely not what I want.


The only option I think which could work is false mass conservation. Create a plane at a location near the intake (not the inlet) of the weir and feedback that discharge at the inlet. Not sure if this makes sense, however, in order to define some kind of influx this is the simplest solution I can think of.



Wondering what you think about this solution. I will have to program some kind of dynamic coded BC which reads the discharge value from an output file generated by OpenFOAM. Do you think OpenFOAM allows such cyclic ccodingon the fly?


Thanks a lot for your suggestions. I will be trying to program a few things to get it working. I would like to solve this once and for all.
Akshay_11235 is offline   Reply With Quote

Old   December 10, 2018, 07:16
Default Additional Details
  #6
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Quote:
Originally Posted by J.H.59 View Post
To your second Problem:
This should be done with "pressureInletOutletVelocity". In my case I have a sinus-pressure wave at the inlet and the velocity at the inlet is also a sinus-wave with the amplitude


U = dp / (rho * c_f)


which should be always the case (c_f is the sound velocity in the fluid). But what I do not know is what dp is in your case. Normally this is the difference between the pressure and the reference pressure (e.g. normal pressure of 101325 Pa).



Do you have a possibility to acces the values of the water surface level next to the inlet? And do you know the relation of the pressure and the surface level? Because then you could define your own BC for example with groovyBC.
http://openfoamwiki.net/index.php/Co...Usage_Examples


Another method could be to make your own solver out of interFoam. There you could define your own values which OpenFOAM calculates. And then you could calculate the flow that exits the domain with "surfaceFieldValue" in your controlDict (but I'm not sure if you can use this values while the simulation runs) or even directly in OpenFOAM (but I'm not quite sure of this works completely).


You are right with the "fixedValue". I did mean the "uniformFixedValue" BC. There you have some possibilities. Again in my case I have


Code:
        type            uniformFixedValue;
        uniformValue    sine;
        uniformValueCoeffs
        {
            t0              0;
            amplitude       constant 100;
            frequency       constant 1e+07;
            scale           constant  1;
            level           constant 101325;
        }
        value           uniform 101325;
For more examples see
https://cfd.direct/openfoam/user-guide/v6-boundaries/
But again you could use just groovyBC to define your own BC.


I hope this helps somehow.



Just so you have a better perspective, there is already a discussion going on in the below post.



Spillway Analysis Fixed Water Surface Boundary Condition
Akshay_11235 is offline   Reply With Quote

Old   December 10, 2018, 14:53
Default
  #7
Member
 
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 13
gkarlsen is on a distinguished road
Quote:
Originally Posted by Akshay_11235 View Post
Hello everyone,


I have been stuck with a problem for a while now. The problem involves free surface flow under the influence of gravity. As described in the picture (see attachment), the water level difference should drive the flow downstream. I am using interFoam to investigate such flows.



I cannot figure out what inlet boundary conditions should be used for


1. p_rgh
2. U
3. alpha.air and alpha.water


The way I would like to setup the problem is as follows:


Specify an initial water level (using setFields). I do not know the mass flow rate or the velocity at the inlet. I would like OpenFOAM to compute the velocity or/and mass flow rate at the inlet. This should be possible as the flow is pressure driven. The only information I provide at the inlet is the initial water level (pressure). At the downstream I would like to set either zeroGradient (outflow) or a specified water level (using setFields).
As far as I know specifying level and calculating flow is not supported in any existing boundary condition. Hopefully, someone will correct me if I am wrong . I can however offer no less than three workarounds which might resolve the issue for you.

Alternative 1: Reverse the problem
Instead of specifying level and calculating flow, you could try the opposite as this is supported by existing BC's. To do that you use you can use "variableHeightFlowrateInletVelocity" for U and "variableHeightFlowrate" for alpha. For p_rgh you can use zerogradient. Just play around with the flowrate until you get the level you want.

Alternative 2: Calculate the pressure
Set "calculated" boundary condition for both p_rgh and alpha. Set the field values to the level you want by use of setFields. The setFields command will also calculate the value at the inlet boundary for the liquid level you set. Then you have to go back and change the boundary condition for both p_rgh and alpha from "calculated" to "fixedValue" while keeping the calculated cell values.I sometimes get unstability with this approach, but it seems to be working for other people.

As an alternative you could probably use groovyBC to calculate the value "on the fly" in a similar manner. This is probably preferred.

Alternative 3: Cheat
Extend your domain and relocate the inlet to the bottom sufficiently far away from the region of interest. "prghPressure" can be used to set the static pressure (or "prghTotalPressure" for the total pressure) at the bottom of the domain. The static pressure as you know would be proportional to the liquid level.

I tried alternative 1 and 3 myself and got the result attached. I know this did not exactly answer the question you had, but hopefully it could be of use anyway.
Attached Images
File Type: jpg Alt3.jpg (48.2 KB, 235 views)
allanZHONG likes this.
gkarlsen is offline   Reply With Quote

Old   December 10, 2018, 16:40
Default
  #8
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Hello Geir,


Thank you for the awesome response. This answers so many questions in a single post. Appreaciate your help!



I will be trying a few things in the coming weeks, will keep this thread updated once I get some results.



Really apreciate the help!


Regards,
Akshay Patil
Akshay_11235 is offline   Reply With Quote

Old   December 10, 2018, 16:59
Default
  #9
Member
 
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 13
gkarlsen is on a distinguished road
Quote:
Originally Posted by Akshay_11235 View Post
Hello Geir,


Thank you for the awesome response. This answers so many questions in a single post. Appreaciate your help!



I will be trying a few things in the coming weeks, will keep this thread updated once I get some results.



Really apreciate the help!


Regards,
Akshay Patil
Great! Look forward to your findings. Please let me know if you want me to upload the test cases for your review.
gkarlsen is offline   Reply With Quote

Old   December 10, 2018, 17:07
Thumbs up Question about your case
  #10
Member
 
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 10
Akshay_11235 is on a distinguished road
Quote:
Originally Posted by gkarlsen View Post
As far as I know specifying level and calculating flow is not supported in any existing boundary condition. Hopefully, someone will correct me if I am wrong . I can however offer no less than three workarounds which might resolve the issue for you.

Alternative 1: Reverse the problem
Instead of specifying level and calculating flow, you could try the opposite as this is supported by existing BC's. To do that you use you can use "variableHeightFlowrateInletVelocity" for U and "variableHeightFlowrate" for alpha. For p_rgh you can use zerogradient. Just play around with the flowrate until you get the level you want.

Alternative 2: Calculate the pressure
Set "calculated" boundary condition for both p_rgh and alpha. Set the field values to the level you want by use of setFields. The setFields command will also calculate the value at the inlet boundary for the liquid level you set. Then you have to go back and change the boundary condition for both p_rgh and alpha from "calculated" to "fixedValue" while keeping the calculated cell values.I sometimes get unstability with this approach, but it seems to be working for other people.

As an alternative you could probably use groovyBC to calculate the value "on the fly" in a similar manner. This is probably preferred.

Alternative 3: Cheat
Extend your domain and relocate the inlet to the bottom sufficiently far away from the region of interest. "prghPressure" can be used to set the static pressure (or "prghTotalPressure" for the total pressure) at the bottom of the domain. The static pressure as you know would be proportional to the liquid level.

I tried alternative 1 and 3 myself and got the result attached. I know this did not exactly answer the question you had, but hopefully it could be of use anyway.



It would be really helpful if you can share your case here.
I have been trying to do something very simple, just open channel flow with a bottom slope. As I understand, the water level which is to be kept constant should always be at z=0 coordinate. In all the other cases the solution has never converged (please correct me if I am wrong). Mind you, when I say converged it does not mean the solution I get is right. I am positive that the converged results are not right. However, if I get it working for a simple case, its only a matter of time when I can start working on complex geometries.





I have tried two setups. Please find the attachments.
Attached Files
File Type: zip trial1.zip (17.0 KB, 55 views)
File Type: zip trial2.zip (17.0 KB, 41 views)
Akshay_11235 is offline   Reply With Quote

Old   December 10, 2018, 17:45
Default
  #11
Member
 
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 13
gkarlsen is on a distinguished road
Sure Here is the case for Alternative 1

https://drive.google.com/file/d/15pV...ew?usp=sharing

And here is the case for Alternative 3:
https://drive.google.com/file/d/1WQv...ew?usp=sharing
gkarlsen is offline   Reply With Quote

Old   April 10, 2024, 22:12
Default cases
  #12
New Member
 
Steven Pells
Join Date: Apr 2024
Posts: 1
Rep Power: 0
Pellet_time is on a distinguished road
Quote:
Originally Posted by gkarlsen View Post
Sure Here is the case for Alternative 1

https://drive.google.com/file/d/15pV...ew?usp=sharing

And here is the case for Alternative 3:
https://drive.google.com/file/d/1WQv...ew?usp=sharing

first post for me ... I'm struggling with these same issues, would love these cases but the ancient link no longer works ... any chance of reposting?
CFDouz likes this.
Pellet_time is offline   Reply With Quote

Old   April 15, 2024, 04:05
Default An idea !
  #13
New Member
 
Samuel Douzamy
Join Date: Apr 2024
Posts: 1
Rep Power: 0
CFDouz is on a distinguished road
Hello,

I had the same problem last week and created an account to download these files to but i may have found a solution.

I work on a 2D model of a weir and decided to try Alternative 3 so i moved the inlet to the bottom of the geometry and used prghTotalPressure as an boundary condition for this patch. I wanted a 0.75m water surface elevation as a BC so i calculated the hydrostatic pressure created by a 0.75m water column (0.75*1000*9.81 = 7750Pa (h*rho*g)), used it as p0 value and it worked !


I think that you have to check the boundary conditions you have for the "atmosphere" patch. You may have to take in account the pressure fixed at this patch to calculate the pressure you use for the inlet BC (mine is 0 i think).

This is a part of my case you be could interested in : https://github.com/CFDouz/2D-Weir-Case

("amont" means upstream in french)

A thing i don't understand is the difference between the prghPressure and prghTotalPressure BC because, they should be the same
since the water doesn't have any speed at the inlet but their effect on the simulation are very different. If someone has an idea ?

Hope this helped !
Sam
CFDouz is offline   Reply With Quote

Reply

Tags
boundary conditions, inlet, interfoam, open channel flow, pressure driven flow


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
time step continuity problem in VAWT simulation lpz_michele OpenFOAM Running, Solving & CFD 5 February 22, 2018 19:50
Error during initialization of "rhoSimpleFoam" kornickel OpenFOAM Running, Solving & CFD 8 September 17, 2013 05:37
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
[swak4Foam] Air Conditioned room groovyBC Sebaj OpenFOAM Community Contributions 7 October 31, 2012 14:16


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