Who can fix the error on this UDF code???
1 Attachment(s)
Hi everyone, I have to implement a UDF in fluent as a Wall Heat Generation Rate Profile on this geometric model
Attachment 55881 The wall heat generation must be in the wall of the inner cylinder and it's defined by these 2 equations T = (((mu_0)*3,14*(chi_2)*(frequency)*(magnetic_field_ quadrato))/(((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water)))*t ; real source = ((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water))* T; I got T then i got real source,the others are parameters with numeric values. I wrote this code for the UDF #include "udf.h" #define mu_0 1,256637*10^(-6) // permeabilitą elettrica vuoto (H/m)// #define chi_2 1,25 //suscettivitą magnetica #define frequency 344000 //frequenza campo #define magnetic_field_quadrato 21000 //campo magnetico #define mass_NPs 1.5 //massa nanoparticelle #define cp_NPs 0.67 //calore specifico nanoparticelle #define mass_water 498.5 //massa acqua #define cp_water 4.18 //calore specifico acqua DEFINE_PROFILE(wallheatgenerate,thread,i) { real t = CURRENT_TIME delta_T = (((mu_0)*3,14*(chi_2)*(frequency)*(magnetic_field_ quadrato))/(((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water)))*t ; real source = ((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water))* T;; face_t f; begin_f_loop(f,thread) F_PROFILE(f,thread,i) = source; end_f_loop(f,thread) } Then i got this error "f:undeclared variable" and "parse error" on these lines 15 delta_T = (((mu_0)*3,14*(chi_2)*(frequency)*(magnetic_field_ quadrato))/(((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water)))*t ; 16 real source = ((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water))* T;; 17 face_t f; Anyone can help me to fix it? Thanks a lot |
Don't use comma's inside numbers, but points.
Wrong: #define mu_0 1,256637*10^(-6) Correct: #define mu_0 1.256637*10^(-6) I think you did this three times in your code. And you used two semicolons (";;") in line 16, that is not needed. |
Furthermore: you calculate "delta_T" but never use it. And you use "T" but never calculate it. I think you mixed the names.
|
"real t = CURRENT_TIME" needs semicolon
" 15 delta_T = (((mu_0)*3,14*(chi_2)*(frequency)*(magnetic_field_ quadrato))/(((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water)))*t ;" It should be "3.14", not "3,14". Use point "." for desimals |
16 real source = ((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water))* T;;
has two semicolons ( ;; ) and wrong amount of brakets "(" |
All times are GMT -4. The time now is 23:56. |