journal file with variable in a while loop?
Hi!
Is it possible, do write a journal file, that has a variable (lets say the filename) that can be altered in a while (or if, or for)loop?? I have a lot of case files, and I want to read, write and display data from every case file. Now, i wrote a journal, that is doing all the neccessary operations with one case file. But I want the journal to do it for all of them! Is there a convenient way? (instead of writing a journal, in that all the case files are written in - thats a lot of work, and one have to take care, that every file name is written correctly) Any Idea?? Ralf |
Re: journal file with variable in a while loop?
Hi Ralf,
I had a similar problem and I wrote some Matlab code to create a journal file with all relevant case/data filenames and commands to execute. I can send you the Matlab code by email if you would like. I dont know if a while or for loop can be used explicitly in the journal file. |
Re: journal file with variable in a while loop?
That would be nice!
send to RSchmidt @ IWT-bremen.de (without the space before/behind the @) |
Re: journal file with variable in a while loop?
Hello,
I too had a similar problem, but I got around it using the Scheme interface (basically looping over the various files and executing the same set of steps). It is probably not the easiest thing due to the lack of documentation, but it has worked for me. Jason |
Re: journal file with variable in a while loop?
hi guys, I have such a file. It is pretty good for large unsteady calculations. If you want this file, please write me a mail, I will mail it you back. Regards mAx
|
Re: journal file with variable in a while loop?
mAx,
I would be interested in seeing your file. Please send to david.osborn@pw.utc.com. Thanks. Dave |
Re: journal file with variable in a while loop?
hi mAx,
i am trying to perform a similar operation, so i am interested in your file. would be glad if you can mail it to kerem.guenbulut@tu-harburg.de thanks. kerem |
Hi, mAx, nice meeting you
Quote:
Would you please share me the file? My mail is "marinbrooke@gmail.com". I need it and your help. Thanks a lot. Best Wishes, Kiger |
Hi mAx!
Quote:
Hi mAx, I know this is a fairly old post and you might not check it anymore, but I too would be very interested in this file! I am currently trying to work out how to do it and have got to the stage where I have a journal file that does what I want for one data set, but not all the other ones! My email is cturner03@qub.ac.uk, if you could contact me I would be much obliged! Chris |
Quote:
mAx, can I also have a copy of the file? hope you still have it, this is a very old thread. Please send to ivanbuz@yahoo.com Thanks! |
I send you both the file
;) |
|
Hi max, I am really interested in this journal file and anxious to learn bout it. Could you please send a copy to my email: aldo_malvin@yahoo.com, thanks a million.
|
The quick way to achieve this is to use one of the gnu/unix string editing tools such as awk, grep, or sed to replace the variable in the journal file with the actual value. This can be done in a shell script or a MATLAB m-file.
Here's an example: I have a Fluent journal file with many lines of code, but all I'd like to do is to vary the speed at an inlet called ENTRANCE_1 and simulate for each speed. First, I set up my journal file to have the inlet speed as a variable name, I call it V_1_VAL. In my journal the particular line of code looks like this: Code:
define b velocity-inlet ENTRANCE_1 yes yes no V_1_VAL no 1 no 0 no 300 no yes 1 1 Code:
for v1=1:10 Notes: -The "!" character at the beginning of a MATLAB command escapes you temporarily to your DOS or UNIX shell. It lets you can do all your command-line/terminal stuff from within MATLAB. For example if you're running Linux/UNIX and you wanted to view your current directory from within MATLAB, you can just type !ls and it'll list the directory's files and folders just as it would if you were in a terminal. -sed is the stream editor, a versatile unix tool for editing text by command-line. The most common use is to substitute one piece of text with another. You do this with the s-command, which follows the form s:apple:orange: my_file >new_file which replaces the first instance of the world apple with the word orange in my_file and dumps it into new_file. To replace all instances of apple with orange, add a 'g' so it says s:apple:orange:g. See a SED tutorial for more info if you'd like to do even more text editing. -notice the use of quotation marks that wrap the shell/environmental variable within the sed substitution. All shell variables begin with a dollar sign. Well I hope this helps get you started in doing loops with journal files. As far as I know, there is no simpler way of automating Fluent from within itself, i.e. doing loops within Fluent's journal scripts. You have to do all your loops outside of Fluent, and you need to bridge the world of MATLAB/C++/Shell to the world of Fluent through environmental variables and text editing. |
Quote:
|
Thanks -MAX-
|
Max
can I have your file please. TQ albab |
|
I send it to you right now
|
simple scheme loop for FLUENT
Hi,
the task is to do some postprocessing with a number of files whose names might not contain sequences of numbers, hence a "for to"- loop with an intenger as a counter is not possible. One easy way ist to use a scheme "for each" loop. Scheme is a programming language. Fluent 's GUI is written in scheme. Here comes a simple example for reading a list of case+dat files, displaying a contour-plot of temperature on the zones wall, inlet, and outlet, finally generating a hard-copy with the case-filename included in the imagefile-name. Example: -------------------------------------------------------------- ; Start of the loop (this is a comment!) (for-each (lambda (filename) (ti-menu-load-string (format #f "file read-case-data ~a.cas yes" filename)) (ti-menu-load-string (format #f " /display/set/contours/surfaces (wall inlet outlet) /display/contour temperature 25 2000 /display/hc ~a-temp.ps " filename )) ) ; list of the filenames here: without extension but one is not obliged to do so '( filename_A filename02 file_XYA hidden_tank lost_water ) ; closing the loop: ) -------------------------------------------------------------- The "~a" is a variable which is replaced by the content of the loop variable "filename". "filename" takes the values from the list at the bottom of the example above: filename_A, filename02, file_XYA as input. You are free to use any fiilname you like without the need to number them in a correct way. The scheme file can be red into fluent via /file/read/scheme (GUI) or /file/read-macro (TUI). In contrast to a script-loop the scheme-loop is carried out here inside one Fluent session. For more details for the use of scheme together with fluent have a look to http://fluid.jku.at/personen/javurek/pdf/scheme.pdf (in German!!). |
All times are GMT -4. The time now is 06:08. |