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/>.
25 Update of block interfaces
27 \*---------------------------------------------------------------------------*/
29 #include "BlockLduMatrix.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 // TODO - This code is currently not called so we have specialized
34 // initInterfaceMatrixUpdate in processorFvPatchScalarfield
35 // This needs to be fixed
38 void Foam::BlockLduMatrix<scalar>::initInterfaces
40 const FieldField<CoeffField, scalar>& coupleCoeffs,
42 const scalarField& psi,
43 const bool switchToLhs
48 Pstream::defaultCommsType() == Pstream::blocking
49 || Pstream::defaultCommsType() == Pstream::nonBlocking
52 forAll (interfaces, interfaceI)
54 if (interfaces.set(interfaceI))
56 interfaces[interfaceI].initInterfaceMatrixUpdate
61 coupleCoeffs[interfaceI].asScalar(),
62 Pstream::defaultCommsType,
68 else if (Pstream::defaultCommsType() == Pstream::scheduled)
70 const lduSchedule& patchSchedule = this->patchSchedule();
72 // Loop over the "global" patches are on the list of interfaces but
73 // beyond the end of the schedule which only handles "normal" patches
76 label interfaceI=patchSchedule.size()/2;
77 interfaceI<interfaces.size();
81 if (interfaces.set(interfaceI))
83 interfaces[interfaceI].initInterfaceMatrixUpdate
88 coupleCoeffs[interfaceI].asScalar(),
97 FatalErrorIn("BlockLduMatrix<scalar>::initMatrixInterfaces")
98 << "Unsuported communications type "
99 << Pstream::commsTypeNames[Pstream::defaultCommsType]
106 void Foam::BlockLduMatrix<scalar>::updateInterfaces
108 const FieldField<CoeffField, scalar>& coupleCoeffs,
110 const scalarField& psi,
111 const bool switchToLhs
116 Pstream::defaultCommsType() == Pstream::blocking
117 || Pstream::defaultCommsType() == Pstream::nonBlocking
120 // Block until all sends/receives have been finished
121 if (Pstream::defaultCommsType() == Pstream::nonBlocking)
123 IPstream::waitRequests();
124 OPstream::waitRequests();
127 forAll (interfaces, interfaceI)
129 if (interfaces.set(interfaceI))
131 interfaces[interfaceI].updateInterfaceMatrix
136 coupleCoeffs[interfaceI].asScalar(),
137 Pstream::defaultCommsType,
143 else if (Pstream::defaultCommsType() == Pstream::scheduled)
145 const lduSchedule& patchSchedule = this->patchSchedule();
147 // Loop over all the "normal" interfaces relating to standard patches
148 forAll (patchSchedule, i)
150 label interfaceI = patchSchedule[i].patch;
152 if (interfaces.set(interfaceI))
154 if (patchSchedule[i].init)
156 interfaces[interfaceI].initInterfaceMatrixUpdate
161 coupleCoeffs[interfaceI].asScalar(),
168 interfaces[interfaceI].updateInterfaceMatrix
173 coupleCoeffs[interfaceI].asScalar(),
181 // Loop over the "global" patches are on the list of interfaces but
182 // beyond the end of the schedule which only handles "normal" patches
185 label interfaceI=patchSchedule.size()/2;
186 interfaceI<interfaces.size();
190 if (interfaces.set(interfaceI))
192 interfaces[interfaceI].updateInterfaceMatrix
197 coupleCoeffs[interfaceI].asScalar(),
206 FatalErrorIn("BlockLduMatrix<scalar>::updateMatrixInterfaces")
207 << "Unsuported communications type "
208 << Pstream::commsTypeNames[Pstream::defaultCommsType]
214 // ************************************************************************* //