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

TUI - Strange behavior related to the working directory

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2022, 06:44
Default TUI - Strange behavior related to the working directory
  #1
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
Dav[ID] is on a distinguished road
Hi all,

I experienced some apparent inconsistencies related to the behavior of fluent TUI writing functions. Basically what seems is that Fluent was disregarding the current working directory while dealing with file writing functions (like /file/write-data or /display/save-picture).

The scenario is the following:

I have a directory tree organized in a parent folder and three levels of subfolders the first sublevel contains a case file which is common to the folder levels below. In the scenario presented here the folders considered are:

Code:
PARENT
|_ N14M09A17_V06
    |_ M0150
        |_ A000
        |_ A020
        |_ A060
The folder from which I start Fluent is PARENT, the folder containing the .cas file is N14M09A17_V06, the folders where the output files should be saved are the A*** folders.

I compiled and run a journal file, I will report only the commands in it that are related to the strange behavior I'm referring to, up to the one that caused the error:

Code:
chdir N14M09A17_V06
/file/start-transcript outputTranscript-retry-WE_June#1_M0150-V02&06.out

pwd
/file/read-case N14M09A17_V06.cas.h5

;-----------------------------M0150
chdir M0150/A000
pwd

/file/read-data N14M09A17_V06/M0150/A000/N14M09A17_V06-M0150A000.dat.h5

 %SOME COMMANDS TO CHANGE CASE SETTINGS (NOT RELATED TO OUTPUT FILES)

/display/objects/display mach
/display/save-picture N14M09A17_V06/M0150/A000/contour_mach.png ok

 %OTHER SIMILAR COMMANDS TO SAVE OTHER PICS%

/file/write-settings N14M09A17_V06-M0150A000.set ok
/define/parameters/output-parameters/write-all-to-file "N14M09A17_V06/M0150/A000/coeff.out" n y

;-------------------------A020
chdir ../A020
pwd

 %CHANGE BCs AND RUN SOLVE%

/display/objects/display mach
/display/save-picture N14M09A17_V06/M0150/A020/contour_mach.png

 %OTHER SIMILAR COMMANDS TO SAVE OTHER PICS%

/file/write-data N14M09A17_V06/M0150/A020/N14M09A17_V06-M0150A020
Each pwd command produces the expected output, the /display/save-picture commands are successful, showing that the path they are referring to is the starting path (PARENT) (this is also the path returned by the !cd command).

The /file/write-data command gave a generic iostream error, and there is the strange behavior: thinking that in this case the command base path is the current working directory I removed the relative path in the command, trying with

Code:
/file/write-data N14M09A17_V06-M0150A020
This saved the file in the folder N14M09A17_V06/M0150/A000 (mind the A000 bit), although the command pwd returned the correct A020 folder.

So I tried with:

Code:
chdir ../A060
pwd
/file/write-data N14M09A17_V06-M0150A020
just to see. And it still saved the file in A000, although the pwd command reported A060.

Then I tried some commands just to be sure of which was the current working directory, the sequence was:

Code:
chdir ../A020
pwd
!cd
ls
/file/write-settings N14M09A17_V06-M0150A020.set
/file/write-data N14M09A17_V06-M0150A020.dat.h5
that last /file/write-data command wrote the file in the right folder (A020).

Anyone have any idea of what causes this behavior, is there something I'm not aware of?

Thank you, for having read this long post!

p.s. I include the transcript of the console from the error on:

Code:
> /display/save-picture N14M09A17_V06/M0150/A020/residuals.png

> /file/write-data N14M09A17_V06/M0150/A020/N14M09A17_V06-M0150A020

Error at host: iostream stream error

Error: iostream stream error
Error Object: #f

Warning: An error or interrupt occurred while reading the journal file.
Some commands may not have been completed.

(cx-gui-do cx-activate-item "Information*OK")

> /file/write-data N14M09A17_V06/M0150/A020/N14M09A17_V06-M0150A020

Error at host: iostream stream error

Error: iostream stream error
Error Object: #f

> pwd
D:\\Share\\*********\\BUT\\N14M09A17_V06\\M0150\\A020

> /file/write-data N14M09A17_V06-M0150A020

Writing to RSM:"D:\Share\**********\BUT\N14M09A17_V06\M0150\A000\N14M09A17_V06-M0150A020.dat.h5" in NODE0 mode and compression level 1 ...
  Writing results.
Done.

> /file/write-data ./N14M09A17_V06-M0150A020

Writing to RSM:"D:\Share\*********\BUT\N14M09A17_V06\M0150\A000\./N14M09A17_V06-M0150A020.dat.h5" in NODE0 mode and compression level 1 ...
  Writing results.
Done.

> /file/write-data N14M09A17_V06/M0150/A020/N14M09A17_V06-M0150A020

Error at host: iostream stream error

Error: iostream stream error
Error Object: #f

> /file/write-data N14M09A17_V06/M0150/A020/N14M09A17_V06-M0150A020.dat.h5

Error at host: iostream stream error

Error: iostream stream error
Error Object: #f

> chdir ../A060

> pwd
D:\\Share\\********\\BUT\\N14M09A17_V06\\M0150\\A060

