dynamicInkJetFvMesh.C
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
00027 #include "dynamicInkJetFvMesh.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "volFields.H"
00030 #include "mathematicalConstants.H"
00031
00032
00033
00034 namespace Foam
00035 {
00036 defineTypeNameAndDebug(dynamicInkJetFvMesh, 0);
00037 addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject);
00038 }
00039
00040
00041
00042
00043 Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io)
00044 :
00045 dynamicFvMesh(io),
00046 dynamicMeshCoeffs_
00047 (
00048 IOdictionary
00049 (
00050 IOobject
00051 (
00052 "dynamicMeshDict",
00053 io.time().constant(),
00054 *this,
00055 IOobject::MUST_READ,
00056 IOobject::NO_WRITE
00057 )
00058 ).subDict(typeName + "Coeffs")
00059 ),
00060 amplitude_(readScalar(dynamicMeshCoeffs_.lookup("amplitude"))),
00061 frequency_(readScalar(dynamicMeshCoeffs_.lookup("frequency"))),
00062 refPlaneX_(readScalar(dynamicMeshCoeffs_.lookup("refPlaneX"))),
00063 stationaryPoints_
00064 (
00065 IOobject
00066 (
00067 "points",
00068 io.time().constant(),
00069 meshSubDir,
00070 *this,
00071 IOobject::MUST_READ,
00072 IOobject::NO_WRITE
00073 )
00074 )
00075 {
00076 Info<< "Performing a dynamic mesh calculation: " << endl
00077 << "amplitude: " << amplitude_
00078 << " frequency: " << frequency_
00079 << " refPlaneX: " << refPlaneX_ << endl;
00080 }
00081
00082
00083
00084 Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh()
00085 {}
00086
00087
00088
00089
00090 bool Foam::dynamicInkJetFvMesh::update()
00091 {
00092 scalar scalingFunction =
00093 0.5*(::cos(2*mathematicalConstant::pi*frequency_*time().value()) - 1.0);
00094
00095 Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
00096 << scalingFunction << endl;
00097
00098 pointField newPoints = stationaryPoints_;
00099
00100 newPoints.replace
00101 (
00102 vector::X,
00103 stationaryPoints_.component(vector::X)*
00104 (
00105 1.0
00106 + pos
00107 (
00108 - (stationaryPoints_.component(vector::X))
00109 - refPlaneX_
00110 )*amplitude_*scalingFunction
00111 )
00112 );
00113
00114 fvMesh::movePoints(newPoints);
00115
00116 volVectorField& U =
00117 const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
00118 U.correctBoundaryConditions();
00119
00120 return true;
00121 }
00122
00123
00124
Copyright © 2000-2009 OpenCFD Ltd