|
[Sponsors] |
August 17, 2004, 14:10 |
do loop in Fluent journal file.
|
#1 |
Guest
Posts: n/a
|
Hi,
Is there anybody know how to use a do loop in fluent journal file? I need it to convert lots of result files for fieldview. Thanks. caterchen |
|
August 18, 2004, 02:54 |
Re: do loop in Fluent journal file.
|
#2 |
Guest
Posts: n/a
|
Hi!
You're in trouble. I think there is no way to do loop in journal file...I can tell you that posprocessing of the reslts can be preety frustrating because of that( MATEUS |
|
August 18, 2004, 03:18 |
Re: do loop in Fluent journal file.
|
#3 |
Guest
Posts: n/a
|
Hello,
Fluent's command language is scheme, quite strange in its syntax but loops are possible. A do-loop will look like: (let loop ((i 5)) // start value for i = 5 // (begin ( .... your code) (loop (+ i 5)) // increment of i = 5 // ) Maybe you should also refer to some scheme-examples at fluentusers.com best regards Markus |
|
April 9, 2014, 00:49 |
|
#4 | |
New Member
Chandrasekhar
Join Date: Oct 2013
Location: new jersey
Posts: 24
Rep Power: 13 |
Hi
i know its a very old post but if u can help i would be thankful. i would like to know if i can open a case-data file using scheme file(i know how to do it in a journal file, i want to do it in scheme because i want to make use of the do loop). Many thanks for replying. with regards Quote:
|
||
April 9, 2014, 10:42 |
|
#5 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Hi chandrasekhar,
I don't know how to insert strings in a scheme loop, but I'll suggest another approach: generate a journal file with another software. For example, I'm on Windows and I use AutoHotkey, a wonderful intuitive open-source utility with which you can script and automate a whole bunch of things (http://www.autohotkey.com/). Moreover, the Help of AutoHotkey is very detailed with a lot of examples (like the Matlab's Help). Here's an AutoHotkey script that generates a journal file (jou.jou) and would satisfy your needs, easy to understand: Code:
FileDelete, jou.jou ; delete the file before writing a new one filenumber := ["1","2","3"] max := filenumber.MaxIndex() ; length of "filenumber" Loop, %max% ; loop until "max" is reached { string := filenumber[A_Index] ; The built-in variable A_Index contains the number of the current loop iteration. FileAppend, ( file read-case-data file_%string%.cas.gz`n ), jou.jou } Last edited by macfly; April 9, 2014 at 12:27. |
|
April 9, 2014, 12:32 |
|
#6 |
New Member
Sanket Dange
Join Date: Jul 2013
Posts: 9
Rep Power: 13 |
Hi Chandrasekhar,
To automate post processing it is very useful to use scheme file in ANSYS Fluent. Here is an example of how to read case file, similarly you can do for case and data file using appropriate TUI commands. Code:
(do ((x 1 (+ x 1))) ((> x 10)) (ti-menu-load-string (format #f "/file/read-case \"case-file-~a.cas.gz\"" x)) ) Or case-file-10.cas.gz , case-file-20.cas.gz , case-file-30.cas.gz ,....... |
|
April 9, 2014, 13:00 |
|
#7 |
New Member
Chandrasekhar
Join Date: Oct 2013
Location: new jersey
Posts: 24
Rep Power: 13 |
wow thanks guys for the immediate response, was not really expecting it so soon. thank you
|
|
April 10, 2014, 15:27 |
|
#8 | |
New Member
Chandrasekhar
Join Date: Oct 2013
Location: new jersey
Posts: 24
Rep Power: 13 |
Hi
i tried using the scheme file with the code which gave, there was an error "Error: WorkBench Error: Could not handle command Error Object: #f". do you by any chance know what this means. Many thanks for replying. with regards Quote:
|
||
April 10, 2014, 20:30 |
|
#9 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
For example, the following scheme loads the 3 following files:
fluent_1.cas.gz fluent_2.cas.gz fluent_3.cas.gz Code:
(do ((x 1 (+ x 1))) ((> x 3)) (ti-menu-load-string (format #f "file read-case fluent_~a.cas.gz" x)) ) Last edited by macfly; April 11, 2014 at 02:05. |
|
April 11, 2014, 06:12 |
|
#10 |
New Member
Sanket Dange
Join Date: Jul 2013
Posts: 9
Rep Power: 13 |
Hi,
The scheme program which I have given in my previous comment works in both the cases, With the slash (\) and with out the slash. If you want to write file name in " " (quote) then you have to give a \ before the use of quote sign (if you are using format # f, if format # f is not used then you should not give a \ ). The error might have occurred because there might not be case file in existence with the specified name in your working directory. And in my script I have specified that do loop will run until x<10, when x becomes equal to 11 it will stop. You may specify the number equal to your number of case files. Chandrasekhar could you pl. post a snap shot of your error, it might be helpful to understand your error. |
|
June 27, 2016, 15:24 |
|
#11 | |
New Member
Peng Zhong
Join Date: Mar 2016
Posts: 2
Rep Power: 0 |
Quote:
(define (recursion i j) (if (>= i j) (display i) (begin (display i) (recursion (+ 1 i) j)))) output: 12345 |
||
November 14, 2016, 14:19 |
Error: CAR: invalid argument [1]: wrong type [not a pair]
|
#12 |
New Member
Katja N.
Join Date: May 2014
Location: Sweden
Posts: 13
Rep Power: 12 |
Found the solution: there should be a an additional "i" at the end of the code (i i) to match the number of ~a's
Hi! I'm trying to create surface monitors along the height of a pipe and save them. I want to create many of them. So, I have successfully created the surfaces using a Do-loop, but somehow the almost same code does not seem to work for making of the monitors. Can you please tell me what's the error in the following code? (Do ((i 0 (+ i 1000))) ((> i 50)) (Ti-menu-load-string (format #f "/solve/monitors/surface/set-monitor h-~a "Vertex Average" air vof (h-~a) no no yes "h~a" 1 yes flow-time"i i)) ) But I'm not really that good at scheme programming! Thank You
__________________
Last edited by Katja; November 14, 2016 at 14:47. Reason: Found solution |
|
November 14, 2016, 23:57 |
|
#13 |
New Member
Sanket Dange
Join Date: Jul 2013
Posts: 9
Rep Power: 13 |
Hi Katja,
The condition (> i 50 ) which you are using is the culprit here. If you want to create 50 monitors then make the condition as (> i 50000) because your increment of i is 1000. Also you are using i inside ti-menu-load-string for three times so at the end of bracket you will have to write i three times. Like this - (Do ((i 0 (+ i 1000))) ((> i 50000)) (Ti-menu-load-string (format #f "/solve/monitors/surface/set-monitor h-~a "Vertex Average" air vof (h-~a) no no yes "h~a" 1 yes flow-time"i i i)) ) Thanks, Sanket |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
2.0.x on Mac OSX | niklas | OpenFOAM Installation | 74 | March 28, 2012 17:46 |
paraview installation woes | vex | OpenFOAM Installation | 15 | January 30, 2011 08:11 |
Fluent 12 Journal File Problem | Krish | FLUENT | 2 | July 16, 2010 07:10 |
OpenFOAM Install Script | ljsh | OpenFOAM Installation | 82 | October 12, 2009 12:47 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |