# An odd ERROR

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 15, 2014, 08:27 An odd ERROR #1 New Member     m.akbari Join Date: Apr 2014 Posts: 14 Rep Power: 4 hi friends, i have a problem in interpreting my .c file when i interpret it by fluent, an error appears that says: label "temp" not found (pc=61) so what does it mean? i really need ur help dudes. my code is below: /************************************************** ******************* UDF all calculations for al2o3 nanoparticles ************************************************** ********************/ #include "udf.h" #define FI 0.01 #define RHO_np 3600 #define SI_1 0.9830 #define SI_2 12.959 DEFINE_PROPERTY(cell_conductivity,cell,thread) { real ktc; real temp = C_T(cell,thread); ktc = (-8.354*0.000001*(pow(temp,2)))+((6.53*0.001*temp)-0.5981); return ktc; } DEFINE_PROPERTY(cell_density,cell,thread) { real rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2)); real temp = C_T(cell,thread); real rho = (FI*RHO_np)+((1-FI)*rho_w); return rho; } DEFINE_PROPERTY(cell_viscosity,cell,thread) { real mu_w,mu; real temp = C_T(cell,thread); mu_w = (2.591*(pow(10,-5))*(pow(10,(238.3/(temp-143.2))))); mu = (SI_1*exp (SI_2*FI)*mu_w); return mu; }

 April 15, 2014, 09:09 #2 Member   Engr Adeniyi Join Date: Jan 2011 Posts: 32 Rep Power: 8 Hi, Try this, declare all variables before assigning values to them, for example, real x, y, z; x=4.; y=10.; z=0.3; Instead of real x= 4.; real y=10.; real z=0.3; NB: Your error is in this line, you used temp before declaring it: real rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2)); mdakbari likes this.

April 16, 2014, 02:22
my error
#3
New Member

m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 4
Quote:
 Originally Posted by Galileo Hi, Try this, declare all variables before assigning values to them, for example, real x, y, z; x=4.; y=10.; z=0.3; Instead of real x= 4.; real y=10.; real z=0.3; NB: Your error is in this line, you used temp before declaring it: real rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));

hello my friend, thank u for ur help. i did that correction and it did work. but unfortunately when i run the calculations, the calculations do not run and there would be an error, so i ask u to look at my full and entire code which i just completed it, and give me ur opinion with regard to the exact error which appeared in fluent:

/************************************************** *******************
Fluent UDF
Author: Milan
all calculations for al2o3 nanoparticles
************************************************** ********************/
#include "udf.h"
#define FI 0.01
#define RHO_np 3600
#define SI_1 0.9830
#define SI_2 12.959
#define KTC_np 36
#define TI 5*(pow(10,4))
#define BETA_1 8.4407
#define BETA_2 -1.07304
#define CP_w 4200
#define KA 1.383*(pow(10,-23))
#define SIi_1 2.8217*(pow(10,-2))
#define SIi_2 3.917*(pow(10,-3))
#define SIi_3 -3.0669*(pow(10,-2))
#define SIi_4 -3.91123*(pow(10,-3))
#define T_0 298.15
#define D_np 59*(pow(10,-9))
#define CP_np 765
{
real ktc,ktc_w;
real f = ((SIi_1*FI+SIi_2*temp)/T_0)+(SIi_3*FI+SIi_4);
real beta = BETA_1*(pow(100*FI,BETA_2));
real rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));
ktc_w = (-8.354*0.000001*(pow(temp,2)))+((6.53*0.001*temp)-0.5981);
ktc = ((KTC_np+(2*ktc_w)-2*(ktc_w-KTC_np)*FI)/(KTC_np+(2*ktc_w)+(ktc_w-KTC_np)*FI))+(TI*beta*FI*rho_w*CP_w*(pow(((KA*temp )/(RHO_np*D_np)),0.5))*f);
return ktc;
}

{
real rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));
real rho = (FI*RHO_np)+((1-FI)*rho_w);
return rho;
}

{
real mu,mu_w;
mu_w = (2.591*(pow(10,-5))*(pow(10,(238.3/(temp-143.2)))));
mu = (SI_1*exp(SI_2*FI)*mu_w);
return mu;
}

{
real cp,rho_w,rho;
rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));
rho = (FI*RHO_np)+((1-FI)*rho_w);
cp=(FI*RHO_np*CP_np)+(((1-FI)*rho_w*CP_w)/rho);
return cp;
}

and the error appeared when running the calculations:

Warning: D:\\mansys\\c\\c bank\\nanofluid\\nano---combined.c: line 26: Warning: D:\\mansys\\c\\c bank\\nanofluid\\nano---combined.c: line 38: Warning: D:\\mansys\\c\\c bank\\nanofluid\\nano---combined.c: line 46: Warning: D:\\mansys\\c\\c bank\\nanoflui
\\nano---combined.c: line 55:
Error: received a fatal signal (Segmentation fault).

Error: received a fatal signal (Segmentation fault).
Error Object: #f

Last edited by mdakbari; April 16, 2014 at 09:21.

