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

UDF for writing txt. file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2007, 11:45
Default UDF for writing txt. file
  #1
manu
Guest
 
Posts: n/a
in a UDF, what is the command to write the value of a variable in a txt. file ???
  Reply With Quote

Old   December 12, 2007, 14:25
Default Re: UDF for writing txt. file
  #2
Greg
Guest
 
Posts: n/a
Hi,

this UDF writes the Temperature of each cell of a fluid domain (with ID 12) to a text file.

Greg

--------------------------------------------------

#include "udf.h"

FILE *fout;

DEFINE_ON_DEMAND(test)

{

Thread *t;

Domain *domain;

cell_t c;

domain = Get_Domain(1);

t=Lookup_Thread(domain,12);

fout = fopen("test.txt", "w");

begin_c_loop(c,t)

{

fprintf(fout, "Temperature at %d: %g \n",c,C_T(c,t));

}

end_c_loop(c,t)

fclose(fout);

}
  Reply With Quote

Old   December 13, 2007, 06:19
Default Re: UDF for writing txt. file
  #3
manu
Guest
 
Posts: n/a
Thanks a lot
  Reply With Quote

Reply


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
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 BlGene OpenFOAM Meshing & Mesh Conversion 10 August 6, 2009 04:26
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


All times are GMT -4. The time now is 16:30.