> /file/write-data N14M09A17_V06-M0150A020

Writing to RSM:"D:\Share\*********\BUT\N14M09A17_V06\M0150\A000\N14M09A17_V06-M0150A020.dat.h5" in NODE0 mode and compression level 1 ...
  Writing results.
Done.

> pwd
D:\\Share\\*********\\BUT\\N14M09A17_V06\\M0150\\A060

> chdir ../A020

> pwd
D:\\Share\\*********\\BUT\\N14M09A17_V06\\M0150\\A020

> !cd
D:\\Share\\*********\\BUT

> ls
 Volume in drive D is DATA
 Volume Serial Number is ********

 Directory of D:\\Share\\********\\BUT\\N14M09A17_V06\\M0150\\A020

[.]                      [..]                     contour_mach.png
contour_pressure.png     contour_vort.png         cp-symmetrycrossec.png
pathlines-1.png          residuals.png            rfile.out
rfile_351.out            vec_vort-x06.png         vec_vort-x09.png
              10 File(s)        637.191 bytes
               2 Dir(s)  487.617.949.696 bytes free

> error
#f

> /file/write-settings N14M09A17_V06-M0150A020.set

Writing Settings file "N14M09A17_V06-M0150A020.set"...
	writing rp variables ... Done.
	writing domain variables ... Done.
	writing fluid (type fluid) (mixture) ... Done.
	writing int_fluid (type interior) (mixture) ... Done.
	writing nose (type wall) (mixture) ... Done.
	writing afterbody (type wall) (mixture) ... Done.
	writing base (type wall) (mixture) ... Done.
	writing ff_fore (type pressure-far-field) (mixture) ... Done.
	writing ff_side (type pressure-far-field) (mixture) ... Done.
	writing ff_aft (type pressure-far-field) (mixture) ... Done.
	writing symmetry (type symmetry) (mixture) ... Done.
	writing int_near_envelope (type interior) (mixture) ... Done.
	writing zones map name-id ... Done.

> /file/write-data N14M09A17_V06-M0150A020.dat.h5

Writing to RSM:"D:\Share\*********\BUT\N14M09A17_V06\M0150\A020\N14M09A17_V06-M0150A020.dat.h5" in NODE0 mode and compression level 1 ...
  Writing results.
Done.
Dav[ID] is offline   Reply With Quote

Old   June 8, 2022, 12:47
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,763
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
I have to ask a really important question. Are you using Workbench or Fluent? I can see this being an issue in Workbench.
LuckyTran is offline   Reply With Quote

Old   June 10, 2022, 05:45
Default
  #3
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
Dav[ID] is on a distinguished road
Hi LuckyTran,

Thank you for your response, I'm using Fluent standalone, launched from the fluent launcher gui.

Anyway it seems that the command /file/write-settings refers to the path returned by the command pwd, while the command /file/write-data refers to the path where the last case or data file were written (or read). So, by anteponing the write-settings command to the write-data one solves my problem. But my confusion about this behavior remains.

I still don't understand how to query for the path to wich write-data refers, but it seems that the command sync-chdir changes both the path returned by pwd and the one returned by !cd to the same value, and in this case also write-data would refer to it.

If someone could complete the bit of information that I clearly miss, I would really appreciate it.
Dav[ID] is offline   Reply With Quote

Old   June 10, 2022, 09:52
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,763
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
!cd behaves differently than cd. See for example. With that knowledge... the names of case and data files are stored as a string of their paths. When you change working directories, you don't change this string. How to query it and how to actually save into an arbitrary sub-directory I don't know yet but I hope that helps.
LuckyTran is offline   Reply With Quote

Old   September 1, 2022, 13:56
Default
  #5
New Member
 
Join Date: Apr 2017
Posts: 6
Rep Power: 9
Dav[ID] is on a distinguished road
Thank you for the additional info.
I know about the different behavior of cd and !cd, the point that I wanted to make is that sync-chdir changes both the pats and also the path where /file/write-data writes. So that I can avoid the problem either by saving the case file before calling for /file/write-data or by changing the path with sync-chdir.
Dav[ID] is offline   Reply With Quote

Old   September 6, 2022, 15:45
Default
  #6
Member
 
Join Date: Jul 2013
Posts: 98
Rep Power: 13
HHOS is on a distinguished road
Hi,


I am not sure about the difference between sync-chdir and chdir. I always use the earlier and have no weird problem like yours.


As a tip, maybe, I can say that if you actually know how the program is actually working, you can easily use the relative path symbols ../ and ./ to go into directories above and within the current directory...


Regards
HHOS is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[openSmoke] LaminarSMOKE compilation error mdhfiz OpenFOAM Community Contributions 8 July 2, 2024 11:32
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
1.7.x Environment Variables on Linux 10.04 rasma OpenFOAM Installation 9 July 30, 2010 05:43
OpenFoam install script Error during paraFoam installation SePe OpenFOAM Installation 10 June 19, 2010 16:15
Gambit Default Working Directory Virgil Howardson FLUENT 5 December 19, 2009 07:13


All times are GMT -4. The time now is 21:58.