|
[Sponsors] |
April 15, 2014, 09:27 |
An odd ERROR
|
#1 |
New Member
m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 12 |
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, 10:09 |
|
#2 |
Member
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 16 |
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)); |
|
April 16, 2014, 03:22 |
my error
|
#3 | |
New Member
m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 12 |
Quote:
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 DEFINE_PROPERTY(cell_conductivity,cell,thread) { real temp = C_T(cell,thread); 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; } DEFINE_PROPERTY(cell_density,cell,thread) { real temp = C_T(cell,thread); 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; } DEFINE_PROPERTY(cell_viscosity,cell,thread) { real temp = C_T(cell,thread); 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; } DEFINE_PROPERTY(cell_specificheat,cell,thread) { real temp = C_T(cell,thread); 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 10:21. |
||
April 16, 2014, 12:14 |
|
#4 |
Member
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 16 |
NB: I did not run the code, but I think it should work now. You need to check through the edits shown in red to make sure the variables are spelt correctly. Please let me know if the errors persist.
Try and compile instead of interpreting before replying just in case it gives an error. /************************************************** ******************* 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 DEFINE_PROPERTY(cell_conductivity,cell,thread) {/*Declare variables first before using them */ real temp, ktc,ktc_w, f,beta,rho_w; real dummy ; /*************************/ temp = C_T(cell,thread); 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); /*Avoid too long equations, split the equation into small parts but make sure it does not cause a bug*/ ktc =(TI*beta*FI*rho_w*CP_w*(pow(((KA*temp )/(RHO_np*D_np)),0.5))*f); dummy =(KTC_np+(2*ktc_w)+(ktc_w-KTC_np)*FI); ktc = ((KTC_np+(2*ktc_w)-2*(ktc_w-KTC_np)*FI)/dummy)+ ktc; return ktc; } DEFINE_PROPERTY(cell_density,cell,thread) {/*Declare variables first before using them */ real temp, rho, rho_w; /************************/ temp = C_T(cell,thread); 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; } DEFINE_PROPERTY(cell_viscosity,cell,thread) { real temp,mu,mu_w; /******************/ 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; } DEFINE_PROPERTY(cell_specificheat,cell,thread) {real temp, cp,rho_w,rho; /******************/ temp = C_T(cell,thread); 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; } |
|
April 17, 2014, 09:01 |
found the bug
|
#5 | |
New Member
m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 12 |
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 DEFINE_PROPERTY(cell_conductivity,cell,thread) { real ktc,ktc_w,temp,f,beta,rho_w; temp = C_T(cell,thread); 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; } DEFINE_PROPERTY(cell_density,cell,thread) { real temp,rho_w,rho; temp = C_T(cell,thread); 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; } DEFINE_PROPERTY(cell_viscosity,cell,thread) { real mu,mu_w,temp; 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; } 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, 12:29 |
|
#6 |
Member
Engr Adeniyi
Join Date: Jan 2011
Posts: 32
Rep Power: 16 |
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.
|
|
April 18, 2014, 03:22 |
|
#7 | |
New Member
m.akbari
Join Date: Apr 2014
Posts: 14
Rep Power: 12 |
Quote:
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, 05:30 |
|
#8 |
New Member
Andrew Vella
Join Date: Feb 2015
Posts: 12
Rep Power: 11 |
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries | NickG | OpenFOAM Installation | 3 | December 30, 2019 01:21 |
[blockMesh] blockMesh with double grading. | spwater | OpenFOAM Meshing & Mesh Conversion | 92 | January 12, 2019 10:00 |
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh | gschaider | OpenFOAM Community Contributions | 300 | October 29, 2014 19:00 |
POSDAT problem | piotka | STAR-CD | 4 | June 12, 2009 09:43 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |