1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 void Foam::BlockLduMatrix<Type>::initInterfaces
36 const FieldField<CoeffField, Type>& interfaceCoeffs,
39 const bool switchToLhs
44 Pstream::defaultCommsType == Pstream::blocking
45 || Pstream::defaultCommsType == Pstream::nonBlocking
48 forAll (interfaces_, interfaceI)
50 if (interfaces_.set(interfaceI))
52 interfaces_[interfaceI].initInterfaceMatrixUpdate
57 interfaceCoeffs[interfaceI],
58 Pstream::defaultCommsType,
64 else if (Pstream::defaultCommsType == Pstream::scheduled)
66 const lduSchedule& patchSchedule = this->patchSchedule();
68 // Loop over the "global" patches are on the list of interfaces but
69 // beyond the end of the schedule which only handles "normal" patches
72 label interfaceI = patchSchedule.size()/2;
73 interfaceI < interfaces_.size();
77 if (interfaces_.set(interfaceI))
79 interfaces_[interfaceI].initInterfaceMatrixUpdate
84 interfaceCoeffs[interfaceI],
93 FatalErrorIn("BlockLduMatrix<Type>::initMatrixInterfaces")
94 << "Unsuported communications type "
95 << Pstream::commsTypeNames[Pstream::defaultCommsType]
102 void Foam::BlockLduMatrix<Type>::updateInterfaces
104 const FieldField<CoeffField, Type>& interfaceCoeffs,
106 const TypeField& psi,
107 const bool switchToLhs
112 Pstream::defaultCommsType == Pstream::blocking
113 || Pstream::defaultCommsType == Pstream::nonBlocking
116 // Block until all sends/receives have been finished
117 if (Pstream::defaultCommsType == Pstream::nonBlocking)
119 IPstream::waitRequests();
120 OPstream::waitRequests();
123 forAll (interfaces_, interfaceI)
125 if (interfaces_.set(interfaceI))
127 interfaces_[interfaceI].updateInterfaceMatrix
132 interfaceCoeffs[interfaceI],
133 Pstream::defaultCommsType,
139 else if (Pstream::defaultCommsType == Pstream::scheduled)
141 const lduSchedule& patchSchedule = this->patchSchedule();
143 // Loop over all the "normal" interfaces relating to standard patches
144 forAll (patchSchedule, i)
146 label interfaceI = patchSchedule[i].patch;
148 if (interfaces_.set(interfaceI))
150 if (patchSchedule[i].init)
152 interfaces_[interfaceI].initInterfaceMatrixUpdate
157 interfaceCoeffs[interfaceI],
164 interfaces_[interfaceI].updateInterfaceMatrix
169 interfaceCoeffs[interfaceI],
177 // Loop over the "global" patches are on the list of interfaces but
178 // beyond the end of the schedule which only handles "normal" patches
181 label interfaceI = patchSchedule.size()/2;
182 interfaceI < interfaces_.size();
186 if (interfaces_.set(interfaceI))
188 interfaces_[interfaceI].updateInterfaceMatrix
193 interfaceCoeffs[interfaceI],
202 FatalErrorIn("BlockLduMatrix<Type>::updateInterfaces")
203 << "Unsuported communications type "
204 << Pstream::commsTypeNames[Pstream::defaultCommsType]
209 // ************************************************************************* //