functions.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) 2023 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 "functions.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace solvers
34 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 :
45  movingMesh(mesh)
46 {
47  // Read the solverName from the subSolver or solver entry in controlDict
48  const word solverName
49  (
50  runTime.controlDict().found("subSolver")
51  ? runTime.controlDict().lookup("subSolver")
52  : runTime.controlDict().lookup("solver")
53  );
54 
55  Time& time(const_cast<Time&>(runTime));
56  const TimeState ts(time);
57  bool startTimeChanged = false;
58 
59  if (runTime.controlDict().found("subSolverTime"))
60  {
61  const scalar subSolverTime
62  (
63  runTime.controlDict().lookup<scalar>("subSolverTime")
64  );
65 
66  time.setTime(subSolverTime, 0);
67 
68  startTimeChanged = true;
69  }
70 
71  // Instantiate the selected solver
72  solverPtr = (solver::New(solverName, mesh));
73 
74  if (startTimeChanged)
75  {
76  time.setTime(ts, ts.timeIndex());
77  }
78 
79  // Set all registered objects to NO_WRITE
80  // so only those created by the functionObjects are written
81  for
82  (
83  objectRegistry::iterator iter = mesh.objectRegistry::begin();
84  iter != mesh.objectRegistry::end();
85  ++iter
86  )
87  {
88  iter()->writeOpt() = IOobject::NO_WRITE;
89  }
90 }
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
96 {}
97 
98 
99 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
100 
102 {
103  return solverPtr->maxDeltaT();
104 }
105 
106 
108 {}
109 
110 
112 {}
113 
114 
116 {}
117 
118 
120 {}
121 
122 
124 {}
125 
126 
128 {}
129 
130 
131 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
friend class iterator
Declare friendship with the iterator.
Definition: HashTable.H:194
const Time & time() const
Return time.
Definition: IOobject.C:318
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:55
label timeIndex() const
Return current time index.
Definition: TimeStateI.H:28
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
virtual void setTime(const Time &)
Reset the time and time-index to those of the given time.
Definition: Time.C:939
const dictionary & controlDict() const
Return the control dict.
Definition: Time.H:265
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:860
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:659
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Abstract base class for run-time selectable region solvers.
Definition: solver.H:55
static autoPtr< solver > New(const word &solverName, fvMesh &mesh)
Select, construct and return the solver.
Definition: solverNew.C:37
const Time & runTime
Time.
Definition: solver.H:97
const fvMesh & mesh
Region mesh.
Definition: solver.H:94
Solver module to execute the functionObjects for a specified solver.
Definition: functions.H:70
virtual void thermophysicalPredictor()
Construct and solve the energy equation,.
Definition: functions.C:115
virtual void prePredictor()
Called at the beginning of the PIMPLE loop.
Definition: functions.C:107
virtual void postSolve()
Called after the PIMPLE loop at the end of the time-step.
Definition: functions.C:127
virtual scalar maxDeltaT() const
Return the current maximum time-step for stable solution.
Definition: functions.C:101
virtual void pressureCorrector()
Construct and solve the pressure equation in the PISO loop.
Definition: functions.C:119
virtual void postCorrector()
Correct the thermophysical transport modelling.
Definition: functions.C:123
virtual void momentumPredictor()
Construct and optionally solve the momentum equation.
Definition: functions.C:111
autoPtr< solver > solverPtr
Pointer to the solid or fluid solver.
Definition: functions.H:75
functions(fvMesh &mesh)
Construct from region mesh.
Definition: functions.C:43
virtual ~functions()
Destructor.
Definition: functions.C:95
Solver module to move the mesh.
Definition: movingMesh.H:56
A class for handling words, derived from string.
Definition: word.H:62
addToRunTimeSelectionTable(solver, compressibleMultiphaseVoF, fvMesh)
defineTypeNameAndDebug(compressibleMultiphaseVoF, 0)
Namespace for OpenFOAM.