smoothSolver.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-2013 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::smoothSolver
29 
30 Group
31  grpLduMatrixSolvers
32 
33 Description
34  Iterative solver for symmetric and asymmetric matrices which uses a
35  run-time selected smoother e.g. GaussSeidel to converge the solution to
36  the required tolerance.
37 
38  To improve efficiency, the residual is evaluated after every nSweeps
39  smoothing iterations.
40 
41 SourceFiles
42  smoothSolver.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef smoothSolver_H
47 #define smoothSolver_H
48 
49 #include "lduMatrix.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class smoothSolver Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class smoothSolver
61 :
62  public lduMatrix::solver
63 {
64 protected:
65 
66  // Protected data
67 
68  //- Number of sweeps before the evaluation of residual
69  label nSweeps_;
70 
71  //- Read the control parameters from the controlDict_
72  virtual void readControls();
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("smoothSolver");
79 
80 
81  // Constructors
82 
83  //- Construct from matrix components and solver controls
85  (
86  const word& fieldName,
87  const lduMatrix& matrix,
91  const dictionary& solverControls
92  );
93 
94 
95  //- Destructor
96  virtual ~smoothSolver() = default;
97 
98  // Member Functions
99 
100  //- Solve the matrix with this solver
101  virtual solverPerformance solve
102  (
103  scalarField& psi,
104  const scalarField& source,
105  const direction cmpt=0
106  ) const;
107 };
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
Foam::lduMatrix::solver::interfaces
const lduInterfaceFieldPtrsList & interfaces() const noexcept
Definition: lduMatrix.H:248
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
Foam::lduMatrix
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition: lduMatrix.H:83
Foam::lduMatrix::solver
Abstract base-class for lduMatrix solvers.
Definition: lduMatrix.H:98
lduMatrix.H
Foam::smoothSolver::TypeName
TypeName("smoothSolver")
Runtime type information.
Foam::lduMatrix::solver::fieldName
const word & fieldName() const noexcept
Definition: lduMatrix.H:228
Foam::smoothSolver::readControls
virtual void readControls()
Read the control parameters from the controlDict_.
Definition: smoothSolver.C:75
Foam::smoothSolver::solve
virtual solverPerformance solve(scalarField &psi, const scalarField &source, const direction cmpt=0) const
Solve the matrix with this solver.
Definition: smoothSolver.C:83
Foam::Field< scalar >
Foam::smoothSolver::smoothSolver
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.
Definition: smoothSolver.C:50
Foam::lduMatrix::solver::interfaceBouCoeffs
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
Definition: lduMatrix.H:238
Foam::UPtrList< const lduInterfaceField >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::smoothSolver::nSweeps_
label nSweeps_
Number of sweeps before the evaluation of residual.
Definition: smoothSolver.H:68
Foam::smoothSolver::~smoothSolver
virtual ~smoothSolver()=default
Destructor.
Foam::lduMatrix::solver::interfaceIntCoeffs
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
Definition: lduMatrix.H:243
Foam::direction
uint8_t direction
Definition: direction.H:52
psi
const volScalarField & psi
Definition: createFieldRefs.H:1
Foam::SolverPerformance
SolverPerformance is the class returned by the LduMatrix solver containing performance statistics.
Definition: SolverPerformance.H:52
Foam::lduMatrix::solver::matrix
const lduMatrix & matrix() const noexcept
Definition: lduMatrix.H:233
Foam::smoothSolver
Iterative solver for symmetric and asymmetric matrices which uses a run-time selected smoother e....
Definition: smoothSolver.H:59