Skip to content

Macro FatalIOErrorInLookup does not work in surfaceInterpolationScheme.C

Summary

A program does not print a list of available surfaceInterpolationSchemes in case of wrong input parameters.

Steps to reproduce

Fill system/fvSchemes with

divSchemes
{
    default         Gauss unknown;
}

Then, the debug output is as follows:

    From static Foam::tmp<Foam::fv::divScheme<Type> > Foam::fv::divScheme<Type>::New(const Foam::fvMesh&, Foam::Istream&) [with Type = Foam::Vector<double>]
    in file /opt/OpenFOAM/OpenFOAM-v2006/src/finiteVolume/lnInclude/divScheme.C at line 56
    Constructing divScheme<Type>

    From static Foam::tmp<Foam::surfaceInterpolationScheme<Type> > Foam::surfaceInterpolationScheme<Type>::New(const Foam::fvMesh&, Foam::Istream&) [with Type = Foam::Vector<double>]
    in file lnInclude/surfaceInterpolationScheme.C at line 58
    Discretisation scheme = unknown


--> FOAM FATAL ERROR:


FOAM exiting

Example case

What is the current bug behaviour?

There is no list of registered schemes.

What is the expected correct behavior?

--> FOAM FATAL IO ERROR:
Unknown discretisation scheme unknown

Valid schemes are :
61
(
CoBlended
Gamma
...

Relevant logs and/or images

Environment information

  • OpenFOAM version : newer than v1912
  • Operating system :
  • Hardware info :
  • Compiler :

Possible fixes

The bug was introduced in this commit.

To fix the bug, the following code from surfaceInterpolationScheme.C

        FatalIOErrorInLookup
        (
            schemeData,
            "discretisation",
            schemeName,
            *MeshConstructorTablePtr_
        ) << exit(FatalError);

can be replaced by

        FatalIOErrorInLookup
        (
            schemeData,
            "discretisation",
            schemeName,
            *MeshConstructorTablePtr_
        ) << exit(FatalIOError);