COMP: Added some volatile statements for clang
TODO: need to revisit
This commit is contained in:
parent
3800ed8dd7
commit
469c9ff078
@ -1,6 +1,21 @@
|
||||
## 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
|
||||
the Intel-MPI installation directory path.
|
||||
@ -86,7 +101,7 @@ packages:
|
||||
It appears that spack will otherwise ignore any `paraview+qt` version
|
||||
and attempt to install a `paraview~qt` version instead.
|
||||
|
||||
--
|
||||
|
||||
<!-- Links -->
|
||||
|
||||
[page ParaView]: http://www.paraview.org/
|
||||
|
@ -82,7 +82,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
//- Cp/Cp []
|
||||
@ -104,7 +111,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
//- Temperature from absolute enthalpy
|
||||
@ -117,7 +131,14 @@ public:
|
||||
const scalar T0
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
//- Cp/Cv []
|
||||
@ -94,7 +101,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Absolute internal energy [J/kg]
|
||||
@ -105,7 +119,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
//- Temperature from absolute internal energy
|
||||
@ -118,7 +139,14 @@ public:
|
||||
const scalar T0
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
return "h";
|
||||
}
|
||||
|
||||
// Heat capacity at constant pressure [J/(kg K)]
|
||||
//- Heat capacity at constant pressure [J/(kg K)]
|
||||
scalar Cpv
|
||||
(
|
||||
const Thermo& thermo,
|
||||
@ -82,7 +82,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
//- Cp/Cp []
|
||||
@ -96,7 +103,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Sensible enthalpy [J/kg]
|
||||
//- Sensible enthalpy [J/kg]
|
||||
scalar HE
|
||||
(
|
||||
const Thermo& thermo,
|
||||
@ -104,7 +111,14 @@ public:
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
//- Temperature from sensible enthalpy
|
||||
@ -117,7 +131,14 @@ public:
|
||||
const scalar T0
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,13 @@ inline scalar Cp
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline scalar Hs
|
||||
@ -13,7 +19,13 @@ inline scalar Hs
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline scalar Ha
|
||||
@ -22,5 +34,11 @@ inline scalar Ha
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
@ -4,7 +4,13 @@ inline scalar Cv
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline scalar Es
|
||||
@ -13,7 +19,13 @@ inline scalar Es
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline scalar Ea
|
||||
@ -22,5 +34,11 @@ inline scalar Ea
|
||||
const scalar T
|
||||
) 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);
|
||||
#endif
|
||||
}
|
||||
|
@ -118,7 +118,12 @@ template<class Thermo, template<class> class Type>
|
||||
inline Foam::scalar
|
||||
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);
|
||||
#endif
|
||||
|
||||
return Cp/(Cp - this->CpMCv(p, T));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user