CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Changing wall to pressure outlet (functioning like check valve)) (https://www.cfd-online.com/Forums/fluent-udf/239814-changing-wall-pressure-outlet-functioning-like-check-valve.html)

jayjays November 26, 2021 02:00

Changing wall to pressure outlet (functioning like check valve))
 
Hello, I am new to UDF and find the way to make udf functioning like a check valve.
If pressure at the wall reaches some point, this wall should change its boundary condition as pressure outlet so the fluid can go out through it. and if pressure goes down it goes back to wall again.

Is there any existing code that I can study with?

thank you.

pakk November 26, 2021 02:25

This is difficult. Maybe not impossible, but for sure difficult. You need scheme commands, not a UDF.

Can't help you more than this... :(

AlexanderZ November 26, 2021 03:17

as Pakk said you need to use TUI command to switch boundary condition type
you may put in journal file this TUI code and execute it, also it could be written as a scheme code

you may find how to get TUI commands in google or in this forum

small example of scheme to switch boundary(boundary_name) to mass-low-inlet boundary condition (mass flow rate 1, pressure 100, temperature 300 all in SI) and back again to wall
Code:

(ti-menu-load-string (format #f "define boundary-conditions set m-f-i boundary_name () m-f no 1 supersonic-or-initial-gauge-pressure no 100 t0 no 300 direct-spec no yes q" ))
(ti-menu-load-string (format #f "define boundary-conditions modify-zones z-t boundary_name wall" ))


once you defined TUI code, now you should execute it at the right moment.

you can make it using scheme code:
1. with TUI commands to get pressure on specific wall using reports->surface_integral
2. OR you may use UDF and compute pressure there. But then you should send computed criteria to your scheme, so you need to define rpvar (rp variable) in scheme, read it in UDF, modify in UDF and send it back to scheme

you may run everything using execute commands tab in solution->calculation activities


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