CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   boundary condition for coupled inlet and outlet (http://www.cfd-online.com/Forums/openfoam-pre-processing/121065-boundary-condition-coupled-inlet-outlet.html)

xxxx July 20, 2013 13:47

boundary condition for coupled inlet and outlet
 
Hello everybody.

I need to run a case in whitch inlet and outlet are strictly linked. I mean that I need to impose Uz velocity component on inlet ( = flux through inlet), calculate the internal velocity field and then impose Ux and Uy veolcity at inlet equal to the ones calculated for outlet, while keeping the same Uz velocity component on inlet.
It seems to me that the problem is closed and correctly defined ( = no circular definition of BCs), since for time zero I impose U = (0 0 Uz) at inlet and for each following time step I impose U = (Ux (outlet,former time step) Uy (outlet, former time step) Uz ).
I have to use a structured mesh and for each inlet node there's a corresponding node at outlet, so I should not have problems of interpolation.
Is there anyone who knows if there is an already implemented BC for my case?
If not, is there anyone who knows how to write a new BC and can give me some advice? I quite know C++ code but I don't have any idea of how BC have to be implemented in OF.

Thank in advance.

kingmaker August 13, 2013 06:12

May be a shell script is helpful
 
Hello
I am no expert in OpenFoam but here is what came to my mind.
I do not know if it is possible using some functions in Openfoam. But what comes to my mind is that you can use a shell script to write the values of Ux and Uy in to the U file in latest time step and then restart the simulation using "latestTime" flag in controlDict.
So finally the work flow will be like that.

1. start simulation with initial condition.
2. run it one step
3. update the velocities at inlet (from previous time step) using shell script (with programs like awk and sed)
(here you may also have to update the controlDict to make simulation run only for one more time step)
4. restart the simulation with flag "latestTime" in control dict.

This is a very dirty hack ... I know ..
.... hope that will be of some help.

xxxx August 13, 2013 16:51

Hello kingmaker,

thanks for your answer..
Actually what you say is what I have already tried, without success.
I used foamCalc components U -latestTime to exctract Ux, Uy, Uz components.
Then I have written a java program which reads from Ux, Uy, Uz files and copies values from outlet to inlet patch.
The problem is that, although I'm using a structured grid, the points ordering is not the same on the to patches. So, if I simply copy the values from a patch to another I don't get what I want.
I should know the exact points order on the to patches or I should read each point coordinates on a patch and found the coupled point on the other one...It is a long and hard work!...so I decided to use a simpler, 'though much expensive, method: I created another domain by copying the original mesh and I stiffly mooved it to match the outlet of "volume 1" (original geometry) to the inlet of "vol 2".
So I simply use the first volume just to create the inlet condition for the second one, whitch is what I really need...of course the mesh size becomes twice the original one!
This may work 'til the mesh is "light" (some hundred of elements) but is not viable for "heavier" meshes..

thanks any way


All times are GMT -4. The time now is 00:35.