CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2005, 02:51
Default How to get each cell value into a text file
  #1
Wiroon
Guest
 
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, 10:14
Default Re: How to get each cell value into a text file
  #2
peter
Guest
 
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:

DEFINE_EXECUTE_AT_END(All_Out)

{ 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 */

{

c0=C_YI(c,c_thread,index0);

c1=C_YI(c,c_thread,index1);

cv=C_VOLUME(c,c_thread);

C_CENTROID(x,c,c_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, 10:35
Default Re: How to get each cell value into a text file
  #3
Wiroon
Guest
 
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

Reply

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 07:29
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 18:50.