CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for Boundary Condition (https://www.cfd-online.com/Forums/fluent/244281-udf-boundary-condition.html)

sina_sls July 31, 2022 05:53

UDF for Boundary Condition
 
Hello,

I want to write UDF for boundary condition (electric potential of wall by using MHD) , the electric potential is sinusoidal , I think , I must use DEFINE_ADJUST and DEFINE_PROFILE but I'm new in UDF and I don't know how to write and couple two DEFINE together, Could someone help me?

Best Regards,

sina_sls July 31, 2022 12:40

1 Attachment(s)
Quote:

Originally Posted by sina_sls (Post 832762)
Hello,

I want to write UDF for boundary condition (electric potential of wall by using MHD) , the electric potential is sinusoidal , I think , I must use DEFINE_ADJUST and DEFINE_PROFILE but I'm new in UDF and I don't know how to write and couple two DEFINE together, Could someone help me?

Best Regards,

I attached box picture which show that part i want to use sinusoidal value

AlexanderZ July 31, 2022 20:34

DEFINE_PROFILE is a way for you

DEFINE_PROFILE and DEFINE_ADJUST are just functions same as in any language -> you may use global variables to communicate between functinos

for some expamles of DEFINE_PROFILE macro you may take a look into
Ansys Fluent Customization manual

sina_sls August 1, 2022 02:02

Quote:

Originally Posted by AlexanderZ (Post 832790)
DEFINE_PROFILE is a way for you

DEFINE_PROFILE and DEFINE_ADJUST are just functions same as in any language -> you may use global variables to communicate between functinos

for some expamles of DEFINE_PROFILE macro you may take a look into
Ansys Fluent Customization manual

Thank you for your response,

I write this code :

#include "udf.h"
#define PI 3.141592654

DEFINE_PROFILE(current_density,thread,position)
{

face_t f;
real t = CURRENT_TIME;

begin_f_loop(f,thread)
{

F_PROFILE(f,thread,position)=13*sin((2*PI/0.04)*t);

end_f_loop(f,thread)
}
}

i want to use it for User Defined Scalar Boundary Value For MHD module, but when i choose it for a wall, fluent consider the wall as insulated , Do you know how can i fix it ?


All times are GMT -4. The time now is 20:56.