View Issue Details

IDProjectCategoryView StatusLast Update
0004004OpenFOAMBugpublic2023-08-07 23:09
ReporterCarl Birger Jenssen Assigned Tohenry  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionno change required 
PlatformAMD Ryzen threadripper proOSUbuntuOS Version22.04.3 LTS
Summary0004004: Coded fvmodel does not work (--> FOAM FATAL IO ERROR: Failed wmake)
DescriptionWhen including a coded model in the file constant/fvModels, OpenFOAM crashes. The error message is:

--> FOAM FATAL IO ERROR:
Failed wmake "dynamicCode/codedSource/platforms/linux64GccDPInt32Opt/lib/libcodedSource_6f65e73111d16d16c4c5beca42777e0b41b1d18b.so"

This happens for all the solvers that I have tested and for several different coded models.

They all worked perfectly well in OpenFOAM v10.
Steps To ReproduceCopy the enclosed fvModels file into the tutorial case airFoil2D and try to run the simulation.
Additional InformationWhen inspecting the dynamicCode/dynamicCode/codedFvModelTemplate.C files generated by v10 and v11, I noticed that several if (false) statements in v10 became if () in v11. Manually replacing if () with if (false) in the v11 generated file solved the problem, and the simulation ran perfectly on the second attempt.
TagsNo tags attached.

Activities

Carl Birger Jenssen

2023-08-07 18:34

reporter  

fvModels (1,043 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvModels;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

codedSource
{
    type            coded;
    field           U;
    selectionMode   all;

    codeInclude
    #{
    #};

    codeAddSup
    #{
        Pout<< "**codeAddSup**" << endl;
    #};
    
    codeAddRhoSup
    #{
        Pout<< "**codeAddRhoSup**" << endl;
    #};
    
    codeAddAlphaRhoSup
    #{
        Pout<< "**codeAddAlphaRhoSup**" << endl;
    #};
}
*/

// ************************************************************************* //
fvModels (1,043 bytes)   

henry

2023-08-07 21:12

manager   ~0013094

With the fvModels file you supplied I get the message

Creating fvModels from "constant/fvModels"

--> FOAM Warning :
    From function entry::New(dictionary&, Istream&)
    in file db/dictionary/entry/entryIO.C at line 128
    Reading .../tutorials/incompressibleFluid/airFoil2D/constant/fvModels
    found on line 42 the punctuation token '*'
    expected either } or EOF

which relates to the spurious trailing '*/' in the file. If I remove this error the fvModels compiles and runs fine:

Creating fvModels from "constant/fvModels"

Selecting finite volume model type coded
    Name: codedSource
Using dynamicCode for fvModel:: codedSource at line 19 in ".../tutorials/incompressibleFluid/airFoil2D/constant/fvModels/codedSource"
Creating new library in "dynamicCode/codedSource/platforms/linux64GccDPInt32Opt/lib/libcodedSource_6f65e73111d16d16c4c5beca42777e0b41b1d18b.so"
".../etc/codeTemplates/dynamicCode/codedFvModelTemplate.C" ".../tutorials/incompressibleFluid/airFoil2D/dynamicCode/codedSource/codedFvModelTemplate.C"
".../etc/codeTemplates/dynamicCode/codedFvModelTemplate.H" ".../tutorials/incompressibleFluid/airFoil2D/dynamicCode/codedSource/codedFvModelTemplate.H"
Invoking "wmake -s libso .../tutorials/incompressibleFluid/airFoil2D/dynamicCode/codedSource"
wmake libso .../tutorials/incompressibleFluid/airFoil2D/dynamicCode/codedSource
    ln: ./lnInclude
    wmkdep: codedFvModelTemplate.C
    Ctoo: codedFvModelTemplate.C
    ld: .../tutorials/incompressibleFluid/airFoil2D/dynamicCode/codedSource/../platforms/linux64GccDPInt32Opt/lib/libcodedSource_6f65e73111d16d16c4c5beca42777e0b41b1d18b.so
.
.
.

Time = 1s

Selecting finite volume model type codedSource
    Name: codedSource
    - selecting all cells
    - selected 10720 cell(s) with volume 10564.5
**codeAddSup**
smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0611362, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 0.0585177, No Iterations 2
GAMG: Solving for p, Initial residual = 1, Final residual = 0.0796943, No Iterations 9
time step continuity errors : sum local = 0.00025243, global = -8.28823e-05, cumulative = -8.28823e-05
smoothSolver: Solving for nuTilda, Initial residual = 1, Final residual = 0.0447475, No Iterations 2
ExecutionTime = 0.195595 s ClockTime = 2 s
.
.
.

Carl Birger Jenssen

2023-08-07 22:12

reporter   ~0013095

Sorry for my mistake. Unfortunately, after I removed the spurious '*/' I still get same error. I also did ./Allclean and removed the old dynamicCode directory.

I have included the new fvModels file

This is the output:

