CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Parse Error Message While interpreting UDF in FLUENT (https://www.cfd-online.com/Forums/fluent-udf/64785-parse-error-message-while-interpreting-udf-fluent.html)

dhimans May 24, 2009 13:57

Parse Error Message While interpreting UDF in FLUENT
 
Hi friends,

(Also posted in FLUENT thread )
*****************************************
I am repeatedly getting a PARSE ERROR message when I try to interpret my source file(named HTCOi.c) containing UDFs
*************************************************
This is what I intend to do with the UDF :-

1. Obtain Heat transfer Coef using a function DEFINE_ON_DEMAND(HTcoef1) modify(using a Correction factor) and store it in UDMI after solving for convection (GAS.msh) over a plate

2. Read another case (SOLID.msh which is a plate) and impose the HT coef stored in UDMI through function DEFINE_PROFILE(HTcoef2,t,pos)
************************************************** *******
However, when I interpret HTCOi.c i get the following error

cpp -I"C:\Fluent.Inc\fluent6.3.26/src" -I"C:\Fluent.Inc\fluent6.3.26/cortex/src" -I"C:\Fluent.Inc\fluent6.3.26/client/src" -I"C:\Fluent.Inc\fluent6.3.26/multiport/src" -I. -DUDFCONFIG_H="<udfconfig.h>" "C:\Users\Sushant Dhiman\Desktop\AUTOMATION_CODES\U
Fs\HTCOi.c"
Error: C:\Users\Sushant Dhiman\Desktop\AUTOMATION_CODES\UDFs\HTCOi.c: line 28: parse error.
Error: C:\Users\Sushant Dhiman\Desktop\AUTOMATION_CODES\UDFs\HTCOi.c: line 29: parse error.
Error: C:\Users\Sushant Dhiman\Desktop\AUTOMATION_CODES\UDFs\HTCOi.c: line 33: f: undeclared variable
************************************************** **********

The HTCOi.c UDF that I use is as Follows

#include "udf.h"
#include "math.h"

/* ##Definition of global variables and constants ########## */

#define tinf 400
#define CF 1 /* Correction factor */
#define ID 0 /* Domain ID to be used in ON DEMAND UDF(default interior ID=0) */
#define ZID 3 /* ID of the Zone of which HT coeff has to be used (plate_top ID=3)*/

int i;

/* ###### OBTAINS THE HT_Coeff from plate_top in GAS.msh#####*/


DEFINE_ON_DEMAND(HTcoef1)

{
Thread *t;
Domain *d;

d=Get_Domain(ID);
t=Lookup_Thread(d,ZID);

real temp,q;
face_t f;


begin_f_loop(f,t)

{

temp=F_T(f,t); /* Obtains the Temp at the surface */
q=BOUNDARY_HEAT_FLUX(f, t); /* gets the TOTAL Heat flux vector at the surface */
F_UDMI(f,t,0)=CF*fabs(q/(temp-tinf)); /* Calculates the HT coefficient and stores in user defined memory */


}
end_f_loop(f,t)


}



/* ### IMPOSES THE HT_Coeff PROFILE ON the face in SOLID.msh ## */

DEFINE_PROFILE(HTcoef2,t,pos)

{

Thread *t;
face_t f;


begin_f_loop(f,t)

{
F_PROFILE(f,t,pos) = F_UDMI(f,t,0);
}
end_f_loop(f,t)

}
*****************************************

I would really appreciate some help on this

Regards

Dhiman

rsdchat July 10, 2009 06:29

Dear Dhiman,
Try this, best wishes,
Dipankar

#include "udf.h"
#include "math.h"
/* ##Definition of global variables and constants ########## */
#define tinf 400
#define CF 1 /* Correction factor */
#define ID 0 /* Domain ID to be used in ON DEMAND UDF(default interior ID=0) */
#define ZID 3 /* ID of the Zone of which HT coeff has to be used (plate_top ID=3)*/
int i;
/* ###### OBTAINS THE HT_Coeff from plate_top in GAS.msh#####*/

DEFINE_ON_DEMAND(HTcoef1)
{
Thread *t;
Domain *d;
face_t f;
real temp;
real q;
d=Get_Domain(ID);
t=Lookup_Thread(d,ZID);


begin_f_loop(f,t)
{
temp=F_T(f,t); /* Obtains the Temp at the surface */
q=BOUNDARY_HEAT_FLUX(f, t); /* gets the TOTAL Heat flux vector at the surface */
F_UDMI(f,t,0)=CF*fabs(q/(temp-tinf)); /* Calculates the HT coefficient and stores in user defined memory */

}
end_f_loop(f,t)

}

/* ### IMPOSES THE HT_Coeff PROFILE ON the face in SOLID.msh ## */
DEFINE_PROFILE(HTcoef2,t,pos)
{
Thread *t;
face_t f;

begin_f_loop(f,t)
{
F_PROFILE(f,t,pos) = F_UDMI(f,t,0);
}
end_f_loop(f,t)
}


All times are GMT -4. The time now is 18:15.