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/)
-   -   combustion model modification (https://www.cfd-online.com/Forums/fluent-udf/128749-combustion-model-modification.html)

M_Tidswell January 20, 2014 12:42

combustion model modification
 
Dear all

I hope someone can point out what I have done here, I have adapted a UDF provided by ansys to implement a combustion model modification. After attempting to de-bugging it I am left with the error below:

Error: C:\\Users\\Mark\\Documents\\Project post 19-1\\udf stuff\\trialmk2.c: line 32: function "Compute_Trb_Vscal" not found (pc=6).
Error: C:\\Users\\Mark\\Documents\\Project post 19-1\\udf stuff\\trialmk2.c: line 32: function "Calculate_unburnt_rho_and_Xl" not found (pc=97).

Now those two commands are commands from the ansys udf which I have not played with at all so I am lost. The entire code is given below:

/************************************************** *****************
UDF that specifies a custom turbulent flame speed and source
for the premixed combustion model
************************************************** ******************/
#include "udf.h"
#include "sg_pdf.h" /* not included in udf.h so must include here */

DEFINE_TURB_PREMIX_SOURCE(turb_flame_src,c,t,turb_ flame_speed,source)
{
real up = TRB_VEL_SCAL(c,t);
real ut,ul,sct,ka,re_t,dab,L,lf,grad_c,rho_u,Xl,DV[ND_ND];

ul = C_LAM_FLAME_SPEED(c,t);
Calculate_unburnt_rho_and_Xl(t,&rho_u,&Xl);

if(NNULLP(THREAD_STORAGE(t,SV_PREMIXC_G)));
{
NV_V(DV, =, C_STORAGE_R_NV(c,t,SV_PREMIXC_G));
grad_c = sqrt(NV_DOT(DV,DV));
}

sct = 0.498*(C_MU_T(c,t)/C_R(c,t));
dab = C_MU_T(c,t)/sct;
re_t = C_MU_L(c,t)/C_MU_T(c,t);
ka = ((C_MU_T(c,t)/C_R(c,t))*C_D(c,t))/ul;
L = ...;
lf = ...;
ut = .....;
*turb_flame_speed = ut;
*source = rho_u*ut*grad_c;
}

Me and coding are not best friends so I was hoping someone could help me!

Many thanks

Mark

M_Tidswell February 2, 2014 07:27

Solution
 
Dear All

After banging my head against this for a while I have come up with a solution which appears to side step the issues with compiling UDF's in Fluent within win64 so I thought I would share.

There are a number of threads on here which provide excellent instructions on how to launch Fluent from the x64 visual studios command line whilst this solved a number of the issues Fluent was not entirely happy. You can get around this by copying the contents of the Ansys SRC file into the visual studios include file then following the instructions in the aforementioned threads. I am guessing that windows put some kind of block on one of the proceeding processes as by placing all the header files in here the UDF will compile correctly.

If you get communication error when running the calculation unsurprisingly the name of this error bares no resemblance to the actual issue, I discovered the formatting I had used was incorrect so by correcting this everything worked well.

The working udf has been given below for anyone's interest:

#include "udf.h"
#include "sg_pdf.h" /* not included in udf.h so must include here */
#include "mpi.h"

DEFINE_TURB_PREMIX_SOURCE(MD_adapt,c,t,turb_flame_ speed,source)
{
real up = TRB_VEL_SCAL(c,t);
real lx = TRB_LEN_SCAL(c,t);
real ut,sl0,p,le,Ret, grad_c,rho_u,Xl,DV[ND_ND];

sl0 = C_LAM_FLAME_SPEED(c,t);
p = 1.0;
le=0.2121;
Calculate_unburnt_rho_and_Xl(t,&rho_u,&Xl);

if(NNULLP(THREAD_STORAGE(t,SV_PREMIXC_G)))
{
NV_V(DV, =, C_STORAGE_R_NV(c,t,SV_PREMIXC_G));
grad_c = sqrt(NV_DOT(DV,DV));
}

Ret=.....;

ut = ...........
*turb_flame_speed = ut;
*source = rho_u*ut*grad_c;
}

Please excuse the ut = ... but the formula after that is not mine to distribute, it is just an equation which could be replaced by any equation of your choice.

Hope this is vaguely helpful

cilliant July 3, 2023 03:42

Hi,

What exactly do you mean when you say you pasted the src file into the header files??

I'm getting the same issue of constantly seeing "Compute_Trb_Tscal" not found or "Calculate_unburnt_rho_and_Xl" not found even after I paste the definition of the turbulent flame source at the bottom of the header files.


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