Loading...
Searching...
No Matches
parProfilingSolver.C
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) 2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "lduMatrix.H"
29#include "parProfilingSolver.H"
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35namespace Foam
36{
38
40
42 (
45 symMatrix,
46 parProfiling
47 );
48
50 (
53 asymMatrix,
54 parProfiling
55 );
56}
57
59// Has been initialised
60static bool initialised_(false);
61
62
63// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64
65Foam::parProfilingSolver::parProfilingSolver
66(
67 const word& fieldName,
68 const lduMatrix& matrix,
72 const dictionary& solverControls
73)
74:
76 (
78 matrix,
82 solverControls
83 )
84{
85 if (!initialised_)
86 {
87 initialised_ = true;
90 }
91
92 const word baseSolver(solverControls.get<word>("baseSolver"));
93
94 solvePtr_.reset
95 (
97 (
98 baseSolver,
100 matrix,
104 solverControls
106 );
107}
108
109
110// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111
113(
114 scalarField& psi_s,
115 const scalarField& source,
116 const direction cmpt
117) const
118{
120 Foam::solverPerformance perf(solvePtr_->solve(psi_s, source, cmpt));
122
123 return perf;
124}
125
126
127// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
Abstract base-class for lduMatrix solvers.
Definition lduMatrix.H:152
const FieldField< Field, scalar > & interfaceIntCoeffs() const noexcept
Definition lduMatrix.H:338
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.
const lduInterfaceFieldPtrsList & interfaces() const noexcept
Definition lduMatrix.H:343
const lduMatrix & matrix() const noexcept
Definition lduMatrix.H:328
static autoPtr< solver > New(const word &solverName, 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 of given type.
const FieldField< Field, scalar > & interfaceBouCoeffs() const noexcept
Definition lduMatrix.H:333
const word & fieldName() const noexcept
Definition lduMatrix.H:323
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
Definition lduMatrix.H:81
Wrapper to switch on parProfiling around a linear solver.
virtual solverPerformance solve(scalarField &psi, const scalarField &source, const direction cmpt=0) const
Solve the matrix with forwarding to the base solver.
static void enable()
Create timer for measuring communication or un-suspend existing.
static void reset()
Reset times/counts. Does not affect the timer itself.
static bool suspend() noexcept
Suspend use of timer. Return old status.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
Namespace for OpenFOAM.
lduMatrix::solver baseType
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
uint8_t direction
Definition direction.H:49
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
SolverPerformance< scalar > solverPerformance
SolverPerformance instantiated for a scalar.
static bool initialised_(false)