View Issue Details

IDProjectCategoryView StatusLast Update
0003637OpenFOAMBugpublic2021-03-05 22:55
ReporterTobermory Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformUnixOSUbuntuOS Version20.04
Summary0003637: Inability to manipulate ".*" keyword in foamDictionary
DescriptionKeyword ".*" is often used in the system/fvSolution dictionary, for setting relaxation factors on all variables, eg:

    equations
    {
       " .*" 0.9;
        U 0.9;
    }

foamDictionary seems unable to be update the ".*" keyword value, even though you can list the keywords for that subdictionary and it will list ".*" as a keyword.
Steps To ReproduceThe following command lists the keywords successfully:
        $ foamDictionary -entry relaxationFactors.equations -keywords system/fvSolution
        ".*"
        U
and the following works:
        $ foamDictionary -entry relaxationFactors.equations.U -set 0.9 system/fvSolution
        New entry U 0.9;
but the following creates an error:
        $ foamDictionary -entry 'relaxationFactors.equations.".*"' system/fvSolution
        --> FOAM FATAL IO ERROR:
        Cannot find entry relaxationFactors.equations.".*"
From the error message, it clearly has the "right" keyword, but cannot interpret it, it seems.
TagsNo tags attached.

Activities

henry

2021-03-05 19:00

manager   ~0011918

Try

foamDictionary -entry 'relaxationFactors/equations/".*"' system/fvSolution -set "0.9"

in OpenFOAM-dev

Tobermory

2021-03-05 21:13

reporter   ~0011919

Yes, that works! From a quick diff on the foamDictionary.C files, I can see that it has been updated in the dev version ... I guess I can copy the dev version to my v8 distribution and compile as a myFoamDictionary installation as an interim measure. Many thanks Henry for coming back so quickly.

Tobermory

2021-03-05 21:22

reporter   ~0011920

Hmmm ... from a quick trial, I can see that dictionary.C has been updated as well, so it may not be possible to splice this change into v8? What are your thoughts? If I update the dictionary class as well, will it bugger up other coding?

henry

2021-03-05 21:37

manager   ~0011921

> so it may not be possible to splice this change into v8?

No, enhancing the handling of dictionary was a substantial and complex change which I have been working on since before the release of version 8 and for some time after. The new more general dictionary and foamDictionary functionality will of course be in the next and subsequent releases.

henry

2021-03-05 21:39

manager   ~0011922

commit 6c8732df5b38da3252e3d132b53519b0d187e485
Author: Henry Weller <http://cfd.direct>
Date: Thu Jul 23 20:36:51 2020 +0100

    dictionary: Set the default scoping syntax to 'slash'
    
    The new optional 'slash' scoping syntax is now the default and provides a more
    intuitive and flexible syntax than the previous 'dot' syntax, corresponding to
    the common directory/file access syntax used in UNIX, providing support for
    reading entries from other dictionary files.
    
    In the 'slash' syntax
        '/' is the scope operator
        '../' is the parent dictionary scope operator
        '!' is the top-level dictionary scope operator
    
    Examples:
    
        internalField 3.4;
    
        active
        {
            type fixedValue;
            value.air $internalField;
        }
    
        inactive
        {
            type anotherFixedValue;
    
            value $../active/value.air;
            anotherValue $!active/value.air;
    
            sub
            {
                value $../../active/value.air;
                anotherValue $!active/value.air;
            }
        }
    
        "U.*"
        {
            solver GAMG;
        }
    
        e.air
        {
            $U.air;
        }
    
        external
        {
            value $testSlashDict2!active/value.air;
        }
    
        active2
        {
            $testSlashDict2!active;
        }
    
    If there is a part of the keyword before the '!' then this is taken to be the
    file name of the dictionary from which the entry will be looked-up using the
    part of the keyword after the '!'. For example given a file testSlashDict containing
    
        internalField 5.6;
    
        active
        {
            type fixedValue;
            value.air $internalField;
        }
    
    entries from it can be read directly from another file, e.g.
    
        external
        {
            value $testSlashDict2!active/value.air;
        }
    
        active2
        {
            $testSlashDict2!active;
        }
    
        which expands to
    
        external
        {
            value 5.6;
        }
    
        active2
        {
            type fixedValue;
            value.air 5.6;
        }
    
    These examples are provided in applications/test/dictionary.
    
    The the default syntax can be changed from 'slash' to 'dot' in etc/controlDict
    to revert to the previous behaviour:
    
    OptimisationSwitches
    {
    .
    .
    .
        // Default dictionary scoping syntax
        inputSyntax slash; // Change to dot for previous behaviour
    }
    
    or within a specific dictionary by adding the entry
    
    See applications/test/dictionary/testDotDict.

Tobermory

2021-03-05 21:45

reporter   ~0011923

Thanks Henry for the info above - sounds like a great update; I'll be patient then for the next release. I can always do a work around for the moment with some "sed" footwork. Thanks again.

Tobermory

2021-03-05 21:45

reporter   ~0011924

PS - please close this issue.

Issue History

Date Modified Username Field Change
2021-03-05 18:38 Tobermory New Issue
2021-03-05 19:00 henry Note Added: 0011918
2021-03-05 21:13 Tobermory Note Added: 0011919
2021-03-05 21:22 Tobermory Note Added: 0011920
2021-03-05 21:37 henry Note Added: 0011921
2021-03-05 21:39 henry Note Added: 0011922
2021-03-05 21:45 Tobermory Note Added: 0011923
2021-03-05 21:45 Tobermory Note Added: 0011924
2021-03-05 22:55 henry Assigned To => henry
2021-03-05 22:55 henry Status new => closed
2021-03-05 22:55 henry Resolution open => no change required