2012-09-11 15:42:55 +00:00
|
|
|
//--------------------------------------------------//
|
|
|
|
//- move mesh
|
|
|
|
//--------------------------------------------------//
|
2013-10-14 08:26:40 +00:00
|
|
|
{
|
|
|
|
//Info << "Moving mesh using least squares interpolation" << endl;
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
leastSquaresVolPointInterpolation pointInterpolation(mesh);
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
// Create point mesh
|
|
|
|
pointMesh pMesh(mesh);
|
2013-10-11 13:31:14 +00:00
|
|
|
//pointMesh pMesh(mesh);
|
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
wordList types
|
2013-10-14 08:26:40 +00:00
|
|
|
(
|
|
|
|
pMesh.boundary().size(),
|
|
|
|
calculatedFvPatchVectorField::typeName
|
|
|
|
);
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
pointVectorField pointDU
|
2013-10-14 08:26:40 +00:00
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"pointDU",
|
|
|
|
runTime.timeName(),
|
|
|
|
mesh
|
2012-09-11 15:42:55 +00:00
|
|
|
),
|
2013-10-14 08:26:40 +00:00
|
|
|
pMesh,
|
|
|
|
dimensionedVector("zero", dimLength, vector::zero),
|
|
|
|
types
|
|
|
|
);
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
pointInterpolation.interpolate(DU, pointDU);
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
//pointDU.write();
|
|
|
|
|
2013-10-14 08:26:40 +00:00
|
|
|
const vectorField& pointDUI = pointDU.internalField();
|
2012-09-11 15:42:55 +00:00
|
|
|
|
|
|
|
//- Move mesh
|
2013-10-11 13:31:14 +00:00
|
|
|
//vectorField newPoints = mesh.allPoints();
|
|
|
|
pointVectorField newPoints
|
2013-10-14 08:26:40 +00:00
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"newPoints",
|
|
|
|
runTime.timeName(),
|
|
|
|
mesh
|
2013-10-11 13:31:14 +00:00
|
|
|
),
|
2013-10-14 08:26:40 +00:00
|
|
|
pMesh,
|
|
|
|
dimensionedVector("zero", dimLength, vector::zero)
|
|
|
|
//mesh.allPoints()
|
|
|
|
);
|
2013-10-11 13:31:14 +00:00
|
|
|
newPoints.internalField() = mesh.allPoints();
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
// note: allPoints will have more points than pointDU
|
|
|
|
// if there are globalFaceZones
|
2012-09-11 15:42:55 +00:00
|
|
|
forAll (pointDUI, pointI)
|
2013-10-14 08:26:40 +00:00
|
|
|
{
|
2012-09-11 15:42:55 +00:00
|
|
|
newPoints[pointI] += pointDUI[pointI];
|
2013-10-14 08:26:40 +00:00
|
|
|
}
|
2012-09-11 15:42:55 +00:00
|
|
|
|
2013-10-14 08:26:40 +00:00
|
|
|
// Correct symmetryPlane points
|
|
|
|
|
|
|
|
forAll(mesh.boundaryMesh(), patchI)
|
|
|
|
{
|
|
|
|
if (isA<symmetryPolyPatch>(mesh.boundaryMesh()[patchI]))
|
|
|
|
{
|
|
|
|
const labelList& meshPoints =
|
|
|
|
mesh.boundaryMesh()[patchI].meshPoints();
|
|
|
|
|
|
|
|
vector avgN =
|
|
|
|
gAverage(mesh.boundaryMesh()[patchI].pointNormals());
|
|
|
|
|
|
|
|
vector i(1, 0, 0);
|
|
|
|
vector j(0, 1, 0);
|
|
|
|
vector k(0, 0, 1);
|
|
|
|
|
|
|
|
if (mag(avgN&i) > 0.95)
|
|
|
|
{
|
|
|
|
forAll(meshPoints, pI)
|
|
|
|
{
|
|
|
|
newPoints[meshPoints[pI]].x() = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mag(avgN&j) > 0.95)
|
|
|
|
{
|
|
|
|
forAll(meshPoints, pI)
|
|
|
|
{
|
|
|
|
newPoints[meshPoints[pI]].y() = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mag(avgN&k) > 0.95)
|
|
|
|
{
|
|
|
|
forAll(meshPoints, pI)
|
|
|
|
{
|
|
|
|
newPoints[meshPoints[pI]].z() = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# include "calcUnusedNewPoints.H"
|
|
|
|
|
|
|
|
// // now we make sure processor patches are exactly the same
|
|
|
|
// newPoints.correctBoundaryConditions();
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
twoDPointCorrector twoDCorrector(mesh);
|
|
|
|
twoDCorrector.correctPoints(newPoints);
|
|
|
|
mesh.movePoints(newPoints);
|
|
|
|
mesh.V00();
|
|
|
|
mesh.moving(false);
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2013-10-14 08:26:40 +00:00
|
|
|
// Update n
|
|
|
|
n = mesh.Sf()/mesh.magSf();
|
2013-10-11 13:31:14 +00:00
|
|
|
}
|