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

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, 03:43
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 9, 2017, 07:12
Default
  #2
Senior Member
 
Kevin
Join Date: Dec 2016
Posts: 138
Rep Power: 9
KevinZ09 is on a distinguished road
Quick scan, so no sure if this is your only problem, but replace the "," by "." for decimals, i.e., write 3.14 instead of 3,14. There are a couple of occurences of this error.
KevinZ09 is offline   Reply With Quote

Old   May 9, 2017, 08:02
Default
  #3
Senior Member
 
KaLium's Avatar
 
Kal-El
Join Date: Apr 2017
Location: Finland
Posts: 150
Rep Power: 9
KaLium is on a distinguished road
; instead of ;;

"real t = CURRENT_TIME" needs "; "
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 18:30
UDF code help solve reaction rate equation palm oil zirkov Fluent UDF and Scheme Programming 0 February 13, 2017 10:34
write code UDF Fluent solve kinetic reaction rate equation palm oil zirkov FLUENT 0 February 13, 2017 10:16
Difficulty with UDF code for HEAT FLUX etudiant_IITB Fluent UDF and Scheme Programming 1 December 7, 2015 08:07


All times are GMT -4. The time now is 03:55.