mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: Added some volatile statements for clang
TODO: need to revisit
This commit is contained in:
@ -1,6 +1,21 @@
|
|||||||
## Known Build Issues (OpenFOAM-v1906)
|
## Known Build Issues (OpenFOAM-v1906)
|
||||||
|
|
||||||
### Intel MPI with Gcc/Clang)
|
### Thermo problems with Clang
|
||||||
|
|
||||||
|
Clang builds required updates to the thermophysical libraries to prevent
|
||||||
|
optimised builds from generating sigFpe's. The changes are wrapped in `#ifdef`
|
||||||
|
`__clang__` statements to not affect other compilers.
|
||||||
|
|
||||||
|
The following tutorials experience known failures:
|
||||||
|
|
||||||
|
- combustion/XiFoam/RAS/moriyoshiHomogeneous
|
||||||
|
- multiphase/reactingTwoPhaseEulerFoam/laminar/bubbleColumnEvaporatingDissolving
|
||||||
|
|
||||||
|
|
||||||
|
This will be further investigated to identify the root cause.
|
||||||
|
|
||||||
|
|
||||||
|
### Intel MPI with Gcc/Clang
|
||||||
|
|
||||||
Either `I_MPI_ROOT` (preferred) or `MPI_ROOT` can be used to specify
|
Either `I_MPI_ROOT` (preferred) or `MPI_ROOT` can be used to specify
|
||||||
the Intel-MPI installation directory path.
|
the Intel-MPI installation directory path.
|
||||||
@ -86,7 +101,7 @@ packages:
|
|||||||
It appears that spack will otherwise ignore any `paraview+qt` version
|
It appears that spack will otherwise ignore any `paraview+qt` version
|
||||||
and attempt to install a `paraview~qt` version instead.
|
and attempt to install a `paraview~qt` version instead.
|
||||||
|
|
||||||
--
|
|
||||||
<!-- Links -->
|
<!-- Links -->
|
||||||
|
|
||||||
[page ParaView]: http://www.paraview.org/
|
[page ParaView]: http://www.paraview.org/
|
||||||
|
|||||||
@ -82,7 +82,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar cp = thermo.Cp(p, T);
|
||||||
|
return cp;
|
||||||
|
#else
|
||||||
return thermo.Cp(p, T);
|
return thermo.Cp(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Cp/Cp []
|
//- Cp/Cp []
|
||||||
@ -104,7 +111,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar ha = thermo.Ha(p, T);
|
||||||
|
return ha;
|
||||||
|
#else
|
||||||
return thermo.Ha(p, T);
|
return thermo.Ha(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Temperature from absolute enthalpy
|
//- Temperature from absolute enthalpy
|
||||||
@ -117,7 +131,14 @@ public:
|
|||||||
const scalar T0
|
const scalar T0
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar tha = thermo.THa(h, p, T0);
|
||||||
|
return tha;
|
||||||
|
#else
|
||||||
return thermo.THa(h, p, T0);
|
return thermo.THa(h, p, T0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -83,7 +83,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar cv = thermo.Cv(p, T);
|
||||||
|
return cv;
|
||||||
|
#else
|
||||||
return thermo.Cv(p, T);
|
return thermo.Cv(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Cp/Cv []
|
//- Cp/Cv []
|
||||||
@ -94,7 +101,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar gamma = thermo.gamma(p, T);
|
||||||
|
return gamma;
|
||||||
|
#else
|
||||||
return thermo.gamma(p, T);
|
return thermo.gamma(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Absolute internal energy [J/kg]
|
// Absolute internal energy [J/kg]
|
||||||
@ -105,7 +119,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar ea = thermo.Ea(p, T);
|
||||||
|
return ea;
|
||||||
|
#else
|
||||||
return thermo.Ea(p, T);
|
return thermo.Ea(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Temperature from absolute internal energy
|
//- Temperature from absolute internal energy
|
||||||
@ -118,7 +139,14 @@ public:
|
|||||||
const scalar T0
|
const scalar T0
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar tea = thermo.TEa(e, p, T0);
|
||||||
|
return tea;
|
||||||
|
#else
|
||||||
return thermo.TEa(e, p, T0);
|
return thermo.TEa(e, p, T0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public:
|
|||||||
return "h";
|
return "h";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heat capacity at constant pressure [J/(kg K)]
|
//- Heat capacity at constant pressure [J/(kg K)]
|
||||||
scalar Cpv
|
scalar Cpv
|
||||||
(
|
(
|
||||||
const Thermo& thermo,
|
const Thermo& thermo,
|
||||||
@ -82,7 +82,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar cp = thermo.Cp(p, T);
|
||||||
|
return cp;
|
||||||
|
#else
|
||||||
return thermo.Cp(p, T);
|
return thermo.Cp(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Cp/Cp []
|
//- Cp/Cp []
|
||||||
@ -96,7 +103,7 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sensible enthalpy [J/kg]
|
//- Sensible enthalpy [J/kg]
|
||||||
scalar HE
|
scalar HE
|
||||||
(
|
(
|
||||||
const Thermo& thermo,
|
const Thermo& thermo,
|
||||||
@ -104,7 +111,14 @@ public:
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar hs = thermo.Hs(p, T);
|
||||||
|
return hs;
|
||||||
|
#else
|
||||||
return thermo.Hs(p, T);
|
return thermo.Hs(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Temperature from sensible enthalpy
|
//- Temperature from sensible enthalpy
|
||||||
@ -117,7 +131,14 @@ public:
|
|||||||
const scalar T0
|
const scalar T0
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
// Using volatile to prevent compiler optimisations leading to
|
||||||
|
// a sigfpe
|
||||||
|
volatile const scalar ths = thermo.THs(h, p, T0);
|
||||||
|
return ths;
|
||||||
|
#else
|
||||||
return thermo.THs(h, p, T0);
|
return thermo.THs(h, p, T0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,13 @@ inline scalar Cp
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar cv = Cv(p, T);
|
||||||
|
volatile const scalar cpmcv = EquationOfState::CpMCv(p, T);
|
||||||
|
return cv + cpmcv;
|
||||||
|
#else
|
||||||
return Cv(p, T) + EquationOfState::CpMCv(p, T);
|
return Cv(p, T) + EquationOfState::CpMCv(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scalar Hs
|
inline scalar Hs
|
||||||
@ -13,7 +19,13 @@ inline scalar Hs
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar es = Es(p, T);
|
||||||
|
volatile const scalar rho = EquationOfState::rho(p, T);
|
||||||
|
return es + p/rho;
|
||||||
|
#else
|
||||||
return Es(p, T) + p/EquationOfState::rho(p, T);
|
return Es(p, T) + p/EquationOfState::rho(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scalar Ha
|
inline scalar Ha
|
||||||
@ -22,5 +34,11 @@ inline scalar Ha
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar ea = Ea(p, T);
|
||||||
|
volatile const scalar rho = EquationOfState::rho(p, T);
|
||||||
|
return ea + p/rho;
|
||||||
|
#else
|
||||||
return Ea(p, T) + p/EquationOfState::rho(p, T);
|
return Ea(p, T) + p/EquationOfState::rho(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,13 @@ inline scalar Cv
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar cp = Cp(p, T);
|
||||||
|
volatile const scalar cpmcv = EquationOfState::CpMCv(p, T);
|
||||||
|
return cp - cpmcv;
|
||||||
|
#else
|
||||||
return Cp(p, T) - EquationOfState::CpMCv(p, T);
|
return Cp(p, T) - EquationOfState::CpMCv(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scalar Es
|
inline scalar Es
|
||||||
@ -13,7 +19,13 @@ inline scalar Es
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar hs = Hs(p, T);
|
||||||
|
volatile const scalar rho = EquationOfState::rho(p, T);
|
||||||
|
return hs - p/rho;
|
||||||
|
#else
|
||||||
return Hs(p, T) - p/EquationOfState::rho(p, T);
|
return Hs(p, T) - p/EquationOfState::rho(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline scalar Ea
|
inline scalar Ea
|
||||||
@ -22,5 +34,11 @@ inline scalar Ea
|
|||||||
const scalar T
|
const scalar T
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar ha = Ha(p, T);
|
||||||
|
volatile const scalar rho = EquationOfState::rho(p, T);
|
||||||
|
return ha - p/rho;
|
||||||
|
#else
|
||||||
return Ha(p, T) - p/EquationOfState::rho(p, T);
|
return Ha(p, T) - p/EquationOfState::rho(p, T);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,7 +118,12 @@ template<class Thermo, template<class> class Type>
|
|||||||
inline Foam::scalar
|
inline Foam::scalar
|
||||||
Foam::species::thermo<Thermo, Type>::gamma(const scalar p, const scalar T) const
|
Foam::species::thermo<Thermo, Type>::gamma(const scalar p, const scalar T) const
|
||||||
{
|
{
|
||||||
|
#ifdef __clang__
|
||||||
|
volatile const scalar Cp = this->Cp(p, T);
|
||||||
|
#else
|
||||||
const scalar Cp = this->Cp(p, T);
|
const scalar Cp = this->Cp(p, T);
|
||||||
|
#endif
|
||||||
|
|
||||||
return Cp/(Cp - this->CpMCv(p, T));
|
return Cp/(Cp - this->CpMCv(p, T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user