View Issue Details

IDProjectCategoryView StatusLast Update
0003692OpenFOAMBugpublic2021-07-02 15:14
ReporterfedeAssigned Towill 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinuxOSDebianOS Version9
Product Versiondev 
Fixed in Versiondev 
Summary0003692: options "-dict" and "-case" do not work when used together in decomposePar
DescriptionIf 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.
Kind regards,

federico
Steps To Reproducecd $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/
TagsNo tags attached.

Activities

fede

2021-07-02 08:41

reporter  

decomposePar.C (46,374 bytes)

will

2021-07-02 09:49

manager   ~0012075

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.

fede

2021-07-02 12:06

reporter   ~0012076

Hi Will,
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.
Kind regards,

Federico

decomposePar-2.C (46,251 bytes)
Allrun.test (1,238 bytes)

will

2021-07-02 12:27

manager   ~0012077

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.

will

2021-07-02 15:14

manager   ~0012078

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.

https://github.com/OpenFOAM/OpenFOAM-dev/commit/c63c1a90c2d5c4dcdc24f79aacb8b81740066ebc

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.

Issue History

Date Modified Username Field Change
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