Blog

Fri Mar 13, 2026 : OpenFOAM(R) field names

Recently, there was a problem with units:

--> FOAM FATAL ERROR: (openfoam-2312)
Different dimensions for '(a = b)'
     dimensions : [0 2 -1 0 0 0 0] != [1 -1 -1 0 0 0 0]

Obviously, the problem is with the division by density, and it is located in

#5  Foam::EddyDiffusivity<Foam::ThermalDiffusivity<Foam::CompressibleTurbulenceModel<Foam::multiphaseInter::multiphaseSystem> > >::correctNut()

So, it seems, the problem is with the nut units. Yet, at a closer analysis, the problem was with the field alphat:

template<class BasicTurbulenceModel>
void Foam::EddyDiffusivity<BasicTurbulenceModel>::correctNut()
{
    // Read Prt if provided
    Prt_ = dimensionedScalar("Prt", dimless, 1.0, this->coeffDict());
    alphat_ = this->rho_*this->nut()/Prt_;
    alphat_.correctBoundaryConditions();
}

However, if we consider nut as a diffusivity of momentum and alphat as a diffusivity of heat, we can call alphatnut”.

Sun Mar 1, 2026 : OpenFOAM(R) warnings with modern compilers

Newer compiler versions add different warnings to -Wall and this leads to unexpected warnings during compilation:

...
DiagonalMatrix.H:82:38: attention: template-id n'est pas permis pour un constructeur en C++20 [-Wtemplate-id-cdtor]
   82 |         explicit DiagonalMatrix<Type>(const label n);
...

To avoid this behaviour we can add warning-suppression flags to the Make/options file in the includes section. This can create nuances if we compile the project with older compilers, they issue warnings about unknown flags.

So, FOAM_EXTRA_CXXFLAGS can help us. For example, on openSUSE LEAP 16 with gcc 15.1.1 this line in ~/.OpenFOAM/prefs.sh:

export FOAM_EXTRA_CXXFLAGS="-Wno-template-id-cdtor -Wno-dangling-reference -Wno-overloaded-virtual"

removes irrelevant warnings.

Archive