CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to automatically switch boundary conditions (https://www.cfd-online.com/Forums/openfoam-programming-development/236469-how-automatically-switch-boundary-conditions.html)

nurs134 May 31, 2021 14:22

How to automatically switch boundary conditions
 
2 Attachment(s)
Hello everyone,

I need automatically switch inlet and outlet conditions in the way that I described below.

1st iteration:
Initial conditions: Pressure (P) (experiment value) inlet -> Mass flow rate (Q)(outlet)
Result: Mass flow rate (Q) (calculated) inlet -> P and Q (calculated) at outlet

then we need to put calculated P values from the outlet of 1st iteration to the outlet initial conditions of 2nd iteration

2nd iteration:
Initial conditions: Mass flow rate (Q) (experiment value) inlet -> Pressure (P) (1st iteration calculated) (outlet)
Result: Pressure (P) (calculated) inlet -> Mass flow rate Q (calculated) at outlet

then we need to put calculated Q values from the outlet of the 2nd iteration to the outlet initial conditions of 3rd iteration

3rd iteration:
Initial conditions: Pressure (P) (experiment value) inlet -> Mass flow rate (Q) (2nd iteration calculated) (outlet)
Result: Mass flow rate (Q) (calculated) inlet -> P and Q (calculated) at outlet

and etc.

How to program such kind of algorithm in OpenFOAM? Maybe in bash or python script.

Replies will be very helpful. I appreciate every response.

Kind regards,
Nursultan


All times are GMT -4. The time now is 19:59.