|
[Sponsors] |
November 22, 2005, 02:25 |
record a variable in UDF
|
#1 |
Guest
Posts: n/a
|
hello
i have an unsteady problem with an UDF. how can i record a variable by time in a file, to get a list? at the moment i use fprintf but i get only the value of the last time step. thanks reto |
|
November 22, 2005, 16:30 |
Re: record a variable in UDF
|
#2 |
Guest
Posts: n/a
|
My suggestion:
1. Define a DEFINE_ON_DEMAND subroutine. In this subroutine you open an output file. Something like this,"ofp=fopen("out2.txt","w");" 2. Define a DEFINE_EXECUTE_AT_END subroutine. This subroutine will be executed at the end of each time step. In this subroutine your output the value of desired variables. e.g. "fprintf (ofp,"%e\n",variablename);" 3. Define another DEFINE_ON_DEMAND subroutine. In this subroutine you close the output file. "fclose(ofp);" 4. Please include, #include "stdio.h" #include "udf.h" and define, FILE *ofp; at the beginning of your source code file. 5. Before you start the iteration, run the first subroutine through "Define -> User-Defined -> Execute On Demand...". Then iterate. Once the iteration finished, run the third subroutine through "Define -> User-Defined -> Execute On Demand...". 6. Hope it works. Good luck! Zhang |
|
November 23, 2005, 05:01 |
Re: record a variable in UDF
|
#3 |
Guest
Posts: n/a
|
many thanks for your suggestion, it works!
reto |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent UDF urgent! Variable reaction rate | natantyt | Fluent UDF and Scheme Programming | 8 | October 17, 2021 04:35 |
Do I need to use UDF to get time-averaged variable? | ivanbuz | Fluent UDF and Scheme Programming | 0 | August 11, 2009 15:26 |
Variable for AVERAGE VELOCITY, Pressure etc. in UDF? | aam | Fluent UDF and Scheme Programming | 0 | May 15, 2009 06:21 |
DEFINE_DPM_OUTPUT macro UDF HELP | Puneet | FLUENT | 3 | November 28, 2003 11:55 |
Yplus UDF variable | Matthew Brannock | FLUENT | 0 | June 23, 2003 04:41 |