Go to the documentation of this file.
72 template<
class Type,
class DType,
class LUType>
75 template<
class Type,
class DType,
class LUType>
87 template<
class Type,
class DType,
class LUType>
167 virtual const word&
type()
const = 0;
279 virtual const word&
type()
const = 0;
376 virtual const word&
type()
const = 0;
390 (sol, preconditionerDict)
402 (sol, preconditionerDict)
501 return lduMesh_.lduAddr();
532 return interfacesUpper_;
537 return interfacesLower_;
548 return interfacesUpper_;
553 return interfacesLower_;
579 return (diagPtr_ && !lowerPtr_ && !upperPtr_);
584 return (diagPtr_ && (!lowerPtr_ && upperPtr_));
589 return (diagPtr_ && lowerPtr_ && upperPtr_);
658 friend Ostream& operator<< <Type, DType, LUType>
672 #define makeLduMatrix(Type, DType, LUType) \
674 typedef Foam::LduMatrix<Type, DType, LUType> \
675 ldu##Type##DType##LUType##Matrix; \
677 defineNamedTemplateTypeNameAndDebug(ldu##Type##DType##LUType##Matrix, 0); \
680 typedef LduMatrix<Type, DType, LUType>::smoother \
681 ldu##Type##DType##LUType##Smoother; \
683 defineTemplateRunTimeSelectionTable \
685 ldu##Type##DType##LUType##Smoother, \
689 defineTemplateRunTimeSelectionTable \
691 ldu##Type##DType##LUType##Smoother, \
696 typedef LduMatrix<Type, DType, LUType>::preconditioner \
697 ldu##Type##DType##LUType##Preconditioner; \
699 defineTemplateRunTimeSelectionTable \
701 ldu##Type##DType##LUType##Preconditioner, \
705 defineTemplateRunTimeSelectionTable \
707 ldu##Type##DType##LUType##Preconditioner, \
712 typedef LduMatrix<Type, DType, LUType>::solver \
713 ldu##Type##DType##LUType##Solver; \
715 defineTemplateRunTimeSelectionTable \
717 ldu##Type##DType##LUType##Solver, \
721 defineTemplateRunTimeSelectionTable \
723 ldu##Type##DType##LUType##Solver, \
728 #define makeLduPreconditioner(Precon, Type, DType, LUType) \
730 typedef Precon<Type, DType, LUType> \
731 Precon##Type##DType##LUType##Preconditioner; \
732 defineNamedTemplateTypeNameAndDebug \
734 Precon##Type##DType##LUType##Preconditioner, \
738 #define makeLduSymPreconditioner(Precon, Type, DType, LUType) \
740 LduMatrix<Type, DType, LUType>::preconditioner:: \
741 addsymMatrixConstructorToTable<Precon##Type##DType##LUType##Preconditioner> \
742 add##Precon##Type##DType##LUType##PreconditionerSymMatrixConstructorToTable_;
744 #define makeLduAsymPreconditioner(Precon, Type, DType, LUType) \
746 LduMatrix<Type, DType, LUType>::preconditioner:: \
747 addasymMatrixConstructorToTable<Precon##Type##DType##LUType##Preconditioner> \
748 add##Precon##Type##DType##LUType##PreconditionerAsymMatrixConstructorToTable_;
751 #define makeLduSmoother(Smoother, Type, DType, LUType) \
753 typedef Smoother<Type, DType, LUType> \
754 Smoother##Type##DType##LUType##Smoother; \
756 defineNamedTemplateTypeNameAndDebug \
758 Smoother##Type##DType##LUType##Smoother, \
762 #define makeLduSymSmoother(Smoother, Type, DType, LUType) \
764 LduMatrix<Type, DType, LUType>::smoother:: \
765 addsymMatrixConstructorToTable<Smoother##Type##DType##LUType##Smoother> \
766 add##Smoother##Type##DType##LUType##SymMatrixConstructorToTable_;
768 #define makeLduAsymSmoother(Smoother, Type, DType, LUType) \
770 LduMatrix<Type, DType, LUType>::smoother:: \
771 addasymMatrixConstructorToTable<Smoother##Type##DType##LUType##Smoother> \
772 add##Smoother##Type##DType##LUType##AsymMatrixConstructorToTable_;
775 #define makeLduSolver(Solver, Type, DType, LUType) \
777 typedef Solver<Type, DType, LUType> \
778 Solver##Type##DType##LUType##Solver; \
780 defineNamedTemplateTypeNameAndDebug \
782 Solver##Type##DType##LUType##Solver, \
786 #define makeLduSymSolver(Solver, Type, DType, LUType) \
788 LduMatrix<Type, DType, LUType>::solver:: \
789 addsymMatrixConstructorToTable<Solver##Type##DType##LUType##Solver> \
790 add##Solver##Type##DType##LUType##SymMatrixConstructorToTable_;
792 #define makeLduAsymSolver(Solver, Type, DType, LUType) \
794 LduMatrix<Type, DType, LUType>::solver:: \
795 addasymMatrixConstructorToTable<Solver##Type##DType##LUType##Solver> \
796 add##Solver##Type##DType##LUType##AsymMatrixConstructorToTable_;
The class contains the addressing required by the lduMatrix: upper, lower and losort.
FieldField< Field, LUType > & interfacesLower()
declareRunTimeSelectionTable(autoPtr, solver, symMatrix,(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict),(fieldName, matrix, solverDict))
static const label defaultMaxIter_
Default maximum number of iterations in the solver.
virtual ~preconditioner()=default
void sumMagOffDiag(Field< LUType > &sumOff) const
A class for handling words, derived from Foam::string.
static autoPtr< smoother > New(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &smootherDict)
Return a new smoother.
A field of fields is a PtrList of fields with reference counting.
void operator=(const LduMatrix< Type, DType, LUType > &)
A class for managing temporary objects.
void readControl(const dictionary &dict, T &val, const word &key)
Deprecated(2021-09) Read control parameter from dictionary.
void initMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Initialise the update of interfaced interfaces.
void sumA(Field< Type > &) const
Sum the coefficients on each row of the matrix.
int log_
Level of verbosity in the solver output statements.
virtual const word & type() const =0
Runtime type information.
virtual void preconditionT(Field< Type > &wT, const Field< Type > &rT) const
Return wT the transpose-matrix preconditioned form of.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
LduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
label maxIter_
Maximum number of iterations in the solver.
tmp< Field< Type > > H(const Field< Type > &) const
const FieldField< Field, LUType > & interfacesUpper() const
void Amul(Field< Type > &, const tmp< Field< Type >> &) const
Matrix multiplication.
void updateMatrixInterfaces(const bool add, const FieldField< Field, LUType > &interfaceCoeffs, const Field< Type > &psiif, Field< Type > &result) const
Update interfaced interfaces for matrix operations.
Field< LUType > & upper()
virtual ~solver()=default
const word & fieldName() const noexcept
void operator-=(const LduMatrix< Type, DType, LUType > &)
preconditioner(const solver &sol)
const LduMatrix< Type, DType, LUType > & matrix_
Abstract base-class for LduMatrix solvers.
virtual void precondition(Field< Type > &wA, const Field< Type > &rA) const =0
Return wA the preconditioned form of residual rA.
dictionary controlDict_
Dictionary of controls.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
void Tmul(Field< Type > &, const tmp< Field< Type >> &) const
Matrix transpose multiplication.
const LduMatrix< Type, DType, LUType > & matrix_
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
const solver & solver_
Reference to the base-solver this preconditioner is used with.
virtual SolverPerformance< Type > solve(Field< Type > &psi) const =0
void residual(Field< Type > &rA, const Field< Type > &psi) const
virtual void read(const dictionary &solverDict)
Read and reset the solver parameters from the given dictionary.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
declareRunTimeSelectionTable(autoPtr, preconditioner, symMatrix,(const solver &sol, const dictionary &preconditionerDict),(sol, preconditionerDict))
List of coupled interface fields to be used in coupling.
LduMatrix(const lduMesh &)
Construct given an LDU addressed mesh.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual const lduSchedule & patchSchedule() const =0
Return patch field evaluation schedule.
Type relTol_
Convergence tolerance relative to the initial.
virtual const word & type() const =0
Runtime type information.
virtual void smooth(Field< Type > &psi, const label nSweeps) const =0
Smooth the solution for a given number of sweeps.
void operator+=(const LduMatrix< Type, DType, LUType > &)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Type tolerance_
Final convergence tolerance.
Abstract base-class for LduMatrix smoothers.
Abstract base-class for LduMatrix preconditioners.
void operator*=(const scalarField &)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const lduMesh & mesh() const
Return the LDU mesh from which the addressing is obtained.
label minIter_
Minimum number of iterations in the solver.
Macros to ease declaration of run-time selection tables.
virtual const word & type() const =0
Runtime type information.
const word & fieldName() const noexcept
smoother(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix)
const lduSchedule & patchSchedule() const
Return the patch evaluation schedule.
const FieldField< Field, LUType > & interfacesLower() const
virtual void read(const dictionary &preconditionerDict)
Read and reset the preconditioner parameters.
solver(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
virtual ~smoother()=default
static autoPtr< preconditioner > New(const solver &sol, const dictionary &preconditionerDict)
Return a new preconditioner.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const LduInterfaceFieldPtrsList< Type > & interfaces() const
Return interfaces.
const volScalarField & psi
declareRunTimeSelectionTable(autoPtr, smoother, symMatrix,(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix),(fieldName, matrix))
FieldField< Field, LUType > & interfacesUpper()
const lduAddressing & lduAddr() const
Return the LDU addressing.
LduInterfaceFieldPtrsList< Type > & interfaces()
Return interfaces.
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.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
static autoPtr< solver > New(const word &fieldName, const LduMatrix< Type, DType, LUType > &matrix, const dictionary &solverDict)
Return a new solver.
const LduMatrix< Type, DType, LUType > & matrix() const noexcept
virtual void readControls()
Read the control parameters from the controlDict_.
tmp< Field< Type > > faceH(const Field< Type > &) const
Field< LUType > & lower()