jaheyns / CfdOF

Computational Fluid Dynamics (CFD) for FreeCAD based on OpenFOAM solver
GNU Lesser General Public License v3.0
442 stars 84 forks source link

Dynamic run directories #162

Open icojb25 opened 1 month ago

icojb25 commented 1 month ago

Makes changes to the Preferences panel to allow setting a relative directory to FoamAnalysis as a subdirectory in the same directory in which the FCStd is located.

icojb25 commented 1 month ago

See #148

oliveroxtoby commented 1 month ago

Hi @icojb25. Thanks a lot for your efforts.

Would it be possible to modify this to use the name of the document rather than 'FoamAnalysis' as the subdirectory? So that the case directories for different files don't overwrite each other. This was the initial complaint raised in #148 if I understood correctly.

icojb25 commented 1 month ago

Hi @icojb25. Thanks a lot for your efforts.

Would it be possible to modify this to use the name of the document rather than 'FoamAnalysis' as the subdirectory? So that the case directories for different files don't overwrite each other. This was the initial complaint raised in #148 if I understood correctly.

Sure, but its not clear what the OP wanted. He talked about use the Project label but also "beside FCStd" so. Current behaviour is /tmp/meshCase or /tmp/case. So what is the expected behaviour:

  1. Remove /tmp as default and use active project label as default (this will not write on /, where should it default to writing?) (still under /tmp ie /tmp/MyProjectname/meshCase and /tmp/MyProjectname/case, and then
  2. Use BesideFCStd file option and write to ./currentFCStddir/MyProjectname/meshcase and ./currentFCStddir/MyProjectname/case

To my mind, 1) is not a great option since /tmp is supposed to be temporary and not a persistence location. Using what i guess is OP's original suggestion will end up with reams of folders under /tmp which are never cleaned up. Defaulting to $HOME/MyProjectname or something under $HOME/CfdOF/MyProjectname would be better.

Perhaps someone can define the behaviour better.

Also NB Opening the Preferences pane before a project is opened is going to break the code since there is no ActiveDocument at this stage.

oliveroxtoby commented 1 month ago

Sure, but its not clear what the OP wanted. He talked about use the Project label but also "beside FCStd" so. Current behaviour is /tmp/meshCase or /tmp/case. So what is the expected behaviour:

What I had in mind was <user specified dir>/MyProjectname/{meshCase,case} or currentFCStddir/MyProjectname/{meshCase,case} if 'Beside .FCStd file' is checked

To my mind, 1) is not a great option since /tmp is supposed to be temporary and not a persistence location. Using what i guess is OP's original suggestion will end up with reams of folders under /tmp which are never cleaned up. Defaulting to $HOME/MyProjectname or something under $HOME/CfdOF/MyProjectname would be better.

/tmp does get cleaned on reboot (on Linux anyway), but you have a point. I suppose this is the reason why the FEM workbench has a third option to manage the storage automatically on /tmp. I guess it probably overwrites the data when in this mode.

Maybe the safest option would be to have another check box to turn on or off the appending of the document name to the path.

Also NB Opening the Preferences pane before a project is opened is going to break the code since there is no ActiveDocument at this stage.

I would not recommend having the document label appear in the preference page. I would just append it to the path when the case is written.