1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "dynamicInkJetFvMesh.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "volFields.H"
29 #include "mathematicalConstants.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(dynamicInkJetFvMesh, 0);
36 addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject);
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io)
57 ).subDict(typeName + "Coeffs")
59 amplitude_(readScalar(dynamicMeshCoeffs_.lookup("amplitude"))),
60 frequency_(readScalar(dynamicMeshCoeffs_.lookup("frequency"))),
61 refPlaneX_(readScalar(dynamicMeshCoeffs_.lookup("refPlaneX"))),
75 Info<< "Performing a dynamic mesh calculation: " << endl
76 << "amplitude: " << amplitude_
77 << " frequency: " << frequency_
78 << " refPlaneX: " << refPlaneX_ << endl;
81 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
83 Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh()
87 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 bool Foam::dynamicInkJetFvMesh::update()
91 scalar scalingFunction =
92 0.5*(::cos(2*mathematicalConstant::pi*frequency_*time().value()) - 1.0);
94 Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
95 << scalingFunction << endl;
97 pointField newPoints = stationaryPoints_;
102 stationaryPoints_.component(vector::X)*
107 - (stationaryPoints_.component(vector::X))
109 )*amplitude_*scalingFunction
113 fvMesh::movePoints(newPoints);
116 const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
117 U.correctBoundaryConditions();
123 // ************************************************************************* //