|
[Sponsors] |
April 19, 2006, 12:41 |
journal file with variable in a while loop?
|
#1 |
Guest
Posts: n/a
|
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 |
|
April 19, 2006, 12:53 |
Re: journal file with variable in a while loop?
|
#2 |
Guest
Posts: n/a
|
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. |
|
April 19, 2006, 12:56 |
Re: journal file with variable in a while loop?
|
#3 |
Guest
Posts: n/a
|
That would be nice!
send to RSchmidt @ IWT-bremen.de (without the space before/behind the @) |
|
April 19, 2006, 18:51 |
Re: journal file with variable in a while loop?
|
#4 |
Guest
Posts: n/a
|
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 |
|
April 20, 2006, 02:23 |
Re: journal file with variable in a while loop?
|
#5 |
Guest
Posts: n/a
|
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
|
|
April 25, 2006, 13:46 |
Re: journal file with variable in a while loop?
|
#6 |
Guest
Posts: n/a
|
mAx,
I would be interested in seeing your file. Please send to david.osborn@pw.utc.com. Thanks. Dave |
|
May 4, 2006, 09:10 |
Re: journal file with variable in a while loop?
|
#7 |
Guest
Posts: n/a
|
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 |
|
August 13, 2009, 02:40 |
Hi, mAx, nice meeting you
|
#8 | |
New Member
Oliver
Join Date: Aug 2009
Posts: 1
Rep Power: 0 |
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 |
||
September 8, 2009, 12:57 |
Hi mAx!
|
#9 | |
New Member
Chris Turner
Join Date: Jun 2009
Location: Belfast
Posts: 12
Rep Power: 17 |
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 |
||
September 8, 2009, 17:52 |
|
#10 | |
Member
Ivan
Join Date: May 2009
Posts: 85
Rep Power: 17 |
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! |
||
September 9, 2009, 02:41 |
|
#11 |
Super Moderator
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 3,297
Rep Power: 41 |
I send you both the file
__________________
In memory of my friend Hervé: CFD engineer & freerider |
|
October 23, 2009, 07:26 |
|
#12 |
New Member
Fabio
Join Date: May 2009
Posts: 11
Rep Power: 17 |
||
October 23, 2009, 23:46 |
|
#13 |
New Member
|
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.
|
|
October 25, 2009, 18:43 |
|
#14 |
New Member
Join Date: Apr 2009
Posts: 19
Rep Power: 0 |
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 setenv('VELOCITY_VALUE',v1); !sed -e 's:V_1_VAL:'$VELOCITY_VALUE':g' my_little_fluent_journal.jou>temp.jou !fluent 2d -r6.3.26 -g <temp.jou end 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:applerange: 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:applerange: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. |
|
October 26, 2009, 02:50 |
|
#15 | |
Super Moderator
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 3,297
Rep Power: 41 |
Quote:
__________________
In memory of my friend Hervé: CFD engineer & freerider |
||
October 26, 2009, 06:56 |
|
#16 |
New Member
Fabio
Join Date: May 2009
Posts: 11
Rep Power: 17 |
Thanks -MAX-
|
|
November 11, 2009, 04:16 |
|
#17 |
New Member
azahari
Join Date: Apr 2009
Posts: 2
Rep Power: 0 |
Max
can I have your file please. TQ albab |
|
November 11, 2009, 04:17 |
|
#18 |
New Member
azahari
Join Date: Apr 2009
Posts: 2
Rep Power: 0 |
||
November 11, 2009, 07:00 |
|
#19 |
Super Moderator
Maxime Perelli
Join Date: Mar 2009
Location: Switzerland
Posts: 3,297
Rep Power: 41 |
I send it to you right now
__________________
In memory of my friend Hervé: CFD engineer & freerider |
|
November 11, 2009, 10:00 |
simple scheme loop for FLUENT
|
#20 |
New Member
Volker Pawlik
Join Date: Mar 2009
Location: Germany
Posts: 25
Rep Power: 17 |
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!!). |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
do loop in Fluent journal file. | caterchen | FLUENT | 12 | November 14, 2016 23:57 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 21:02 |
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 | flakid | OpenFOAM Installation | 16 | December 28, 2010 09:48 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
[OpenFOAM] ParaView 33 canbt open OpenFoam file | hariya03 | ParaView | 7 | September 25, 2008 18:33 |