CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   PB: Saving mass fraction of species on two points with an udf (https://www.cfd-online.com/Forums/fluent/66701-pb-saving-mass-fraction-species-two-points-udf.html)

biget.a July 22, 2009 03:26

PB: Saving mass fraction of species on two points with an udf
 
Hello, I'm new on this forum. I use fluent and i have some problems.
I'm working with an unbaffled stirred tank. I would evaluate the mixing time. I'm working in monophasique, and i use species. In my domain, i make a patch with species (O2 in the domain of H20). I create few points in my domain for evaluate the mass fraction of my species. I work with unsteady formulation.
For saving the results, i write an udf. My problem is that i would integrate two results' points in my results' file. I have procede as follow. I don't understand why the two results have the same value at each time step.

#include <udf.h>
DEFINE_EXECUTE_AT_END(Capture_donnees)
{
int zone_ID1=12; /*ID of my first point*/
int zone_ID2=15; /* ID of my second point*/
real C1; real C2;
Domain *d= Get_Domain(1);
Thread *t=Lookup_Thread(d,zone_ID1);
Thread *t2=Lookup_Thread(d,zone_ID2);

cell_t c; cell_t c2;
FILE *fp=fopen("Donnees_species.txt","a");

thread_loop_c(t,d) {C1=C_YI(c,t,1);}
/* C_YI(c,t,i) represents species mass fraction. The species index i is the order of species listed in the selected species list (in material panel)
In our case: 0 => N2, 1 => O2 and 2 => H2O */

thread_loop_c(t2,d) {C2=C_YI(c2,t2,1);}

fprintf(fp,"%f %f\n",C1,C2);
fclose(fp);
}

Can anyone help me and tell me how to procede for saving in the same udf (execute at end) the same quantity for more than one ID zone.

vatovato July 23, 2009 01:55

hi
 
i didnt exactly undrestand whats your problem.but if you want to save mass fraction in 2 points during the time its better to do the following procedure
solve monitors surface
in this way yon can monitor and save mass fraction in many points during the time as you want and writting udf to save data is not nessecary

biget.a July 23, 2009 03:06

Thank you for your reply. Effectively it is very more easy with the Surface Monitor function.
Have a nice day.


All times are GMT -4. The time now is 23:59.