jmf |
August 21, 2016 15:36 |
Messing alphaEqn solver with meshPrimitivePtr->movePoints(newPointsRef, oldPointsRef)
Hi
I spent two days in vain to solve coding problem.
My project is to modify interDyMFoam by adding a tightly coupled motion solver loop.
For the mesh deformation, I try to use the method movePoints() from the class primitiveMesh
Here is an extract of the code:
Code:
// Calculates the candidatePoints from the initialPoints
pointField initialPoints(mesh.points());
tmp<pointField> candidatePointsTmp(new pointField(mesh.points()));
pointField& candidatePointsRef = candidatePointsTmp();
// Calculate the transformation septernion from the initial state
septernion s ( centreOfMass - centreOfMass0,
quaternion(orientationTensor & orientationTensor0.T())
);
forAll(candidatePointsRef, iPoint) {
// Move non-stationary points
if (scale_[iPoint] > SMALL) {
// Use solid-body motion where scale_ = 1
if (scale_[iPoint] > 1 - SMALL) {
candidatePointsRef[iPoint] = centreOfMass
+ (orientationTensor & orientationTensor0.T() & (initialPoints[iPoint] - centreOfMass0));
}
// Slerp septernion interpolation
else {
septernion ss(slerp(septernion::I, s, scale_[iPoint]));
candidatePointsRef[iPoint] = centreOfMass0
+ ss.transform (initialPoints[iPoint] - centreOfMass0);
}
}
}
// Calculates the swept volume with the base class primitiveMesh
pointField& initialPointsRef = initialPoints;
primitiveMesh* meshPrimitivePtr = &mesh;
// Following instruction causes the bug
tmp<scalarField> sweptVolsTmp
(
meshPrimitivePtr->movePoints
(
candidatePointsRef,
initialPointsRef
)
);
This compiles, creates the new points and calculates the swept volume as expected.
But after that, the solver fails when solving "alpha1" :
Code:
smoothSolver: Solving for alpha.water, Initial residual = nan, Final residual = nan, No Iterations 1000
Phase-1 volume fraction = -nan Min(alpha1) = -nan Max(alpha1) = -nan
MULES: Correcting alpha.water
Phase-1 volume fraction = -nan Min(alpha1) = -nan Max(alpha1) = -nan
When I comment out the line marked as bug, everything is normal.
I can't figure out the problem : pointers ? tmp<field> ?
Could anybody help out ?
Greetings
Jean-Michel
|