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

UDF saving data to a text file

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 1, 2013, 06:29
Default UDF saving data to a text file
  #1
New Member
 
Join Date: May 2012
Posts: 8
Rep Power: 5
fleure_Jasmin is on a distinguished road
Hello everyone,
I'm working on a case of particle injected into a flow and subjected to ultrasound radiation force. I then modeled this force as body force and I introduced it in fluent using Udf where the variable returned is named radforce. The problem is that I can’t see this force in fluent console even if I add this line: Message (‘’ force: %g\n ‘’,radforce) ;
I also tried to write force calculated data in a text file, but nothing works the text file which is in the same folder as the case and the data is empty.
BODY_FORCE(…)
{ FILE *fp;
real radforce;
…/*calcule of radiation force*/
…
if(NULL == (pf = fopen("data.txt","w")))
Error("Could not open file for append!\n");

fprintf(pf,"%e\n",radforce);
fclose(pf);


If someone has an idea and can help I will be really grateful.
Thank you very much J
fleure_Jasmin is offline   Reply With Quote

Old   May 1, 2013, 07:53
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 12
blackmask will become famous soon enough
Why fp appeared in the declaration section
FILE *fp;
but pf is used in the following
pf = ...
fprintf(pf...) ?

No error during compilation?
blackmask is offline   Reply With Quote

Old   May 1, 2013, 09:06
Default
  #3
New Member
 
Join Date: May 2012
Posts: 8
Rep Power: 5
fleure_Jasmin is on a distinguished road
Oh thank you Blackmask but it was just a typo when writing this message but the file is fp
fleure_Jasmin is offline   Reply With Quote

Old   May 1, 2013, 09:10
Default
  #4
New Member
 
Join Date: May 2012
Posts: 8
Rep Power: 5
fleure_Jasmin is on a distinguished road
actually the problem is in the compilation
fleure_Jasmin is offline   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
wmake compiling new solver mksca OpenFOAM Programming & Development 13 August 18, 2014 22:26
Problem installing on Ubuntu 9.10 -> 'Cannot open : No such file or directory' mfiandor OpenFOAM Installation 2 January 25, 2010 10:50
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 12:46
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
UDF (write a data file) problem lichun Dong FLUENT 2 July 29, 2005 11:39


All times are GMT -4. The time now is 05:24.