Compare commits

...

3 Commits

Author SHA1 Message Date
d3a079b4da COMP: g++11: suppress optimisation. See #3024 2024-01-19 20:52:34 +01:00
177176c5ff BUG: particle: use correct celli. Fixes #1992
Was checking the old celli instead of the result of
re-finding the position. See also Foundation commit 50a965f8866683a81d79cbc7811af7333baf9d10.
2023-10-10 15:40:47 +01:00
53feaf2560 BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:39:16 +02:00
3 changed files with 51 additions and 23 deletions

View File

@ -513,6 +513,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::T() const
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
{
@ -536,6 +540,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Foam::Tensor<Cmpt>
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
{
@ -970,6 +978,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
//- Inner-product of a SphericalTensor and a Tensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{
@ -984,6 +996,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SphericalTensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
{
@ -998,6 +1014,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
//- Inner-product of a SymmTensor and a Tensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
{
@ -1020,6 +1040,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
//- Inner-product of a Tensor and a SymmTensor
template<class Cmpt>
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Tensor<Cmpt>
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
{
@ -1046,7 +1070,7 @@ template<class Cmpt>
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline typename innerProduct<Tensor<Cmpt>, Vector<Cmpt>>::type
inline Vector<Cmpt>
operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
{
return Vector<Cmpt>
@ -1060,7 +1084,11 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
//- Inner-product of a Vector and a Tensor
template<class Cmpt>
inline typename innerProduct<Vector<Cmpt>, Tensor<Cmpt>>::type
#if defined(__GNUC__) && !defined(__clang__)
// Workaround for gcc (11+) that fails to handle tensor dot vector
__attribute__((optimize("no-tree-vectorize")))
#endif
inline Vector<Cmpt>
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
{
return Vector<Cmpt>

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -415,21 +415,21 @@ void Foam::particle::locate
{
if (debug)
{
Info << "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
Pout<< "Particle " << origId() << nl << FUNCTION_NAME << nl << endl;
}
celli_ = celli;
// Find the cell, if it has not been given
if (celli < 0)
if (celli_ < 0)
{
celli_ = mesh_.cellTree().findInside(position);
}
if (celli < 0)
{
FatalErrorInFunction
<< "Cell not found for particle position " << position << "."
<< exit(FatalError);
if (celli_ < 0)
{
FatalErrorInFunction
<< "Cell not found for particle position " << position << "."
<< exit(FatalError);
}
}
const vector displacement = position - mesh_.cellCentres()[celli_];
@ -811,10 +811,10 @@ Foam::scalar Foam::particle::trackToStationaryTri
if (debug)
{
Info << "Step Fraction : " << stepFraction_ << endl;
Info << "fraction*muH*detA : " << fraction*muH*detA << endl;
Info << "static muH : " << muH << endl;
Info << "origId() : " << origId() << endl;
Pout << "Step Fraction : " << stepFraction_ << endl;
Pout << "fraction*muH*detA : " << fraction*muH*detA << endl;
Pout << "static muH : " << muH << endl;
Pout << "origId() : " << origId() << endl;
}
// Accumulate displacement behind
@ -864,7 +864,7 @@ Foam::scalar Foam::particle::trackToMovingTri
{
Pair<vector> o, b, v1, v2;
movingTetGeometry(fraction, o, b, v1, v2);
Info<< "Tet points o=" << o[0] << ", b=" << b[0]
Pout<< "Tet points o=" << o[0] << ", b=" << b[0]
<< ", v1=" << v1[0] << ", v2=" << v2[0] << endl
<< "Tet determinant = " << detA[0] << endl
<< "Start local coordinates = " << y0[0] << endl;
@ -895,10 +895,10 @@ Foam::scalar Foam::particle::trackToMovingTri
{
for (label i = 0; i < 4; ++ i)
{
Info<< (i ? " " : "Hit equation ") << i << " = "
Pout<< (i ? " " : "Hit equation ") << i << " = "
<< hitEqn[i] << endl;
}
Info<< " DetA equation = " << detA << endl;
Pout<< " DetA equation = " << detA << endl;
}
// Calculate the hit fraction
@ -927,12 +927,12 @@ Foam::scalar Foam::particle::trackToMovingTri
);
const scalar detAH = detAEqn.value(mu[j]);
Info<< "Hit on tet face " << i << " at local coordinate "
Pout<< "Hit on tet face " << i << " at local coordinate "
<< (std::isnormal(detAH) ? name(yH/detAH) : "???")
<< ", " << mu[j]*detA[0]*100 << "% of the "
<< "way along the track" << endl;
Info<< "derivative : " << hitEqn[i].derivative(mu[j]) << nl
Pout<< "derivative : " << hitEqn[i].derivative(mu[j]) << nl
<< " coord " << j << " mu[j]: " << mu[j] << nl
<< " hitEq " << i << endl;
}

View File

@ -843,15 +843,15 @@ Foam::meshToMesh::mapTgtToSrc
label srcPatchi = srcPatchID_[i];
label tgtPatchi = tgtPatchID_[i];
if (!srcPatchFields.set(tgtPatchi))
if (!srcPatchFields.set(srcPatchi))
{
srcPatchFields.set
(
srcPatchi,
fvPatchField<Type>::New
(
tgtBfld[srcPatchi],
srcMesh.boundary()[tgtPatchi],
tgtBfld[tgtPatchi],
srcMesh.boundary()[srcPatchi],
DimensionedField<Type, volMesh>::null(),
directFvPatchFieldMapper
(