OpenFOAM: API Guide
v2112
The open source CFD toolbox
dynamicFvMesh.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) 2011-2012 OpenFOAM Foundation
9
Copyright (C) 2018-2021 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
\*---------------------------------------------------------------------------*/
28
29
#include "
dynamicFvMesh.H
"
30
#include "
profiling.H
"
31
32
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34
namespace
Foam
35
{
36
defineTypeNameAndDebug
(
dynamicFvMesh
, 0);
37
defineRunTimeSelectionTable
(
dynamicFvMesh
,
IOobject
);
38
defineRunTimeSelectionTable
(
dynamicFvMesh
, doInit);
39
}
40
41
42
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43
44
void
Foam::dynamicFvMesh::readDict()
45
{
46
IOobject dictHeader
47
(
48
"dynamicMeshDict"
,
49
thisDb
().
time
().
constant
(),
50
thisDb
(),
51
IOobject::MUST_READ_IF_MODIFIED
,
52
IOobject::NO_WRITE
,
53
false
// Do not register
54
);
55
56
if
(dictHeader.typeHeaderOk<IOdictionary>(
false
,
false
))
57
{
58
IOdictionary
dict
(dictHeader);
59
timeControl_.
read
(
dict
);
60
61
if
(!timeControl_.
always
())
62
{
63
// Feedback about the trigger mechanism
64
Info
<<
"Controlled mesh update triggered on "
65
<< timeControl_.
type
() <<
" interval "
66
<< timeControl_.
interval
() <<
nl
;
67
}
68
}
69
else
70
{
71
// Ensure it is indeed pass-through
72
timeControl_.
clear
();
73
}
74
}
75
76
77
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
78
79
Foam::dynamicFvMesh::dynamicFvMesh
(
const
IOobject
&
io
,
const
bool
doInit)
80
:
81
fvMesh
(
io
, doInit),
82
timeControl_(
io
.time(),
"update"
)
// assume has no side effects
83
{
84
if
(doInit)
85
{
86
init
(
false
);
// do not initialise lower levels
87
}
88
}
89
90
91
bool
Foam::dynamicFvMesh::init
(
const
bool
doInit)
92
{
93
if
(doInit)
94
{
95
fvMesh::init
(doInit);
96
}
97
98
readDict();
99
100
// Assume something changed
101
return
true
;
102
}
103
104
105
Foam::dynamicFvMesh::dynamicFvMesh
106
(
107
const
IOobject
&
io
,
108
const
Foam::zero
,
109
bool
syncPar
110
)
111
:
112
fvMesh
(
io
,
Foam
::
zero
{}, syncPar),
113
timeControl_(
io
.time(),
"update"
)
114
{
115
readDict();
116
}
117
118
119
Foam::dynamicFvMesh::dynamicFvMesh
120
(
121
const
IOobject
&
io
,
122
pointField
&&
points
,
123
faceList
&& faces,
124
labelList
&& allOwner,
125
labelList
&& allNeighbour,
126
const
bool
syncPar
127
)
128
:
129
fvMesh
130
(
131
io
,
132
std::move(
points
),
133
std::move(faces),
134
std::move(allOwner),
135
std::move(allNeighbour),
136
syncPar
137
),
138
timeControl_(
io
.time(),
"update"
)
139
{
140
readDict();
141
}
142
143
144
Foam::dynamicFvMesh::dynamicFvMesh
145
(
146
const
IOobject
&
io
,
147
pointField
&&
points
,
148
faceList
&& faces,
149
cellList
&&
cells
,
150
const
bool
syncPar
151
)
152
:
153
fvMesh
154
(
155
io
,
156
std::move(
points
),
157
std::move(faces),
158
std::move(
cells
),
159
syncPar
160
),
161
timeControl_(
io
.time(),
"update"
)
162
{
163
readDict();
164
}
165
166
167
bool
Foam::dynamicFvMesh::controlledUpdate
()
168
{
169
if
(timeControl_.execute())
170
{
171
if
(!timeControl_.always())
172
{
173
// Feedback that update has been triggered
174
Info
<<
"Mesh update triggered based on "
175
<< timeControl_.type() <<
nl
;
176
}
177
178
addProfiling
(
mesh
,
"mesh.update()"
);
179
return
this->
update
();
180
}
181
182
return
false
;
183
}
184
185
186
// ************************************************************************* //
Foam::Field< vector >
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition:
IOobject.H:187
Foam::IOobject::MUST_READ_IF_MODIFIED
@ MUST_READ_IF_MODIFIED
Definition:
IOobject.H:180
Foam::List< face >
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition:
dynamicFvMesh.H:81
Foam::dynamicFvMesh::controlledUpdate
virtual bool controlledUpdate()
Update the mesh if controller permits.
Definition:
dynamicFvMesh.C:167
Foam::dynamicFvMesh::init
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Definition:
dynamicFvMesh.C:91
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition:
fvMesh.H:91
Foam::fvMesh::thisDb
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
Definition:
fvMesh.H:302
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition:
fvMesh.H:290
constant
constant condensation/saturation model.
Foam::timeControl::interval
scalar interval() const
Return interval.
Definition:
timeControlI.H:65
Foam::timeControl::read
void read(const dictionary &dict)
Read from dictionary.
Definition:
timeControl.C:109
Foam::timeControl::clear
void clear()
Reset control to 'always' - ie, no intervention.
Definition:
timeControl.C:100
Foam::timeControl::always
bool always() const
Return true if the control will always execute - ie, no intervention.
Definition:
timeControlI.H:55
Foam::timeControl::type
const word & type() const
Return the named control enumeration as its 'type'.
Definition:
timeControlI.H:43
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition:
zero.H:63
defineTypeNameAndDebug
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition:
className.H:121
update
mesh update()
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
dynamicFvMesh.H
points
const pointField & points
Definition:
gmvOutputHeader.H:1
cells
const cellShapeList & cells
Definition:
gmvOutputHeader.H:3
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:34
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::nl
constexpr char nl
The newline '\n' character (0x0a)
Definition:
Ostream.H:53
addProfiling
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
Definition:
profilingTrigger.H:113
profiling.H
defineRunTimeSelectionTable
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
Definition:
runTimeSelectionTables.H:374
dict
dictionary dict
Definition:
searchingEngine.H:14
Foam::lduScheduleEntry::init
bool init
Definition:
lduSchedule.H:60
src
dynamicFvMesh
dynamicFvMesh
dynamicFvMesh.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.