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-------------------------------------------------------------------------------
11License
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"
31#include "volFields.H"
33
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
37{
41}
42
43
44// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45
47(
48 const IOobject& io,
49 const bool doInit
50)
51:
52 dynamicFvMesh(io, doInit),
53 dynamicMeshCoeffs_
54 (
56 (
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 (
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
93{}
94
95
96// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97
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// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Definition: Field.C:557
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:81
Mesh motion specifically for the "pumping" system of an ink-jet injector.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual bool movePoints()
Avoid masking surfaceInterpolation method.
constant condensation/saturation model.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
constexpr scalar twoPi(2 *M_PI)
Namespace for OpenFOAM.
dimensionedScalar pos0(const dimensionedScalar &ds)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
dimensionedScalar cos(const dimensionedScalar &ds)