View Issue Details

IDProjectCategoryView StatusLast Update
0002933OpenFOAMBugpublic2018-05-15 17:09
ReporterSamMallinson Assigned Tohenry  
Status resolvedResolutionfixed 
OSdebianOS Versionbuster 
Product Versiondev 
Fixed 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/"

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 and later.

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

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

Now, getApplication invokes foamDictionary (see

    foamDictionary -entry application -value system/controlDict



2018-05-15 03:04


singleGraph (897 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Web:
     \\/     M anipulation  |
    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"

    type midPoint;
    axis x;

#includeEtc "caseDicts/postProcessing/graphs/graph.cfg"

// ************************************************************************* //
singleGraph (897 bytes)   


2018-05-15 03:04


Allrun1 (398 bytes)   
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

Allrun1 (398 bytes)   


2018-05-15 08:28

manager   ~0009573

Last edited: 2018-05-15 11:57


    foamDictionary -disableFunctionEntries -entry application -value system/controlDict


2018-05-15 17:09

manager   ~0009580

Resolved by commit ad32e5ceb9ea854f2078bb79314464ca32b73eff

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
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