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/)
-   -   Itīs possible to use this in unsteady dpm tracking? (https://www.cfd-online.com/Forums/fluent-udf/88778-s-possible-use-unsteady-dpm-tracking.html)

JSoares May 25, 2011 15:26

Itīs possible to use this in unsteady dpm tracking?
 
Hello everyone.

Itīs possible to use this in unsteady dpm tracking?
I have a problem with this UDF using unsteady particle tracking, because the scalar is updated to a new value and will not retain the last. I want to measure the total U.V. dose in each particle on the output boundary, but I only get the last value of UV dose, and not the total.
Iīm a beginner user to UDF but there is any way to change this, to retain the values of UV dose each dpm time step?

/************************************************** *********************/
/* UDF for computing the UV dosage along a particle trajectory */
/************************************************** *********************/

#include "udf.h"
#include "dpm.h"
#include "sg_disco.h"

#define fileuv "output.dpm"
#define C_DO(c,t)C_STORAGE_R_XV(c,t,SV_DO_IRRAD,0)

static real uv_intensity_0;
static real x0, y00, z0;

FILE *fuv;

DEFINE_DPM_SCALAR_UPDATE(uv_dosage, cell, thread, initialize, p)
{
cphase_state_t *c = &(p->cphase);
if (initialize)
{
p->user[0] = 0.;
uv_intensity_0 = C_DO(cell,thread);
x0=p->state.pos[0];
y00=p->state.pos[1];
z0=p->state.pos[2];
}

else
{
p->user[0] += P_DT(p) * .5 * (uv_intensity_0 + C_DO(cell,thread));
uv_intensity_0 = C_DO(cell,thread);
}
}

DEFINE_DPM_OUTPUT(uv_output, header, fp, p, thread, plane)
{

char name[100];


if (header)
{
fuv = fopen(fileuv,"w");
if (NNULLP(thread))
{
fprintf(fuv,"(%s %d)\n",thread->head->dpm_summary.sort_file_name,14);
}
else
fprintf(fuv,"(%s %d)\n",plane->sort_file_name,14);
fprintf(fuv,"(%10s %10s %10s %10s %10s %10s %10s"
" %10s %10s %10s %10s %10s %10s %10s %s)\n",
"X0","Y0","Z0",
"X","Y","Z","U","V","W","diameter","T","mass-flow",
"time","UV-Dosage","name");
fclose(fuv);
}
else
{
fuv = fopen(fileuv,"a");
sprintf(name,"%s:%d",p->injection->name,p->part_id);
fprintf(fuv,
"((%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g "
"%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g) %s)\n",
x0,y00,z0,
p->state.pos[0], p->state.pos[1], p->state.pos[2],
p->state.V[0], p->state.V[1], p->state.V[2],
p->state.diam, p->state.temp, p->flow_rate, p->state.time,
p->user[0], name);
fclose(fuv);
}
}

JSoares May 26, 2011 10:08

Hello fluent users,

Sorry to ask again, but i think that i wasnīt very explicit. In first figure you see the particles recording the total uv radiation . In second figure youīll see particles recording only instant uv radiation.
I want to change the UDF so i can have results as first figure. Anyone nows how to do that?

Thanks

http://imageshack.us/photo/my-images/851/pata.jpg/

http://imageshack.us/photo/my-images/543/16044862.jpg/

lauripar June 9, 2011 08:53

Hi, I'm modelling UV and particles my self too. Have you visited this site?
http://www.sandia.gov/cfd-water/uvdisinfection.htm

It might help you a bit. At least there is an UDF file that can calculate the total UV dose what a particle gets.

JSoares June 9, 2011 10:41

Quote:

Originally Posted by lauripar (Post 311262)
Hi, I'm modelling UV and particles my self too. Have you visited this site?
http://www.sandia.gov/cfd-water/uvdisinfection.htm

It might help you a bit. At least there is an UDF file that can calculate the total UV dose what a particle gets.

Thanks for your answer lauripar. Iīm using that udf in my simulations and the results are positive for steady state. If you try to use it in a transient dpm formulation, it only retains the last state information. I think that the diferences wouldnīt be big, but i would like to try it.

Thanks anyway.


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