Position interpolation in tabulated6DoFMotion does not give expected result
Summary
When the position of a dynamic mesh is calculated using tabulated6DoFMotion, the result is neither intuitive nor smooth. I don't know enough about the purported method to know if it's a bug or just not a very suitable algorithm.
Steps to reproduce
With at least 4 defined steps, define a motion that moves, pauses and returns. Example below:
Example case
dynamicMeshDict:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicOversetFvMesh;
dynamicOversetFvMeshCoeffs
{
// layerRelax 0.3;
}
solver multiSolidBodyMotionSolver;
multiSolidBodyMotionSolverCoeffs
{
movingZone
{
solidBodyMotionFunction tabulated6DoFMotion;
tabulated6DoFMotionCoeffs
{
CofG (0.001 0.001 0.001);
timeDataFileName "constant/dipMotion.dat";
}
}
}
// ************************************************************************* //
Dipmotion.dat:
//Position formatting is not important. File is based on the character sequence only.
//Vectors are not relative. Each vector is total displacement and total rotation.
(
//(time_point ( (linear displacement vector) (rotation vector) ) )
//(seconds ( (following unit system, usually meters) (radians) ) )
(0 ( (0 0 0) (0 0 0) ) )
(4.19042 ( (0 -0.159236 0) (0 0 0) ) )
(5.19042 ( (0 -0.159236 0) (0 0 0) ) )
(38.141 ( (0 0.05 0) (0 0 0) ) )
)
What is the current bug behaviour?
Instead of pausing between the middle two times (as would be expected from linear interpolation), there is a rapid further movement. See below for a graph where I've re-implemented the interpolateSplineXY.C algorithm to investigate what it returns:
What is the expected correct behavior?
Interpolation should either be linear (which would potentially cause problems with derivative values being high/undefined), or should approximate to linear with rounded corners of some kind.
Relevant logs and/or images
Environment information
- OpenFOAM version : 1912 & 2006
- Operating system : Ubuntu 18.04
- Hardware info :
- Compiler :
Possible fixes
Either use a different interpolation method here, or adjust what values the existing one returns: