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

how to retrieve output to a text file!!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2013, 11:14
Default how to retrieve output to a text file!!
  #1
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
Hi,
I am a beginner in udf and would love to have your help in the following problem. Thank you very much in advance

I have a udf for accessing the cell information such as its x,y,z coordinate, mixture fraction of species.
Everything is fine, except i dont know how to get this data written into a text file.
I thought it would get displayed in one of the "results" so that i can just "write" it into a file..But now it gets displayed only in the boundary conditions.

Please can someone tell me how do i extract this information on to a text file. the program is as below.

#include "udf.h"
DEFINE_ADJUST(fonction_retour,domain)
{
cell_t c;
Thread *tc;
real xc[ND_ND],x,y,z,tempe,mass_w_i;
int i;
thread_loop_c(tc, domain)
{
begin_c_loop(c, tc)
{
C_CENTROID(xc,c,tc);
x=xc[0];
y=xc[1];
z=xc[2];
tempe= C_T(c,tc);
mass_w_i = C_YI(c,tc,i);
}
end_c_loop(c, tc)
}
}
Ananthakrishnan is offline   Reply With Quote

Old   May 3, 2013, 11:28
Default
  #2
Super Moderator
 
diamondx's Avatar
 
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,385
Blog Entries: 23
Rep Power: 29
diamondx will become famous soon enough
can't you just use surface monitors, point, and write to a file ???
__________________
Regards,
New to ICEM CFD, try this document --> https://goo.gl/KAOIwm
Ali
diamondx is offline   Reply With Quote

Old   May 3, 2013, 11:31
Default
  #3
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
Thanks for your reply,
To be honest, i just figured out the option FILE *fp function.. is this what you are talking about.. Can you please send some link where it is discribed more.

Thanks,
Ananthakrishnan is offline   Reply With Quote

Old   May 3, 2013, 11:42
Default
  #4
Super Moderator
 
diamondx's Avatar
 
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,385
Blog Entries: 23
Rep Power: 29
diamondx will become famous soon enough
no, my method does not use UDF... just go to monitors in the left part of you screen, selec create surface monitor, give it your point, and write to a file at each iteration
__________________
Regards,
New to ICEM CFD, try this document --> https://goo.gl/KAOIwm
Ali
diamondx is offline   Reply With Quote

Old   May 3, 2013, 12:02
Default
  #5
Senior Member
 
Ananthakrishnan.A.S
Join Date: Feb 2012
Location: Mumbai (Bombay), India
Posts: 157
Rep Power: 16
Ananthakrishnan is on a distinguished road
Send a message via Skype™ to Ananthakrishnan
Hi,
Thanks diamondX,
I dont know how to get the cell coordinates from surface monitor. So i think i dont have any other option other than writing a udf.

THIS IS the updated udf with file write option. I still dont know how to execute this file? It will be really helpful if someone can help me out of this!! Thanks in advance

#include "udf.h"
DEFINE_ADJUST(fonction_retour,domain)
{
FILE *fp;
cell_t c;
Thread *tc;
real xc[ND_ND],x,y,z,tempe,mass_w_i;
int i;
fp=fopen("cell_info.txt","w");
thread_loop_c(tc, domain)
{
begin_c_loop(c, tc)
{
C_CENTROID(xc,c,tc);
x=xc[0];
y=xc[1];
z=xc[2];
tempe= C_T(c,tc);
mass_w_i = C_YI(c,tc,i);
fprintf(fp,"%r %r %r %d\n",x,y,z,i);
}
end_c_loop(c, tc)
}
fclose(fp);
}
Ananthakrishnan 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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise mbeaudoin OpenFOAM Installation 20 June 17, 2008 07:43
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00


All times are GMT -4. The time now is 17:25.