View Issue Details

IDProjectCategoryView StatusLast Update
0003959OpenFOAMBugpublic2023-02-22 15:16
Reportermarniemann Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformUnixOSOtherOS Version(please specify)
Product Version10 
Summary0003959: foamDictionary cannot set entries in wildcarded subDicts
DescriptionI have a fvSolution Dict containing a definition for both PISO and PIMPLE solvers:

"(PIMPLE|PISO)"
{
    transonic no;
    nOuterCorrectors 1;
    nCorrectors 2;
    nNonOrthogonalCorrectors 0;
    momentumPredictor yes;
}

When querying any entry in this subDict using foamDictionary I get the correct result, e.g.:
foamDictionary system/fvSolution -entry PIMPLE/transonic --> transonic no;

Trying to change an entry using set yields and error:
foamDictionary system/fvSolution -entry PIMPLE/transonic -set no

--> FOAM FATAL IO ERROR:
keyword PIMPLE is undefined in dictionary "system/fvSolution" or is not a dictionary
Valid keywords are
4
(
FoamFile
#include
solvers
relaxationFactors
)
file: system/fvSolution from line 10 to line 38.

    From function const Foam::dictionary& Foam::dictionary::scopedDict(const Foam::word&) const
    in file db/dictionary/dictionary.C at line 1093.

FOAM exiting

Is this intended behavior or should foamDictionary be able to understand wildcards?

----

On another note: I noticed that the dot access for subDicts seems to be no longer supported. At least, the call
foamDictionarysystem/fvSolution -entry PIMPLE.transonic -set no --> New entry PIMPLE.transonic no;
results in a new entry in the dict, no access into a subDict.

From other issues that I found, I assume that this is actually intended behavior. However, a clear error message on this usage might help during migration.
Steps To Reproducesee description.
TagsNo tags attached.

Activities

henry

2023-02-22 14:03

manager   ~0012955

Try:

foamDictionary system/fvSolution -entry '(PIMPLE|PISO)/transonic' -set no
 
It works for me in OpenFOAM-dev and OpenFOAM-10

marniemann

2023-02-22 15:05

reporter   ~0012956

confirmed.
foamDictionary system/fvSolution -entry '(PIMPLE|PISO)/transonic' -set no
foamDictionary system/fvSolution -entry "(PIMPLE|PISO)/transonic" -set no
foamDictionary system/fvSolution -entry '(PIMPLE|PISO)'/transonic -set no

all work fine. Thanks!

I tried something like foamDictionary system/fvSolution -entry \"\(PIMPLE\|PISO\)\"/transonic -set no which does fail with keyword "(PIMPLE|PISO)" is undefined in dictionary

henry

2023-02-22 15:16

manager   ~0012957

User support

Issue History

Date Modified Username Field Change
2023-02-22 13:01 marniemann New Issue
2023-02-22 14:03 henry Note Added: 0012955
2023-02-22 15:05 marniemann Note Added: 0012956
2023-02-22 15:16 henry Assigned To => henry
2023-02-22 15:16 henry Status new => closed
2023-02-22 15:16 henry Resolution open => no change required
2023-02-22 15:16 henry Note Added: 0012957