BUG: inconsistent finiteArea proc-boundary contributions (fixes #2672)
This commit is contained in:
parent
8993af73ac
commit
d0151570a1
@ -53,7 +53,6 @@ $(basicFaPatchFields)/transform/transformFaPatchScalarField.C
|
||||
constraintFaPatchFields = $(faPatchFields)/constraint
|
||||
$(constraintFaPatchFields)/empty/emptyFaPatchFields.C
|
||||
$(constraintFaPatchFields)/processor/processorFaPatchFields.C
|
||||
$(constraintFaPatchFields)/processor/processorFaPatchScalarField.C
|
||||
$(constraintFaPatchFields)/wedge/wedgeFaPatchFields.C
|
||||
$(constraintFaPatchFields)/wedge/wedgeFaPatchScalarField.C
|
||||
$(constraintFaPatchFields)/cyclic/cyclicFaPatchFields.C
|
||||
|
@ -181,13 +181,6 @@ public:
|
||||
|
||||
// Coupled interface functionality
|
||||
|
||||
//- Transform given patch component field
|
||||
virtual void transformCoupleField
|
||||
(
|
||||
solveScalarField& f,
|
||||
const direction cmpt
|
||||
) const = 0;
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
virtual void updateInterfaceMatrix
|
||||
(
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef transformFaPatchFieldsFwd_H
|
||||
#define transformFaPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class transformFaPatchField;
|
||||
|
||||
// typedef transformFaPatchField<scalar> transformFaPatchScalarField;
|
||||
// typedef transformFaPatchField<vector> transformFaPatchVectorField;
|
||||
// typedef transformFaPatchField<tensor> transformFaPatchTensorField;
|
||||
|
||||
// template<class Type> class transformFaPatchField;
|
||||
|
||||
makeFaPatchTypeFieldTypedefs(transform)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -187,20 +187,7 @@ void Foam::cyclicFaPatchField<Type>::updateInterfaceMatrix
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
if (add)
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
}
|
||||
|
||||
|
||||
@ -227,21 +214,11 @@ void Foam::cyclicFaPatchField<Type>::updateInterfaceMatrix
|
||||
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
|
||||
}
|
||||
|
||||
// Transform according to the transformation tensors
|
||||
transformCoupleField(pnf);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
if (add)
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] += coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,16 +164,6 @@ public:
|
||||
|
||||
// Coupled interface functionality
|
||||
|
||||
//- Transform neighbour field
|
||||
virtual void transformCoupleField
|
||||
(
|
||||
solveScalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
cyclicLduInterfaceField::transformCoupleField(f, cmpt);
|
||||
}
|
||||
|
||||
//- Update result field based on interface functionality
|
||||
virtual void updateInterfaceMatrix
|
||||
(
|
||||
|
@ -130,13 +130,6 @@ Foam::processorFaPatchField<Type>::processorFaPatchField
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::processorFaPatchField<Type>::~processorFaPatchField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -203,6 +196,8 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
|
||||
commsType,
|
||||
this->patch().patchInternalField(psiInternal)()
|
||||
);
|
||||
|
||||
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = false;
|
||||
}
|
||||
|
||||
|
||||
@ -219,32 +214,28 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
if (this->updatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const labelUList& faceCells = this->patch().edgeFaces();
|
||||
|
||||
solveScalarField pnf
|
||||
(
|
||||
procPatch_.receive<solveScalar>(commsType, this->size())()
|
||||
procPatch_.receive<solveScalar>(commsType, this->size())
|
||||
);
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(pnf, cmpt);
|
||||
if (!std::is_arithmetic<Type>::value)
|
||||
{
|
||||
// Transform non-scalar data according to the transformation tensor
|
||||
transformCoupleField(pnf, cmpt);
|
||||
}
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
|
||||
const labelUList& edgeFaces = this->patch().edgeFaces();
|
||||
|
||||
if (add)
|
||||
{
|
||||
forAll(edgeFaces, elemI)
|
||||
{
|
||||
result[edgeFaces[elemI]] += coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(edgeFaces, elemI)
|
||||
{
|
||||
result[edgeFaces[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = true;
|
||||
}
|
||||
|
||||
|
||||
@ -265,6 +256,8 @@ void Foam::processorFaPatchField<Type>::initInterfaceMatrixUpdate
|
||||
commsType,
|
||||
this->patch().patchInternalField(psiInternal)()
|
||||
);
|
||||
|
||||
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = false;
|
||||
}
|
||||
|
||||
|
||||
@ -280,29 +273,25 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
if (this->updatedMatrix())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const labelUList& faceCells = this->patch().edgeFaces();
|
||||
|
||||
Field<Type> pnf
|
||||
(
|
||||
procPatch_.receive<Type>(commsType, this->size())()
|
||||
procPatch_.receive<Type>(commsType, this->size())
|
||||
);
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
transformCoupleField(pnf);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
this->addToInternalField(result, !add, faceCells, coeffs, pnf);
|
||||
|
||||
const labelUList& edgeFaces = this->patch().edgeFaces();
|
||||
|
||||
if (add)
|
||||
{
|
||||
forAll(edgeFaces, elemI)
|
||||
{
|
||||
result[edgeFaces[elemI]] += coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(edgeFaces, elemI)
|
||||
{
|
||||
result[edgeFaces[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
}
|
||||
}
|
||||
const_cast<processorFaPatchField<Type>&>(*this).updatedMatrix() = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,8 +38,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFaPatchField_H
|
||||
#define processorFaPatchField_H
|
||||
#ifndef Foam_processorFaPatchField_H
|
||||
#define Foam_processorFaPatchField_H
|
||||
|
||||
#include "coupledFaPatchField.H"
|
||||
#include "processorLduInterfaceField.H"
|
||||
@ -139,9 +139,8 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~processorFaPatchField();
|
||||
//- Destructor
|
||||
~processorFaPatchField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -169,17 +168,8 @@ public:
|
||||
//- Return patch-normal gradient
|
||||
virtual tmp<Field<Type>> snGrad() const;
|
||||
|
||||
// Coupled interface functionality
|
||||
|
||||
//- Transform neighbour field
|
||||
virtual void transformCoupleField
|
||||
(
|
||||
solveScalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
processorLduInterfaceField::transformCoupleField(f, cmpt);
|
||||
}
|
||||
// Coupled interface functionality
|
||||
|
||||
//- Initialise neighbour matrix update
|
||||
virtual void initInterfaceMatrixUpdate
|
||||
|
@ -25,10 +25,10 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFaPatchFields_H
|
||||
#define processorFaPatchFields_H
|
||||
#ifndef Foam_processorFaPatchFields_H
|
||||
#define Foam_processorFaPatchFields_H
|
||||
|
||||
#include "processorFaPatchScalarField.H"
|
||||
#include "processorFaPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFaPatchFieldsFwd_H
|
||||
#define processorFaPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class processorFaPatchField;
|
||||
|
||||
makeFaPatchTypeFieldTypedefs(processor)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
@ -1,100 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorFaPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
void Foam::processorFaPatchField<Foam::scalar>::transformCoupleField
|
||||
(
|
||||
solveScalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::processorFaPatchField<Foam::scalar>::initInterfaceMatrixUpdate
|
||||
(
|
||||
solveScalarField& result,
|
||||
const bool add,
|
||||
const lduAddressing& lduAddr,
|
||||
const label patchId,
|
||||
const solveScalarField& psiInternal,
|
||||
const scalarField& coeffs,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
patch().patchInternalField(psiInternal)()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::processorFaPatchField<Foam::scalar>::updateInterfaceMatrix
|
||||
(
|
||||
solveScalarField& result,
|
||||
const bool add,
|
||||
const lduAddressing& lduAddr,
|
||||
const label patchId,
|
||||
const solveScalarField&,
|
||||
const scalarField& coeffs,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
solveScalarField pnf
|
||||
(
|
||||
procPatch_.receive<solveScalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
const labelUList& edgeFaces = patch().edgeFaces();
|
||||
|
||||
if (add)
|
||||
{
|
||||
forAll(edgeFaces, facei)
|
||||
{
|
||||
result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(edgeFaces, facei)
|
||||
{
|
||||
result[edgeFaces[facei]] -= coeffs[facei]*pnf[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -1,86 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFaPatchScalarField_H
|
||||
#define processorFaPatchScalarField_H
|
||||
|
||||
#include "processorFaPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
void processorFaPatchField<scalar>::transformCoupleField
|
||||
(
|
||||
solveScalarField& f,
|
||||
const direction cmpt
|
||||
) const;
|
||||
|
||||
|
||||
template<>
|
||||
void processorFaPatchField<scalar>::initInterfaceMatrixUpdate
|
||||
(
|
||||
solveScalarField& result,
|
||||
const bool add,
|
||||
const lduAddressing& lduAddr,
|
||||
const label patchId,
|
||||
const solveScalarField&,
|
||||
const scalarField& coeffs,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const;
|
||||
|
||||
|
||||
template<>
|
||||
void processorFaPatchField<scalar>::updateInterfaceMatrix
|
||||
(
|
||||
solveScalarField& result,
|
||||
const bool add,
|
||||
const lduAddressing& lduAddr,
|
||||
const label patchId,
|
||||
const solveScalarField&,
|
||||
const scalarField& coeffs,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user