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 "cyclicFvPatchVectorNFields.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 #define VectorNMatrixInterfaceFunc(Type) \
38 void cyclicFvPatchField<Type>::updateInterfaceMatrix \
40 const Field<Type>& psiInternal, \
41 Field<Type>& result, \
42 const BlockLduMatrix<Type>&, \
43 const CoeffField<Type>& coeffs, \
44 const Pstream::commsTypes commsType, \
45 const bool switchToLhs \
48 Field<Type> pnf(this->size()); \
50 label sizeby2 = this->size()/2; \
51 const unallocLabelList& faceCells = cyclicPatch_.faceCells(); \
53 for (label facei=0; facei<sizeby2; facei++) \
55 pnf[facei] = psiInternal[faceCells[facei + sizeby2]]; \
56 pnf[facei + sizeby2] = psiInternal[faceCells[facei]]; \
59 if (coeffs.activeType() == blockCoeffBase::SCALAR) \
61 pnf = coeffs.asScalar() * pnf; \
63 else if (coeffs.activeType() == blockCoeffBase::LINEAR) \
65 pnf = cmptMultiply(coeffs.asLinear(), pnf); \
67 else if (coeffs.activeType() == blockCoeffBase::SQUARE) \
69 pnf = coeffs.asSquare() & pnf; \
74 forAll(faceCells, elemI) \
76 result[faceCells[elemI]] += pnf[elemI]; \
81 forAll(faceCells, elemI) \
83 result[faceCells[elemI]] -= pnf[elemI]; \
89 #define doMakePatchTypeField(type, Type, args...) \
91 VectorNMatrixInterfaceFunc(type) \
93 makeTemplatePatchTypeField \
95 fvPatch##Type##Field, \
96 cyclicFvPatch##Type##Field \
99 forAllVectorNTypes(doMakePatchTypeField)
101 #undef doMakePatchTypeField
103 #undef VectorNMatrixInterfaceFunc
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 } // End namespace Foam
109 // ************************************************************************* //