1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "processorFvPatchVectorNFields.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 #define VectorNMatrixInterfaceFunc(Type) \
38 void processorFvPatchField<Type>::initInterfaceMatrixUpdate \
40 const Field<Type>& psiInternal, \
42 const BlockLduMatrix<Type>&, \
43 const CoeffField<Type>&, \
44 const Pstream::commsTypes commsType, \
45 const bool switchToLhs \
48 procPatch_.compressedSend \
51 this->patch().patchInternalField(psiInternal)() \
56 void processorFvPatchField<Type>::updateInterfaceMatrix \
58 const Field<Type>& psiInternal, \
59 Field<Type>& result, \
60 const BlockLduMatrix<Type>&, \
61 const CoeffField<Type>& coeffs, \
62 const Pstream::commsTypes commsType, \
63 const bool switchToLhs \
66 Field<Type> pnf(this->size()); \
68 if (coeffs.activeType() == blockCoeffBase::SCALAR) \
70 pnf = coeffs.asScalar() * \
71 procPatch_.compressedReceive<Type>(commsType, this->size())(); \
73 else if (coeffs.activeType() == blockCoeffBase::LINEAR) \
75 pnf = cmptMultiply(coeffs.asLinear(), \
76 procPatch_.compressedReceive<Type>(commsType, this->size())() \
79 else if (coeffs.activeType() == blockCoeffBase::SQUARE) \
81 pnf = coeffs.asSquare() & \
82 procPatch_.compressedReceive<Type>(commsType, this->size())(); \
85 const unallocLabelList& faceCells = this->patch().faceCells(); \
89 forAll(faceCells, elemI) \
91 result[faceCells[elemI]] += pnf[elemI]; \
96 forAll(faceCells, elemI) \
98 result[faceCells[elemI]] -= pnf[elemI]; \
104 #define doMakePatchTypeField(type, Type, args...) \
106 VectorNMatrixInterfaceFunc(type) \
108 makeTemplatePatchTypeField \
110 fvPatch##Type##Field, \
111 processorFvPatch##Type##Field \
114 forAllVectorNTypes(doMakePatchTypeField)
116 #undef doMakePatchTypeField
118 #undef VectorNMatrixInterfaceFunc
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 } // End namespace Foam
124 // ************************************************************************* //