April 17, 2014, 08:01
found the bug
#5
New Member

m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 4
Quote:

hello my friend mr. galileo, i really appreciate ur help. ur so so kind.
i used the code that u have written but the errors appeared again. however finally found why it is happening, its the specific heat part . now i know the problem, its because of the way and the macro we must define specific heat with. so i modified the code. now no error would occur by compiling the code in fluent or by running the calcs.
but i'm not sure that my specific heat part is correct. whatever the modified code is below, i am really keen to have new comments.

/************************************************** *******************
Fluent UDF
Author: Milan
all calculations for al2o3 nanoparticles
************************************************** ********************/
#include "udf.h"
#define FI 0.01
#define RHO_np 3600
#define SI_1 0.9830
#define SI_2 12.959
#define KTC_np 36
#define TI 5.E4
#define BETA_1 8.4407
#define BETA_2 -1.07304
#define CP_w 4200
#define KA 1.383E-23
#define SIi_1 2.8217E-2
#define SIi_2 3.917E-3
#define SIi_3 -3.0669E-2
#define SIi_4 -3.91123E-3
#define T_0 298.15
#define D_np 59.E-9
#define CP_np 765
{
real ktc,ktc_w,temp,f,beta,rho_w;
f = ((SIi_1*FI+SIi_2*temp)/T_0)+(SIi_3*FI+SIi_4);
beta = BETA_1*(pow(100*FI,BETA_2));
rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));
ktc_w = (-8.354*0.000001*(pow(temp,2)))+((6.53*0.001*temp)-0.5981);
ktc = ((KTC_np+(2*ktc_w)-2*(ktc_w-KTC_np)*FI)/(KTC_np+(2*ktc_w)+(ktc_w-KTC_np)*FI))+(TI*beta*FI*rho_w*CP_w*(pow(((KA*temp )/(RHO_np*D_np)),0.5))*f);
return ktc;
}

{
real temp,rho_w,rho;
rho_w = (-3.570*(pow(10,-3))*(pow(temp,2))+(1.88*temp+753.2));
rho = (FI*RHO_np)+((1-FI)*rho_w);
return rho;
}

{
real mu,mu_w,temp;
mu_w = (2.591*(pow(10,-5))*(pow(10,(238.3/(temp-143.2)))));
mu = (SI_1*exp(SI_2*FI)*mu_w);
return mu;
}

DEFINE_SPECIFIC_HEAT(specificheat, T, Tref, h, yi)
{
real cp,rho_w,rho;
rho_w = (-3.570*(pow(10,-3))*(pow(T,2))+(1.88*T+753.2));
rho = (FI*RHO_np)+((1-FI)*rho_w);
cp = (FI*RHO_np*CP_np)+(((1-FI)*rho_w*CP_w)/rho);
return cp;
}

 April 17, 2014, 11:29 #6 Member   Engr Adeniyi Join Date: Jan 2011 Posts: 32 Rep Power: 8 Are you compiling or interpreting the code? Good to hear the code now runs with no error. What else do you want to know? If the Cp is correct I suppose? That is not a UDF question in my own view. You will need to know how you formulated the equations, perhaps from a journal paper or a text book reference or a data fit. All you need to do is do the same equation in Excel and see if it is giving what you want it to give. If you are compiling the code, you can put CX_Message("Cp= %E \n", cp); before the return cp; line so that it will display the values used in the simulation. mdakbari likes this.

April 18, 2014, 02:22
#7
New Member

m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 4
Quote:
 Originally Posted by Galileo Are you compiling or interpreting the code? Good to hear the code now runs with no error. What else do you want to know? If the Cp is correct I suppose? That is not a UDF question in my own view. You will need to know how you formulated the equations, perhaps from a journal paper or a text book reference or a data fit. All you need to do is do the same equation in Excel and see if it is giving what you want it to give. If you are compiling the code, you can put CX_Message("Cp= %E \n", cp); before the return cp; line so that it will display the values used in the simulation.

ok, thanks for ur help along making my code, i will update this page if the code was mistake and caused errors,
again thanks

 April 4, 2016, 04:30 #8 New Member   Andrew Vella Join Date: Feb 2015 Posts: 12 Rep Power: 3 Dear All, I have just compiled the above UDF for the specific heat of Al2O3 nanofluids in FLUENT. The UDF was compiled and the CASE file was initialised with no errors. However, as soon as I initiated the calculations, I was prompted with a solver error due to a diverging temperature. This was not the case with a constant Cp and with the UDFs for density, conductivity and viscosity. Hence, my suspicion is that the cause of this error is Tref. Hence do we need to specify a reference temperature? Thanks in advance!

 Tags error, udf

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post spwater OpenFOAM Native Meshers: blockMesh 86 October 20, 2016 14:01 gschaider OpenFOAM 300 October 29, 2014 19:00 NickG OpenFOAM Installation 2 August 30, 2013 07:42 piotka STAR-CD 4 June 12, 2009 08:43 jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51

All times are GMT -4. The time now is 11:02.