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-2026 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
82  (
84  (
85  pimpleNoLoopControl::dict(mesh_),
86  mesh_
87  )
88  )
89 {
90  deltaTFactor =
91  mesh.time().controlDict().lookupOrDefault<scalar>("deltaTFactor", 1.2);
92 }
93 
94 
95 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
96 
98 {}
99 
100 
101 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
102 
104 {
105  if (!fvModelsPtr)
106  {
107  fvModelsPtr = &Foam::fvModels::New(mesh);
108  }
109 
110  return *fvModelsPtr;
111 }
112 
113 
115 {
116  if (!fvConstraintsPtr)
117  {
118  fvConstraintsPtr = &Foam::fvConstraints::New(mesh);
119  }
120 
121  return *fvConstraintsPtr;
122 }
123 
124 
125 // ************************************************************************* //
static fvModels & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
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:275
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
Finite volume constraints.
Definition: fvConstraints.H:68
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
Finite volume models.
Definition: fvModels.H:69
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
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:97
Foam::fvModels & fvModels() const
Return the fvModels that are created on demand.
Definition: solver.C:103
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:114
const fvMesh & mesh
Region mesh.
Definition: solver.H:101
virtual bool read()
Read controls.
Definition: solver.C:52
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
pimpleControl pimple(mesh)
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
const dimensionSet time
Namespace for OpenFOAM.
Type PrintDictionary(const dictionary &dict, Args &... args)
defineRunTimeSelectionTable(fvConstraint, dictionary)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
labelList fv(nPoints)
dictionary dict