1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 Block matrix insertion and retrieval tools
34 \*---------------------------------------------------------------------------*/
37 #ifndef blockMatrixTools_H
38 #define blockMatrixTools_H
40 #include "blockLduMatrices.H"
41 #include "fvMatrices.H"
42 #include "surfaceFieldsFwd.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Namespace blockMatrixTools functions Declaration
51 \*---------------------------------------------------------------------------*/
53 namespace blockMatrixTools
57 //- Insert field into block field
58 template<class BlockType>
63 Field<BlockType>& blockX
66 //- Add field into block field
67 template<class BlockType>
72 Field<BlockType>& blockX
75 //- Retrieve field from block field
76 template<class BlockType>
81 const Field<BlockType>& blockX
85 // Diagonal block operations
87 //- Insert matrix diagonal and source into the block system
88 template<class BlockType>
92 const fvScalarMatrix& m,
93 BlockLduMatrix<BlockType>& blockM,
94 Field<BlockType>& blockB
97 // Insert upper and lower coefficients matrix into the block system
98 template<class Type, class BlockType>
102 const fvScalarMatrix& m,
103 BlockLduMatrix<BlockType>& blockM
106 // Insert matrix into the block system
107 template<class BlockType>
111 const fvScalarMatrix& m,
112 BlockLduMatrix<BlockType>& blockM,
113 Field<BlockType>& blockX,
114 Field<BlockType>& blockB
118 // Coupling block operations
120 //- Insert coupling matrix diagonal and source into the block system
121 template<class BlockType>
122 void insertCouplingDiagSource
124 const direction dirI,
125 const direction dirJ,
126 const fvScalarMatrix& m,
127 BlockLduMatrix<BlockType>& blockM,
128 Field<BlockType>& blockB
131 // Insert coupling matrix into the block system
132 template<class Type, class BlockType>
133 void insertCouplingUpperLower
135 const direction dirI,
136 const direction dirJ,
137 const fvScalarMatrix& m,
138 BlockLduMatrix<BlockType>& blockM
141 // Insert coupling matrix into the block system
142 template<class BlockType>
146 const fvScalarMatrix& m,
147 BlockLduMatrix<BlockType>& blockM,
148 Field<BlockType>& blockX,
149 Field<BlockType>& blockB
152 // Update coupling of block system
153 // Subtracts the block-coefficient coupling as specified by the user
154 // from the source, leaving the implicit update given by linearisation
155 template<class BlockType>
156 void updateSourceCoupling
158 BlockLduMatrix<BlockType>& blockM,
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 } // End namespace Foam
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 # include "blockMatrixTools.C"
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 // ************************************************************************* //