|
[Sponsors] |
March 31, 2015, 06:06 |
how to read a journal or scheme from UDF?
|
#1 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
I want to know how to read an scheme (or journal) file from a UDF. So I have this code:
#include "udf.h" #include <stdio.h> FILE *fout; DEFINE_ON_DEMAND(start_iteration) { Domain *d =Get_Domain(1); char buffer[100]; fout = fopen("iteration.scm", "r"); fscanf(fout, "%[^\t\n]", buffer); fclose(fout); } and my scheme file "iteration.scm" is simply: it 100 So the aim in this case is to run 100 iteration from the execute on demand. On the other hand, when I add to the code a line Message0("\n%s", buffer); The TUI displays the message "it 100", but nothing happens. Before any answers, I know that this UDF does not make much sense, I only want to know if it is possible to run a scheme or journal file from UDF. Thanks for your help. |
|
March 31, 2015, 07:13 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
I don't believe there is a way of calling scheme code (including TUI commands) from inside a UDF. Please let us know if you find a way!
What are you trying to achieve overall? Why not simply run a scheme file instead of the execute on demand UDF? The Message and Message0 utilities print text to the user's screen and cannot execute commands to Fluent. |
|
March 31, 2015, 12:05 |
|
#3 |
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14 |
Any time you could call an on-demand UDF, you should be able call a journal or scheme macro.
If you want some other UDF macro (adjust, execute at end, etc.) to call scheme/TUI "on-demand", the best I've come up with is to create a calculation activity that runs a macro every iteration conditional on some scheme boolean, and use the UDF to set that boolean to true whenever you want to run that command, then back to false next iteration. |
|
March 31, 2015, 19:08 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
True, if you need to run scheme code between iterations or time steps you could setup a calculation activity to load the scheme file each time. I've used this technique and run the scheme file every time (and written an empty file from the UDF if there's nothing required for the current iteration/time step).
|
|
October 24, 2016, 10:00 |
|
#5 | |
New Member
anonymous
Join Date: Dec 2015
Posts: 14
Rep Power: 10 |
Quote:
may I ask you how you did this? I do have a journal file that does a mesh adaption whenever I stop/interrupt simulation and click via GUI file-read-journal and selct the right *.jou-file. Now I want to use an EXECUTE_AT_END UDF to run this mentioned journal file (automatically) when for example during my 100000 iterations 1000 iterations are done. Many thanks for your help/reply |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
compile UDF in journal file | ivanbuz | FLUENT | 6 | February 10, 2020 12:21 |
999999 (../../src/mpsystem.c@1123):mpt_read: failed:errno = 11 | UDS_rambler | FLUENT | 2 | November 22, 2011 10:46 |
using UDF to read file | Ellen | FLUENT | 5 | November 25, 2008 18:38 |
how to read matlab script/results to UDF | lamlash | FLUENT | 0 | July 17, 2006 09:58 |
Integrating Scheme with a FLUENT journal file | Pete Willemsen | FLUENT | 0 | May 19, 2006 18:00 |