2012-09-11 15:42:55 +00:00
|
|
|
{
|
|
|
|
// Move fluid mesh
|
2013-10-11 13:31:14 +00:00
|
|
|
const vectorField& n =
|
2012-09-11 15:42:55 +00:00
|
|
|
mesh.boundaryMesh()[fluidPatchID].pointNormals();
|
|
|
|
|
|
|
|
primitivePatchInterpolation patchInterpolator
|
|
|
|
(
|
|
|
|
mesh.boundaryMesh()[fluidPatchID]
|
|
|
|
);
|
|
|
|
|
|
|
|
scalarField pointDeltaCoeffs =
|
|
|
|
patchInterpolator.faceToPointInterpolate
|
|
|
|
(
|
|
|
|
mesh.boundary()[fluidPatchID].deltaCoeffs()
|
|
|
|
);
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
scalar delta =
|
2012-09-11 15:42:55 +00:00
|
|
|
gMax
|
|
|
|
(
|
|
|
|
mag
|
|
|
|
(
|
|
|
|
n
|
|
|
|
& (
|
|
|
|
accumulatedFluidInterfaceDisplacement
|
|
|
|
+ fluidPatchPointsDispl
|
|
|
|
- fluidPatchPointsDisplOld
|
|
|
|
)
|
|
|
|
)
|
|
|
|
*pointDeltaCoeffs
|
|
|
|
);
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
Info << "Maximal accumulated displacement of interface points: "
|
2012-09-11 15:42:55 +00:00
|
|
|
<< delta << endl;
|
|
|
|
|
|
|
|
if(delta < interfaceDeformationLimit)
|
|
|
|
{
|
|
|
|
// Move only interface points
|
|
|
|
pointField newPoints = mesh.allPoints();
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
const labelList& meshPoints =
|
2012-09-11 15:42:55 +00:00
|
|
|
mesh.boundaryMesh()[fluidPatchID].meshPoints();
|
|
|
|
|
|
|
|
forAll (fluidPatchPointsDispl, pointI)
|
|
|
|
{
|
2013-10-11 13:31:14 +00:00
|
|
|
newPoints[meshPoints[pointI]] +=
|
2012-09-11 15:42:55 +00:00
|
|
|
fluidPatchPointsDispl[pointI]
|
|
|
|
- fluidPatchPointsDisplOld[pointI];
|
|
|
|
}
|
|
|
|
|
|
|
|
twoDPointCorrector twoDCorrector(mesh);
|
|
|
|
|
|
|
|
twoDCorrector.correctPoints(newPoints);
|
|
|
|
|
|
|
|
mesh.movePoints(newPoints);
|
|
|
|
|
|
|
|
// Accumulate interface points displacement
|
2013-10-11 13:31:14 +00:00
|
|
|
accumulatedFluidInterfaceDisplacement +=
|
2012-09-11 15:42:55 +00:00
|
|
|
fluidPatchPointsDispl
|
|
|
|
- fluidPatchPointsDisplOld;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Move whole fluid mesh
|
|
|
|
pointField newPoints = mesh.allPoints();
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
const labelList& meshPoints =
|
2012-09-11 15:42:55 +00:00
|
|
|
mesh.boundaryMesh()[fluidPatchID].meshPoints();
|
|
|
|
|
|
|
|
forAll (accumulatedFluidInterfaceDisplacement, pointI)
|
|
|
|
{
|
2013-10-11 13:31:14 +00:00
|
|
|
newPoints[meshPoints[pointI]] -=
|
|
|
|
accumulatedFluidInterfaceDisplacement[pointI];
|
2012-09-11 15:42:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
twoDPointCorrector twoDCorrector(mesh);
|
|
|
|
|
|
|
|
twoDCorrector.correctPoints(newPoints);
|
|
|
|
|
|
|
|
mesh.movePoints(newPoints);
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
accumulatedFluidInterfaceDisplacement +=
|
2012-09-11 15:42:55 +00:00
|
|
|
fluidPatchPointsDispl
|
|
|
|
- fluidPatchPointsDisplOld;
|
|
|
|
|
|
|
|
|
|
|
|
if (feMotionSolver)
|
|
|
|
{
|
|
|
|
tetPointVectorField& motionU =
|
|
|
|
const_cast<tetPointVectorField&>
|
|
|
|
(
|
|
|
|
mesh.objectRegistry::
|
|
|
|
lookupObject<tetPointVectorField>
|
|
|
|
(
|
|
|
|
"motionU"
|
|
|
|
)
|
|
|
|
);
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
fixedValueTetPolyPatchVectorField& motionUFluidPatch =
|
|
|
|
refCast<fixedValueTetPolyPatchVectorField>
|
|
|
|
(
|
|
|
|
motionU.boundaryField()[fluidPatchID]
|
|
|
|
);
|
|
|
|
|
|
|
|
tetPolyPatchInterpolation tppi
|
|
|
|
(
|
|
|
|
refCast<const faceTetPolyPatch>(motionUFluidPatch.patch())
|
|
|
|
);
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
motionUFluidPatch ==
|
2012-09-11 15:42:55 +00:00
|
|
|
tppi.pointToPointInterpolate
|
|
|
|
(
|
|
|
|
accumulatedFluidInterfaceDisplacement
|
|
|
|
/runTime.deltaT().value()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else if (fvMotionSolver)
|
|
|
|
{
|
|
|
|
pointVectorField& motionU =
|
|
|
|
const_cast<pointVectorField&>
|
|
|
|
(
|
|
|
|
mesh.objectRegistry::
|
|
|
|
lookupObject<pointVectorField>
|
|
|
|
(
|
|
|
|
"pointMotionU"
|
|
|
|
)
|
|
|
|
);
|
2013-10-11 13:31:14 +00:00
|
|
|
|
2012-09-11 15:42:55 +00:00
|
|
|
fixedValuePointPatchVectorField& motionUFluidPatch =
|
|
|
|
refCast<fixedValuePointPatchVectorField>
|
|
|
|
(
|
|
|
|
motionU.boundaryField()[fluidPatchID]
|
|
|
|
);
|
|
|
|
|
2013-10-11 13:31:14 +00:00
|
|
|
motionUFluidPatch ==
|
2012-09-11 15:42:55 +00:00
|
|
|
accumulatedFluidInterfaceDisplacement
|
|
|
|
/runTime.deltaT().value();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FatalErrorIn(args.executable())
|
|
|
|
<< "Problem with mesh motion solver selection"
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
|
|
|
|
mesh.update();
|
|
|
|
|
|
|
|
accumulatedFluidInterfaceDisplacement = vector::zero;
|
|
|
|
}
|
|
|
|
}
|