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