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

DPM Output Problem (Again...)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2011, 09:59
Exclamation DPM Output Problem (Again...)
  #1
New Member
 
lodie
Join Date: Aug 2011
Posts: 2
Rep Power: 0
DLINSA is on a distinguished road
Hello everybody,

I'm on a UV water treatment reactor case, using a DPM feature to measure the UV Dose received by particles.

My problem is quiet simple and common according to other related topics(SANDIA lab uv dose files) but I still can't find the problem in my UDF :

I use a SCALAR_UPDATE macro to increase the uv dose at each time step(using a DPM scalar) which is working well at the only exception that (and I do not know why) the "initialize" variable (int) given by Fluent is always on the 1 value and this implies the program to enter always in the initialization condition and then my scalar are always reset to zero.

I solved this problem by bypassing the initialization part (I know it's bad but I didn't find any solution... Anyway scalar initialization at zero seems to be automatic when adding it in the DPM menu). If you have explanation about this they are welcome but it is not the real problem.

Here it is : the DPM_OUTPUT macro. I run this simulation on a parallel mode and when I put the "%s" for name(char variable) at the end of the par_printf() the solver crashes when a particle is sampled. When I do not put the "%s" the solver doesn't crash but I have totaly non sense values written like these :

(X):5.17004e+08 (Y) :-2.85269e+28 (Z) : 2 (my scalar 1):-4.89611e-145 (my scalar2):-1.48809e+89 etc...

Wether I'm in serial or in parallel mode, the fprintf in the dpm scal update macro works fine but that was just for testing. In the file it writes well all variables but for each interpolated positions and this is not easily exploitable. I don't know if there is a way to write in the file only if a particle is removed of the domain, with a particular condition. If it is possible that will help me because the fprintf works.

Here is the UDF:
DEFINE_ON_DEMAND(open_file)
{
fs=fopen(
"his.txt","a");
fprintf(fs,
"(%10s %10s %10s %10s %10s %10s %s ) \n","DT","X","Y","Z","Age","Dose","ID");
}
DEFINE_DPM_SCALAR_UPDATE(part_dose,cell,thread,ini tialize,p)
{
int id;
if (initialize)
{
/*P_USER_REAL(p,0) = 0.;
P_USER_REAL(p,1) = 0.;
uv_intensity_0 = C_UDMI(cell,thread,0);
Message("%d",initialize);*/
}
else
{
id=p->part_id;
P_USER_REAL(p,0) += P_DT(p) * .5 * (uv_intensity_0 + C_UDMI(cell,thread,0));
P_USER_REAL(p,1) += P_DT(p);
uv_intensity_0 = C_UDMI(cell,thread,0);


if(fs!=NULL)
{
fprintf(fs,"((%d %e %f %e %e %f %f\n",id, C_UDMI(cell,thread,0), P_DT(p), P_USER_REAL(p,0), P_USER_REAL(p,1), P_TIME(p) - p->time_of_birth, P_POS(p)[2]);
}
}
}

DEFINE_DPM_OUTPUT(output_part_dose,header,fp,p,thr ead,plane)
{
char name[100];
if (header)
{
if (NNULLP(thread))

par_fprintf_head(fp,
"(%s %d)\n",THREAD_HEAD(thread)->dpm_summary.sort_file_name,11);


else

par_fprintf_head(fp,
"(%s %d)\n",plane->sort_file_name,11);

par_fprintf_head(fp,
"(%10s %10s %10s %10s %10s %10s %10s %s)\n","X","Y","Z","Dose","Age","Time","ID","Blabla");


}

else
{

int id_out;
id_out=p->part_id;
sprintf(name,
"%s:%d",P_INJECTION(p)->name,id_out);
Message(
"\n\n\n%d %s\n\n\n",id_out,name); /*well displayed in the solver window)*/


#if PARALLEL

par_fprintf(fp,
"%d %d %10.6g %10.6g %10.6g %10.6g %10.6g %10.6g %d %s\n", P_INJ_ID(P_INJECTION(p)), p->part_id, P_POS(p)[0], P_POS(p)[1], P_POS(p)[2], P_USER_REAL(p,0), P_USER_REAL(p,1), P_TIME(p) - p->time_of_birth, id_out, name);


#else

par_fprintf(fp,
"((%e %e %e %e) %s)\n", P_USER_REAL(p,0), P_USER_REAL(p,1), P_TIME(p) - p->time_of_birth, name);

#endif
}
}
Configuration : Ansys Workbench 13, Win XP/ I7 860 (8 threads) 3GB

Thanks a lot in advance!

PS : The intensity field is stored in an UDM (it doesn't change with the simulation)
DLINSA is offline   Reply With Quote

Old   March 16, 2012, 00:45
Default
  #2
Member
 
Join Date: Mar 2011
Posts: 50
Rep Power: 15
cdf_user is on a distinguished road
So whats your question in one line?
cdf_user is offline   Reply With Quote

Reply

Tags
dpm, output


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
DPM converging Problem Markus Alzon FLUENT 6 April 7, 2016 11:41
Problem with DPM interaction in a coal burner Nando FLUENT 1 April 17, 2007 04:46
CFX-5.7 MPICH Parallel Problem (Output of Results) James Date CFX 7 February 15, 2005 16:03
ICEM5 Hexa output problem Pete CFX 9 September 16, 2004 18:33
Problem with DPM model cwflying FLUENT 5 January 31, 2003 11:25


All times are GMT -4. The time now is 12:26.