diff --git a/applications/test/LduMatrix/LduMatrixTest3.C b/applications/test/LduMatrix/LduMatrixTest3.C
index 22d44bd2d0..596559e6a7 100644
--- a/applications/test/LduMatrix/LduMatrixTest3.C
+++ b/applications/test/LduMatrix/LduMatrixTest3.C
@@ -88,7 +88,7 @@ int main(int argc, char *argv[])
"{"
" solver PBiCG;"
" preconditioner DILU;"
- " tolerance (1e-13 1e-13 1e-13);"
+ " tolerance (1e-5 1e-5 1);"
" relTol (0 0 0);"
"}"
)()
diff --git a/applications/test/PisoFoam/Make/files b/applications/test/PisoFoam/Make/files
new file mode 100644
index 0000000000..340f8016c2
--- /dev/null
+++ b/applications/test/PisoFoam/Make/files
@@ -0,0 +1,3 @@
+PisoFoam.C
+
+EXE = $(FOAM_USER_APPBIN)/PisoFoam
diff --git a/applications/test/PisoFoam/Make/options b/applications/test/PisoFoam/Make/options
new file mode 100644
index 0000000000..259f95f7b9
--- /dev/null
+++ b/applications/test/PisoFoam/Make/options
@@ -0,0 +1,13 @@
+EXE_INC = \
+ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
+ -I$(LIB_SRC)/transportModels \
+ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
+ -I$(LIB_SRC)/finiteVolume/lnInclude
+
+EXE_LIBS = \
+ -lincompressibleTurbulenceModel \
+ -lincompressibleRASModels \
+ -lincompressibleLESModels \
+ -lincompressibleTransportModels \
+ -lfiniteVolume \
+ -lmeshTools
diff --git a/applications/test/PisoFoam/PisoFoam.C b/applications/test/PisoFoam/PisoFoam.C
new file mode 100644
index 0000000000..a3ea54b568
--- /dev/null
+++ b/applications/test/PisoFoam/PisoFoam.C
@@ -0,0 +1,191 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+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 .
+
+Application
+ pisoFoam
+
+Description
+ Transient solver for incompressible flow.
+
+ Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
+
+\*---------------------------------------------------------------------------*/
+
+#include "fvCFD.H"
+#include "singlePhaseTransportModel.H"
+#include "turbulenceModel.H"
+
+#include "LduMatrix.H"
+#include "diagTensorField.H"
+
+typedef LduMatrix lduVectorMatrix;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+int main(int argc, char *argv[])
+{
+ #include "setRootCase.H"
+
+ #include "createTime.H"
+ #include "createMesh.H"
+ #include "createFields.H"
+ #include "initContinuityErrs.H"
+
+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ Info<< "\nStarting time loop\n" << endl;
+
+ while (runTime.loop())
+ {
+ Info<< "Time = " << runTime.timeName() << nl << endl;
+
+ #include "readPISOControls.H"
+ #include "CourantNo.H"
+
+ // Pressure-velocity PISO corrector
+ {
+ // Momentum predictor
+
+ fvVectorMatrix UEqn
+ (
+ fvm::ddt(U)
+ + fvm::div(phi, U)
+ + turbulence->divDevReff(U)
+ );
+
+ //UEqn.relax();
+
+ fvVectorMatrix UEqnp(UEqn == -fvc::grad(p));
+
+ lduVectorMatrix U3Eqnp(mesh);
+ U3Eqnp.diag() = UEqnp.diag();
+ U3Eqnp.upper() = UEqnp.upper();
+ U3Eqnp.lower() = UEqnp.lower();
+ U3Eqnp.source() = UEqnp.source();
+
+ UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0);
+ UEqnp.addBoundarySource(U3Eqnp.source(), false);
+
+ U3Eqnp.interfaces() = U.boundaryField().interfaces();
+ U3Eqnp.interfacesUpper() = UEqnp.boundaryCoeffs().component(0);
+ U3Eqnp.interfacesLower() = UEqnp.internalCoeffs().component(0);
+
+ autoPtr U3EqnpSolver =
+ lduVectorMatrix::solver::New
+ (
+ U.name(),
+ U3Eqnp,
+ dictionary
+ (
+ IStringStream
+ (
+ "{"
+ " /*solver SmoothSolver;*/"
+ " smoother GaussSeidel;"
+ " solver PBiCCCG;"
+ " preconditioner DILU;"
+ " tolerance (1e-7 1e-7 1);"
+ " relTol (0 0 0);"
+ "}"
+ )()
+ )
+ );
+
+ //for (int i=0; i<3; i++)
+ {
+ U3EqnpSolver->solve(U).print(Info);
+ U.correctBoundaryConditions();
+ }
+ //solve(UEqnp);
+
+ // --- PISO loop
+
+ for (int corr=0; corrcorrect();
+
+ runTime.write();
+
+ Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
+ << " ClockTime = " << runTime.elapsedClockTime() << " s"
+ << nl << endl;
+ }
+
+ Info<< "End\n" << endl;
+
+ return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/PisoFoam/createFields.H b/applications/test/PisoFoam/createFields.H
new file mode 100644
index 0000000000..7cae304f6f
--- /dev/null
+++ b/applications/test/PisoFoam/createFields.H
@@ -0,0 +1,42 @@
+ Info<< "Reading field p\n" << endl;
+ volScalarField p
+ (
+ IOobject
+ (
+ "p",
+ runTime.timeName(),
+ mesh,
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ mesh
+ );
+
+ Info<< "Reading field U\n" << endl;
+ volVectorField U
+ (
+ IOobject
+ (
+ "U",
+ runTime.timeName(),
+ mesh,
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ mesh
+ );
+
+# include "createPhi.H"
+
+
+ label pRefCell = 0;
+ scalar pRefValue = 0.0;
+ setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
+
+
+ singlePhaseTransportModel laminarTransport(U, phi);
+
+ autoPtr turbulence
+ (
+ incompressible::turbulenceModel::New(U, phi, laminarTransport)
+ );
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index d32d9c82e0..3c054e2bfd 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -316,6 +316,7 @@ meshes/lduMesh/lduMesh.C
LduMatrix = matrices/LduMatrix
$(LduMatrix)/LduMatrix/lduMatrices.C
+$(LduMatrix)/LduMatrix/LduInterfaceField/LduInterfaceFields.C
$(LduMatrix)/Smoothers/lduSmoothers.C
$(LduMatrix)/Preconditioners/lduPreconditioners.C
$(LduMatrix)/Solvers/lduSolvers.C
diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C
index 9397411ec4..c26227cd00 100644
--- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C
+++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.C
@@ -365,7 +365,7 @@ scalar sumProd(const UList& f1, const UList& f2)
if (f1.size() && (f1.size() == f2.size()))
{
scalar SumProd = 0.0;
- TFOR_ALL_S_OP_F_OP_F(scalar, SumProd, +=, Type, f1, *, Type, f2)
+ TFOR_ALL_S_OP_F_OP_F(scalar, SumProd, +=, Type, f1, &&, Type, f2)
return SumProd;
}
else
@@ -498,7 +498,7 @@ template
scalar gSumProd(const UList& f1, const UList& f2)
{
scalar SumProd = sumProd(f1, f2);
- reduce(SumProd, sumOp());
+ reduce(SumProd, sumOp());
return SumProd;
}
diff --git a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H
index e3fd66afaf..869346e29a 100644
--- a/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H
+++ b/src/OpenFOAM/fields/Fields/Field/FieldFunctions.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -23,8 +23,6 @@ License
\*---------------------------------------------------------------------------*/
-#include "scalarField.H"
-
#define TEMPLATE template
#include "FieldFunctionsM.H"
@@ -332,5 +330,6 @@ PRODUCT_OPERATOR(scalarProduct, &&, dotdot)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "undefFieldFunctionsM.H"
+#include "scalarField.H"
// ************************************************************************* //
diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C
index 9000bb533a..cd18592265 100644
--- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C
+++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -86,6 +86,24 @@ tmp stabilise(const tmp& tsf, const scalar s)
}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template<>
+scalar sumProd(const UList& f1, const UList& f2)
+{
+ if (f1.size() && (f1.size() == f2.size()))
+ {
+ scalar SumProd = 0.0;
+ TFOR_ALL_S_OP_F_OP_F(scalar, SumProd, +=, scalar, f1, *, scalar, f2)
+ return SumProd;
+ }
+ else
+ {
+ return 0.0;
+ }
+}
+
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H
index 8d39528b9f..d5a3b7659b 100644
--- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H
+++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -72,6 +72,12 @@ tmp stabilise(const UList&, const scalar s);
tmp stabilise(const tmp&, const scalar s);
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template<>
+scalar sumProd(const UList& f1, const UList& f2);
+
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
BINARY_TYPE_OPERATOR(scalar, scalar, scalar, +, add)
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
index 448a009cab..5117f8cb23 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C
@@ -485,9 +485,35 @@ boundaryInternalField() const
template class PatchField, class GeoMesh>
-Foam::lduInterfaceFieldPtrsList
+Foam::LduInterfaceFieldPtrsList
Foam::GeometricField::GeometricBoundaryField::
interfaces() const
+{
+ LduInterfaceFieldPtrsList interfaces(this->size());
+
+ forAll(interfaces, patchi)
+ {
+ if (isA >(this->operator[](patchi)))
+ {
+ interfaces.set
+ (
+ patchi,
+ &refCast >
+ (
+ this->operator[](patchi)
+ )
+ );
+ }
+ }
+
+ return interfaces;
+}
+
+
+template class PatchField, class GeoMesh>
+Foam::lduInterfaceFieldPtrsList
+Foam::GeometricField::GeometricBoundaryField::
+scalarInterfaces() const
{
lduInterfaceFieldPtrsList interfaces(this->size());
@@ -498,7 +524,10 @@ interfaces() const
interfaces.set
(
patchi,
- &refCast(this->operator[](patchi))
+ &refCast
+ (
+ this->operator[](patchi)
+ )
);
}
}
diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H
index 56b9beee49..5aef9e0fb8 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -44,6 +44,7 @@ SourceFiles
#include "DimensionedField.H"
#include "FieldField.H"
#include "lduInterfaceFieldPtrsList.H"
+#include "LduInterfaceFieldPtrsList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -191,7 +192,11 @@ public:
//- Return a list of pointers for each patch field with only those
// pointing to interfaces being set
- lduInterfaceFieldPtrsList interfaces() const;
+ LduInterfaceFieldPtrsList interfaces() const;
+
+ //- Return a list of pointers for each patch field with only those
+ // pointing to interfaces being set
+ lduInterfaceFieldPtrsList scalarInterfaces() const;
//- Write boundary field as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const;
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/CyclicLduInterfaceField.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/CyclicLduInterfaceField.C
deleted file mode 100644
index 445a654a1c..0000000000
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/CyclicLduInterfaceField.C
+++ /dev/null
@@ -1,65 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-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 "CyclicLduInterfaceField.H"
-#include "diagTensorField.H"
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
- //defineTypeNameAndDebug(CyclicLduInterfaceField, 0);
-}
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-template
-Foam::CyclicLduInterfaceField::~CyclicLduInterfaceField()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-template
-void Foam::CyclicLduInterfaceField::transformCoupleField
-(
- Field& f
-) const
-{
- if (doTransform())
- {
- label sizeby2 = f.size()/2;
-
- for (label facei=0; facei.
-
-Class
- Foam::CyclicLduInterfaceField
-
-Description
- Abstract base class for cyclic coupled interfaces.
-
-SourceFiles
- CyclicLduInterfaceField.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef CyclicLduInterfaceField_H
-#define CyclicLduInterfaceField_H
-
-#include "primitiveFieldsFwd.H"
-#include "typeInfo.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
- Class CyclicLduInterfaceField Declaration
-\*---------------------------------------------------------------------------*/
-
-template
-class CyclicLduInterfaceField
-{
-
-public:
-
- //- Runtime type information
- TypeName("CyclicLduInterfaceField");
-
-
- // Constructors
-
- //- Construct given coupled patch
- CyclicLduInterfaceField()
- {}
-
-
- // Destructor
-
- virtual ~CyclicLduInterfaceField();
-
-
- // Member Functions
-
- // Access
-
- //- Is the transform required
- virtual bool doTransform() const = 0;
-
- //- Return face transformation tensor
- virtual const tensorField& forwardT() const = 0;
-
- //- Return neighbour-cell transformation tensor
- virtual const tensorField& reverseT() const = 0;
-
- //- Return rank of component for transform
- virtual int rank() const = 0;
-
-
- //- Transform given patch internal field
- void transformCoupleField(Field& f) const;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.C
index 5f50f7eb53..6f8d95bafa 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.C
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.C
@@ -23,25 +23,11 @@ License
\*---------------------------------------------------------------------------*/
-#include "lduInterfaceField.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-defineTypeNameAndDebug(lduInterfaceField, 0);
-
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-lduInterfaceField::~lduInterfaceField()
+template
+Foam::LduInterfaceField::~LduInterfaceField()
{}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
// ************************************************************************* //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H
index 0cae1a925d..adacc45ed2 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceField.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -36,27 +36,28 @@ SourceFiles
#ifndef LduInterfaceField_H
#define LduInterfaceField_H
-#include "lduInterface.H"
-#include "Field.H"
+#include "lduInterfaceField.H"
+#include "primitiveFieldsFwd.H"
+#include "Pstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+class lduMatrix;
+
/*---------------------------------------------------------------------------*\
Class LduInterfaceField Declaration
\*---------------------------------------------------------------------------*/
template
class LduInterfaceField
+:
+ public lduInterfaceField
{
- // Private data
-
- //- Reference to the coupled patch this field is defined for
- const lduInterface& interface_;
-
-
// Private Member Functions
//- Disallow default bitwise copy construct
@@ -68,73 +69,52 @@ class LduInterfaceField
public:
- class Amultiplier
- {
- public:
-
- Amultiplier()
- {}
-
- virtual ~Amultiplier()
- {}
-
- virtual void addAmul
- (
- Field& Apsi,
- const Field& psi
- ) const = 0;
- };
-
-
//- Runtime type information
TypeName("LduInterfaceField");
// Constructors
- //- Construct given interface
- LduInterfaceField(const lduInterface& interface)
+ //- Construct given coupled patch
+ LduInterfaceField(const lduInterface& patch)
:
- interface_(interface)
+ lduInterfaceField(patch)
{}
- // Destructor
-
- virtual ~LduInterfaceField();
+ //- Destructor
+ virtual ~LduInterfaceField();
// Member Functions
- // Access
+ //- Initialise neighbour matrix update
+ virtual void initInterfaceMatrixUpdate
+ (
+ Field&,
+ const Field&,
+ const scalarField&,
+ const Pstream::commsTypes commsType
+ ) const
+ {}
- //- Return the interface
- const lduInterface& interface() const
- {
- return interface_;
- }
-
-
- // Coupled interface matrix update
-
- //- Initialise neighbour matrix update
- virtual void initInterfaceMatrixUpdate
+ //- Update result field based on interface functionality
+ virtual void updateInterfaceMatrix
+ (
+ Field&,
+ const Field&,
+ const scalarField&,
+ const Pstream::commsTypes commsType
+ ) const // = 0;
+ {
+ notImplemented
(
- Field& Apsi,
- const Field& psi,
- const Amultiplier&,
- const Pstream::commsTypes commsType
- ) const
- {}
-
- //- Update result field based on interface functionality
- virtual void updateInterfaceMatrix
- (
- Field& Apsi,
- const Field& psi,
- const Amultiplier&,
- const Pstream::commsTypes commsType
- ) const = 0;
+ "updateInterfaceMatrix"
+ "(Field&, const Field&,"
+ "const scalarField&,"
+ "const Pstream::commsTypes commsType) const"
+ );
+ }
};
@@ -144,6 +124,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#ifdef NoRepository
+# include "LduInterfaceField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
#endif
// ************************************************************************* //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/ProcessorLduInterfaceField.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceFields.C
similarity index 64%
rename from src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/ProcessorLduInterfaceField.C
rename to src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceFields.C
index 0bbe441612..002e3cf700 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/ProcessorLduInterfaceField.C
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/LduInterfaceFields.C
@@ -23,44 +23,19 @@ License
\*---------------------------------------------------------------------------*/
-#include "processorLduInterfaceField.H"
-#include "diagTensorField.H"
+#include "LduInterfaceField.H"
+#include "fieldTypes.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-namespace Foam
-{
- //defineTypeNameAndDebug(processorLduInterfaceField, 0);
-}
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-template
-Foam::processorLduInterfaceField::~processorLduInterfaceField()
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-template
-void Foam::processorLduInterfaceField::transformCoupleField
+defineTemplateTypeNameAndDebug(Foam::LduInterfaceField, 0);
+defineTemplateTypeNameAndDebug(Foam::LduInterfaceField, 0);
+defineTemplateTypeNameAndDebug
(
- Field& f
-) const
-{
- if (doTransform())
- {
- if (forwardT().size() == 1)
- {
- transform(f, forwardT()[0], f);
- }
- else
- {
- transform(f, forwardT(), f);
- }
- }
-}
-
+ Foam::LduInterfaceField,
+ 0
+);
+defineTemplateTypeNameAndDebug(Foam::LduInterfaceField, 0);
+defineTemplateTypeNameAndDebug(Foam::LduInterfaceField, 0);
// ************************************************************************* //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/ProcessorLduInterfaceField.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/ProcessorLduInterfaceField.H
deleted file mode 100644
index f794de01d4..0000000000
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduInterfaceField/ProcessorLduInterfaceField.H
+++ /dev/null
@@ -1,105 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-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 .
-
-Class
- Foam::ProcessorLduInterfaceField
-
-Description
- Abstract base class for processor coupled interfaces.
-
-SourceFiles
- ProcessorLduInterfaceField.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef ProcessorLduInterfaceField_H
-#define ProcessorLduInterfaceField_H
-
-#include "primitiveFieldsFwd.H"
-#include "typeInfo.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-/*---------------------------------------------------------------------------*\
- Class ProcessorLduInterfaceField Declaration
-\*---------------------------------------------------------------------------*/
-
-template
-class ProcessorLduInterfaceField
-{
-
-public:
-
- //- Runtime type information
- TypeName("ProcessorLduInterfaceField");
-
-
- // Constructors
-
- //- Construct given coupled patch
- ProcessorLduInterfaceField()
- {}
-
-
- // Destructor
-
- virtual ~ProcessorLduInterfaceField();
-
-
- // Member Functions
-
- // Access
-
- //- Return processor number
- virtual int myProcNo() const = 0;
-
- //- Return neigbour processor number
- virtual int neighbProcNo() const = 0;
-
- //- Is the transform required
- virtual bool doTransform() const = 0;
-
- //- Return face transformation tensor
- virtual const tensorField& forwardT() const = 0;
-
- //- Return rank of component for transform
- virtual int rank() const = 0;
-
-
- //- Transform given patch component field
- void transformCoupleField(Field& f) const;
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H
index 892e1a0ae5..e0ce6d28ba 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrix.H
@@ -75,6 +75,27 @@ Ostream& operator<<
const LduMatrix&
);
+template
+typename LduMatrix::solverPerformance max
+(
+ const typename LduMatrix::solverPerformance&,
+ const typename LduMatrix::solverPerformance&
+);
+
+template
+Istream& operator>>
+(
+ Istream&,
+ typename LduMatrix::solverPerformance&
+);
+
+template
+Ostream& operator<<
+(
+ Ostream&,
+ const typename LduMatrix::solverPerformance&
+);
+
/*---------------------------------------------------------------------------*\
Class LduMatrix Declaration
@@ -162,6 +183,20 @@ public:
return solverName_;
}
+ //- Return solver name
+ word& solverName()
+ {
+ return solverName_;
+ }
+
+
+ //- Return field name
+ const word& fieldName() const
+ {
+ return fieldName_;
+ }
+
+
//- Return initial residual
const Type& initialResidual() const
{
@@ -200,8 +235,12 @@ public:
return noIterations_;
}
- //- Check, store and return singularity
- bool singular(const Type& wApA);
+
+ //- Has the solver converged?
+ bool converged() const
+ {
+ return converged_;
+ }
//- Is the matrix singular?
bool singular() const;
@@ -213,14 +252,41 @@ public:
const Type& relTolerance
);
- //- Has the solver converged?
- bool converged() const
- {
- return converged_;
- }
+ //- Singularity test
+ bool checkSingularity(const Type& residual);
//- Print summary of solver performance to the given stream
void print(Ostream& os) const;
+
+
+ // Member Operators
+
+ bool operator!=(const solverPerformance&) const;
+
+
+ // Friend functions
+
+ //- Return the element-wise maximum of two solverPerformances
+ friend solverPerformance max
+ (
+ const solverPerformance&,
+ const solverPerformance&
+ );
+
+
+ // Ostream Operator
+
+ friend Istream& operator>>
+ (
+ Istream&,
+ solverPerformance&
+ );
+
+ friend Ostream& operator<<
+ (
+ Ostream&,
+ const solverPerformance&
+ );
};
@@ -635,6 +701,12 @@ public:
return interfaces_;
}
+ //- Return interfaces
+ LduInterfaceFieldPtrsList& interfaces()
+ {
+ return interfaces_;
+ }
+
// Access to coefficients
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C
index dc5b22e428..98d24f4e9b 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixATmul.C
@@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "LduMatrix.H"
+#include "LduInterfaceFieldPtrsList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixTests.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixTests.C
index c4dd85fd0e..f5a675f044 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixTests.C
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixTests.C
@@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
-bool Foam::LduMatrix::solverPerformance::singular
+bool Foam::LduMatrix::solverPerformance::checkSingularity
(
const Type& wApA
)
@@ -115,4 +115,85 @@ void Foam::LduMatrix::solverPerformance::print
}
+template
+bool Foam::LduMatrix::solverPerformance::operator!=
+(
+ const LduMatrix::solverPerformance& sp
+) const
+{
+ return
+ (
+ solverName() != sp.solverName()
+ || fieldName() != sp.fieldName()
+ || initialResidual() != sp.initialResidual()
+ || finalResidual() != sp.finalResidual()
+ || nIterations() != sp.nIterations()
+ || converged() != sp.converged()
+ || singular() != sp.singular()
+ );
+}
+
+
+template
+typename Foam::LduMatrix::solverPerformance Foam::max
+(
+ const typename Foam::LduMatrix::solverPerformance& sp1,
+ const typename Foam::LduMatrix::solverPerformance& sp2
+)
+{
+ return lduMatrix::solverPerformance
+ (
+ sp1.solverName(),
+ sp1.fieldName_,
+ max(sp1.initialResidual(), sp2.initialResidual()),
+ max(sp1.finalResidual(), sp2.finalResidual()),
+ max(sp1.nIterations(), sp2.nIterations()),
+ sp1.converged() && sp2.converged(),
+ sp1.singular() || sp2.singular()
+ );
+}
+
+
+template
+Foam::Istream& Foam::operator>>
+(
+ Istream& is,
+ typename Foam::LduMatrix::solverPerformance& sp
+)
+{
+ is.readBeginList("LduMatrix::solverPerformance");
+ is >> sp.solverName_
+ >> sp.fieldName_
+ >> sp.initialResidual_
+ >> sp.finalResidual_
+ >> sp.noIterations_
+ >> sp.converged_
+ >> sp.singular_;
+ is.readEndList("LduMatrix::solverPerformance");
+
+ return is;
+}
+
+
+template
+Foam::Ostream& Foam::operator<<
+(
+ Ostream& os,
+ const typename Foam::LduMatrix::solverPerformance& sp
+)
+{
+ os << token::BEGIN_LIST
+ << sp.solverName_ << token::SPACE
+ << sp.fieldName_ << token::SPACE
+ << sp.initialResidual_ << token::SPACE
+ << sp.finalResidual_ << token::SPACE
+ << sp.noIterations_ << token::SPACE
+ << sp.converged_ << token::SPACE
+ << sp.singular_ << token::SPACE
+ << token::END_LIST;
+
+ return os;
+}
+
+
// ************************************************************************* //
diff --git a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C
index fc8a9c8097..d3d8de20a0 100644
--- a/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C
+++ b/src/OpenFOAM/matrices/LduMatrix/LduMatrix/LduMatrixUpdateMatrixInterfaces.C
@@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "LduMatrix.H"
-#include "LduInterfaceField.H"
+#include "lduInterfaceField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@@ -50,7 +50,8 @@ void Foam::LduMatrix::initMatrixInterfaces
(
result,
psiif,
- Amultiplier(interfaceCoeffs[interfaceI]),
+ interfaceCoeffs[interfaceI],
+ //Amultiplier(interfaceCoeffs[interfaceI]),
Pstream::defaultCommsType
);
}
@@ -75,7 +76,8 @@ void Foam::LduMatrix::initMatrixInterfaces
(
result,
psiif,
- Amultiplier(interfaceCoeffs[interfaceI]),
+ interfaceCoeffs[interfaceI],
+ //Amultiplier(interfaceCoeffs[interfaceI]),
Pstream::blocking
);
}
@@ -120,7 +122,8 @@ void Foam::LduMatrix::updateMatrixInterfaces
(
result,
psiif,
- Amultiplier(interfaceCoeffs[interfaceI]),
+ interfaceCoeffs[interfaceI],
+ //Amultiplier(interfaceCoeffs[interfaceI]),
Pstream::defaultCommsType
);
}
@@ -143,7 +146,8 @@ void Foam::LduMatrix::updateMatrixInterfaces
(
result,
psiif,
- Amultiplier(interfaceCoeffs[interfaceI]),
+ interfaceCoeffs[interfaceI],
+ //Amultiplier(interfaceCoeffs[interfaceI]),
Pstream::scheduled
);
}
@@ -153,7 +157,8 @@ void Foam::LduMatrix::updateMatrixInterfaces
(
result,
psiif,
- Amultiplier(interfaceCoeffs[interfaceI]),
+ interfaceCoeffs[interfaceI],
+ //Amultiplier(interfaceCoeffs[interfaceI]),
Pstream::scheduled
);
}
@@ -175,7 +180,8 @@ void Foam::LduMatrix::updateMatrixInterfaces
(
result,
psiif,
- Amultiplier(interfaceCoeffs[interfaceI]),
+ interfaceCoeffs[interfaceI],
+ //Amultiplier(interfaceCoeffs[interfaceI]),
Pstream::blocking
);
}
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCGScalarAlpha/PBiCGScalarAlpha.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C
similarity index 91%
rename from src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCGScalarAlpha/PBiCGScalarAlpha.C
rename to src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C
index c540a2c746..45453ff1d0 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCGScalarAlpha/PBiCGScalarAlpha.C
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCCCG/PBiCCCG.C
@@ -23,12 +23,12 @@ License
\*---------------------------------------------------------------------------*/
-#include "TPBiCG.H"
+#include "PBiCCCG.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
-Foam::TPBiCG::TPBiCG
+Foam::PBiCCCG::PBiCCCG
(
const word& fieldName,
const LduMatrix& matrix,
@@ -48,7 +48,7 @@ Foam::TPBiCG::TPBiCG
template
typename Foam::LduMatrix::solverPerformance
-Foam::TPBiCG::solve
+Foam::PBiCCCG::solve
(
Field& psi
) const
@@ -125,8 +125,7 @@ Foam::TPBiCG::solve
preconPtr->preconditionT(wT, rT);
// --- Update search directions:
- //wArT = gSumProd(wA, rT);
- wArT = sum(wA & rT);
+ wArT = gSumProd(wA, rT);
if (solverPerf.nIterations() == 0)
{
@@ -138,7 +137,7 @@ Foam::TPBiCG::solve
}
else
{
- scalar beta = cmptDivide(wArT, wArTold);
+ scalar beta = wArT/wArTold;
for (register label cell=0; cell::solve
this->matrix_.Amul(wA, pA);
this->matrix_.Tmul(wT, pT);
- scalar wApT = sum(wA & pT);
-
+ scalar wApT = gSumProd(wA, pT);
// --- Test for singularity
- //if
- //(
- // solverPerf.checkSingularity(ratio(mag(wApT)normFactor))
- //) break;
+ if
+ (
+ solverPerf.checkSingularity
+ (
+ cmptDivide(pTraits::one*mag(wApT), normFactor)
+ )
+ )
+ {
+ break;
+ }
// --- Update solution and residual:
- scalar alpha = cmptDivide(wArT, wApT);
+ scalar alpha = wArT/wApT;
for (register label cell=0; cell.
Class
- Foam::TPBiCG
+ Foam::PBiCCCG
Description
Preconditioned bi-conjugate gradient solver for asymmetric lduMatrices
using a run-time selectable preconditiioner.
SourceFiles
- TPBiCG.C
+ PBiCCCG.C
\*---------------------------------------------------------------------------*/
-#ifndef TPBiCG_H
-#define TPBiCG_H
+#ifndef PBiCCCG_H
+#define PBiCCCG_H
#include "LduMatrix.H"
@@ -44,33 +44,33 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
- Class TPBiCG Declaration
+ Class PBiCCCG Declaration
\*---------------------------------------------------------------------------*/
template
-class TPBiCG
+class PBiCCCG
:
public LduMatrix::solver
{
// Private Member Functions
//- Disallow default bitwise copy construct
- TPBiCG(const TPBiCG&);
+ PBiCCCG(const PBiCCCG&);
//- Disallow default bitwise assignment
- void operator=(const TPBiCG&);
+ void operator=(const PBiCCCG&);
public:
//- Runtime type information
- TypeName("PBiCG");
+ TypeName("PBiCCCG");
// Constructors
//- Construct from matrix components and solver data dictionary
- TPBiCG
+ PBiCCCG
(
const word& fieldName,
const LduMatrix& matrix,
@@ -80,7 +80,7 @@ public:
// Destructor
- virtual ~TPBiCG()
+ virtual ~PBiCCCG()
{}
@@ -101,7 +101,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
-# include "PBiCGScalarAlpha.C"
+# include "PBiCCCG.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCG/TPBiCG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C
similarity index 94%
rename from src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCG/TPBiCG.C
rename to src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C
index 6221fe3b9c..b3665f0617 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCG/TPBiCG.C
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.C
@@ -23,12 +23,12 @@ License
\*---------------------------------------------------------------------------*/
-#include "TPBiCG.H"
+#include "PBiCICG.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
-Foam::TPBiCG::TPBiCG
+Foam::PBiCICG::PBiCICG
(
const word& fieldName,
const LduMatrix& matrix,
@@ -48,7 +48,7 @@ Foam::TPBiCG::TPBiCG
template
typename Foam::LduMatrix::solverPerformance
-Foam::TPBiCG::solve(Field& psi) const
+Foam::PBiCICG::solve(Field& psi) const
{
word preconditionerName(this->controlDict_.lookup("preconditioner"));
@@ -150,13 +150,18 @@ Foam::TPBiCG::solve(Field& psi) const
// --- Update preconditioned residuals
this->matrix_.Amul(wA, pA);
-
this->matrix_.Tmul(wT, pT);
Type wApT = gSumCmptProd(wA, pT);
// --- Test for singularity
- if (solverPerf.singular(cmptDivide(cmptMag(wApT), normFactor)))
+ if
+ (
+ solverPerf.checkSingularity
+ (
+ cmptDivide(cmptMag(wApT), normFactor)
+ )
+ )
{
break;
}
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCG/TPBiCG.H b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.H
similarity index 90%
rename from src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCG/TPBiCG.H
rename to src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.H
index 736654cbeb..340ae48667 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCG/TPBiCG.H
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PBiCICG/PBiCICG.H
@@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::TPBiCG
+ Foam::PBiCICG
Description
Preconditioned bi-conjugate gradient solver for asymmetric lduMatrices
using a run-time selectable preconditiioner.
SourceFiles
- TPBiCG.C
+ PBiCICG.C
\*---------------------------------------------------------------------------*/
-#ifndef TPBiCG_H
-#define TPBiCG_H
+#ifndef PBiCICG_H
+#define PBiCICG_H
#include "LduMatrix.H"
@@ -44,33 +44,33 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
- Class TPBiCG Declaration
+ Class PBiCICG Declaration
\*---------------------------------------------------------------------------*/
template
-class TPBiCG
+class PBiCICG
:
public LduMatrix::solver
{
// Private Member Functions
//- Disallow default bitwise copy construct
- TPBiCG(const TPBiCG&);
+ PBiCICG(const PBiCICG&);
//- Disallow default bitwise assignment
- void operator=(const TPBiCG&);
+ void operator=(const PBiCICG&);
public:
//- Runtime type information
- TypeName("PBiCG");
+ TypeName("PBiCICG");
// Constructors
//- Construct from matrix components and solver data dictionary
- TPBiCG
+ PBiCICG
(
const word& fieldName,
const LduMatrix& matrix,
@@ -80,7 +80,7 @@ public:
// Destructor
- virtual ~TPBiCG()
+ virtual ~PBiCICG()
{}
@@ -101,7 +101,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
-# include "TPBiCG.C"
+# include "PBiCICG.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCG/TPCG.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C
similarity index 94%
rename from src/OpenFOAM/matrices/LduMatrix/Solvers/PCG/TPCG.C
rename to src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C
index d48dfb6fe2..e6206e6116 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCG/TPCG.C
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.C
@@ -23,12 +23,12 @@ License
\*---------------------------------------------------------------------------*/
-#include "TPCG.H"
+#include "PCICG.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
-Foam::TPCG::TPCG
+Foam::PCICG::PCICG
(
const word& fieldName,
const LduMatrix& matrix,
@@ -48,7 +48,7 @@ Foam::TPCG::TPCG
template
typename Foam::LduMatrix::solverPerformance
-Foam::TPCG::solve(Field& psi) const
+Foam::PCICG::solve(Field& psi) const
{
word preconditionerName(this->controlDict_.lookup("preconditioner"));
@@ -143,7 +143,13 @@ Foam::TPCG::solve(Field& psi) const
// --- Test for singularity
- if (solverPerf.singular(cmptDivide(cmptMag(wApA), normFactor)))
+ if
+ (
+ solverPerf.checkSingularity
+ (
+ cmptDivide(cmptMag(wApA), normFactor)
+ )
+ )
{
break;
}
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCG/TPCG.H b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.H
similarity index 90%
rename from src/OpenFOAM/matrices/LduMatrix/Solvers/PCG/TPCG.H
rename to src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.H
index 779de7ec5e..250cc41b9a 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/PCG/TPCG.H
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/PCICG/PCICG.H
@@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::TPCG
+ Foam::PCICG
Description
Preconditioned conjugate gradient solver for symmetric lduMatrices
using a run-time selectable preconditiioner.
SourceFiles
- TPCG.C
+ PCICG.C
\*---------------------------------------------------------------------------*/
-#ifndef TPCG_H
-#define TPCG_H
+#ifndef PCICG_H
+#define PCICG_H
#include "LduMatrix.H"
@@ -44,33 +44,33 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
- Class TPCG Declaration
+ Class PCICG Declaration
\*---------------------------------------------------------------------------*/
template
-class TPCG
+class PCICG
:
public LduMatrix::solver
{
// Private Member Functions
//- Disallow default bitwise copy construct
- TPCG(const TPCG&);
+ PCICG(const PCICG&);
//- Disallow default bitwise assignment
- void operator=(const TPCG&);
+ void operator=(const PCICG&);
public:
//- Runtime type information
- TypeName("PCG");
+ TypeName("PCICG");
// Constructors
//- Construct from matrix components and solver data dictionary
- TPCG
+ PCICG
(
const word& fieldName,
const LduMatrix& matrix,
@@ -80,7 +80,7 @@ public:
// Destructor
- virtual ~TPCG()
+ virtual ~PCICG()
{}
@@ -101,7 +101,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
-# include "TPCG.C"
+# include "PCICG.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/matrices/LduMatrix/Solvers/lduSolvers.C b/src/OpenFOAM/matrices/LduMatrix/Solvers/lduSolvers.C
index 0029abc632..6e36e525b8 100644
--- a/src/OpenFOAM/matrices/LduMatrix/Solvers/lduSolvers.C
+++ b/src/OpenFOAM/matrices/LduMatrix/Solvers/lduSolvers.C
@@ -23,8 +23,9 @@ License
\*---------------------------------------------------------------------------*/
-#include "TPCG.H"
-#include "TPBiCG.H"
+#include "PCICG.H"
+#include "PBiCCCG.H"
+#include "PBiCICG.H"
#include "SmoothSolver.H"
#include "fieldTypes.H"
@@ -34,11 +35,14 @@ License
makeLduSymSolver(DiagonalSolver, Type, DType, LUType); \
makeLduAsymSolver(DiagonalSolver, Type, DType, LUType); \
\
- makeLduSolver(TPCG, Type, DType, LUType); \
- makeLduSymSolver(TPCG, Type, DType, LUType); \
+ makeLduSolver(PCICG, Type, DType, LUType); \
+ makeLduSymSolver(PCICG, Type, DType, LUType); \
\
- makeLduSolver(TPBiCG, Type, DType, LUType); \
- makeLduAsymSolver(TPBiCG, Type, DType, LUType); \
+ makeLduSolver(PBiCCCG, Type, DType, LUType); \
+ makeLduAsymSolver(PBiCCCG, Type, DType, LUType); \
+ \
+ makeLduSolver(PBiCICG, Type, DType, LUType); \
+ makeLduAsymSolver(PBiCICG, Type, DType, LUType); \
\
makeLduSolver(SmoothSolver, Type, DType, LUType); \
makeLduSymSolver(SmoothSolver, Type, DType, LUType); \
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H
index 86bdcd045e..5ff1f3eff8 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -84,10 +84,14 @@ public:
virtual int rank() const = 0;
- //- Transform given patch internal field
+ //- Transform given patch field
+ template
+ void transformCoupleField(Field& f) const;
+
+ //- Transform given patch component field
void transformCoupleField
(
- scalarField& psiInternal,
+ scalarField& f,
const direction cmpt
) const;
};
@@ -97,6 +101,30 @@ public:
} // End namespace Foam
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "tensorField.H"
+
+template
+void Foam::cyclicLduInterfaceField::transformCoupleField
+(
+ Field& f
+) const
+{
+ if (doTransform())
+ {
+ if (forwardT().size() == 1)
+ {
+ transform(f, forwardT()[0], f);
+ }
+ else
+ {
+ transform(f, forwardT(), f);
+ }
+ }
+}
+
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H
index e4aa7b1032..45ad3f0dca 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.H
@@ -73,6 +73,7 @@ class lduInterfaceField
//- Disallow default bitwise assignment
void operator=(const lduInterfaceField&);
+
public:
//- Runtime type information
@@ -112,17 +113,6 @@ public:
// Coupled interface matrix update
- //- Initialise neighbour matrix update
- virtual void initInterfaceMatrixUpdate
- (
- scalarField&,
- const scalarField&,
- const scalarField&,
- const direction,
- const Pstream::commsTypes commsType
- ) const
- {}
-
//- Whether matrix has been updated
bool updatedMatrix() const
{
@@ -141,6 +131,17 @@ public:
return true;
}
+ //- Initialise neighbour matrix update
+ virtual void initInterfaceMatrixUpdate
+ (
+ scalarField&,
+ const scalarField&,
+ const scalarField&,
+ const direction,
+ const Pstream::commsTypes commsType
+ ) const
+ {}
+
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H
index b511193355..a5b9066b82 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H
+++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -87,6 +87,10 @@ public:
virtual int rank() const = 0;
+ //- Transform given patch field
+ template
+ void transformCoupleField(Field& f) const;
+
//- Transform given patch component field
void transformCoupleField
(
@@ -100,6 +104,30 @@ public:
} // End namespace Foam
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "tensorField.H"
+
+template
+void Foam::processorLduInterfaceField::transformCoupleField
+(
+ Field& f
+) const
+{
+ if (doTransform())
+ {
+ if (forwardT().size() == 1)
+ {
+ transform(f, forwardT()[0], f);
+ }
+ else
+ {
+ transform(f, forwardT(), f);
+ }
+ }
+}
+
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H
index dc9583fc0b..ae7438b937 100644
--- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H
+++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -210,7 +210,7 @@ public:
return singular_;
}
- //- Convergence test
+ //- Check, store and return convergence
bool checkConvergence
(
const scalar tolerance,
@@ -223,6 +223,7 @@ public:
//- Print summary of solver performance
void print() const;
+
// Member Operators
bool operator!=(const solverPerformance&) const;
diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C b/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C
index b553bab048..d47b606c24 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/PBiCG/PBiCG.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -167,9 +167,11 @@ Foam::lduMatrix::solverPerformance Foam::PBiCG::solve
scalar wApT = gSumProd(wA, pT);
-
// --- Test for singularity
- if (solverPerf.checkSingularity(mag(wApT)/normFactor)) break;
+ if (solverPerf.checkSingularity(mag(wApT)/normFactor))
+ {
+ break;
+ }
// --- Update solution and residual:
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C
index a5fa44e1d7..895f340479 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -39,7 +39,7 @@ coupledFvPatchField::coupledFvPatchField
const DimensionedField& iF
)
:
- lduInterfaceField(refCast(p)),
+ LduInterfaceField(refCast(p)),
fvPatchField(p, iF)
{}
@@ -52,7 +52,7 @@ coupledFvPatchField::coupledFvPatchField
const Field& f
)
:
- lduInterfaceField(refCast(p)),
+ LduInterfaceField(refCast(p)),
fvPatchField(p, iF, f)
{}
@@ -66,7 +66,7 @@ coupledFvPatchField::coupledFvPatchField
const fvPatchFieldMapper& mapper
)
:
- lduInterfaceField(refCast(p)),
+ LduInterfaceField(refCast(p)),
fvPatchField(ptf, p, iF, mapper)
{}
@@ -79,7 +79,7 @@ coupledFvPatchField::coupledFvPatchField
const dictionary& dict
)
:
- lduInterfaceField(refCast(p)),
+ LduInterfaceField(refCast(p)),
fvPatchField(p, iF, dict)
{}
@@ -90,7 +90,7 @@ coupledFvPatchField::coupledFvPatchField
const coupledFvPatchField& ptf
)
:
- lduInterfaceField(refCast(ptf.patch())),
+ LduInterfaceField(refCast(ptf.patch())),
fvPatchField(ptf)
{}
@@ -102,7 +102,7 @@ coupledFvPatchField::coupledFvPatchField
const DimensionedField& iF
)
:
- lduInterfaceField(refCast(ptf.patch())),
+ LduInterfaceField(refCast(ptf.patch())),
fvPatchField(ptf, iF)
{}
diff --git a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H
index 5a271a763e..88f473829f 100644
--- a/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/basic/coupled/coupledFvPatchField.H
@@ -35,7 +35,7 @@ SourceFiles
#ifndef coupledFvPatchField_H
#define coupledFvPatchField_H
-#include "lduInterfaceField.H"
+#include "LduInterfaceField.H"
#include "fvPatchField.H"
#include "coupledFvPatch.H"
@@ -51,7 +51,7 @@ namespace Foam
template
class coupledFvPatchField
:
- public lduInterfaceField,
+ public LduInterfaceField,
public fvPatchField
{
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C
index 520d4b23db..90638bf40c 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C
@@ -221,6 +221,38 @@ void cyclicFvPatchField::updateInterfaceMatrix
}
+template
+void cyclicFvPatchField::updateInterfaceMatrix
+(
+ Field& result,
+ const Field& psiInternal,
+ const scalarField& coeffs,
+ const Pstream::commsTypes
+) const
+{
+ Field pnf(this->size());
+
+ const labelUList& nbrFaceCells =
+ cyclicPatch().cyclicPatch().neighbPatch().faceCells();
+
+ forAll(pnf, facei)
+ {
+ pnf[facei] = psiInternal[nbrFaceCells[facei]];
+ }
+
+ // Transform according to the transformation tensors
+ transformCoupleField(pnf);
+
+ // Multiply the field by coefficients and add into the result
+ const labelUList& faceCells = cyclicPatch_.faceCells();
+
+ forAll(faceCells, elemI)
+ {
+ result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
+ }
+}
+
+
template
void cyclicFvPatchField::write(Ostream& os) const
{
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H
index b08b0aa91a..c3ba07477d 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H
@@ -166,6 +166,15 @@ public:
const Pstream::commsTypes commsType
) const;
+ //- Update result field based on interface functionality
+ virtual void updateInterfaceMatrix
+ (
+ Field& result,
+ const Field& psiInternal,
+ const scalarField& coeffs,
+ const Pstream::commsTypes commsType
+ ) const;
+
// Cyclic coupled interface functions
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
index d86c49e5c4..c9fb2563c1 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C
@@ -45,6 +45,7 @@ processorFvPatchField::processorFvPatchField
coupledFvPatchField(p, iF),
procPatch_(refCast(p)),
sendBuf_(0),
+ receiveBuf_(0),
outstandingSendRequest_(-1),
outstandingRecvRequest_(-1),
scalarSendBuf_(0),
@@ -63,6 +64,7 @@ processorFvPatchField::processorFvPatchField
coupledFvPatchField(p, iF, f),
procPatch_(refCast(p)),
sendBuf_(0),
+ receiveBuf_(0),
outstandingSendRequest_(-1),
outstandingRecvRequest_(-1),
scalarSendBuf_(0),
@@ -83,6 +85,7 @@ processorFvPatchField::processorFvPatchField
coupledFvPatchField(ptf, p, iF, mapper),
procPatch_(refCast(p)),
sendBuf_(0),
+ receiveBuf_(0),
outstandingSendRequest_(-1),
outstandingRecvRequest_(-1),
scalarSendBuf_(0),
@@ -126,6 +129,7 @@ processorFvPatchField::processorFvPatchField
coupledFvPatchField(p, iF, dict),
procPatch_(refCast(p)),
sendBuf_(0),
+ receiveBuf_(0),
outstandingSendRequest_(-1),
outstandingRecvRequest_(-1),
scalarSendBuf_(0),
@@ -162,6 +166,7 @@ processorFvPatchField::processorFvPatchField
coupledFvPatchField(ptf),
procPatch_(refCast(ptf.patch())),
sendBuf_(ptf.sendBuf_.xfer()),
+ receiveBuf_(ptf.receiveBuf_.xfer()),
outstandingSendRequest_(-1),
outstandingRecvRequest_(-1),
scalarSendBuf_(ptf.scalarSendBuf_.xfer()),
@@ -186,6 +191,7 @@ processorFvPatchField::processorFvPatchField
coupledFvPatchField(ptf, iF),
procPatch_(refCast(ptf.patch())),
sendBuf_(0),
+ receiveBuf_(0),
outstandingSendRequest_(-1),
outstandingRecvRequest_(-1),
scalarSendBuf_(0),
@@ -428,6 +434,124 @@ void processorFvPatchField::updateInterfaceMatrix
}
+template
+void processorFvPatchField::initInterfaceMatrixUpdate
+(
+ Field&,
+ const Field& psiInternal,
+ const scalarField&,
+ const Pstream::commsTypes commsType
+) const
+{
+ this->patch().patchInternalField(psiInternal, sendBuf_);
+
+ if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer)
+ {
+ // Fast path.
+ if (debug && !this->ready())
+ {
+ FatalErrorIn
+ (
+ "processorFvPatchField::initInterfaceMatrixUpdate(..)"
+ ) << "On patch " << procPatch_.name()
+ << " outstanding request."
+ << abort(FatalError);
+ }
+
+
+ receiveBuf_.setSize(sendBuf_.size());
+ outstandingRecvRequest_ = UPstream::nRequests();
+ IPstream::read
+ (
+ Pstream::nonBlocking,
+ procPatch_.neighbProcNo(),
+ reinterpret_cast(receiveBuf_.begin()),
+ receiveBuf_.byteSize(),
+ procPatch_.tag()
+ );
+
+ outstandingSendRequest_ = UPstream::nRequests();
+ OPstream::write
+ (
+ Pstream::nonBlocking,
+ procPatch_.neighbProcNo(),
+ reinterpret_cast(sendBuf_.begin()),
+ sendBuf_.byteSize(),
+ procPatch_.tag()
+ );
+ }
+ else
+ {
+ procPatch_.compressedSend(commsType, sendBuf_);
+ }
+
+ const_cast&>(*this).updatedMatrix() = false;
+}
+
+
+template
+void processorFvPatchField::updateInterfaceMatrix
+(
+ Field& result,
+ const Field&,
+ const scalarField& coeffs,
+ const Pstream::commsTypes commsType
+) const
+{
+ if (this->updatedMatrix())
+ {
+ return;
+ }
+
+ const labelUList& faceCells = this->patch().faceCells();
+
+ if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer)
+ {
+ // Fast path.
+ if
+ (
+ outstandingRecvRequest_ >= 0
+ && outstandingRecvRequest_ < Pstream::nRequests()
+ )
+ {
+ UPstream::waitRequest(outstandingRecvRequest_);
+ }
+ // Recv finished so assume sending finished as well.
+ outstandingSendRequest_ = -1;
+ outstandingRecvRequest_ = -1;
+
+ // Consume straight from receiveBuf_
+
+ // Transform according to the transformation tensor
+ transformCoupleField(receiveBuf_);
+
+ // Multiply the field by coefficients and add into the result
+ forAll(faceCells, elemI)
+ {
+ result[faceCells[elemI]] -= coeffs[elemI]*receiveBuf_[elemI];
+ }
+ }
+ else
+ {
+ Field pnf
+ (
+ procPatch_.compressedReceive(commsType, this->size())()
+ );
+
+ // Transform according to the transformation tensor
+ transformCoupleField(pnf);
+
+ // Multiply the field by coefficients and add into the result
+ forAll(faceCells, elemI)
+ {
+ result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
+ }
+ }
+
+ const_cast&>(*this).updatedMatrix() = true;
+}
+
+
template
bool processorFvPatchField