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

error c2440 during compiling of udf in fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 27, 2019, 06:41
Smile error c2440 during compiling of udf in fluent
  #1
New Member
 
Rajasekar
Join Date: Nov 2019
Posts: 4
Rep Power: 6
Rajasekar_K is on a distinguished road
Hi I am trying to compile the DPM_HEAT_MASS for multicomponent UDF(pasted at bottom of this question) given by ANSYS, when I am trying to compile it is showing the following error(given after the udf) at the line highlighted in magenta. kindly help me to solve this issue.

/************************************************** *********************
UDF for defining the heat and mass transport for
multicomponent particle vaporization
************************************************** *********************/
#include "udf.h"

DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_ surf,Z,dydt,dzdt)
{
int ns;
Material *sp;

real dens_total = 0.0; /* total vapor density*/
real P_total = 0.0; /* vapor pressure */
int nc = TP_N_COMPONENTS(p); /* number of particle components */
Thread *t0 = P_CELL_THREAD(p); /* thread where the particle is in*/
Material *gas_mix = THREAD_MATERIAL(DPM_THREAD(t0, p)); /* gas mixture material */
Material *cond_mix = P_MATERIAL(p); /* particle mixture material*/
cphase_state_t *c = &(p->cphase); /* cell information of particle location*/
real molwt[MAX_SPE_EQNS]; /* molecular weight of gas species */
real Tp = P_T(p); /* particle temperature */
real mp = P_MASS(p); /* particle mass */
real molwt_bulk = 0.; /* average molecular weight in bulk gas */
real Dp = DPM_DIAM_FROM_VOL(mp / P_RHO(p)); /* particle diameter */
real Ap = DPM_AREA(Dp); /* particle surface */
real Pr = c->sHeat * c->mu / c->tCond; /* Prandtl number */
real Nu = 2.0 + 0.6 * sqrt(p->Re) * pow(Pr, 1./3.); /* Nusselt number */
real h = Nu * c->tCond / Dp; /* Heat transfer coefficient*/
real dh_dt = h * (c->temp - Tp) * Ap; /* heat source term*/

dydt[0] += dh_dt / (mp * Cp);
dzdt->energy -= dh_dt;

mixture_species_loop(gas_mix,sp,ns)
{
molwt[ns] = MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas
species */
molwt_bulk += c->yi[ns] / molwt[ns]; /* average molecular weight */
}

/* prevent division by zero */
molwt_bulk = MAX(molwt_bulk,DPM_SMALL);

for (ns = 0; ns < nc; ns++)
{
int gas_index = TP_COMPONENT_INDEX_I(p,ns); /* gas species index of
vaporization */
if( gas_index >= 0 )
{
/* condensed material */
Material * cond_c = MIXTURE_COMPONENT(cond_mix, ns);
/* vaporization temperature */
real vap_temp = MATERIAL_PROP(cond_c,PROP_vap_temp);
/* diffusion coefficient */
real D = MATERIAL_PROP_POLYNOMIAL(cond_c, PROP_binary_diffusivity,
c->temp);
/* Schmidt number */
real Sc = c->mu / ( c->rho * D );
/* mass transfer coefficient */
real k = (2. + 0.6 * sqrt(p->Re) * pow(Sc, 1./3.)) * D / Dp;
/* bulk gas concentration (ideal gas) */
real cvap_bulk = c->pressure / UNIVERSAL_GAS_CONSTANT / c->temp
* c->yi[gas_index] / molwt_bulk / solver_par.molWeight[gas_index];
/* vaporization rate */
real vap_rate = k * molwt[gas_index] * Ap
* (cvap_surf[ns] - cvap_bulk);

/* no vaporization below vaporization temperature, no condensation */
if (Tp < vap_temp || vap_rate < 0.0)
vap_rate = 0.;

dydt[1+ns] -= vap_rate;
dzdt->species[gas_index] += vap_rate;
/* dT/dt = dh/dt / (m Cp)*/
dydt[0] -= hvap[gas_index] * vap_rate / ( mp * Cp );
/* gas enthalpy source term */
dzdt->energy += hgas[gas_index] * vap_rate;

P_total += cvap_surf[ns];
dens_total += cvap_surf[ns] * molwt[gas_index];
}
}

/* multicomponent boiling */
P_total *= Z * UNIVERSAL_GAS_CONSTANT * Tp;
if (P_total > c->pressure && dydt[0] > 0.)
{
real h_boil = dydt[0] * mp * Cp;
/* keep particle temperature constant */
dydt[0] = 0.;
for (ns = 0; ns < nc; ns++)
{
int gas_index = TP_COMPONENT_INDEX_I(p,ns);
if (gas_index >= 0)
{
real boil_rate = h_boil / hvap[gas_index] * cvap_surf[ns] *
molwt[gas_index] / dens_total;
/* particle component mass source term */
dydt[1+ns] -= boil_rate;
/* fluid species source */
dzdt->species[gas_index] += boil_rate;
/* fluid energy source */
dzdt->energy += hgas[gas_index] * boil_rate;
}
}
}
}


ERROR:
udf_names.c and user_nt.udf files in 2ddp_node are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v194\fluent"\fluent19.4.0\sr c\udf\makefile_nt.udf "libudf\win64\2ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\2ddp_node")# Generating ud_io1.h
tobechecked.cpp
..\..\src\tobechecked.cpp(18): error C2440: 'initializing': cannot convert from 'cphase_state_t **' to 'cphase_state_t *'
..\..\src\tobechecked.cpp(18): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Done.
Rajasekar_K is offline   Reply With Quote

Old   November 28, 2019, 02:12
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
on my machine i have warning only
Code:
..\..\src\test_delete.c(18) : warning C4047: 'initializing' : 'cphase_state_t *' differs in levels of indirection from 'cphase_state_t **'
with small change
Code:
cphase_state_t *c = (p->cphase); /* cell information of particle location*/
no warning comes out, however, I'm not sure If it is possible to remove & or not
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 28, 2019, 04:02
Default
  #3
New Member
 
Rajasekar
Join Date: Nov 2019
Posts: 4
Rep Power: 6
Rajasekar_K is on a distinguished road
Thanks alexanderZ sir, now it is compiling without any warning in my machine, I have to check with the simulatiom now.. Thanks
Rajasekar_K is offline   Reply With Quote

Reply

Tags
dpm fluent model, evaporation of droplet


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
looking for a smart interface matlab fluent chary FLUENT 24 June 18, 2021 09:07
How to solve UDF compilation problems in Fluent. pakk Fluent UDF and Scheme Programming 16 September 10, 2018 02:48
The fluent stopped and errors with "Emergency: received SIGHUP signal" yuyuxuan FLUENT 0 December 3, 2013 22:56
Error while compiling udf in fluent 13.0.0 siddharth12 FLUENT 0 December 3, 2013 16:46
compiling my UDF Seyed Farid Hosseinizadeh FLUENT 22 February 14, 2006 10:19


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