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 | Copyright (C) 2011 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 "dynamicInkJetFvMesh.H"
28 #include "volFields.H"
29 #include "mathematicalConstants.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(dynamicInkJetFvMesh, 0);
36  addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject);
37 }
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 :
44  dynamicFvMesh(io),
45  dynamicMeshCoeffs_
46  (
48  (
49  IOobject
50  (
51  "dynamicMeshDict",
52  io.time().constant(),
53  *this,
54  IOobject::MUST_READ_IF_MODIFIED,
55  IOobject::NO_WRITE,
56  false
57  )
58  ).subDict(typeName + "Coeffs")
59  ),
60  amplitude_(readScalar(dynamicMeshCoeffs_.lookup("amplitude"))),
61  frequency_(readScalar(dynamicMeshCoeffs_.lookup("frequency"))),
62  refPlaneX_(readScalar(dynamicMeshCoeffs_.lookup("refPlaneX"))),
63  stationaryPoints_
64  (
65  IOobject
66  (
67  "points",
68  io.time().constant(),
69  meshSubDir,
70  *this,
71  IOobject::MUST_READ,
72  IOobject::NO_WRITE
73  )
74  )
75 {
76  Info<< "Performing a dynamic mesh calculation: " << endl
77  << "amplitude: " << amplitude_
78  << " frequency: " << frequency_
79  << " refPlaneX: " << refPlaneX_ << endl;
80 }
81 
82 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 
85 {}
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
91 {
92  scalar scalingFunction =
93  0.5*
94  (
95  ::cos(constant::mathematical::twoPi*frequency_*time().value())
96  - 1.0
97  );
98 
99  Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
100  << scalingFunction << endl;
101 
102  pointField newPoints = stationaryPoints_;
103 
104  newPoints.replace
105  (
106  vector::X,
107  stationaryPoints_.component(vector::X)*
108  (
109  1.0
110  + pos
111  (
112  - (stationaryPoints_.component(vector::X))
113  - refPlaneX_
114  )*amplitude_*scalingFunction
115  )
116  );
117 
118  fvMesh::movePoints(newPoints);
119 
120  volVectorField& U =
121  const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
122  U.correctBoundaryConditions();
123 
124  return true;
125 }
126 
127 
128 // ************************************************************************* //
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
mathematicalConstants.H
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:51
Foam::dynamicInkJetFvMesh::amplitude_
scalar amplitude_
Definition: dynamicInkJetFvMesh.H:63
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::constant::mathematical::twoPi
const scalar twoPi(2 *pi)
U
U
Definition: pEqn.H:46
constant
Constant dispersed-phase particle diameter model.
Foam::dynamicInkJetFvMesh::frequency_
scalar frequency_
Definition: dynamicInkJetFvMesh.H:64
Foam::dynamicInkJetFvMesh::refPlaneX_
scalar refPlaneX_
Definition: dynamicInkJetFvMesh.H:65
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
Foam::Vector< scalar >::X
@ X
Definition: Vector.H:89
Foam::Field::replace
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
Foam::dynamicInkJetFvMesh::update
virtual bool update()
Update the mesh for both mesh motion and topology change.
Definition: dynamicInkJetFvMesh.C:90
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::surfaceInterpolation::movePoints
bool movePoints()
Do what is neccessary if the mesh has moved.
Definition: surfaceInterpolation.C:125
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
readScalar
#define readScalar
Definition: doubleScalar.C:38
dynamicInkJetFvMesh.H
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh
dynamicInkJetFvMesh(const dynamicInkJetFvMesh &)
Disallow default bitwise copy construct.
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress
Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh
~dynamicInkJetFvMesh()
Destructor.
Definition: dynamicInkJetFvMesh.C:84
Foam::cos
dimensionedScalar cos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:256
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:190