Loading...
Searching...
No Matches
LduMatrix.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::LduMatrix
29
30Description
31 LduMatrix is a general matrix class in which the coefficients are
32 stored as three arrays, one for the upper triangle, one for the
33 lower triangle and a third for the diagonal.
34
35 Addressing arrays must be supplied for the upper and lower triangles.
36
37Note
38 It might be better if this class were organised as a hierarchy starting
39 from an empty matrix, then deriving diagonal, symmetric and asymmetric
40 matrices.
41
42SourceFiles
43 LduMatrixATmul.C
44 LduMatrix.C
45 LduMatrixOperations.C
46 LduMatrixSolver.C
47 LduMatrixPreconditioner.C
48 LduMatrixTests.C
49 LduMatrixUpdateMatrixInterfaces.C
50
51\*---------------------------------------------------------------------------*/
52
53#ifndef Foam_LduMatrix_H
54#define Foam_LduMatrix_H
55
56#include "lduMesh.H"
57#include "lduMatrix.H"
58#include "Field.H"
59#include "FieldField.H"
61#include "SolverPerformance.H"
62#include "typeInfo.H"
63#include "autoPtr.H"
65
66// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67
68namespace Foam
69{
70
71// Forward Declarations
72
73template<class Type, class DType, class LUType> class LduMatrix;
74
75template<class Type, class DType, class LUType>
76Ostream& operator<<
77(
78 Ostream&,
80);
81
82
83/*---------------------------------------------------------------------------*\
84 Class LduMatrix Declaration
85\*---------------------------------------------------------------------------*/
86
87template<class Type, class DType, class LUType>
88class LduMatrix
89{
90 // Private Data
91
92 //- LDU mesh reference
93 const lduMesh& lduMesh_;
94
95 //- Diagonal coefficients
96 std::unique_ptr<Field<DType>> diagPtr_;
97
98 //- Off-diagonal coefficients
99 std::unique_ptr<Field<LUType>> upperPtr_;
100
101 //- Off-diagonal coefficients
102 std::unique_ptr<Field<LUType>> lowerPtr_;
103
104 //- Source
105 std::unique_ptr<Field<Type>> sourcePtr_;
106
107 //- Field interfaces (processor patches etc.)
109
110 //- Off-diagonal coefficients for interfaces
111 FieldField<Field, LUType> interfacesUpper_;
112
113 //- Off-diagonal coefficients for interfaces
114 FieldField<Field, LUType> interfacesLower_;
115
116
117public:
118
119 friend class SolverPerformance<Type>;
120
121 // -----------------------------------------------------------------------
122 //- Abstract base-class for LduMatrix solvers
123 class solver
124 {
125 protected:
126
127 // Protected Data
128
131
132 //- Dictionary of solution controls
134
135 //- Verbosity level for solver output statements
136 int log_;
137
138 //- Minimum number of iterations in the solver
139 label minIter_;
140
141 //- Maximum number of iterations in the solver
142 label maxIter_;
144 //- The matrix normalisation type
146
147 //- Final convergence tolerance
149
150 //- Convergence tolerance relative to the initial
151 Type relTol_;
152
154 // Protected Member Functions
155
156 //- Read the control parameters from controlDict_
157 virtual void readControls();
159
160 // Housekeeping
161
162 //- Deprecated(2021-09) Read control parameter from dictionary
163 // \deprecated(2021-09) - use dictionary methods directly
164 template<class T>
165 void readControl(const dictionary& dict, T& val, const word& key)
166 {
167 dict.readIfPresent(key, val);
169
170
171 public:
172
173 //- Runtime type information
174 virtual const word& type() const = 0;
175
176
177 // Declare run-time constructor selection tables
180 (
181 autoPtr,
182 solver,
183 symMatrix,
184 (
185 const word& fieldName,
187 const dictionary& solverDict
188 ),
189 (
190 fieldName,
191 matrix,
192 solverDict
193 )
194 );
195
198 autoPtr,
199 solver,
200 asymMatrix,
201 (
202 const word& fieldName,
204 const dictionary& solverDict
205 ),
206 (
207 fieldName,
209 solverDict
210 )
211 );
212
214 // Constructors
215
216 //- Construct for given field name, matrix and controls
217 solver
218 (
219 const word& fieldName,
221 const dictionary& solverDict
222 );
223
224
225 // Selectors
226
227 //- Return a new solver
228 static autoPtr<solver> New
229 (
232 const dictionary& solverDict
233 );
234
235
236 //- Destructor
237 virtual ~solver() = default;
238
239
240 // Member Functions
241
242 const word& fieldName() const noexcept
243 {
244 return fieldName_;
245 }
246
248 {
249 return matrix_;
250 }
251
252
253 //- Read and reset the solver parameters from the given dictionary
254 virtual void read(const dictionary&);
255
257 (
259 ) const = 0;
260
261 //- Return the matrix norm using the specified norm method
262 Type normFactor
263 (
264 const Field<Type>& psi,
265 const Field<Type>& Apsi,
266 Field<Type>& tmpField,
267 const lduMatrix::normTypes normType
268 ) const;
269
270 //- Return the matrix norm used to normalise the residual for the
271 //- stopping criterion
272 Type normFactor
273 (
274 const Field<Type>& psi,
275 const Field<Type>& Apsi,
276 Field<Type>& tmpField
277 ) const
278 {
279 return this->normFactor(psi, Apsi, tmpField, normType_);
280 }
281 };
283
284 // -----------------------------------------------------------------------
285 //- Abstract base-class for LduMatrix smoothers
286 class smoother
288 protected:
289
290 // Protected Data
291
294
295
296 public:
297
298 //- Runtime type information
299 virtual const word& type() const = 0;
300
301
302 // Declare run-time constructor selection tables
303
305 (
306 autoPtr,
307 smoother,
308 symMatrix,
309 (
310 const word& fieldName,
312 ),
313 (
314 fieldName,
315 matrix
316 )
317 );
320 (
321 autoPtr,
322 smoother,
323 asymMatrix,
324 (
325 const word& fieldName,
327 ),
328 (
329 fieldName,
330 matrix
331 )
332 );
333
335 // Constructors
336
337 //- Construct for given field name and matrix
339 (
342 );
343
344
345 // Selectors
346
347 //- Return a new smoother
350 const word& fieldName,
352 const dictionary& smootherDict
353 );
355
356 //- Destructor
357 virtual ~smoother() = default;
358
359
360 // Member Functions
361
362 const word& fieldName() const noexcept
363 {
364 return fieldName_;
365 }
366
368 {
369 return matrix_;
370 }
371
372
373 //- Smooth the solution for a given number of sweeps
374 virtual void smooth
375 (
377 const label nSweeps
378 ) const = 0;
379 };
380
381
382 // -----------------------------------------------------------------------
383 //- Abstract base-class for LduMatrix preconditioners
384 class preconditioner
385 {
386 protected:
387
388 // Protected Data
389
390 //- Reference to the base-solver this preconditioner is used with
391 const solver& solver_;
392
393
394 public:
395
396 //- Runtime type information
397 virtual const word& type() const = 0;
398
399
400 // Declare run-time constructor selection tables
401
403 (
404 autoPtr,
406 symMatrix,
407 (
408 const solver& sol,
409 const dictionary& preconditionerDict
410 ),
411 (sol, preconditionerDict)
412 );
415 (
416 autoPtr,
418 asymMatrix,
419 (
420 const solver& sol,
421 const dictionary& preconditionerDict
422 ),
423 (sol, preconditionerDict)
424 );
425
426
427 // Constructors
428
429 //- Construct for given solver
430 preconditioner(const solver& sol)
431 :
433 {}
434
435
436 // Selectors
437
438 //- Return a new preconditioner
440 (
441 const solver& sol,
442 const dictionary& preconditionerDict
443 );
445
446 //- Destructor
447 virtual ~preconditioner() = default;
448
449
450 // Member functions
451
452 //- Read and reset the preconditioner parameters
453 //- from the given dictionary
454 virtual void read(const dictionary&)
455 {}
456
457 //- Return wA the preconditioned form of residual rA
458 virtual void precondition
459 (
460 Field<Type>& wA,
461 const Field<Type>& rA
462 ) const = 0;
463
464 //- Return wT the transpose-matrix preconditioned form of
465 //- residual rT.
466 // This is only required for preconditioning asymmetric matrices.
467 virtual void preconditionT
468 (
469 Field<Type>& wT,
470 const Field<Type>& rT
471 ) const
472 {
474 }
475 };
476
477
478 // -----------------------------------------------------------------------
479
480 // Static Data
481
482 // Declare name of the class and its debug switch
483 ClassName("LduMatrix");
484
485
486 // Constructors
487
488 //- Construct given an LDU addressed mesh.
489 // The coefficients are initially empty for subsequent setting.
490 // Not yet 'explicit' (legacy code may rely on implicit construct)
491 LduMatrix(const lduMesh& mesh);
492
493 //- Copy construct
495
496 //- Move construct
498
499 //- Construct as copy or re-use as specified.
501
502 //- Construct given an LDU addressed mesh and an Istream
503 //- from which the coefficients are read
504 LduMatrix(const lduMesh& mesh, Istream& is);
505
506
507 //- Destructor
508 ~LduMatrix() = default;
509
510
511 // Member Functions
512
513 // Addressing
514
515 //- Return the LDU mesh from which the addressing is obtained
516 const lduMesh& mesh() const noexcept
518 return lduMesh_;
519 }
520
521 //- Return the LDU addressing
522 const lduAddressing& lduAddr() const
523 {
524 return lduMesh_.lduAddr();
525 }
527 //- Return the patch evaluation schedule
528 const lduSchedule& patchSchedule() const
529 {
530 return lduMesh_.lduAddr().patchSchedule();
531 }
533 //- Const access to the interfaces
535 {
536 return interfaces_;
537 }
538
539 //- Non-const access to the interfaces
541 {
542 return interfaces_;
543 }
545
546 // Coefficients
547
548 const Field<DType>& diag() const;
549 const Field<LUType>& upper() const;
550 const Field<LUType>& lower() const;
551 const Field<Type>& source() const;
552
557
558
559 // Interfaces
562 {
563 return interfacesUpper_;
564 }
565
567 {
568 return interfacesLower_;
569 }
570
572 {
573 return interfacesUpper_;
574 }
575
577 {
578 return interfacesLower_;
579 }
580
582 // Characteristics
583
584 //- The matrix type (empty, diagonal, symmetric, ...)
585 word matrixTypeName() const;
587 bool hasDiag() const noexcept { return bool(diagPtr_); }
588 bool hasUpper() const noexcept { return bool(upperPtr_); }
589 bool hasLower() const noexcept { return bool(lowerPtr_); }
590 bool hasSource() const noexcept { return bool(sourcePtr_); }
591
592 //- Matrix has diagonal only
593 bool diagonal() const noexcept
594 {
595 return (diagPtr_ && !lowerPtr_ && !upperPtr_);
596 }
597
598 //- Matrix is symmetric
599 bool symmetric() const noexcept
600 {
601 return (diagPtr_ && !lowerPtr_ && upperPtr_);
602 }
603
604 //- Matrix is asymmetric (ie, full)
605 bool asymmetric() const noexcept
606 {
607 return (diagPtr_ && lowerPtr_ && upperPtr_);
609
610
611 // Operations
612
613 void sumDiag();
614 void negSumDiag();
615
616 void sumMagOffDiag(Field<LUType>& sumOff) const;
617
618 //- Matrix multiplication
619 void Amul(Field<Type>&, const tmp<Field<Type>>&) const;
620
621 //- Matrix transpose multiplication
622 void Tmul(Field<Type>&, const tmp<Field<Type>>&) const;
623
625 //- Sum the coefficients on each row of the matrix
626 void sumA(Field<Type>&) const;
627
628
629 void residual(Field<Type>& rA, const Field<Type>& psi) const;
630
633
634 //- Initialise the update of interfaced interfaces
635 // for matrix operations
637 (
638 const bool add,
639 const FieldField<Field, LUType>& interfaceCoeffs,
640 const Field<Type>& psiif,
641 Field<Type>& result
642 ) const;
643
644 //- Update interfaced interfaces for matrix operations
646 (
647 const bool add,
648 const FieldField<Field, LUType>& interfaceCoeffs,
649 const Field<Type>& psiif,
650 Field<Type>& result,
651 const label startRequest // starting request (for non-blocking)
652 ) const;
657
658 tmp<Field<Type>> faceH(const Field<Type>&) const;
659 tmp<Field<Type>> faceH(const tmp<Field<Type>>&) const;
660
662 // Member Operators
663
664 //- Copy assignment
667 //- Move assignment
669
670 void negate();
675 void operator*=(const scalarField&);
676 void operator*=(scalar);
677
678
679 // Ostream Operator
680
682 (
683 Ostream&,
685 );
686};
688
689// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
691} // End namespace Foam
693// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
694
695#define makeLduMatrix(Type, DType, LUType) \
696 \
697typedef Foam::LduMatrix<Type, DType, LUType> \
698 ldu##Type##DType##LUType##Matrix; \
699 \
700defineNamedTemplateTypeNameAndDebug(ldu##Type##DType##LUType##Matrix, 0); \
701 \
702 \
703typedef LduMatrix<Type, DType, LUType>::smoother \
704 ldu##Type##DType##LUType##Smoother; \
706defineTemplateRunTimeSelectionTable \
707( \
708 ldu##Type##DType##LUType##Smoother, \
709 symMatrix \
710); \
711 \
712defineTemplateRunTimeSelectionTable \
713( \
714 ldu##Type##DType##LUType##Smoother, \
715 asymMatrix \
716); \
717 \
718 \
719typedef LduMatrix<Type, DType, LUType>::preconditioner \
720 ldu##Type##DType##LUType##Preconditioner; \
722defineTemplateRunTimeSelectionTable \
723( \
724 ldu##Type##DType##LUType##Preconditioner, \
725 symMatrix \
726); \
727 \
728defineTemplateRunTimeSelectionTable \
729( \
730 ldu##Type##DType##LUType##Preconditioner, \
731 asymMatrix \
732); \
733 \
735typedef LduMatrix<Type, DType, LUType>::solver \
736 ldu##Type##DType##LUType##Solver; \
737 \
738defineTemplateRunTimeSelectionTable \
739( \
740 ldu##Type##DType##LUType##Solver, \
741 symMatrix \
742); \
744defineTemplateRunTimeSelectionTable \
745( \
746 ldu##Type##DType##LUType##Solver, \
747 asymMatrix \
748);
749
750
751#define makeLduPreconditioner(Precon, Type, DType, LUType) \
752 \
753typedef Precon<Type, DType, LUType> \
754 Precon##Type##DType##LUType##Preconditioner; \
755defineNamedTemplateTypeNameAndDebug \
756( \
757 Precon##Type##DType##LUType##Preconditioner, \
758 0 \
759);
760
761#define makeLduSymPreconditioner(Precon, Type, DType, LUType) \
762 \
763LduMatrix<Type, DType, LUType>::preconditioner:: \
764addsymMatrixConstructorToTable<Precon##Type##DType##LUType##Preconditioner> \
765add##Precon##Type##DType##LUType##PreconditionerSymMatrixConstructorToTable_;
766
767#define makeLduAsymPreconditioner(Precon, Type, DType, LUType) \
768 \
769LduMatrix<Type, DType, LUType>::preconditioner:: \
770addasymMatrixConstructorToTable<Precon##Type##DType##LUType##Preconditioner> \
771add##Precon##Type##DType##LUType##PreconditionerAsymMatrixConstructorToTable_;
772
773
774#define makeLduSmoother(Smoother, Type, DType, LUType) \
776typedef Smoother<Type, DType, LUType> \
777 Smoother##Type##DType##LUType##Smoother; \
779defineNamedTemplateTypeNameAndDebug \
780( \
781 Smoother##Type##DType##LUType##Smoother, \
782 0 \
783);
784
785#define makeLduSymSmoother(Smoother, Type, DType, LUType) \
787LduMatrix<Type, DType, LUType>::smoother:: \
788 addsymMatrixConstructorToTable<Smoother##Type##DType##LUType##Smoother> \
789 add##Smoother##Type##DType##LUType##SymMatrixConstructorToTable_;
790
791#define makeLduAsymSmoother(Smoother, Type, DType, LUType) \
792 \
793LduMatrix<Type, DType, LUType>::smoother:: \
794 addasymMatrixConstructorToTable<Smoother##Type##DType##LUType##Smoother> \
795 add##Smoother##Type##DType##LUType##AsymMatrixConstructorToTable_;
797
798#define makeLduSolver(Solver, Type, DType, LUType) \
800typedef Solver<Type, DType, LUType> \
801 Solver##Type##DType##LUType##Solver; \
802 \
803defineNamedTemplateTypeNameAndDebug \
804( \
805 Solver##Type##DType##LUType##Solver, \
806 0 \
807);
808
809#define makeLduSymSolver(Solver, Type, DType, LUType) \
810 \
811LduMatrix<Type, DType, LUType>::solver:: \
812 addsymMatrixConstructorToTable<Solver##Type##DType##LUType##Solver> \
813 add##Solver##Type##DType##LUType##SymMatrixConstructorToTable_;
814
815#define makeLduAsymSolver(Solver, Type, DType, LUType) \
816 \
817LduMatrix<Type, DType, LUType>::solver:: \
818 addasymMatrixConstructorToTable<Solver##Type##DType##LUType##Solver> \
819 add##Solver##Type##DType##LUType##AsymMatrixConstructorToTable_;
820
821
822// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
823
824#ifdef NoRepository
825 #include "LduMatrix.C"
826#endif
827
828// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
829
830#endif
831
832// ************************************************************************* //
List of coupled interface fields to be used in coupling.
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Abstract base-class for LduMatrix preconditioners.
Definition LduMatrix.H:445
const solver & solver_
Reference to the base-solver this preconditioner is used with.
Definition LduMatrix.H:453
preconditioner(const solver &sol)
Construct for given solver.
Definition LduMatrix.H:496
declareRunTimeSelectionTable(autoPtr, preconditioner, symMatrix,(const solver &sol, const dictionary &preconditionerDict),(sol, preconditionerDict))
static autoPtr< preconditioner > New(const solver &sol, const dictionary &preconditionerDict)
Return a new preconditioner.
declareRunTimeSelectionTable(autoPtr, preconditioner, asymMatrix,(const solver &sol, const dictionary &preconditionerDict),(sol, preconditionerDict))
virtual void read(const dictionary &)
Read and reset the preconditioner parameters from the given dictionary.
Definition LduMatrix.H:526
virtual void preconditionT(Field< Type > &wT, const Field< Type > &rT) const
Return wT the transpose-matrix preconditioned form of residual rT.
Definition LduMatrix.H:545
virtual void precondition(Field< Type > &wA, const Field< Type > &rA) const =0
Return wA the preconditioned form of residual rA.
virtual const word & type() const =0
Runtime type information.
virtual ~preconditioner()=default
Destructor.
Abstract base-class for LduMatrix smoothers.
Definition LduMatrix.H:335
declareRunTimeSelectionTable(autoPtr, smoother, symMatrix,(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix),(fieldName, matrix))
smoother(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix)
Construct for given field name and matrix.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
Definition LduMatrix.H:423
virtual ~smoother()=default
Destructor.
declareRunTimeSelectionTable(autoPtr, smoother, asymMatrix,(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix),(fieldName, matrix))
const LduMatrix< Type, DType, LUType > & matrix_
Definition LduMatrix.H:341
virtual void smooth(Field< Type > &psi, const label nSweeps) const =0
Smooth the solution for a given number of sweeps.
virtual const word & type() const =0
Runtime type information.
const word & fieldName() const noexcept
Definition LduMatrix.H:418
static autoPtr< smoother > New(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &smootherDict)
Return a new smoother.
Abstract base-class for LduMatrix solvers.
Definition LduMatrix.H:137
label maxIter_
Maximum number of iterations in the solver.
Definition LduMatrix.H:163
solver(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Construct for given field name, matrix and controls.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
Definition LduMatrix.H:287
Type relTol_
Convergence tolerance relative to the initial.
Definition LduMatrix.H:178
void readControl(const dictionary &dict, T &val, const word &key)
Deprecated(2021-09) Read control parameter from dictionary.
Definition LduMatrix.H:197
virtual SolverPerformance< Type > solve(Field< Type > &psi) const =0
Type normFactor(const Field< Type > &psi, const Field< Type > &Apsi, Field< Type > &tmpField, const lduMatrix::normTypes normType) const
Return the matrix norm using the specified norm method.
Type normFactor(const Field< Type > &psi, const Field< Type > &Apsi, Field< Type > &tmpField) const
Return the matrix norm used to normalise the residual for the stopping criterion.
Definition LduMatrix.H:319
label minIter_
Minimum number of iterations in the solver.
Definition LduMatrix.H:158
Type tolerance_
Final convergence tolerance.
Definition LduMatrix.H:173
declareRunTimeSelectionTable(autoPtr, solver, asymMatrix,(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict),(fieldName, matrix, solverDict))
lduMatrix::normTypes normType_
The matrix normalisation type.
Definition LduMatrix.H:168
int log_
Verbosity level for solver output statements.
Definition LduMatrix.H:153
virtual ~solver()=default
Destructor.
virtual void readControls()
Read the control parameters from controlDict_.
const LduMatrix< Type, DType, LUType > & matrix_
Definition LduMatrix.H:143
declareRunTimeSelectionTable(autoPtr, solver, symMatrix,(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict),(fieldName, matrix, solverDict))
static autoPtr< solver > New(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Return a new solver.
virtual void read(const dictionary &)
Read and reset the solver parameters from the given dictionary.
dictionary controlDict_
Dictionary of solution controls.
Definition LduMatrix.H:148
virtual const word & type() const =0
Runtime type information.
const word & fieldName() const noexcept
Definition LduMatrix.H:282
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition LduMatrix.H:84
void Amul(Field< Type > &, const tmp< Field< Type > > &) const
Matrix multiplication.
bool hasUpper() const noexcept
Definition LduMatrix.H:690
LduMatrix(const LduMatrix< Type, DType, LUType > &)
Copy construct.
const Field< LUType > & upper() const
Definition LduMatrix.C:178
const FieldField< Field, LUType > & interfacesUpper() const noexcept
Definition LduMatrix.H:661
void sumA(Field< Type > &) const
Sum the coefficients on each row of the matrix.
tmp< Field< Type > > faceH(const tmp< Field< Type > > &) const
const lduAddressing & lduAddr() const
Return the LDU addressing.
Definition LduMatrix.H:616
const Field< Type > & source() const
Definition LduMatrix.C:267
bool asymmetric() const noexcept
Matrix is asymmetric (ie, full).
Definition LduMatrix.H:713
Field< Type > & source()
Definition LduMatrix.C:281
FieldField< Field, LUType > & interfacesUpper() noexcept
Definition LduMatrix.H:671
tmp< Field< Type > > H(const Field< Type > &) const
void updateMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result, const label startRequest) const
Update interfaced interfaces for matrix operations.
Field< LUType > & upper()
Definition LduMatrix.C:199
tmp< Field< Type > > residual(const Field< Type > &psi) const
LduMatrix(LduMatrix< Type, DType, LUType > &, bool reuse)
Construct as copy or re-use as specified.
bool symmetric() const noexcept
Matrix is symmetric.
Definition LduMatrix.H:705
const Field< DType > & diag() const
Definition LduMatrix.C:151
void operator+=(const LduMatrix< Type, DType, LUType > &)
const LduInterfaceFieldPtrsList< Type > & interfaces() const noexcept
Const access to the interfaces.
Definition LduMatrix.H:632
const lduSchedule & patchSchedule() const
Return the patch evaluation schedule.
Definition LduMatrix.H:624
LduMatrix(LduMatrix< Type, DType, LUType > &&)
Move construct.
ClassName("LduMatrix")
const FieldField< Field, LUType > & interfacesLower() const noexcept
Definition LduMatrix.H:666
void operator=(const LduMatrix< Type, DType, LUType > &)
Copy assignment.
void operator*=(const scalarField &)
bool diagonal() const noexcept
Matrix has diagonal only.
Definition LduMatrix.H:697
void sumMagOffDiag(Field< LUType > &sumOff) const
LduMatrix(const lduMesh &mesh)
Construct given an LDU addressed mesh.
Definition LduMatrix.C:28
FieldField< Field, LUType > & interfacesLower() noexcept
Definition LduMatrix.H:676
void residual(Field< Type > &rA, const Field< Type > &psi) const
bool hasLower() const noexcept
Definition LduMatrix.H:691
tmp< Field< Type > > faceH(const Field< Type > &) const
void initMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Initialise the update of interfaced interfaces.
~LduMatrix()=default
Destructor.
const lduMesh & mesh() const noexcept
Definition LduMatrix.H:608
void operator-=(const LduMatrix< Type, DType, LUType > &)
void operator=(LduMatrix< Type, DType, LUType > &&)
Move assignment.
bool hasSource() const noexcept
Definition LduMatrix.H:692
word matrixTypeName() const
The matrix type (empty, diagonal, symmetric, ...).
Definition LduMatrix.C:133
tmp< Field< Type > > H(const tmp< Field< Type > > &) const
bool hasDiag() const noexcept
Definition LduMatrix.H:689
LduMatrix(const lduMesh &mesh, Istream &is)
Construct given an LDU addressed mesh and an Istream from which the coefficients are read.
Definition LduMatrix.C:117
void Tmul(Field< Type > &, const tmp< Field< Type > > &) const
Matrix transpose multiplication.
Field< LUType > & lower()
Definition LduMatrix.C:244
const Field< LUType > & lower() const
Definition LduMatrix.C:223
LduInterfaceFieldPtrsList< Type > & interfaces() noexcept
Non-const access to the interfaces.
Definition LduMatrix.H:640
friend Ostream & operator(Ostream &, const LduMatrix< Type, DType, LUType > &)
Field< DType > & diag()
Definition LduMatrix.C:165
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
The class contains the addressing required by the lduMatrix: upper, lower and losort.
normTypes
Enumerated matrix normalisation types.
Definition lduMatrix.H:125
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Definition lduMesh.H:54
Base solver class.
Definition solver.H:48
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
const volScalarField & psi
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Namespace for OpenFOAM.
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
Definition lduSchedule.H:46
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
const direction noexcept
Definition scalarImpl.H:265
UPtrList< const LduInterfaceField< Type > > LduInterfaceFieldPtrsList
Store lists of LduInterfaceField as a UPtrList.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
dictionary dict
CEqn solve()
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...