solver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "solver.H"
27 #include "localEulerDdtScheme.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
35 }
36 
37 
38 Foam::scalar Foam::solver::deltaTFactor = 1.2;
39 
40 
41 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
42 
43 bool Foam::solver::writeData(Ostream&) const
44 {
46  return false;
47 }
48 
49 
50 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
51 
53 {
54  return true;
55 }
56 
57 
58 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
59 
61 :
63  (
64  IOobject
65  (
66  typeName,
67  mesh.time().name(),
68  mesh
69  )
70  ),
71 
72  mesh_(mesh),
73  steady(mesh_.schemes().steady()),
74  LTS(fv::localEulerDdt::enabled(mesh)),
75 
76  fvModelsPtr(nullptr),
77  fvConstraintsPtr(nullptr),
78 
79  mesh(mesh_),
80  runTime(mesh_.time()),
81  pimple(mesh_)
82 {
83  deltaTFactor =
84  mesh.time().controlDict().lookupOrDefault<scalar>("deltaTFactor", 1.2);
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
91 {}
92 
93 
94 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
95 
97 {
98  if (!fvModelsPtr)
99  {
100  fvModelsPtr = &Foam::fvModels::New(mesh);
101  }
102 
103  return *fvModelsPtr;
104 }
105 
106 
108 {
109  if (!fvConstraintsPtr)
110  {
111  fvConstraintsPtr = &Foam::fvConstraints::New(mesh);
112  }
113 
114  return *fvConstraintsPtr;
115 }
116 
117 
118 // ************************************************************************* //
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const IOdictionary & controlDict() const
Return the control dict.
Definition: Time.H:269
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
Definition: dictionaryIO.C:100
Finite volume constraints.
Definition: fvConstraints.H:67
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:418
Finite volume models.
Definition: fvModels.H:65
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
Abstract base class for run-time selectable region solvers.
Definition: solver.H:56
static scalar deltaTFactor
deltaT increase factor
Definition: solver.H:110
virtual ~solver()
Destructor.
Definition: solver.C:90
Foam::fvModels & fvModels() const
Return the fvModels that are created on demand.
Definition: solver.C:96
solver(fvMesh &mesh)
Construct from region mesh.
Definition: solver.C:60
Foam::fvConstraints & fvConstraints() const
Return the fvConstraints that are created on demand.
Definition: solver.C:107
const fvMesh & mesh
Region mesh.
Definition: solver.H:101
virtual bool read()
Read controls.
Definition: solver.C:52
pimpleControl pimple(mesh)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
Namespace for OpenFOAM.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
defineTypeNameAndDebug(combustionModel, 0)
labelList fv(nPoints)