carlbirger@carlbirger-System-Product-Name:~/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D$ foamRun -solver incompressibleFluid
/*---------------------------------------------------------------------------*\
  ========= |
  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
   \\ / O peration | Website: https://openfoam.org
    \\ / A nd | Version: 11
     \\/ M anipulation |
\*---------------------------------------------------------------------------*/
Build : 11-d496a603da00
Exec : foamRun -solver incompressibleFluid
Date : Aug 07 2023
Time : 22:51:47
Host : "carlbirger-System-Product-Name"
PID : 64067
I/O : uncollated
Case : /home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Selecting solver incompressibleFluid
Selecting viscosity model constant
Selecting turbulence model type RAS
Selecting RAS turbulence model SpalartAllmaras
Selecting patchDistMethod meshWave
RAS
{
    model SpalartAllmaras;
    turbulence on;
    printCoeffs on;
    sigmaNut 0.66666;
    kappa 0.41;
    Cb1 0.1355;
    Cb2 0.622;
    Cw2 0.3;
    Cw3 2;
    Cv1 7.1;
    Cs 0.3;
}

No MRF models present

Creating fvModels from "constant/fvModels"

Selecting finite volume model type coded
    Name: codedSource
Using dynamicCode for fvModel:: codedSource at line 18 in "/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource"
Creating new library in "dynamicCode/codedSource/platforms/linux64GccDPInt32Opt/lib/libcodedSource_6f65e73111d16d16c4c5beca42777e0b41b1d18b.so"
"/opt/openfoam11/etc/codeTemplates/dynamicCode/codedFvModelTemplate.C" "/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/dynamicCode/codedSource/codedFvModelTemplate.C"
"/opt/openfoam11/etc/codeTemplates/dynamicCode/codedFvModelTemplate.H" "/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/dynamicCode/codedSource/codedFvModelTemplate.H"
Invoking "wmake -s libso /home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/dynamicCode/codedSource"
wmake libso /home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/dynamicCode/codedSource
    ln: ./lnInclude
    wmkdep: codedFvModelTemplate.C
    Ctoo: codedFvModelTemplate.C
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource: In constructor ‘Foam::fv::codedSourceFvModelvectorSource::codedSourceFvModelvectorSource(const Foam::word&, const Foam::word&, const Foam::fvMesh&, const Foam::dictionary&)’:
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource:95:9: error: expected primary-expression before ‘)’ token
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource: In destructor ‘virtual Foam::fv::codedSourceFvModelvectorSource::~codedSourceFvModelvectorSource()’:
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource:108:9: error: expected primary-expression before ‘)’ token
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource: In member function ‘virtual void Foam::fv::codedSourceFvModelvectorSource::addSup(Foam::fvMatrix<Foam::Vector<double> >&, const Foam::word&) const’:
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource:123:9: error: expected primary-expression before ‘)’ token
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource: In member function ‘virtual void Foam::fv::codedSourceFvModelvectorSource::addSup(const volScalarField&, Foam::fvMatrix<Foam::Vector<double> >&, const Foam::word&) const’:
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource:40:9: error: expected primary-expression before ‘)’ token
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource: In member function ‘virtual void Foam::fv::codedSourceFvModelvectorSource::addSup(const volScalarField&, const volScalarField&, Foam::fvMatrix<Foam::Vector<double> >&, const Foam::word&) const’:
/home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource:46:9: error: expected primary-expression before ‘)’ token
make: *** [/opt/openfoam11/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/codedFvModelTemplate.o] Error 1


--> FOAM FATAL IO ERROR:
Failed wmake "dynamicCode/codedSource/platforms/linux64GccDPInt32Opt/lib/libcodedSource_6f65e73111d16d16c4c5beca42777e0b41b1d18b.so"


file: /home/carlbirger/OpenFOAM/carlbirger-11/run/tutorials/airFoil2D/constant/fvModels/codedSource from line 18 to line 37.

    From function void Foam::codedBase::createLibrary(Foam::dynamicCode&, const Foam::dynamicCodeContext&) const
    in file db/dynamicLibrary/codedBase/codedBase.C at line 209.

FOAM exiting
fvModels-2 (1,038 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvModels;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
codedSource
{
    type            coded;
    field           U;
    selectionMode   all;

    codeInclude
    #{
    #};

    codeAddSup
    #{
        Pout<< "**codeAddSup**" << endl;
    #};
    
    codeAddRhoSup
    #{
        Pout<< "**codeAddRhoSup**" << endl;
    #};
    
    codeAddAlphaRhoSup
    #{
        Pout<< "**codeAddAlphaRhoSup**" << endl;
    #};
}
// ************************************************************************* //
fvModels-2 (1,038 bytes)   

henry

2023-08-07 23:02

manager   ~0013097

You will need this bug-fix:

commit 0e35bc73b538e1d01f18f93795a4b276a071187c
Author: Will Bainbridge <http://cfd.direct>
Date: Wed Jul 12 15:51:33 2023 +0100

    codedFvModel: Fix to substitution of "verbose" setting

Issue History

Date Modified Username Field Change
2023-08-07 18:34 Carl Birger Jenssen New Issue
2023-08-07 18:34 Carl Birger Jenssen File Added: fvModels
2023-08-07 21:12 henry Note Added: 0013094
2023-08-07 22:12 Carl Birger Jenssen Note Added: 0013095
2023-08-07 22:12 Carl Birger Jenssen File Added: fvModels-2
2023-08-07 23:02 henry Note Added: 0013097
2023-08-07 23:09 henry Assigned To => henry
2023-08-07 23:09 henry Status new => closed
2023-08-07 23:09 henry Resolution open => no change required