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/)
-   -   Custom DPM laws using UDF (https://www.cfd-online.com/Forums/fluent-udf/199384-custom-dpm-laws-using-udf.html)

Sowmi March 5, 2018 08:11

Custom DPM laws using UDF
 
Hi all
I am injecting particles in plasma spray jet and need to find the solid heating of the particle with respect to time.
The formula used is
When the particle is less than melting point then DTp= DT *(6*dh/(PI*dp^3*cpp*rhop)

I wrote this in custom DPM law using UDF given below.
Can anyone help me to correct this UDF. And am very new to fluent and UDF it would be a grateful anybody help me at the earliest... Already am running out of time.

#include "udf.h"
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "surf.h"
#include "random.h"
#include "prop.h"
#include <math.h>
#include "mem.h"
#include "metric.h"
#include "dpm.h"
#include "dpm_types.h"
#include "dpm_laws.h"

#define CVIS 0.0037866 /*viscosity at 1310K */
#define PI 3.14


DEFINE_DPM_LAW(user_law,p,ci)
{
Material*m = P_MATERIAL(p);
Thread*t0=P_CELL_THREAD(p);
cell_t c = P_CELL(p);

real Tg,thermcnd,Tp,mp,Dp,Ap,Pr,cpp,cpg,visg,Nu,h,times tep,dh,dT,Re,aux5,rel_vel,TM=1358.0;
float x=0,dx;

Tg = C_T(c,t0); /*gas temperature */
visg = C_MU_T(c,t0); /*turbulent viscosity of gas*/
thermcnd = C_K_L(c,t0); /*thermal conductivity of gas*/
cpg = C_CP(c,t0); /*specific heat of gas*/
Tp = P_T(p); /* particle temperature */
mp = P_MASS(p); /* particle mass */
Dp = DPM_DIAM_FROM_VOL(mp / P_RHO(p)); /* particle diameter */
Ap = DPM_AREA(Dp); /* particle surface */
Pr = (cpg * visg)/thermcnd; /* Prandtl number */


cpp = DPM_SPECIFIC_HEAT(p,P_T(p)); /* particle specific heat*/


rel_vel= sqrt(pow((P_VEL(p)[0]-C_U(c,t0)),2.0)+pow((P_VEL(p)[1]-C_V(c,t0)),2.0));
aux5=((rel_vel* Dp * P_RHO(p))/CVIS); /* reynolds number */

Nu = (2.0 + 0.66 * sqrt(aux5) * pow(Pr, 1.0/3.0))); /* Nusselt number */
h = (Nu * thermcnd) / Dp; /* Heat transfer coefficient*/
timestep = P_DT(p);

dh = h * (Tg - Tp) * Ap; /* heat source term*/


dT =timestep*(6*dh/(PI*pow(Dp,3.0)*cpp*P_RHO(p)));
P_T(p)= P_T(p)+dT;
}

Sowmi March 7, 2018 11:31

Kindly someone reply me....

Tousif March 19, 2019 01:54

What is the error you are getting? Can you explain?


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