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/icoFsiElasticNonLinULSolidFoam/moveSolidMeshLeastSquares.H

57 lines
1.3 KiB
C
Raw Normal View History

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