I have a transient simulation and I want to change the boundary condition from Mass Flow Outlet to Pressure Outlet when a limit value of pressure in a cell zone is reached.
I have already written a Scheme-File for changing a boundary condition as function of time but not as function of a value.
I have read this in order to change the BC.
- You need a RP Variable
- You need an UDF to set that variable to True or False / 1 or 0 depending of the condition
- You need then a calculation activity which checks for that variable and change the boundary condition
- You need another UDF to adjust the boundary if RP Varriable is true or 1..
I have created the following Scheme for defining a RP Variable named "reached", which defines if the pressure at the outlet is reached or not.
In a UDF i have to set the variable to True or False depending on the condition. In a UDF I can access the value of the RP Variable by using RP_Get_Integer. I have seen that I can change the value of the variable by using rpsetvar in the Text Interface. For the UDF, can I use RP_Set_Variable("...", int)?
Moreoever how can I access the pressure at the outlet for defining the UDF? I think that I have to use the ID number of the face and the face macro F_P(f, t). Is it right?