inkJet_fvMeshMover.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) 2021-2024 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 "inkJet_fvMeshMover.H"
27 #include "volFields.H"
28 #include "mathematicalConstants.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace fvMeshMovers
36 {
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
46 :
48  amplitude_(dict.lookup<scalar>("amplitude")),
49  frequency_(dict.lookup<scalar>("frequency")),
50  refPlaneX_(dict.lookup<scalar>("refPlaneX")),
51  stationaryPoints_
52  (
53  IOobject
54  (
55  "points",
56  mesh.time().constant(),
57  fvMesh::meshSubDir,
58  mesh,
59  IOobject::MUST_READ,
60  IOobject::NO_WRITE
61  )
62  ),
63  velocityMotionCorrection_(mesh, dict)
64 {
65  Info<< "Performing a dynamic mesh calculation: " << endl
66  << "amplitude: " << amplitude_
67  << " frequency: " << frequency_
68  << " refPlaneX: " << refPlaneX_ << endl;
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
73 
75 {}
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
81 {
82  const scalar scalingFunction =
83  0.5*
84  (
85  cos(constant::mathematical::twoPi*frequency_*mesh().time().value())
86  - 1.0
87  );
88 
89  Info<< "Mesh scaling. Time = " << mesh().time().value() << " scaling: "
90  << scalingFunction << endl;
91 
92  pointField newPoints = stationaryPoints_;
93 
94  newPoints.replace
95  (
96  vector::X,
97  stationaryPoints_.component(vector::X)*
98  (
99  1.0
100  + pos0
101  (
102  - (stationaryPoints_.component(vector::X))
103  - refPlaneX_
104  )*amplitude_*scalingFunction
105  )
106  );
107 
108  mesh().movePoints(newPoints);
109 
110  velocityMotionCorrection_.update();
111 
112  return true;
113 }
114 
115 
117 {
119 }
120 
121 
123 {
125 }
126 
127 
129 (
130  const polyDistributionMap&
131 )
132 {
134 }
135 
136 
137 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Definition: Field.C:498
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const Type & value() const
Return const reference to value.
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:53
Mesh motion specifically for the "pumping" system of an ink-jet injector.
inkJet(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool update()
Update the mesh for both mesh motion and topology change.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:420
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:1244
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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 scalar twoPi(2 *pi)
defineTypeNameAndDebug(none, 0)
addToRunTimeSelectionTable(fvMeshMover, none, fvMesh)
Namespace for OpenFOAM.
dimensionedScalar pos0(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:258
messageStream Info
dimensionedScalar cos(const dimensionedScalar &ds)
dictionary dict