displacementLaplacianFvMotionSolver.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 "displacementLaplacianFvMotionSolver.H"
00028 #include "motionDiffusivity.H"
00029 #include "fvmLaplacian.H"
00030 #include "addToRunTimeSelectionTable.H"
00031 #include "OFstream.H"
00032 #include "meshTools.H"
00033 #include "mapPolyMesh.H"
00034 #include "volPointInterpolation.H"
00035
00036
00037
00038 namespace Foam
00039 {
00040 defineTypeNameAndDebug(displacementLaplacianFvMotionSolver, 0);
00041
00042 addToRunTimeSelectionTable
00043 (
00044 fvMotionSolver,
00045 displacementLaplacianFvMotionSolver,
00046 dictionary
00047 );
00048 }
00049
00050
00051
00052
00053 Foam::displacementLaplacianFvMotionSolver::displacementLaplacianFvMotionSolver
00054 (
00055 const polyMesh& mesh,
00056 Istream& is
00057 )
00058 :
00059 displacementFvMotionSolver(mesh, is),
00060 pointDisplacement_
00061 (
00062 IOobject
00063 (
00064 "pointDisplacement",
00065 fvMesh_.time().timeName(),
00066 fvMesh_,
00067 IOobject::MUST_READ,
00068 IOobject::AUTO_WRITE
00069 ),
00070 pointMesh::New(fvMesh_)
00071 ),
00072 cellDisplacement_
00073 (
00074 IOobject
00075 (
00076 "cellDisplacement",
00077 mesh.time().timeName(),
00078 mesh,
00079 IOobject::READ_IF_PRESENT,
00080 IOobject::AUTO_WRITE
00081 ),
00082 fvMesh_,
00083 dimensionedVector
00084 (
00085 "cellDisplacement",
00086 pointDisplacement_.dimensions(),
00087 vector::zero
00088 ),
00089 cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
00090 ),
00091 pointLocation_(NULL),
00092 diffusivityPtr_
00093 (
00094 motionDiffusivity::New(*this, lookup("diffusivity"))
00095 ),
00096 frozenPointsZone_
00097 (
00098 found("frozenPointsZone")
00099 ? fvMesh_.pointZones().findZoneID(lookup("frozenPointsZone"))
00100 : -1
00101 )
00102 {
00103 IOobject io
00104 (
00105 "pointLocation",
00106 fvMesh_.time().timeName(),
00107 fvMesh_,
00108 IOobject::MUST_READ,
00109 IOobject::AUTO_WRITE
00110 );
00111
00112 if (debug)
00113 {
00114 Info<< "displacementLaplacianFvMotionSolver:" << nl
00115 << " diffusivity : " << diffusivityPtr_().type() << nl
00116 << " frozenPoints zone : " << frozenPointsZone_ << endl;
00117 }
00118
00119
00120 if (io.headerOk())
00121 {
00122 pointLocation_.reset
00123 (
00124 new pointVectorField
00125 (
00126 io,
00127 pointMesh::New(fvMesh_)
00128 )
00129 );
00130
00131 if (debug)
00132 {
00133 Info<< "displacementLaplacianFvMotionSolver :"
00134 << " Read pointVectorField "
00135 << io.name() << " to be used for boundary conditions on points."
00136 << nl
00137 << "Boundary conditions:"
00138 << pointLocation_().boundaryField().types() << endl;
00139 }
00140 }
00141 }
00142
00143
00144
00145
00146 Foam::displacementLaplacianFvMotionSolver::
00147 ~displacementLaplacianFvMotionSolver()
00148 {}
00149
00150
00151
00152
00153 Foam::tmp<Foam::pointField>
00154 Foam::displacementLaplacianFvMotionSolver::curPoints() const
00155 {
00156 volPointInterpolation::New(fvMesh_).interpolate
00157 (
00158 cellDisplacement_,
00159 pointDisplacement_
00160 );
00161
00162 if (pointLocation_.valid())
00163 {
00164 if (debug)
00165 {
00166 Info<< "displacementLaplacianFvMotionSolver : applying "
00167 << " boundary conditions on " << pointLocation_().name()
00168 << " to new point location."
00169 << endl;
00170 }
00171
00172 pointLocation_().internalField() =
00173 points0()
00174 + pointDisplacement_.internalField();
00175
00176 pointLocation_().correctBoundaryConditions();
00177
00178
00179 if (frozenPointsZone_ != -1)
00180 {
00181 const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
00182
00183 forAll(pz, i)
00184 {
00185 pointLocation_()[pz[i]] = points0()[pz[i]];
00186 }
00187 }
00188
00189 twoDCorrectPoints(pointLocation_().internalField());
00190
00191 return tmp<pointField>(pointLocation_().internalField());
00192 }
00193 else
00194 {
00195 tmp<pointField> tcurPoints
00196 (
00197 points0() + pointDisplacement_.internalField()
00198 );
00199
00200
00201 if (frozenPointsZone_ != -1)
00202 {
00203 const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
00204
00205 forAll(pz, i)
00206 {
00207 tcurPoints()[pz[i]] = points0()[pz[i]];
00208 }
00209 }
00210
00211 twoDCorrectPoints(tcurPoints());
00212
00213 return tcurPoints;
00214 }
00215 }
00216
00217
00218 void Foam::displacementLaplacianFvMotionSolver::solve()
00219 {
00220
00221
00222 movePoints(fvMesh_.points());
00223
00224 diffusivityPtr_->correct();
00225 pointDisplacement_.boundaryField().updateCoeffs();
00226
00227 Foam::solve
00228 (
00229 fvm::laplacian
00230 (
00231 diffusivityPtr_->operator()(),
00232 cellDisplacement_,
00233 "laplacian(diffusivity,cellDisplacement)"
00234 )
00235 );
00236 }
00237
00238
00239 void Foam::displacementLaplacianFvMotionSolver::updateMesh
00240 (
00241 const mapPolyMesh& mpm
00242 )
00243 {
00244 displacementFvMotionSolver::updateMesh(mpm);
00245
00246
00247
00248 diffusivityPtr_.reset(NULL);
00249 diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
00250 }
00251
00252
00253
Copyright © 2000-2009 OpenCFD Ltd