OpenFOAM: API Guide
v2112
The open source CFD toolbox
dynamicInkJetFvMesh.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-2017 OpenFOAM Foundation
9
Copyright (C) 2020 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 "
dynamicInkJetFvMesh.H
"
30
#include "
addToRunTimeSelectionTable.H
"
31
#include "
volFields.H
"
32
#include "
mathematicalConstants.H
"
33
34
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36
namespace
Foam
37
{
38
defineTypeNameAndDebug
(
dynamicInkJetFvMesh
, 0);
39
addToRunTimeSelectionTable
(
dynamicFvMesh
,
dynamicInkJetFvMesh
,
IOobject
);
40
addToRunTimeSelectionTable
(
dynamicFvMesh
,
dynamicInkJetFvMesh
, doInit);
41
}
42
43
44
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45
46
Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh
47
(
48
const
IOobject
&
io
,
49
const
bool
doInit
50
)
51
:
52
dynamicFvMesh
(
io
, doInit),
53
dynamicMeshCoeffs_
54
(
55
IOdictionary
56
(
57
IOobject
58
(
59
"dynamicMeshDict"
,
60
io
.time().
constant
(),
61
*this,
62
IOobject
::MUST_READ_IF_MODIFIED,
63
IOobject
::NO_WRITE,
64
false
65
)
66
).optionalSubDict(typeName +
"Coeffs"
)
67
),
68
amplitude_(dynamicMeshCoeffs_.get<scalar>(
"amplitude"
)),
69
frequency_(dynamicMeshCoeffs_.get<scalar>(
"frequency"
)),
70
refPlaneX_(dynamicMeshCoeffs_.get<scalar>(
"refPlaneX"
)),
71
stationaryPoints_
72
(
73
IOobject
74
(
75
"points"
,
76
io
.time().
constant
(),
77
meshSubDir,
78
*this,
79
IOobject
::MUST_READ,
80
IOobject
::NO_WRITE
81
)
82
)
83
{
84
Info
<<
"Performing a dynamic mesh calculation: "
<<
endl
85
<<
"amplitude: "
<< amplitude_
86
<<
" frequency: "
<< frequency_
87
<<
" refPlaneX: "
<< refPlaneX_ <<
endl
;
88
}
89
90
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91
92
Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh
()
93
{}
94
95
96
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97
98
bool
Foam::dynamicInkJetFvMesh::update
()
99
{
100
scalar scalingFunction =
101
0.5*
102
(
103
::cos
(
constant::mathematical::twoPi
*frequency_*time().value())
104
- 1.0
105
);
106
107
Info
<<
"Mesh scaling. Time = "
<< time().value() <<
" scaling: "
108
<< scalingFunction <<
endl
;
109
110
pointField
newPoints = stationaryPoints_;
111
112
newPoints.
replace
113
(
114
vector::X
,
115
stationaryPoints_.component(
vector::X
)*
116
(
117
1.0
118
+
pos0
119
(
120
- (stationaryPoints_.component(
vector::X
))
121
- refPlaneX_
122
)*amplitude_*scalingFunction
123
)
124
);
125
126
fvMesh::movePoints
(newPoints);
127
128
lookupObjectRef<volVectorField>(
"U"
).correctBoundaryConditions();
129
130
return
true
;
131
}
132
133
134
// ************************************************************************* //
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Definition:
addToRunTimeSelectionTable.H:42
Foam::Field< vector >
Foam::Field::replace
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Definition:
Field.C:557
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition:
IOdictionary.H:57
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::Vector< scalar >::X
@ X
Definition:
Vector.H:81
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition:
dynamicFvMesh.H:81
Foam::dynamicInkJetFvMesh
Mesh motion specifically for the "pumping" system of an ink-jet injector.
Definition:
dynamicInkJetFvMesh.H:61
Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh
~dynamicInkJetFvMesh()
Destructor.
Definition:
dynamicInkJetFvMesh.C:92
Foam::dynamicInkJetFvMesh::update
virtual bool update()
Update the mesh for both mesh motion and topology change.
Definition:
dynamicInkJetFvMesh.C:98
Foam::fvMesh::movePoints
virtual bool movePoints()
Avoid masking surfaceInterpolation method.
Definition:
surfaceInterpolation.C:154
constant
constant condensation/saturation model.
defineTypeNameAndDebug
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition:
className.H:121
dynamicInkJetFvMesh.H
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
mathematicalConstants.H
Foam::constant::mathematical::twoPi
constexpr scalar twoPi(2 *M_PI)
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:34
Foam::pos0
dimensionedScalar pos0(const dimensionedScalar &ds)
Definition:
dimensionedScalar.C:188
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition:
Ostream.H:372
Foam::cos
dimensionedScalar cos(const dimensionedScalar &ds)
Definition:
dimensionedScalar.C:265
volFields.H
src
dynamicFvMesh
dynamicInkJetFvMesh
dynamicInkJetFvMesh.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.