
[Sponsors] 
Inlet Boundary Condition for Open Channel type flow 

LinkBack  Thread Tools  Search this Thread  Display Modes 
December 6, 2018, 07:21 
Inlet Boundary Condition for Open Channel type flow

#1 
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 7 
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 illdefined 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 AnsysFluent 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. 

December 7, 2018, 09:54 

#2 
New Member
Johannes Voß
Join Date: May 2018
Posts: 13
Rep Power: 5 
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". 

December 7, 2018, 13:11 
p_rgh

#3 
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 7 
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. 

December 10, 2018, 05:41 

#4  
New Member
Johannes Voß
Join Date: May 2018
Posts: 13
Rep Power: 5 
To your second Problem:
Quote:
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; https://cfd.direct/openfoam/userguide/v6boundaries/ But again you could use just groovyBC to define your own BC. I hope this helps somehow. 

December 10, 2018, 06:14 
pressure definition

#5 
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 7 
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. 

December 10, 2018, 07:16 
Additional Details

#6  
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 7 
Quote:
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 

December 10, 2018, 14:53 

#7  
Member
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 10 
Quote:
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. 

December 10, 2018, 16:40 

#8 
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 7 
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 

December 10, 2018, 16:59 

#9  
Member
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 10 
Quote:


December 10, 2018, 17:07 
Question about your case

#10  
Member
Akshay Patil
Join Date: Nov 2015
Location: Pune, India
Posts: 34
Rep Power: 7 
Quote:
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. 

December 10, 2018, 17:45 

#11 
Member
Geir Karlsen
Join Date: Nov 2013
Location: Norway
Posts: 59
Rep Power: 10 
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 

Tags 
boundary conditions, inlet, interfoam, open channel flow, pressure driven flow 
Thread Tools  Search this Thread 
Display Modes  


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 