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

error C2109: subscript requires array or pointer type --on drying simulation--

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 9, 2016, 03:05
Default error C2109: subscript requires array or pointer type --on drying simulation--
  #1
New Member
 
meljuntak
Join Date: Nov 2016
Posts: 7
Rep Power: 9
Melvin is on a distinguished road





Hi everyone...
I am a Ph.D. Student with research about simulation of coal drying. In my simulation I use UDF based on DPM multicomponent model as shown in UDF Guide for DPM_Heat_and_Mass_Transfer, I use Ansys Fluent 12 version with the transient model, injection of particle occur on 60 t0 61 second, as much as 600 gr. After I compile my UDF there are occur error as shown below

multivap.c(56) : error C2109: subscript requires array or pointer type
multivap.c(57) : error C2109: subscript requires array or pointer type

This error due to part of udf line 56 and 57
56 P_total += cvap_surf[ns];
57 dens_total += cvap_surf[ns] * molwt[gas_index];

Did someone ever do this case and how to solve the problem??
Whether this simulation needs to be initialized vaporization and injection must be written in UDF also???

Thankyou very much
Melvin

My complete UDF was written as below

#include "udf.h"
DEFINE_DPM_HEAT_MASS(multivap,p,Cp,hgas,hvap,cvap_ bulk,cvap_surf,dydt,dzdt)
{
int ns ; /*declaring variable ns as an integer*/
int nc = TP_N_COMPONENTS( p ); /* number of particle component */
real dens_total = 0.0; /*total vapor density*/
real P_total = 0.0; /*vapor pressure*/
cell_t c0 = RP_CELL( &(p->cCell) ); /* cell and thread */
Thread *t0 = RP_THREAD( &(p->cCell) ); /* where the particle is in */
Material *gas_mix = THREAD_MATERIAL( t0 ); /* gas mixture material */
Material *cond_mix = p->injection->material; /* particle mixture material */
cphase_state_t *c =&(p->cphase); /*cell info of particle location */
real molwt[MAX_SPE_EQNS]; /* molecular weightf gas species */
real Tp = P_T(p); /* particle temperature */
real mp = P_MASS(p); /* particle mass */
real molwt_bulk = 0.; /* average molecular weight in the 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;
{
Material *sp;
mixture_species_loop(gas_mix,sp,ns)
{
molwt[ns] = MATERIAL_PROP(sp,PROP_mwi); /* molecular weight of gas species */
molwt_bulk += C_YI(c0,t0,ns) / molwt[ns]; /* average molecular weight */
}
}
/* prevent division by zero */
molwt_bulk = MAX(molwt_bulk,DPM_SMALL);

for( ns = 0; ns < nc; ns++ );
{
/* gas species index of vaporization */
int gas_index = TP_COMPONENT_INDEX_I(p,ns);
if ( gas_index >= 0 )
{
Material * cond_c = MIXTURE_COMPONENT(cond_mix, ns ); /*condensed material*/
real vap_temp = MATERIAL_PROP(cond_c,PROP_vap_temp); /* vaporization temperature */
real D = MATERIAL_PROP_POLYNOMIAL(cond_c,PROP_binary_diffus ivity,c->temp); /* diffusion coefficient */
real Sc = c->mu / ( c->rho * D ); /* Schmidt number */
real k = ( 2.0 + 0.6 * sqrt(p->Re) * pow( Sc, 1./3. ) ) * D /Dp; /* mass transfer coefficient */
real cvap_bulk = c->pressure / UNIVERSAL_GAS_CONSTANT / c->temp
* c->yi[gas_index] / molwt_bulk / solver_par.molWeight[gas_index]; /* bulk gas concentration */
real vap_rate = k * molwt[gas_index] * Ap * ( cvap_surf - cvap_bulk ); /* vaporization rate */
if( 0. < vap_rate && Tp < vap_temp )
vap_rate = 0.;
dydt[1+ns] -= vap_rate;
dzdt->species[gas_index] +=vap_rate;
dydt[0] -= hvap[gas_index] * vap_rate / ( mp * Cp ); /* dT/dt = dh/dt / (m Cp) */
dzdt->energy += hgas[gas_index] * vap_rate; /* gas enthalpy source term */
P_total += cvap_surf[0, ns]; /*vapor pressure = vapor equilibrium concentration of vaporizing components*/
dens_total += cvap_surf[0, ns] * molwt[gas_index]; /*Total vapor density = mol/m3 *kg/mol*/
}
}
}

Melvin is offline   Reply With Quote

Old   November 10, 2016, 22:08
Default
  #2
New Member
 
meljuntak
Join Date: Nov 2016
Posts: 7
Rep Power: 9
Melvin is on a distinguished road
After I make some adjust, the UDF can run. but the problem still occurs that no interaction between evaporated moisture (from particle) and drying air. The Humidity of dry air always same even though particle moisture content decrease. Did someone in this forum know how to solve this problem?. What UDF must be added to solve this problem??? Is it possible by added udf about mass and energy exchange will solve the interaction between continuous phase and discrete phase?? Thanks.........
i run the model again (after compiled the UDF), the simulation get error again...how come it occur?????

Last edited by Melvin; November 14, 2016 at 20:58.
Melvin is offline   Reply With Quote

Reply


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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 05:38
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 00:21
Boundary Conditions MtnRunBeachBum OpenFOAM Pre-Processing 1 April 30, 2015 16:33
singularity? mihaipruna OpenFOAM Running, Solving & CFD 5 April 24, 2012 17:18
Pressure instability with rhoSimpleFoam daniel_mills OpenFOAM Running, Solving & CFD 44 February 17, 2011 17:08


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