CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

do loop in Fluent journal file.

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree6Likes
  • 3 Post By Markus
  • 1 Post By macfly
  • 2 Post By sanketdange2007

Reply
 
LinkBack Thread Tools Display Modes
Old   August 17, 2004, 13:10
Default do loop in Fluent journal file.
  #1
caterchen
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
  Reply With Quote

Old   August 18, 2004, 01:54
Default Re: do loop in Fluent journal file.
  #2
mateus
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
  Reply With Quote

Old   August 18, 2004, 02:18
Default Re: do loop in Fluent journal file.
  #3
Markus
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
  Reply With Quote

Old   April 8, 2014, 23:49
Default
  #4
New Member
 
Chandrasekhar
Join Date: Oct 2013
Location: new jersey
Posts: 24
Rep Power: 3
chandrasekhar is on a distinguished road
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:
Originally Posted by Markus
;114444
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
chandrasekhar is offline   Reply With Quote

Old   April 9, 2014, 09:42
Default
  #5
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 366
Rep Power: 8
macfly is on a distinguished road
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
     }
Attached Files
File Type: zip read-case-data.zip (405 Bytes, 13 views)
chandrasekhar likes this.

Last edited by macfly; April 9, 2014 at 11:27.
macfly is offline   Reply With Quote

Old   April 9, 2014, 11:32
Default
  #6
New Member
 
sanketdange2007's Avatar
 
Sanket Dange
Join Date: Jul 2013
Posts: 3
Rep Power: 4
sanketdange2007 is on a distinguished road
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))

)
Just make sure that you file name are in some fixed format so that you can use the do loop to read them. Simple way to do this is number them serially or with equal difference like: case-file-1.cas.gz , case-file-2.cas.gz , case-file-3.cas.gz, ......

Or

case-file-10.cas.gz , case-file-20.cas.gz , case-file-30.cas.gz ,.......
macfly and chandrasekhar like this.
sanketdange2007 is offline   Reply With Quote

Old   April 9, 2014, 12:00
Default
  #7
New Member
 
Chandrasekhar
Join Date: Oct 2013
Location: new jersey
Posts: 24
Rep Power: 3
chandrasekhar is on a distinguished road
wow thanks guys for the immediate response, was not really expecting it so soon. thank you
chandrasekhar is offline   Reply With Quote

Old   April 10, 2014, 14:27
Default
  #8
New Member
 
Chandrasekhar
Join Date: Oct 2013
Location: new jersey
Posts: 24
Rep Power: 3
chandrasekhar is on a distinguished road
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:
Originally Posted by sanketdange2007 View Post
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))

)
Just make sure that you file name are in some fixed format so that you can use the do loop to read them. Simple way to do this is number them serially or with equal difference like: case-file-1.cas.gz , case-file-2.cas.gz , case-file-3.cas.gz, ......

Or

case-file-10.cas.gz , case-file-20.cas.gz , case-file-30.cas.gz ,.......


For more detailed explanation you can visit our blog : http://www.learncax.com/index.php/en...and-automation

This blog explains how to use do loop for automation and it also explains the syntax of the do loop. I would recommend you to go through this blog.
chandrasekhar is offline   Reply With Quote

Old   April 10, 2014, 19:30
Default
  #9
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 366
Rep Power: 8
macfly is on a distinguished road
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))
)
There is a \ that seems to be outside its "" in Sanket's example.

Last edited by macfly; April 11, 2014 at 01:05.
macfly is offline   Reply With Quote

Old   April 11, 2014, 05:12
Default
  #10
New Member
 
sanketdange2007's Avatar
 
Sanket Dange
Join Date: Jul 2013
Posts: 3
Rep Power: 4
sanketdange2007 is on a distinguished road
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.
sanketdange2007 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2.0.x on Mac OSX niklas OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 74 March 28, 2012 16:46
paraview installation woes vex OpenFOAM Installation 15 January 30, 2011 08:11
Fluent 12 Journal File Problem Krish FLUENT 2 July 16, 2010 06:10
OpenFOAM Install Script ljsh OpenFOAM Installation 82 October 12, 2009 11:47
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


All times are GMT -4. The time now is 07:04.