View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0003692||OpenFOAM||Bug||public||2021-07-02 08:41||2021-07-02 15:14|
|Fixed in Version||dev|
|Summary||0003692: options "-dict" and "-case" do not work when used together in decomposePar|
|Description||If options "-case" and "-dict" are used at the same time when decomposePar is launched, the application does not find the dictionary file. This is due to a wrong definition of the variable dictPath for this very specific case. Please find attached a file with a proposal of modification to decomposePar.C to fix the issue. |
Version tested: OpenFOAM-dev, commit 261d5ccd6.
|Steps To Reproduce||cd $FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak|
blockMesh -case damBreak
setFields -case damBreak
Then, none of these commands works:
decomposePar -case damBreak -dict system/decomposeParDict
decomposePar -case damBreak -dict damBreak/system/decomposeParDict
decomposePar -case damBreak -dict system/
|Tags||No tags attached.|
decomposePar.C (46,374 bytes)
Your change assumes that the directory passed to `-case` is relative to the current working directory. If it is absolute, then `cwd()/caseName/dictPath` will be nonsense.
Also, I don't think we want `-dict` to be relative to `-case`. I think that's confusing, and that it would better for them both to be handled as paths that are either absolute or relative to the current working directory.
If we do that, then all that is needed is to add `dictPath.toAbsolute()` after the argument is read.
thank you very much for your hint, very helpful.
Please find attached a modified version of the working code and a script to test it.
decomposePar-2.C (46,251 bytes)
Allrun.test (1,238 bytes)
||Thanks, but I'm afraid this affects more than just decomposePar. The logic needs to be centralised and made consistent across a bunch of applications. There is some of this implemented in `systemDict`, but it needs extending to handle `-case` and to do the `isDir` stuff correctly. I'm working on it now.|
Looking at the rest of the code, it seems to be standard that if -dict has a relative path then that path is taken to be from the case directory. If -dict is absolute, then it's just an absolute path. That wasn't my initial assumption, but it's fine as a convention as log as it's applied consistently.
So, I've enforced that everywhere. I've extended the systemDict stuff and it's now handling all -dict options in all executables. It should all be correct now.
Your test script won't work because it's assuming relative paths relative to the working directory, not the case directory. You don't need "damBreak" at the start of the relative paths (the ones without $workDir). If you remove these then it runs.
|2021-07-02 08:41||fede||New Issue|
|2021-07-02 08:41||fede||File Added: decomposePar.C|
|2021-07-02 09:49||will||Note Added: 0012075|
|2021-07-02 12:06||fede||File Added: decomposePar-2.C|
|2021-07-02 12:06||fede||File Added: Allrun.test|
|2021-07-02 12:06||fede||Note Added: 0012076|
|2021-07-02 12:27||will||Note Added: 0012077|
|2021-07-02 15:14||will||Assigned To||=> will|
|2021-07-02 15:14||will||Status||new => resolved|
|2021-07-02 15:14||will||Resolution||open => fixed|
|2021-07-02 15:14||will||Fixed in Version||=> dev|
|2021-07-02 15:14||will||Note Added: 0012078|