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

UDF (write a data file) problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2005, 21:36
Default UDF (write a data file) problem
  #1
lichun Dong
Guest
 
Posts: n/a
Hi, all:

I am modeling a liquid drop movement on a surface and need to calculate the mass of the liquid drop. Therefore, I wrote a UDF, (actually a DEFINE_RW_File Macro) and try to save a data file. The code seemed to work, no any problem was showed during compiling or interpreting, however, I can not see any data file was saved, The mmanual says that once I save a data file, the UDF will work and a data file shoula be saved? Am I right?

Therfore, my question is: How to run a DEFINE_RW_FILE udf? would a data file be saved once the udf works properlly?

Thanks very much for your help and suggestion

Lichun Dong

The followed is my code.

#include "udf.h"

DEFINE_RW_FILE(weight_center, filep)

Domain *d

{

face_t f;

cell_t c;

Thread *t;

d = Get_Domain(1); /* Get the domian using Fluent utility */

real volume;

real vol_tot = 0;

real position[ND_ND],x,y,z;

real xadjvol = 0;

real yadjvol = 0;

real zadjvol = 0;

real xcenter;

real ycenter;

real zcenter;

real flowt;

real vowater;

/* Loop over all cell threads in the domian */

thread_loop_c(t,d)

{

/* Loop over all cells */

begin_c_loop(c, t)

{

volume = C_VOLUME(c,t);

vowater = C_VOF(c, t[1]);

vol_tot =+ volume*vowater;

C_CENTROID(position, c, t);

x = position(0);

y = pisition(1);

z = position(2);

xadjvol = xadjvol + x*vowater*volume;

yadjvol = yadjvol + y*vowater*volume;

zadjvol = zadjvol + z*vowater*volume;

}

end_c_loop(c,t);

xcenter = xadjvol/vol_tot;

ycenter = yadjvol/vol_tot;

zcenter = zadjvol/vol_tot;

flowt = RP_GET_Real("flow-time");

fprintf(filep, "%d", flowt, "%d", xcenter, "%d", ycenter, "%d", zcenter);

} }

  Reply With Quote

Old   July 29, 2005, 04:16
Default Re: UDF (write a data file) problem
  #2
CFD-novice
Guest
 
Posts: n/a
As I understand the UDF manual, the DEFINE_RW_FILE macro does not by itself write or read any files. It only determines, what additional information is written/read to/from the case or data files that you write/read yourself manually or in a script.

Maybe as you set up a small test model and write the case/data file in clear text (not binary), you can inspect the files to see if your data is written.

I haven't used this macro myself yet though.
  Reply With Quote

Old   July 29, 2005, 12:39
Default Re: UDF (write a data file) problem
  #3
lichun Dong
Guest
 
Posts: n/a
Hi,

Thank you for your response. Have you used DEFINE_ON_DEMAND and save data using C_UDMI?

I will be very appreciated if anyone can give me some advice.

Lichun dong
  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
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18
Problem installing on Ubuntu 9.10 -> 'Cannot open : No such file or directory' mfiandor OpenFOAM Installation 2 January 25, 2010 10:50
UDF Getting data from file jreig FLUENT 0 July 10, 2009 09:07
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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