CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   udf (https://www.cfd-online.com/Forums/fluent/31499-udf.html)

DAE May 19, 2003 06:47

udf
 
Hi

Below is a udf that I intend to evaporate particles if they enter the primary phase in the VOF multiphase model.

The purpose of this is because in practice, the particles will not enter the primary phase, thus evaporating them is a way of terminating their trajectories.

I am getting errors when compiling though telling me that the mixture may not be initialized.

Does anyone know how I can correct this?

Thanks

/************************************************** **********************/ /* A DPM udf to terminate particles that enter the air phase */ /************************************************** **********************/

#include "udf.h" /* Always include udf.h when writing a UDF. It translates the DEFINE */ /* and other macros into C, which is what the compiler understands */

#include "dpm.h" /* dpm.h contains macros for use with the discrete phase model. dpm.h */ /* is included in the udf.h header file */

#include "sg_mphase.h" /* sg_mphase.h contains macros for use with multiphase model. sg_mphase.h */ /* is included in the udf.h header file */

#include "surf.h" /* surf.h is not included in the udf.h file. */ /* surf.h must be included for use with the macros: */ /* RP_Cell() & RP_Thread() */

#define P_CELL(p)RP_CELL(&(p->cCell)) #define P_CELL_THREAD(p)RP_THREAD(&(p->cCell)) /* Non-standard macros - Used for: fuck knows! */

DEFINE_DPM_SCALAR_UPDATE(terminateair, c, t, initialize, p) /* This macro is used to update a scalar quantity ever time a particle */ /* position is updated */ /* c.f. DEFINE_DPM_SCALAR_UPDATE(name, c, t, initialize, p) */ /* name: the name of the udf */ /* c: an index that identifies the cell that the particle is currently in */ /* t: pointer to the thread the particle is currently in */ /* initialize: an integer that has a value of 1 when the function is */ /* called at the start of the particle integration and 0 thereafter */ /* p: pointer to a Tracked_Particle structure that contains data relating */ /* to the particle being tracked */

{

Thread *mixture_thread; Thread **pt; /* pointer to a phase thread, initialize pt */ pt = THREAD_SUB_THREADS(mixture_thread);

if (initialize)

{

P_DIAM(p) = P_INIT_DIAM(p); /* P_MASS(p) is the mass of the particle */

P_MASS(p) = P_INIT_MASS(p); /* P_DIAM(p) is the diameter of the particle */

} /* P_INIT_DIAM(p) is the mass of the particle */

/* at injection into domain */

/* P_INIT_MASS(p) is the mass of the particle */

/* at injection into the domain */

else

{

if( C_VOF(c,pt[0]) > 0.99 ) /* If volume fraction of primary phase > 0.99 */

{

(P_MASS(p) = (0.0));

(P_DIAM(p) = (0.0));

}

else

{

P_DIAM(p) = P_INIT_DIAM(p);

P_MASS(p) = P_INIT_MASS(p);

}

} }

Raja Banerjee May 20, 2003 12:29

Re: udf
 
Hi, I seem to have found one error is that code. You seem to have one extra } at the end of your udf. It might be the problem.


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