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

ANSYS Fluent - udf, write to file

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2017, 03:31
Default ANSYS Fluent - udf, write to file
  #1
New Member
 
Ivan
Join Date: Nov 2012
Location: Czech Republic
Posts: 22
Rep Power: 13
cfdhelp is on a distinguished road
Dear friends,

I would like to ask you how to write some data from the udf during the simulation.
Concretely, I mean the data from the tutorial dynamic mesh with the code from valve.c through some function.
How to use the function in the code.

Regards,
Ivan

Here is a part of the code:

static void write_data(FILE *fp) { int i, j; for(i=0; i<NO_OF_VALVES; i++) { fprintf(fp, "%e ", current_vel_mag[i]); } fprintf(fp, "\n"); for(i=0; i<NO_OF_VALVES; i++) { for(j=0; j<ND_ND; j++) { fprintf(fp, "%e ", cur_r_rp[i][j]); } fprintf(fp, "\n"); } fprintf(fp, "\n"); for(i=0; i<NO_OF_VALVES; i++) { fprintf(fp, "%e ", previous_time[i]); } }

DEFINE_RW_FILE(writer, fp) { Message0("Writing UDF data to data file...\n"); #if PARALLEL #if RP_HOST write_data(fp); #endif #else write_data(fp); #endif }
cfdhelp is offline   Reply With Quote

Old   November 16, 2017, 03:11
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by cfdhelp View Post
Dear friends,

I would like to ask you how to write some data from the udf during the simulation.
Concretely, I mean the data from the tutorial dynamic mesh with the code from valve.c through some function.
How to use the function in the code.

Regards,
Ivan

Here is a part of the code:

static void write_data(FILE *fp) { int i, j; for(i=0; i<NO_OF_VALVES; i++) { fprintf(fp, "%e ", current_vel_mag[i]); } fprintf(fp, "\n"); for(i=0; i<NO_OF_VALVES; i++) { for(j=0; j<ND_ND; j++) { fprintf(fp, "%e ", cur_r_rp[i][j]); } fprintf(fp, "\n"); } fprintf(fp, "\n"); for(i=0; i<NO_OF_VALVES; i++) { fprintf(fp, "%e ", previous_time[i]); } }

DEFINE_RW_FILE(writer, fp) { Message0("Writing UDF data to data file...\n"); #if PARALLEL #if RP_HOST write_data(fp); #endif #else write_data(fp); #endif }
DEFINE_RW_FILE is the macro that writes data into cas/dat file. If you want to write data in your own file, please use fopen/fprintf/fclose function as common C language.
gearboy is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 18:13
[OpenFOAM.org] Patches to compile OpenFOAM 2.2 on Mac OS X gschaider OpenFOAM Installation 136 October 10, 2017 17:25
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44


All times are GMT -4. The time now is 04:28.