CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Who can fix the error on this UDF code???

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2017, 04:40
Default Who can fix the error on this UDF code???
  #1
NPs
New Member
 
Join Date: Apr 2017
Posts: 7
Rep Power: 9
NPs is on a distinguished road
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
NPs is offline   Reply With Quote

Old   May 12, 2017, 08:43
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   May 12, 2017, 08:53
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Furthermore: you calculate "delta_T" but never use it. And you use "T" but never calculate it. I think you mixed the names.
pakk is offline   Reply With Quote

Old   June 2, 2017, 07:53
Default
  #4
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
"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
KaLium is offline   Reply With Quote

Old   June 2, 2017, 07:58
Default
  #5
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
16 real source = ((mass_NPs)*(cp_NPs))+(cp_water)*(mass_water))* T;;

has two semicolons ( ;; ) and wrong amount of brakets "("
KaLium is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


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