|
[Sponsors] |
November 26, 2017, 20:18 |
Fluent journal - do loop
|
#1 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
Hello!
I need to create a code that will load case&data into ANSYS Fluent, then create a surface, and then - calculate medium pressure on that surface. These three actions have to be repeated 100 times. I write a do loop, which you can see below, but in doesn't work with these three action. It work for only one action (any of these 3). Please tell me, where my mistake is, and how to change the code. Is there even a possibility of making multiple commands in do loop? Regards (Do ((x 1 (+ x 1))) ((> x 100)) (Ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz" x)) (Ti-menu-load-string (format #f "surface plane-surf-aligned ooooo~a outlet2 -0.0291707 -0.0056188 0.13" x)) (Ti-menu-load-string (format #f "report surface-integrals area-weighted-avg ooooo~a () pressure y pressure1" x)) ) |
|
November 26, 2017, 21:03 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
For this problem I suggest you to try this code: Code:
(Do ((x 1 (+ x 1))) ((> x 100)) (begin (Ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postprocessing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz" x)) (Ti-menu-load-string (format #f "surface plane-surf-aligned ooooo~a outlet2 -0.0291707 -0.0056188 0.13" x)) (Ti-menu-load-string (format #f "report surface-integrals area-weighted-avg ooooo~a () pressure y pressure1" x)) )) |
||
November 26, 2017, 21:10 |
|
#3 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
Thanks for reply,
I read these tutorials but I still had the problem. The solution that you sent me still doesn't work. In Fluent output I get (just a fragment): file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-00001.cas.gzsurface plane-surf-aligned ooooo1 Invalid new surface. outlet2 Invalid new surface. -0.0291707 Surface name should start with alphabet or underscore. Setting default name. I think that the program can't see the interval between two commands. I get this error all the time when trying to solve it - that was the reason why I asked about mulpitle commands in do loop. Regards Destroy |
|
November 26, 2017, 23:58 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
(Ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz" x))
why do you have space here? also you may try to use \n at the end of each command, for instance: Code:
(Ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postprocessing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz\n" x)) |
|
November 27, 2017, 03:36 |
|
#5 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
Good point, but - I made a mistake only here, copying code to my query. As I said previously - the code works for the every command, but not all or two commands in the one loop.
The proposed \n doesn't help. PS The program still can't see the gap between commands - I think that we can focus on that point. Regards |
|
November 27, 2017, 05:55 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
No, it has nothing to do with 'gap between commands'.
The problem is probably that your surface ooooo1 already exists in the file. Try deleting it first: Code:
(Do ((x 1 (+ x 1))) ((> x 100)) (begin (ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postprocessing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz" x)) (ti-menu-load-string (format #f "surface plane-surf-aligned delete-surface ooooo~a" x)) (ti-menu-load-string (format #f "surface plane-surf-aligned ooooo~a outlet2 -0.0291707 -0.0056188 0.13" x)) (ti-menu-load-string (format #f "report surface-integrals area-weighted-avg ooooo~a () pressure y pressure1" x)) )) |
|
November 27, 2017, 06:01 |
|
#7 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
Unfortunately - doesn't help. The same error as earlier:
"file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-00001.cas.gzsurface plane-surf-aligned delete-surface ooooo1surface plane-surf-aligned ooooo1 Invalid new surface. outlet2 Invalid new surface. -0.0291707 Surface name should start with alphabet or underscore. Setting default name. (...)" |
|
November 27, 2017, 07:34 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Open your file (the first one), and try to add the surface ooooo1 using the text interface. Do you get the same error message?
|
|
November 27, 2017, 07:35 |
|
#9 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
I tried. I didn't get any error message.
|
|
November 27, 2017, 08:32 |
|
#10 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
I changed the code as:
(Do ((x 1 (+ x 1))) ((> x 3)) (ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz" x)) (newline) ;(ti-menu-load-string (format #f "surface delete-surface avyyyzzzzz~a" x)) (newline) (ti-menu-load-string (format #f "surface plane-surf-aligned avyyyzzzzz~a outlet2 -0.0291707 -0.0056188 0.13" x)) (newline) (ti-menu-load-string (format #f "report surface-integrals area-weighted-avg avyyyzzzzz~a () pressure y pressure~a" x x)) (newline) ) It still doesn't work as I wish; firstly, it loads the first case&data (Fluentmesh14-58-00001.cas.gz), then the Fluent TUI output suggest, that the code is OK, but it does not load the next case&data files. The end of the Fluent TUI output is: (...) surface plane-surf-aligned avyyyzzzzz1 outlet2 -0.0291707 -0.0056188 0.13 report surface-integrals area-weighted-avg avyyyzzzzz1 () pressure y pressure1 file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-00002.cas.gz surface plane-surf-aligned avyyyzzzzz2 outlet2 -0.0291707 -0.0056188 0.13 report surface-integrals area-weighted-avg avyyyzzzzz2 () pressure y pressure2 file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-00003.cas.gz surface plane-surf-aligned avyyyzzzzz3 outlet2 -0.0291707 -0.0056188 0.13 report surface-integrals area-weighted-avg avyyyzzzzz3 () pressure y pressure3 #f |
|
November 27, 2017, 09:46 |
|
#11 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I don't know...
|
|
November 27, 2017, 22:07 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Once you use DO and multiple functions inside, you have to use BEGIN.
How do you read journal file? I've never tried it but you may ask fluent to read journal from fluent launcher window. I believe, once you read new case, everything inside fluent had lost (and journals also) So you need external source to execute journal. However, this is just my thought Best regards |
|
November 28, 2017, 10:18 |
|
#13 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
Thank you for all your replies.
The problem was mainly the lack of decision (o - OK, c - cancel) indicating to write or not the changes made by loop (i.e. new surface). The final makro is: (Do ((x 1 (+ x 1))) ((> x 9)) (ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-0000~a.cas.gz o" x)); (newline) ;(ti-menu-load-string (format #f "surface delete-surface iiiii~a" x)) (newline) (ti-menu-load-string (format #f "surface plane-surf-aligned iiiii~a outlet2 -0.0291707 -0.0056188 0.13" x)) (newline) (ti-menu-load-string (format #f "report surface-integrals area-weighted-avg iiiii~a () pressure y pressure" x)) (newline) ) (Do ((x 10 (+ x 1))) ((> x 99)) (ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-000~a.cas.gz o" x)); (newline) ;(ti-menu-load-string (format #f "surface delete-surface iiiii~a" x)) (newline) (ti-menu-load-string (format #f "surface plane-surf-aligned iiiii~a outlet2 -0.0291707 -0.0056188 0.13" x)) (newline) (ti-menu-load-string (format #f "report surface-integrals area-weighted-avg iiiii~a () pressure y pressure" x)) (newline) ) (Do ((x 100 (+ x 1))) ((> x 110)) (ti-menu-load-string (format #f "file read-case-data K:\USERS\mnowak\artykulzautosavemnaprawa\postproce ssing\caseanddatadoanalizy\Fluentmesh14-58-00~a.cas.gz o" x)); (newline) ;(ti-menu-load-string (format #f "surface delete-surface iiiii~a" x)) (newline) (ti-menu-load-string (format #f "surface plane-surf-aligned iiiii~a outlet2 -0.0291707 -0.0056188 0.13" x)) (newline) (ti-menu-load-string (format #f "report surface-integrals area-weighted-avg iiiii~a () pressure y pressure" x)) (newline) ) PS. I have no idea why in above code the word "postprocessing" seems "postproce ssing" - it's just here, in my code I don't have any gap inside this word. I tried to edit this post but after it still displays "postproce ssing". Regards |
|
December 1, 2017, 10:30 |
|
#14 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
The code is working fine, but after 72 timesteps I get this error all the time:
Error: sopenoutputfile: unable to open file for output Error Object: "K:\USERS\mnowak\monitory\monitory_files\dp0\FLU\F luent\K:\USERS\mnowak\artykulzautosavemnaprawa\pos tprocessing\caseanddatadoanalizy\Fluentmesh14-58-00073.set" I found some solutions: - close and run again Fluent - open Workbench as administrator - change the localization of the files None of them helped. I ran this macro on other computer, still the same problem. Have you got any idea, what the problem is? I found that people ask about this error message over the years, and they didn't find the solution many times. |
|
December 4, 2017, 06:53 |
|
#15 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You have to turn into a detective, and investigate what is the problem.
First clue: Fluent complains that there is a problem with a specific file:Fluentmesh14-58-00073.set. Do you recognize this file? Why is Fluent trying to write this file? Second clue: It works for 71 time steps, but it fails after 72. What is the difference? Why was there no problem with Fluentmesh14-58-0070.set? Can you find this file? What is in it? To be clear: I don't know the answer to your problem. But I can see some logical things to investigate. |
|
January 15, 2018, 14:51 |
do loop with journal
|
#16 |
Member
Muhammad Ali Uzair
Join Date: Sep 2017
Posts: 44
Rep Power: 9 |
Hi,
I am trying to read data files using do loop (scheme) and then export solution data on a surface using journal. its not working, always giving errors. Can please somebody help what is wrong with it. I am new to scheme programming and journals .. following is the program (do ((x 1 (+ x 1))) ((> x 5)) (ti-menu-load-string (format #f "file read-data check-1-000~a0.dat" x)) ) (cx-gui-do cx-activate-item "MenuBar*ExportSubMenu*Solution Data...") (cx-gui-do cx-set-list-selections "Export*Table1*Table2*DropDownList1(File Type)" '( 1)) (cx-gui-do cx-activate-item "Export*Table1*Table2*DropDownList1(File Type)") (cx-gui-do cx-set-list-selections "Export*Table1*List4(Surfaces)" '( 2)) (cx-gui-do cx-activate-item "Export*Table1*List4(Surfaces)") (cx-gui-do cx-set-list-selections "Export*Table1*List5(Quantities)" '( 61)) (cx-gui-do cx-activate-item "Export*Table1*List5(Quantities)") (cx-gui-do cx-activate-item "Export*PanelButtons*PushButton1(OK)") (cx-gui-do cx-set-file-dialog-entries "Select File" '( "check-1-000~a0") "ASCII Files ()") (cx-gui-do cx-activate-item "Export*PanelButtons*PushButton2(Cancel)") ) |
|
January 15, 2018, 18:38 |
|
#17 |
Member
Marcin
Join Date: Jun 2016
Posts: 98
Rep Power: 10 |
I think that you were registering a journal and then you were editing it into that code.
In my opinion if you want to use scheme programming, you have to use commands that you are typing into TUI. Firstly test how to achieve the tasks that you've got, by using TUI, and then write new program. |
|
January 15, 2018, 21:07 |
|
#18 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
(cx-gui-do cx-set-file-dialog-entries "Select File" '( "check-1-000~a0") "ASCII Files ()")
what is a here? |
|
January 16, 2018, 06:13 |
|
#19 |
Member
Muhammad Ali Uzair
Join Date: Sep 2017
Posts: 44
Rep Power: 9 |
||
January 16, 2018, 06:16 |
|
#20 | |
Member
Muhammad Ali Uzair
Join Date: Sep 2017
Posts: 44
Rep Power: 9 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
fluent journal file for carrying out LES | raunakjung | FLUENT | 13 | June 7, 2017 11:16 |
Calculation of Load Carrying capacity of a journal bearing in Fluent | Dinesh_Dhande | FLUENT | 1 | June 17, 2015 05:20 |
Fluent JOURNAL file issue | mhsn | FLUENT | 0 | June 5, 2013 13:47 |
Fluent jobs through pbs | ibnkureshi | FLUENT | 5 | June 9, 2011 14:43 |