Skip to content

include in fvOption

Functionality to add/problem to solve

for automation purposes it would be convenient, if the "#include" would also be possible in the fvOption files

Example

#include "${FOAM_CASE}/system/SetupDict"

momentumSource
{
    type            meanVelocityForce;

    selectionMode   cellZone;
    cellZone        inletCellZone;

    fields          (U);
    Ubar            (0 $:BC.Uin 0);  //<--- does not work!
}

The file ${FOAM_CASE}/system/SetupDict reads:

/*--------------------------------*- C++ -*----------------------------------*\
|    =========                 |                                              |
|    \      /  F ield         | OpenFOAM: The Open Source CFD Toolbox        |
|     \    /   O peration     |           @ Virtual Vehicle                  |
| \  / \  /    A nd           | Web:      www.OpenFOAM.org                   |
|  \/   \/     M anipulation  |                                              |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      SetupDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

BC
{
	Uin	0.060455;
}

Which causes the following error:

[0] 
[1] [0] 
[0] --> FOAM FATAL IO ERROR: 
[0] 
[1] 
[1] --> FOAM FATAL IO ERROR: 
[1] Entry 'type' not found in dictionary "IOstream.BC"
[1] 
[1] 
[1] file: [2] 
[2] 
Entry 'type' not found in dictionary "/data/P2P/channel_v01_3/system/fvOptions.BC"
[0] 
[0] 
[0] file: /data/P2P/channel_v01_3/system/fvOptions.BC
[0] 
[0]     From function bool Foam::dictionary::readEntry(const Foam::word&, T&, Foam::keyType::
option, bool) const [with T = Foam::word]
[0]     in file [2] --> FOAM FATAL IO ERROR: 
[2] Entry 'type' not found in dictionary "IOstream.BC"
IOstream.BC
[1] 
[1]     From function bool Foam::dictionary::readEntry(const Foam::word&, T&, Foam::keyType::
option, bool) const [with T = Foam::word]
[1] /software/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/dictionaryTemplates.C at line 33
4.
[0] 
FOAM parallel run exiting
[0] [3] 
[3] 
[3] --> FOAM FATAL IO ERROR: 
[3] Entry 'type' not found in dictionary "IOstream.BC"
[3] 
[3] 
[3] file:     in file /software/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/dictionaryTemp
lates.C at line 334.
[1] 
FOAM parallel run exiting
[1] 
[2] 
[2] 
[2] file: IOstream.BC
[2] 
[2]     From function bool Foam::dictionary::readEntry(const Foam::word&, T&, Foam::keyType::
option, bool) const [with T = Foam::word]
[2]     in file /software/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/dictionaryTemplates.
C at line 334.
[2] 

FOAM parallel run exiting
[2] 
IOstream.BC
[3] 
[3]     From function bool Foam::dictionary::readEntry(const Foam::word&, T&, Foam::keyType::
option, bool) const [with T = Foam::word]
[3]     in file /software/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/dictionaryTemplates.
C at line 334.
[3] 
FOAM parallel run exiting
[3] 
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

If I hard code the value for Ubar it works!

Edited by christoph irrenfried