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

Problem writing data file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2012, 14:35
Default Problem writing data file
  #1
Member
 
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 14
fevi84 is on a distinguished road
Hello all,

I'm trying write the values of a variable through of an UDF. I'm run the case on a Cluster with linux platform. My UDF is:

real Utb;
real Xs;

FILE *fp;

DEFINE_EXECUTE_AT_END(velocity_integral)
{
Domain *domain;

Thread *thread;

real sum_vel=0.;
real vol_gas=0.;
real vol_tot=0.;
real vel_u, axis;
real Xinit = 0.05;
real X[ND_ND];
real flow_time = CURRENT_TIME;

cell_t cell;
fp = fopen("vol_gas.txt","w");
domain = Get_Domain(1);


if (N_TIME<=1.)
Xs = Xinit;
else
Xs = Xinit + Utb*flow_time;


thread_loop_c(thread,domain)
{
begin_c_loop(cell,thread)
{
vel_u = C_U(cell,thread);
vol_tot += C_VOLUME(cell,thread);
C_CENTROID(X,cell,thread);

if(X[0]>=Xs && vel_u>=0.)
{
axis=X[0];
sum_vel += C_UDSI(cell,thread,0)*C_U(cell,thread)*C_UDSI(cell ,thread,3);
vol_gas += C_UDSI(cell,thread,0)*C_UDSI(cell,thread,3);
}

fprintf(fp,"vg: %g X: %g um: %g\n", vol_gas, axis, sum_vel);
}
end_c_loop(cell,thread_l)
fclose(fp);
}

Utb = sum_vel/vol_gas;
printf("Volume total: %g\n", vol_tot);
printf("Volume gas: %g\n", vol_gas);
printf("volume integral: %g\n", sum_vel);
printf("Velocity of the Taylor bubble: %g\n", Utb);
printf("Distance step: %g\n", Xs);
}

When I load the UDF compiled, the message is:

The UDF library is not compiled for parallel use on the current platform (lnam64).

I think that the error is in the printf, fprintf, fopen and fclose commands, due to when I compile and then load the UDF without this commands, it works well.
Moreover, when I run the case with this UDF on the Windows 64 bit platform, also works well.

Anyone know what could be the problem?, when I run the case on Linux platform (cluster).

Thanks!!!
fevi84 is offline   Reply With Quote

Old   August 29, 2012, 03:55
Default
  #2
New Member
 
Anton Khokhlov
Join Date: Aug 2012
Location: Moscow
Posts: 4
Rep Power: 13
antonk67 is on a distinguished road
As it is clearly specified in UDF manual you should write to file only from host. You will face the same problem running this code on Windows cluster (or even simply in parallel).
antonk67 is offline   Reply With Quote

Old   August 29, 2012, 13:47
Default
  #3
Member
 
Fer Villa
Join Date: Apr 2012
Posts: 35
Rep Power: 14
fevi84 is on a distinguished road
Thank you very much for your reply.

Quote:
Originally Posted by antonk67 View Post
As it is clearly specified in UDF manual you should write to file only from host. You will face the same problem running this code on Windows cluster (or even simply in parallel).
fevi84 is offline   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
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18
Problem installing on Ubuntu 9.10 -> 'Cannot open : No such file or directory' mfiandor OpenFOAM Installation 2 January 25, 2010 09:50
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 BlGene OpenFOAM Meshing & Mesh Conversion 10 August 6, 2009 04:26
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


All times are GMT -4. The time now is 09:19.