View Issue Details

IDProjectCategoryView StatusLast Update
0000640OpenFOAMBugpublic2014-01-02 09:29
Reporterdhora Assigned Touser4 
PrioritynoneSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Summary0000640: case specific central controlDict
DescriptionThe central controlDict can be located in ~/.OpenFOAM/VERSION or $WM_PROJECT_DIR/etc. Sometimes it would be nice to have the possibility to change certain debug flags only for a specific case, e.g. by having the central controlDict in the case/system directory. Of course that would require a different file name.
TagsNo tags attached.

Activities

user4

2012-08-30 12:26

  ~0001648

If it is just to set a debug flag you could use a dummy #codeStream in the system/controlDict ;-)


    //- Enable debug flag
    abc #codeStream
    {
        codeOptions
        #{
          -I$(LIB_SRC)/finiteVolume/lnInclude
        #};
        codeLibs
        #{
            -lfiniteVolume
        #};
        codeInclude
        #{
            #include "volPointInterpolation.H"
        #};
        code
        #{
            volPointInterpolation::debug = 1;
            os << "123";
        #};
    };

dhora

2012-08-30 14:28

reporter   ~0001649

Yes, a possible solution. Unfortunately it has the drawback that you have to allow system operations.

wyldckat

2012-08-31 15:00

updater   ~0001657

This reminds me of issue #236... I remembered it because I was thinking of basing myself on "foamDebugSwitches" for creating a function object for this, but ended up figuring out that the debug flags are a _one way street_: the flags are definable only when initializing every library at start, or if you hard-code the access to the flag you want.


Anyway, attached are two files:
* dummyFunctionObject.tar.gz - a base structure for creating function objects.
* finiteVolumeDebugFlagsFunctionObject.tar.gz - a proof-of-concept function object for controlling the debug flags on "finiteVolume".

"wmake libso" to build the libraries. Each has an example "controlDict".
Both attachments follow OpenFOAM's file structure (and coding standard?), but are designed for user-side build+usage. I.e., the headers have been _tweaked_...

In "finiteVolumeDebugFlags.H", the main comment section indicates the commands I've used to generate lists of the embeddable code. It's not bullet proof, since "fv" and "SRC" sub-namespaces were not detected automatically.

@mattijs: the generation for this function object could be generalized and made automatic for each library (at least after figuring out how to detect sub-namespaces). This way it wouldn't require changing OpenFOAM's source code and could possibly be placed in a section for users to build this themselves... at least to avoid having twice as many libraries...

wyldckat

2012-08-31 15:00

updater  

wyldckat

2012-08-31 15:00

updater  

wyldckat

2012-09-01 13:22

updater   ~0001668

I gave it a shot and tried creating a "magical" script that would generate these function objects.
Conclusion: it's impractical due to several reasons. Some of them are:
* Some debug variables are private inside the class they're in.
* The connection between class names and files isn't tight enough to allow such a "simple minded" script to work.
* Templates sometimes "get in the way", or at least it looked like it.

The script I ended up with is available here: https://github.com/wyldckat/genDebugFlagsFunctionObjects
Instructions are available in the readme file for anyone who wants to play with it.


It looks like that a proper implementation of the feature request requires an additional hash list with names<->pointers to said "debug" flags, for making it possible to access them via a function object library, solver or utility, without direct linking.

user4

2014-01-02 09:29

  ~0002737

The DebugSwitches entry in the case controlDict is pretty good (for non-templated classes). See e.g.
http://www.openfoam.org/version2.2.0/runtime-control.php

Issue History

Date Modified Username Field Change
2012-08-30 11:40 dhora New Issue
2012-08-30 12:26 user4 Note Added: 0001648
2012-08-30 14:28 dhora Note Added: 0001649
2012-08-31 15:00 wyldckat Note Added: 0001657
2012-08-31 15:00 wyldckat File Added: dummyFunctionObject.tar.gz
2012-08-31 15:00 wyldckat File Added: finiteVolumeDebugFlagsFunctionObject.tar.gz
2012-09-01 13:22 wyldckat Note Added: 0001668
2014-01-02 09:29 user4 Note Added: 0002737
2014-01-02 09:29 user4 Status new => closed
2014-01-02 09:29 user4 Assigned To => user4
2014-01-02 09:29 user4 Resolution open => fixed
2014-01-02 09:29 user4 Fixed in Version => 2.2.x