2018-05-25 10:14 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002933OpenFOAM[All Projects] Bugpublic2018-05-15 17:09
ReporterSamMallinson 
Assigned Tohenry 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSdebianOS Versionbuster
Product Versiondev 
Target VersionFixed in Versiondev 
Summary0002933: getApplication error when #calc invoked in functions sub-dict of system/controlDict
DescriptionWhilst trying to automate calculation of some entries in system/singleGraph, I encountered an error: getApplication was returning additional information above and beyond the solver name (from system/controlDict).

(NB: I've used the basic/potentialFoam/cylinder tutorial to show this problem. I've added #includeFunc singleGraph to the functions sub-dict of system/controlDict, and added the singleGraph file attached here.)

In particular, it looks like getApplication is collecting some dynamicCode information and outputting that information as well:

>$ getApplication
Using #calcEntry at line 15 in file "/usr/local/users/samuel/projects/cylinder/system/singleGraph"
Using #codeStream with "/usr/local/users/samuel/projects/cylinder/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_31aa3d3b040ff7ed8df473c1eff90daf9849c7cf.so"
potentialFoam

When Allrun is called, I get the following error:

r$ ./Allrun
    ln: ./lnInclude
Running blockMesh on /usr/local/users/samuel/projects/cylinder
Running Using on /usr/local/users/samuel/projects/cylinder
Running postProcess on /usr/local/users/samuel/projects/cylinder

That is, the return from getApplication, "Using #calcEntry at...", is not what is required.

Workaround: change the definition of application inside Allrun:

application=`getApplication | tail -n 1`

This cuts all but the last line from the return, which is just the name of the application (as require). However, this is a bit messy, so I thought you'd want to make a nice fix.
Steps To Reproduce1. copy tutorial basic/potentialFoam/cylinder to <some-location>
2. add attached file singleGraph to system directory
3. edit system/controlDict and add #includeFunc singleGraph to the functions sub-dict
4. ./Allrun
5. for the workaround, download Allrun1 (attached) and then ./Allrun1
Additional InformationThis error only seems to occur for OF-dev commits https://github.com/OpenFOAM/OpenFOAM-dev/commit/984c4a2b518e2022f2eda534a1949c18728e33bc and later.

Prior to that, getApplication was defined as a sed command:

getApplication()
{
    sed -ne 's/^ *application\s*\([a-zA-Z]*\)\s*;.*$/\1/p' system/controlDict
}

Now, getApplication invokes foamDictionary (see https://github.com/OpenFOAM/OpenFOAM-dev/blob/master/bin/tools/RunFunctions):

getApplication()
{
    foamDictionary -entry application -value system/controlDict
}
TagsgetApplication
Attached Files
  • ? file icon singleGraph (897 bytes) 2018-05-15 03:04 -
    /*--------------------------------*- C++ -*----------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     |
        \\  /    A nd           | Web:      www.OpenFOAM.org
         \\/     M anipulation  |
    -------------------------------------------------------------------------------
    Description
        Writes graph data for specified fields along a line, specified by start
        and end points.
    
    \*---------------------------------------------------------------------------*/
    
    x0  0.0;   
    x1  #calc "$x0 + 2.0";
    start   ($x0 0 0);
    end     ($x1 0 0);
    fields  (U);
    
    #includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"
    
    setConfig
    {
        type midPoint;
        axis x;
    }
    
    #includeEtc "caseDicts/postProcessing/graphs/graph.cfg"
    
    // ************************************************************************* //
    
    ? file icon singleGraph (897 bytes) 2018-05-15 03:04 +
  • ? file icon Allrun1 (398 bytes) 2018-05-15 03:04 -
    #!/bin/sh
    cd ${0%/*} || exit 1    # Run from this directory
    
    # Source tutorial run functions
    . $WM_PROJECT_DIR/bin/tools/RunFunctions
    
    application=`getApplication | tail -n 1`
    
    runApplication blockMesh
    runApplication $application -withFunctionObjects -writePhi -writep
    runApplication postProcess -func streamFunction
    
    #------------------------------------------------------------------------------
    
    ? file icon Allrun1 (398 bytes) 2018-05-15 03:04 +

-Relationships
+Relationships

-Notes

~0009573

henry (manager)

Last edited: 2018-05-15 11:57

View 2 revisions

Try

getApplication()
{
    foamDictionary -disableFunctionEntries -entry application -value system/controlDict
}

~0009580

henry (manager)

Resolved by commit ad32e5ceb9ea854f2078bb79314464ca32b73eff
+Notes

-Issue History
Date Modified Username Field Change
2018-05-15 03:04 SamMallinson New Issue
2018-05-15 03:04 SamMallinson File Added: singleGraph
2018-05-15 03:04 SamMallinson Tag Attached: getApplication
2018-05-15 03:04 SamMallinson File Added: Allrun1
2018-05-15 08:28 henry Note Added: 0009573
2018-05-15 11:57 chris Note Edited: 0009573 View Revisions
2018-05-15 17:09 henry Assigned To => henry
2018-05-15 17:09 henry Status new => resolved
2018-05-15 17:09 henry Resolution open => fixed
2018-05-15 17:09 henry Fixed in Version => dev
2018-05-15 17:09 henry Note Added: 0009580
+Issue History