displacementFvMotionSolver.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 "displacementFvMotionSolver.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "mapPolyMesh.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035 defineTypeNameAndDebug(displacementFvMotionSolver, 0);
00036 }
00037
00038
00039
00040
00041 Foam::displacementFvMotionSolver::displacementFvMotionSolver
00042 (
00043 const polyMesh& mesh,
00044 Istream&
00045 )
00046 :
00047 fvMotionSolver(mesh),
00048 points0_
00049 (
00050 pointIOField
00051 (
00052 IOobject
00053 (
00054 "points",
00055 mesh.time().constant(),
00056 polyMesh::meshSubDir,
00057 mesh,
00058 IOobject::MUST_READ,
00059 IOobject::NO_WRITE,
00060 false
00061 )
00062 )
00063 )
00064 {}
00065
00066
00067
00068
00069 Foam::displacementFvMotionSolver::~displacementFvMotionSolver()
00070 {}
00071
00072
00073
00074
00075 void Foam::displacementFvMotionSolver::updateMesh(const mapPolyMesh& mpm)
00076 {
00077 fvMotionSolver::updateMesh(mpm);
00078
00079
00080
00081
00082
00083
00084 const pointField& points =
00085 (
00086 mpm.hasMotionPoints()
00087 ? mpm.preMotionPoints()
00088 : fvMesh_.points()
00089 );
00090
00091
00092 const vector span0 = boundBox(points0_).span();
00093 const vector span = boundBox(points).span();
00094
00095 vector scaleFactors(cmptDivide(span0, span));
00096
00097 pointField newPoints0(mpm.pointMap().size());
00098
00099 forAll(newPoints0, pointI)
00100 {
00101 label oldPointI = mpm.pointMap()[pointI];
00102
00103 if (oldPointI >= 0)
00104 {
00105 label masterPointI = mpm.reversePointMap()[oldPointI];
00106
00107 if (masterPointI == pointI)
00108 {
00109 newPoints0[pointI] = points0_[oldPointI];
00110 }
00111 else
00112 {
00113
00114 newPoints0[pointI] = points0_[oldPointI] + cmptMultiply
00115 (
00116 scaleFactors,
00117 points[pointI]-points[masterPointI]
00118 );
00119 }
00120 }
00121 else
00122 {
00123 FatalErrorIn
00124 (
00125 "displacementLaplacianFvMotionSolver::updateMesh"
00126 "(const mapPolyMesh& mpm)"
00127 ) << "Cannot work out coordinates of introduced vertices."
00128 << " New vertex " << pointI << " at coordinate "
00129 << points[pointI] << exit(FatalError);
00130 }
00131 }
00132 points0_.transfer(newPoints0);
00133 }
00134
00135
00136
Copyright © 2000-2009 OpenCFD Ltd