1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2006-7 H. Jasak All rights reserved
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Collection of lduMatrices solved together as a block system
32 Hrvoje Jasak, Wikki Ltd. All rights reserved
34 \*----------------------------------------------------------------------------*/
36 #include "coupledLduMatrix.H"
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(coupledLduMatrix, 1);
46 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 // Construct given size
52 Foam::coupledLduMatrix::coupledLduMatrix(const label size)
54 PtrList<lduMatrix>(size)
58 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 Foam::coupledLduMatrix::~coupledLduMatrix()
64 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 bool Foam::coupledLduMatrix::diagonal() const
68 const PtrList<lduMatrix>& matrices = *this;
72 forAll (matrices, matrixI)
74 diag = diag && matrices[matrixI].diagonal();
81 bool Foam::coupledLduMatrix::symmetric() const
83 const PtrList<lduMatrix>& matrices = *this;
87 forAll (matrices, matrixI)
90 (sym && matrices[matrixI].diagonal())
91 || (sym && matrices[matrixI].symmetric());
98 bool Foam::coupledLduMatrix::asymmetric() const
100 const PtrList<lduMatrix>& matrices = *this;
104 forAll (matrices, matrixI)
106 asym = (asym || matrices[matrixI].asymmetric());
113 void Foam::coupledLduMatrix::Amul
115 FieldField<Field, scalar>& result,
116 const FieldField<Field, scalar>& x,
117 const PtrList<FieldField<Field, scalar> >& bouCoeffs,
118 const lduInterfaceFieldPtrsListList& interfaces,
122 const PtrList<lduMatrix>& matrices = *this;
124 // Reset product to zero
127 // Initialise the update of coupled interfaces
137 forAll (matrices, rowI)
139 matrices[rowI].AmulCore(result[rowI], x[rowI]);
142 // Update couple interfaces
143 updateMatrixInterfaces
154 void Foam::coupledLduMatrix::Tmul
156 FieldField<Field, scalar>& result,
157 const FieldField<Field, scalar>& x,
158 const PtrList<FieldField<Field, scalar> >& intCoeffs,
159 const lduInterfaceFieldPtrsListList& interfaces,
163 const PtrList<lduMatrix>& matrices = *this;
165 // Reset product to zero
168 // Initialise the update of coupled interfaces
178 forAll (matrices, rowI)
180 matrices[rowI].TmulCore(result[rowI], x[rowI]);
183 // Update couple interfaces
184 updateMatrixInterfaces
195 void Foam::coupledLduMatrix::initMatrixInterfaces
197 const PtrList<FieldField<Field, scalar> >& coupleCoeffs,
198 const lduInterfaceFieldPtrsListList& interfaces,
199 const FieldField<Field, scalar>& x,
200 FieldField<Field, scalar>& result,
204 const PtrList<lduMatrix>& matrices = *this;
206 forAll (matrices, rowI)
208 matrices[rowI].initMatrixInterfaces
220 void Foam::coupledLduMatrix::updateMatrixInterfaces
222 const PtrList<FieldField<Field, scalar> >& coupleCoeffs,
223 const lduInterfaceFieldPtrsListList& interfaces,
224 const FieldField<Field, scalar>& x,
225 FieldField<Field, scalar>& result,
229 const PtrList<lduMatrix>& matrices = *this;
231 forAll (matrices, rowI)
233 matrices[rowI].updateMatrixInterfaces
245 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
248 // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
251 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
254 // ************************************************************************* //