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

UDF for writing txt. file

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 12, 2007, 12: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, 15: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, 07:19
Default Re: UDF for writing txt. file
  #3
manu
Guest
 
Posts: n/a
Thanks a lot
  Reply With Quote

Reply

Thread Tools
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 On
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 18:18
Compiling gmshFoam with OpenFOAM-1.5 BlGene Open Source Meshers: Gmsh, Netgen, CGNS, ... 10 August 6, 2009 04:26
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


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