|
[Sponsors] |
May 9, 2017, 04:40 |
Who can fix the error on this UDF code???
|
#1 |
New Member
Join Date: Apr 2017
Posts: 7
Rep Power: 9 |
Hi everyone, I have to implement a UDF in fluent as a Wall Heat Generation Rate Profile on this geometric model
modello - Copia.PNG 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 |
|
May 12, 2017, 08:43 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
May 12, 2017, 08:53 |
|
#3 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Furthermore: you calculate "delta_T" but never use it. And you use "T" but never calculate it. I think you mixed the names.
|
|
June 2, 2017, 07:53 |
|
#4 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
"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 |
|
June 2, 2017, 07:58 |
|
#5 |
Senior Member
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9 |
16 real source = ((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water))* T;;
has two semicolons ( ;; ) and wrong amount of brakets "(" |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compiling the customized UDF code for PEMFC | dmfo | Fluent UDF and Scheme Programming | 2 | October 1, 2017 19:30 |
UDF code help solve reaction rate equation palm oil | zirkov | Fluent UDF and Scheme Programming | 0 | February 13, 2017 11:34 |
write code UDF Fluent solve kinetic reaction rate equation palm oil | zirkov | FLUENT | 0 | February 13, 2017 11:16 |
Difficulty with UDF code for HEAT FLUX | etudiant_IITB | Fluent UDF and Scheme Programming | 1 | December 7, 2015 09:07 |