39 lduMatrix::solver::addsymMatrixConstructorToTable<smoothSolver>
42 lduMatrix::solver::addasymMatrixConstructorToTable<smoothSolver>
51 const word& fieldName,
118 solverPerf.nIterations() -= nSweeps_;
122 solveScalar normFactor = 0;
125 ConstPrecisionAdaptor<solveScalar, scalar> tsource(source);
132 matrix_.Amul(Apsi,
psi, interfaceBouCoeffs_, interfaces_, cmpt);
135 normFactor = this->normFactor(
psi, tsource(), Apsi, temp);
137 residual = tsource() - Apsi;
139 matrix().setResidualField
141 ConstPrecisionAdaptor<scalar, solveScalar>(residual)(),
147 solverPerf.initialResidual() =
148 gSumMag(residual, matrix().
mesh().comm())/normFactor;
149 solverPerf.finalResidual() = solverPerf.initialResidual();
152 if ((log_ >= 2) || (lduMatrix::debug >= 2))
154 Info.masterStream(matrix().
mesh().comm())
155 <<
" Normalisation factor = " << normFactor <<
endl;
163 || !solverPerf.checkConvergence(tolerance_, relTol_, log_)
200 solverPerf.finalResidual() =
201 gSumMag(residual, matrix().
mesh().comm())/normFactor;
205 (solverPerf.nIterations() += nSweeps_) < maxIter_
206 && !solverPerf.checkConvergence(tolerance_, relTol_, log_)
208 || solverPerf.nIterations() < minIter_
212 matrix().setResidualField
A const Field/List wrapper with possible data conversion.
A field of fields is a PtrList of fields with reference counting.
A non-const Field/List wrapper with possible data conversion.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
const lduMatrix & matrix_
label maxIter_
Maximum number of iterations in the solver.
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.
scalar tolerance_
Final convergence tolerance.
const lduInterfaceFieldPtrsList & interfaces() const noexcept
lduInterfaceFieldPtrsList interfaces_
const FieldField< Field, scalar > & interfaceBouCoeffs_
label minIter_
Minimum number of iterations in the solver.
const lduMatrix & matrix() const noexcept
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.
int log_
Verbosity level for solver output statements.
scalar relTol_
Convergence tolerance relative to the initial.
const FieldField< Field, scalar > & interfaceIntCoeffs_
virtual void readControls()
Read the control parameters from controlDict_.
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
dictionary controlDict_
Dictionary of solution controls.
const word & fieldName() const noexcept
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Iterative solver for symmetric and asymmetric matrices which uses a run-time selected smoother e....
smoothSolver(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Construct from matrix components and solver controls.
label nSweeps_
Number of sweeps before the evaluation of residual.
virtual void readControls()
Read the control parameters from the controlDict_.
virtual solverPerformance solve(scalarField &psi, const scalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & psi
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
lduMatrix::solver::addsymMatrixConstructorToTable< smoothSolver > addsmoothSolverSymMatrixConstructorToTable_
Field< solveScalar > solveScalarField
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
typeOfMag< Type >::type gSumMag(const FieldField< Field, Type > &f)
lduMatrix::solver::addasymMatrixConstructorToTable< smoothSolver > addsmoothSolverAsymMatrixConstructorToTable_
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
SolverPerformance< scalar > solverPerformance
SolverPerformance instantiated for a scalar.
#define addProfiling(Name,...)
Define profiling trigger with specified name and description string. The description is generated by ...