diff --git a/src/finiteArea/Make/files b/src/finiteArea/Make/files
index e13cd3d344..fd0d7f92a9 100644
--- a/src/finiteArea/Make/files
+++ b/src/finiteArea/Make/files
@@ -55,7 +55,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
diff --git a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H
index 8f6a2db48e..8a861d4549 100644
--- a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H
+++ b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchField.H
@@ -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
(
diff --git a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFieldsFwd.H b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFieldsFwd.H
deleted file mode 100644
index 3b9a128c73..0000000000
--- a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFieldsFwd.H
+++ /dev/null
@@ -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 .
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef transformFaPatchFieldsFwd_H
-#define transformFaPatchFieldsFwd_H
-
-#include "fieldTypes.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-template class transformFaPatchField;
-
-// typedef transformFaPatchField transformFaPatchScalarField;
-// typedef transformFaPatchField transformFaPatchVectorField;
-// typedef transformFaPatchField transformFaPatchTensorField;
-
-// template class transformFaPatchField;
-
-makeFaPatchTypeFieldTypedefs(transform)
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C
index 30039b895f..be981c5518 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C
+++ b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C
@@ -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::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::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);
}
diff --git a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H
index 63da81ed38..23800ce051 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H
+++ b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.H
@@ -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
(
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C
index 613fd7ce57..3649700be4 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C
+++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C
@@ -130,13 +130,6 @@ Foam::processorFaPatchField::processorFaPatchField
{}
-// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
-
-template
-Foam::processorFaPatchField::~processorFaPatchField()
-{}
-
-
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
@@ -203,6 +196,8 @@ void Foam::processorFaPatchField::initInterfaceMatrixUpdate
commsType,
this->patch().patchInternalField(psiInternal)()
);
+
+ const_cast&>(*this).updatedMatrix() = false;
}
@@ -219,32 +214,28 @@ void Foam::processorFaPatchField::updateInterfaceMatrix
const Pstream::commsTypes commsType
) const
{
+ if (this->updatedMatrix())
+ {
+ return;
+ }
+
+ const labelUList& faceCells = this->patch().edgeFaces();
+
solveScalarField pnf
(
- procPatch_.receive(commsType, this->size())()
+ procPatch_.receive(commsType, this->size())
);
- // Transform according to the transformation tensor
- transformCoupleField(pnf, cmpt);
+ if (!std::is_arithmetic::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&>(*this).updatedMatrix() = true;
}
@@ -265,6 +256,8 @@ void Foam::processorFaPatchField::initInterfaceMatrixUpdate
commsType,
this->patch().patchInternalField(psiInternal)()
);
+
+ const_cast&>(*this).updatedMatrix() = false;
}
@@ -280,29 +273,25 @@ void Foam::processorFaPatchField::updateInterfaceMatrix
const Pstream::commsTypes commsType
) const
{
+ if (this->updatedMatrix())
+ {
+ return;
+ }
+
+ const labelUList& faceCells = this->patch().edgeFaces();
+
Field pnf
(
- procPatch_.receive(commsType, this->size())()
+ procPatch_.receive(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&>(*this).updatedMatrix() = true;
}
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H
index 10d01e42a1..cdc8a0e0ce 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H
+++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H
@@ -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> 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
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H
index 3ac8610d4b..7b3fe7ca53 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H
+++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H
@@ -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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFieldsFwd.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFieldsFwd.H
deleted file mode 100644
index 05670667a2..0000000000
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFieldsFwd.H
+++ /dev/null
@@ -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 .
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef processorFaPatchFieldsFwd_H
-#define processorFaPatchFieldsFwd_H
-
-#include "fieldTypes.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-template class processorFaPatchField;
-
-makeFaPatchTypeFieldTypedefs(processor)
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C
deleted file mode 100644
index 65a9edb7f4..0000000000
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C
+++ /dev/null
@@ -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 .
-
-\*---------------------------------------------------------------------------*/
-
-#include "processorFaPatchScalarField.H"
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-template<>
-void Foam::processorFaPatchField::transformCoupleField
-(
- solveScalarField& f,
- const direction cmpt
-) const
-{}
-
-
-template<>
-void Foam::processorFaPatchField::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::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(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];
- }
- }
-}
-
-
-// ************************************************************************* //
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.H
deleted file mode 100644
index a7227f5de2..0000000000
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.H
+++ /dev/null
@@ -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 .
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef processorFaPatchScalarField_H
-#define processorFaPatchScalarField_H
-
-#include "processorFaPatchField.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-template<>
-void processorFaPatchField::transformCoupleField
-(
- solveScalarField& f,
- const direction cmpt
-) const;
-
-
-template<>
-void processorFaPatchField::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::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
-
-// ************************************************************************* //