Pressure on a face UDF

  • 42 Views
  • Last Post 06 March 2019
  • Topic Is Solved
Max4 posted this 06 March 2019

Hi,

I want to write an UDF for changing the boundary condition when a pressure limit value on a face is reached. At the beginning, the face is set as "Mass-Flow-Outlet" with 0 kg/s. When the pressure value is reached, it should change in "Pressure-Outlet" with 20E5 Pa.

I have found this:

A first try for the function is as follow. I don´t what to use for the DEFINE Macro. Moreover, can I use the "ti-menu- load-string  ".." " in the UDF or juste for Scheme file?

Thank you in advance.

Regards,

Maxime

Order By: Standard | Newest | Votes
abenhadj posted this 06 March 2019

No you cannot use that inside a C code. You cannot change the type of boundary condition from C side. You always need Scheme there.

Best regards,

Amine

  • Liked by
  • Max4
Max4 posted this 06 March 2019

Thank you for the answer. Is it possible to do it in a scheme file, i.e. change the BC when a pressure value is reached ?

abenhadj posted this 06 March 2019

Yes it is possible

Best regards,

Amine

Max4 posted this 06 March 2019

Ok thank you. The if-statement could be use too?

In order to calculte the value on this face, should I use the macro " F_P(t,tf)" ?

Regards,

Maxime

abenhadj posted this 06 March 2019

F_P is C-Side. In scheme you can off course setup conditions. In Scheme you would change the complete boundary condition. In UDF you can then adjust the changes to whatever you like.

Best regards,

Amine

Max4 posted this 06 March 2019

Have I to use both methods then ? From your experience, is it hard to set up?

 

Regards,

Maxime

abenhadj posted this 06 March 2019

Requires some knowledge of C and Scheme but not really difficult:

 

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..

 

 

Best regards,

Amine

  • Liked by
  • Max4
Close