This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/moveMeshLeastSquares.H

56 lines
1.2 KiB
C++
Raw Normal View History

2012-09-11 15:42:55 +00:00
//--------------------------------------------------//
//- move mesh
//--------------------------------------------------//
if(min(J.internalField()) > 0)
{
2012-09-11 15:42:55 +00:00
Info << "Moving mesh using least squares interpolation" << endl;
leastSquaresVolPointInterpolation pointInterpolation(mesh);
2012-09-11 15:42:55 +00:00
// Create point mesh
pointMesh pMesh(mesh);
2012-09-11 15:42:55 +00:00
wordList types
(
pMesh.boundary().size(),
calculatedFvPatchVectorField::typeName
);
2012-09-11 15:42:55 +00:00
pointVectorField pointU
(
IOobject
(
"pointU",
runTime.timeName(),
mesh
2012-09-11 15:42:55 +00:00
),
pMesh,
dimensionedVector("zero", dimLength, vector::zero),
types
);
2012-09-11 15:42:55 +00:00
pointInterpolation.interpolate(U, pointU);
const vectorField& pointUI = pointU.internalField();
2012-09-11 15:42:55 +00:00
//- Move mesh
vectorField newPoints = mesh.allPoints();
forAll (pointUI, pointI)
{
2012-09-11 15:42:55 +00:00
newPoints[pointI] += pointUI[pointI];
}
2012-09-11 15:42:55 +00:00
twoDPointCorrector twoDCorrector(mesh);
twoDCorrector.correctPoints(newPoints);
mesh.movePoints(newPoints);
mesh.V00();
mesh.moving(false);
}
else
{
FatalErrorIn(args.executable())
<< "Negative Jacobian"
<< exit(FatalError);
}