CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

How to get each cell value into a text file

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2005, 01:51
Default How to get each cell value into a text file
Posts: n/a
Dear All,

I am considering mixing of two components inside a 2D-closed geometry where I move its sidewall to trigger internal recirculation. I want to calculate deviation change of concentration with time to evaluate mixing intensity. However, I don't know how to get a value of cell concentration cnd cell grid size from each cell into a file for deviation calculation. Is there a function in Fluent that helps calculating deviation? If anyone knows, please help me.
  Reply With Quote

Old   June 28, 2005, 09:14
Default Re: How to get each cell value into a text file
Posts: n/a
To put each cell centroid, species mass fractions and cell volume into a text file, try to compile and then hook as an execute at end UDF something like the following:


{ Domain *dom= Get_Domain(1); /* returns fluid domain pointer */

int index0=0;

int index1=1;

real c0;

real c1;

real cv;

Thread *c_thread ;

real x[ND_ND];

cell_t c;

FILE *fp; /* define a local pointer fp of type FILE */

fp = fopen("data.txt","a"); /* open a file named data.txt in

append mode and assign it to fp */

thread_loop_c(c_thread, dom) /*loops over all cell threads in domain*/


begin_c_loop(c, c_thread) /* loops over cells in a cell thread */






fprintf(fp, "%g %g %g %g %g\n", x[0], x[1], c0, c1, cv);


end_c_loop(c, c_thread)


fclose(fp); /* close the file pointed to by fp */

  Reply With Quote

Old   June 28, 2005, 09:35
Default Re: How to get each cell value into a text file
Posts: n/a
Dear Peter, Thank you very much for your kind help. I will try to understand the program first and then use it in my simulation.
  Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
wmake compiling new solver mksca OpenFOAM Programming & Development 14 June 22, 2018 06:29
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 18:00
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
Warning 097- AB Siemens 6 November 15, 2004 04:41

All times are GMT -4. The time now is 05:17.