|
[Sponsors] |
how to write case and data with DEFINE_EXECUTE_AT_END |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 18, 2012, 23:02 |
how to write case and data with DEFINE_EXECUTE_AT_END
|
#1 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
For example:
DEFINE_EXECUTE_AT_END(timetosave) { real t = CURRENT_TIME; if (t==10) ????save the case and data file for future postprocessing???? } What is the command for "????save the case and data file for future postprocessing????" Thanks, Regards, François |
|
October 18, 2012, 23:47 |
|
#2 |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
same as the C language. Use fopen, fprintf, fclose
|
|
October 18, 2012, 23:53 |
|
#3 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Hi Ji,
I'm familiar with fopen, fprintf and fclose in Matlab, and I understand your answer, but this is not what I'm looking for. I have dozens of variables to save in multiple 3D domains, there must be an elegant way to simply write ALL the data just as we do in the GUI via File\Write\Data... So, again, what would be the UDF command for "File\Write\Data..." and modify filename each time? François |
|
October 21, 2012, 23:06 |
|
#4 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Sorry for my error. If you want to save case and data at each iteration, you can "File->Write->Autosave" menu to save case and data and set the auto save frequency as "1".
Quote:
|
||
October 21, 2012, 23:34 |
|
#5 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Ji,
I know about the autosave option. I have good reasons for wanting to save at specific 'flow times' only : my timestep changes with time and I only want to save at every 24h of 'flow time'. An example: Let's say my timestep is 10 s during the first 5 h of flow time, and then my timestep is 5 min for the next 3 days of flow time, what will autosave at every 10 simulations do? It will save at every 100 s of flow time for the first 5 hours, and then it will save at every 50 min for the rest of simulation... Not what I want. I want to tell Fluent : at every 24 hours of flow time (for example), save all data, REGARDLESS OF TIME STEP. I can't believe it's not possible to do that elegantly (without the use of endless fprintf commands throughout all my domains...), there must be a way! |
|
October 22, 2012, 06:18 |
|
#6 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Ok, I got your point. Then you can use the following code in UDF.
char* file_name="example-100s.cas"; char scheme_command[1000]; if(CURRENT_TIME==100) { sprintf(scheme_command,"(write-case-data \"%s\")", file_name); CX_Interpret_String(scheme_command); } But as I know, it only works in serial version. If you want to realize the function in parallel version, I think you should program with scheme language. Here is an example of writing case and data at 100s. (if (= 100 (rpgetvar 'flow-time)) (write-case-data "example-100s.cas") (display "not 100s, do nothing\n")) Copy the above source into the command input box from "solve->Execute Commands..." menu temp.png Then, Fluent will auto save your case and data at 100s and do nothing at other time. Quote:
|
||
October 22, 2012, 08:49 |
|
#7 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Now you are talking! The 2nd option that you propose is fine with me since I want to save at a couple of flow times only => I will define a couple of 'Execute commands'.
Thanks a lot Ji. |
|
October 23, 2018, 11:18 |
save case and data by udf
|
#8 |
Member
Join Date: Nov 2017
Posts: 54
Rep Power: 9 |
hello dear
I want to save my case and data in some time step not every time step the method that u told by scheme programming save case and data every time step? how can save my case and data by udf when I want? |
|
October 23, 2018, 11:19 |
|
#9 | |
Member
Join Date: Nov 2017
Posts: 54
Rep Power: 9 |
Quote:
hello dear I want to save my case and data in some time step not every time step the method that u told by scheme programming save case and data every time step? how can save my case and data by udf when I want? |
||
November 15, 2018, 01:46 |
a problem
|
#10 | |
Member
Join Date: Nov 2017
Posts: 54
Rep Power: 9 |
Quote:
your method for serial version is not work for me and I receive an error: Error: eval: unbound variable Error Object: write-case-data can you help me? what can i do? |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to read or write case by commands during simulation with Fluent | lzgwhy | FLUENT | 4 | April 20, 2011 23:02 |
Unable to write case and data...! | sushii | FLUENT | 4 | December 7, 2007 02:12 |
fluent case n data files not exporting to tecplot | krishna | FLUENT | 2 | February 18, 2007 00:24 |
how to save case data and data during iteration? | JOHN | FLUENT | 3 | October 10, 2006 20:40 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 18:27 |