53 #ifndef Foam_lduMatrix_H 54 #define Foam_lduMatrix_H 76 Ostream&
operator<<(Ostream&,
const lduMatrix&);
77 Ostream& operator<<(Ostream&, const InfoProxy<lduMatrix>&);
90 std::reference_wrapper<const lduMesh> lduMesh_;
165 virtual const word&
type()
const = 0;
278 virtual void read(
const dictionary&);
342 virtual const word&
type()
const = 0;
486 virtual const word&
type()
const = 0;
500 (sol, solverControls)
512 (sol, solverControls)
660 return (diagPtr_ && !lowerPtr_ && !upperPtr_);
665 return (diagPtr_ && (!lowerPtr_ && upperPtr_));
670 return (diagPtr_ && lowerPtr_ && upperPtr_);
685 const tmp<solveScalarField>&,
686 const FieldField<Field, scalar>&,
695 const tmp<solveScalarField>&,
696 const FieldField<Field, scalar>&,
752 const label startRequest
760 const word& fieldName,
805 friend Ostream& operator<<(Ostream&, const InfoProxy<lduMatrix>&);
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
virtual void read(const dictionary &)
Read and reset the preconditioner parameters from the given stream.
virtual void smooth(solveScalarField &psi, const scalarField &source, const direction cmpt, const label nSweeps) const =0
Smooth the solution for a given number of sweeps.
const lduInterfaceFieldPtrsList & interfaces_
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
tmp< Field< Type > > faceH(const Field< Type > &) const
const lduInterfaceFieldPtrsList & interfaces() const noexcept
void Tmul(solveScalarField &, const tmp< solveScalarField > &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &, const direction cmpt) const
Matrix transpose multiplication with updated interfaces.
bool symmetric() const noexcept
virtual void read(const dictionary &)
Read and reset the solver parameters from the given stream.
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
const FieldField< Field, scalar > & interfaceIntCoeffs_
const lduMatrix & matrix() const noexcept
preconditioner(const solver &sol)
Construct for given solver.
Field< solveScalar > solveScalarField
virtual const word & type() const =0
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
declareRunTimeSelectionTable(autoPtr, preconditioner, symMatrix,(const solver &sol, const dictionary &solverControls),(sol, solverControls))
const solver & solver_
Reference to the base-solver this preconditioner is used with.
lduMatrix(const lduMesh &)
Construct given an LDU addressed mesh.
void residual(solveScalarField &rA, const solveScalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
void setResidualField(const scalarField &residual, const word &fieldName, const bool initial) const
Set the residual field using an IOField on the object registry if it exists.
declareRunTimeSelectionTable(autoPtr, solver, symMatrix,(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls),(fieldName, matrix, interfaceBouCoeffs, interfaceIntCoeffs, interfaces, solverControls))
virtual solverPerformance solve(scalarField &psi, const scalarField &source, const direction cmpt=0) const =0
Solve with given field and rhs.
const FieldField< Field, scalar > & interfaceBouCoeffs_
virtual void preconditionT(solveScalarField &wT, const solveScalarField &rT, const direction cmpt=0) const
Return wT the transpose-matrix preconditioned form of residual rT.
pTraits< solveScalar >::cmptType cmptType
Component type.
const lduMatrix & matrix() const noexcept
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
InfoProxy< lduMatrix > info() const
Return info proxy.
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
Triggers for starting/stopping code profiling.
tmp< scalarField > H1() const
void sumMagOffDiag(scalarField &sumOff) const
static constexpr const label defaultMaxIter
Default maximum number of iterations for solvers (1000)
int log_
Verbosity level for solver output statements.
A field of fields is a PtrList of fields with reference counting.
static const Enum< normTypes > normTypesNames_
Names for the normTypes.
label minIter_
Minimum number of iterations in the solver.
lduMatrix::normTypes normType_
The normalisation type.
virtual ~preconditioner()=default
Destructor.
const lduMatrix & matrix_
static word getName(const dictionary &)
Find the smoother name (directly or from a sub-dictionary)
const lduSchedule & patchSchedule() const
Return the patch evaluation schedule.
Abstract base-class for lduMatrix smoothers.
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
scalar tolerance_
Final convergence tolerance.
void Amul(solveScalarField &, const tmp< solveScalarField > &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &, const direction cmpt) const
Matrix multiplication with updated interfaces.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label maxIter_
Maximum number of iterations in the solver.
static autoPtr< preconditioner > New(const solver &sol, const dictionary &solverControls)
Return a new preconditioner.
Abstract base-class for lduMatrix solvers.
const word & fieldName() const noexcept
lduMatrix member H operations.
void updateMatrixInterfaces(const bool add, const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces, const solveScalarField &psiif, solveScalarField &result, const direction cmpt, const label startRequest) const
Update interfaced interfaces for matrix operations.
void initMatrixInterfaces(const bool add, const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces, const solveScalarField &psiif, solveScalarField &result, const direction cmpt) const
Initialise the update of interfaced interfaces for matrix operations.
friend Ostream & operator<<(Ostream &, const lduMatrix &)
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
void sumA(solveScalarField &, const FieldField< Field, scalar > &, const lduInterfaceFieldPtrsList &) const
Sum the coefficients on each row of the matrix.
const lduInterfaceFieldPtrsList & interfaces() const noexcept
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
static const scalar defaultTolerance
Default (absolute) tolerance (1e-6)
solver(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Construct solver for given field name, matrix etc.
virtual const word & type() const =0
Runtime type information.
const FieldField< Field, scalar > & interfaceBouCoeffs_
static autoPtr< solver > New(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Return a new solver.
normTypes
Enumerated matrix normalisation types.
void operator=(const lduMatrix &)
const lduMatrix & matrix_
bool hasUpper() const noexcept
bool asymmetric() const noexcept
An Ostream is an abstract base class for all output systems (streams, files, token lists...
smoother(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces)
Construct for given field name, matrix etc.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
void operator*=(const scalarField &)
lduInterfaceFieldPtrsList interfaces_
solveScalarField::cmptType normFactor(const solveScalarField &psi, const solveScalarField &source, const solveScalarField &Apsi, solveScalarField &tmpField, const lduMatrix::normTypes normType) const
Return the matrix norm using the specified norm method.
bool diagonal() const noexcept
virtual ~smoother()=default
Destructor.
virtual const word & type() const =0
Runtime type information.
dictionary controlDict_
Dictionary of solution controls.
"default" norm (== L1_scaled)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
Abstract base-class for lduMatrix preconditioners.
A helper class for outputting values to Ostream.
const lduMesh & mesh() const noexcept
Return the LDU mesh from which the addressing is obtained.
const lduAddressing & lduAddr() const
Return the LDU addressing.
static autoPtr< smoother > New(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Return a new smoother.
virtual void precondition(solveScalarField &wA, const solveScalarField &rA, const direction cmpt=0) const =0
Return wA the preconditioned form of residual rA.
void setLduMesh(const lduMesh &m)
Set the LDU mesh containing the addressing is obtained.
virtual ~solver()=default
Destructor.
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
const FieldField< Field, scalar > & interfaceIntCoeffs_
virtual solverPerformance scalarSolve(solveScalarField &psi, const solveScalarField &source, const direction cmpt=0) const
Solve with given field and rhs (in solveScalar precision).
static word getName(const dictionary &)
Find the preconditioner name (directly or from a sub-dictionary)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
bool hasDiag() const noexcept
const volScalarField & psi
The class contains the addressing required by the lduMatrix: upper, lower and losort.
tmp< Field< Type > > H(const Field< Type > &) const
Macros to ease declaration of run-time selection tables.
void operator-=(const lduMatrix &)
void operator+=(const lduMatrix &)
A class for managing temporary objects.
profilingTrigger profiling_
Profiling instrumentation.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
bool hasLower() const noexcept
const word & fieldName() const noexcept
virtual void scalarSmooth(solveScalarField &psi, const solveScalarField &source, const direction cmpt, const label nSweeps) const =0
Smooth the solution for a given number of sweeps.
SolverPerformance< scalar > solverPerformance
SolverPerformance instantiated for a scalar.
virtual void readControls()
Read the control parameters from controlDict_.
virtual const lduSchedule & patchSchedule() const =0
Return patch field evaluation schedule.
scalar relTol_
Convergence tolerance relative to the initial.
declareRunTimeSelectionTable(autoPtr, smoother, symMatrix,(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces),(fieldName, matrix, interfaceBouCoeffs, interfaceIntCoeffs, interfaces))