CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to add additional header / libs to an codedSource (https://www.cfd-online.com/Forums/openfoam-programming-development/236129-how-add-additional-header-libs-codedsource.html)

Siassei May 15, 2021 07:32

How to add additional header / libs to an codedSource
 
Hello,

I will use an scalarCodedSource in an fvOptions with access to turbulence model functions as the example.

Code:

options
{
sourceTerm1
{
    type            scalarCodedSource;
    selectionMode  cellSet;
    cellSet        myCellSetForSourceTerm1;

    fields          (h);
    name            source1;

    codeInclude
    #{
        #include "fvCFD.H"
        #include "fvc.H"
        //#include "fluidThermo.H"
        //#include "compressibleTurbulenceModel.H"
        //#include "turbulentTransportModel.H"
    #};

    codeCorrect
    #{
    #};

    codeAddSup
    #{
        // get fields
        const scalarField& volume = mesh_.V();

        const volScalarField& cellT = mesh_.lookupObject<volScalarField> ("T");
        const volVectorField& cellU = mesh_.lookupObject<volVectorField> ("U");
        //const dictionary& transportProperties = db().lookupObject<IOdictionary> ("transportProperties");
        const dictionary& transportProperties = mesh_.lookupObject<IOdictionary> ("transportProperties");

        const compressible::turbulenceModel& turbModel = mesh_.lookupObject<compressible::turbulenceModel> (turbulenceModel::propertiesName);
        const fluidThermo& thermo = mesh_.lookupObject<fluidThermo> (basicThermo::dictName);
    #};

    codeConstrain
    #{
    #};
}
}

The compilation (by calling the solver) leads into the errors
Quote:

error: ‘compressible’ does not name a type
error: ‘fluidThermo’ does not name a type
error: ‘thermo’ was not declared in this scope
...
How I can add the information for the additional include path, headers and libs?

HPE May 15, 2021 14:59

Hi,

May be `codeLibs` and/or `codeOptions` help? (I didn't try them).

link

Hope this helps.

olesen May 16, 2021 04:12

Quote:

Originally Posted by Siassei (Post 803868)
Hello,

I will use an scalarCodedSource in an fvOptions with access to turbulence model functions as the example.

Code:

options
{
sourceTerm1
{
    type            scalarCodedSource;
    selectionMode  cellSet;
    cellSet        myCellSetForSourceTerm1;

    fields          (h);
    name            source1;

    codeInclude
    #{
        #include "fvCFD.H"
        #include "fvc.H"
        //#include "fluidThermo.H"
        //#include "compressibleTurbulenceModel.H"
        //#include "turbulentTransportModel.H"
    #};
...

The compilation (by calling the solver) leads into the errors

How I can add the information for the additional include path, headers and libs?


Remove the comment characters from in front of your include statements?


All times are GMT -4. The time now is 03:19.