Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "dynamicInkJetFvMesh.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <finiteVolume/volFields.H>
00029 #include <OpenFOAM/mathematicalConstants.H>
00030
00031
00032
00033 namespace Foam
00034 {
00035 defineTypeNameAndDebug(dynamicInkJetFvMesh, 0);
00036 addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject);
00037 }
00038
00039
00040
00041
00042 Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io)
00043 :
00044 dynamicFvMesh(io),
00045 dynamicMeshCoeffs_
00046 (
00047 IOdictionary
00048 (
00049 IOobject
00050 (
00051 "dynamicMeshDict",
00052 io.time().constant(),
00053 *this,
00054 IOobject::MUST_READ,
00055 IOobject::NO_WRITE
00056 )
00057 ).subDict(typeName + "Coeffs")
00058 ),
00059 amplitude_(readScalar(dynamicMeshCoeffs_.lookup("amplitude"))),
00060 frequency_(readScalar(dynamicMeshCoeffs_.lookup("frequency"))),
00061 refPlaneX_(readScalar(dynamicMeshCoeffs_.lookup("refPlaneX"))),
00062 stationaryPoints_
00063 (
00064 IOobject
00065 (
00066 "points",
00067 io.time().constant(),
00068 meshSubDir,
00069 *this,
00070 IOobject::MUST_READ,
00071 IOobject::NO_WRITE
00072 )
00073 )
00074 {
00075 Info<< "Performing a dynamic mesh calculation: " << endl
00076 << "amplitude: " << amplitude_
00077 << " frequency: " << frequency_
00078 << " refPlaneX: " << refPlaneX_ << endl;
00079 }
00080
00081
00082
00083 Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh()
00084 {}
00085
00086
00087
00088
00089 bool Foam::dynamicInkJetFvMesh::update()
00090 {
00091 scalar scalingFunction =
00092 0.5*(::cos(2*mathematicalConstant::pi*frequency_*time().value()) - 1.0);
00093
00094 Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
00095 << scalingFunction << endl;
00096
00097 pointField newPoints = stationaryPoints_;
00098
00099 newPoints.replace
00100 (
00101 vector::X,
00102 stationaryPoints_.component(vector::X)*
00103 (
00104 1.0
00105 + pos
00106 (
00107 - (stationaryPoints_.component(vector::X))
00108 - refPlaneX_
00109 )*amplitude_*scalingFunction
00110 )
00111 );
00112
00113 fvMesh::movePoints(newPoints);
00114
00115 volVectorField& U =
00116 const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
00117 U.correctBoundaryConditions();
00118
00119 return true;
00120 }
00121
00122
00123