RBF mesh motion solver - davidsblom/FOAM-FSI GitHub Wiki
dynamicMeshDict
The page https://github.com/davidsblom/FOAM-FSI/blob/master/run/3dTube/fluid/constant/dynamicMeshDict shows an example of the configuration file for the mesh motion solver. A distinction is made between moving patches, and static patches. In general, the static patches consist of the outer boundaries of the domain and possibly also other patches of the grid.
dynamicFvMesh dynamicMotionSolverFvMesh;
solver RBFMeshMotionSolver;
movingPatches ( wall );
staticPatches ( outlet inlet );
coarsening
{
enabled true;
tol 1.0e-6;
minPoints 10;
maxPoints 2000;
livePointSelection true;
tolLivePointSelection 1.0e-5;
}
interpolation
{
function TPS;
}
Coarsening based on the greedy algorithm
A coarsening sub-dictionary configuration is available which can be enabled or disabled with the "enabled" parameter. The coarsening of the control points for the radial basis function interpolation is based on a unit displacement of the moving and static patches, or on the actual imposed displacement. The points with the largest error are selected. The error is simply the difference between the interpolated value and the imposed or unit displacement of the control points.
The algorithm can be configured with a minimum and maximum number of points. A maximum number of points can be set such that the memory usage of the mesh motion solver does not exceed the amount of available RAM.
In case "livePointSelection" is set to true, the greedy algorithms selects the points based on the actual imposed displacement. A reselection of the control points occurs in case the error is larger than "tolLivePointSelection". Generally, reselection of the control points is only occasionally and not at every time step or iteration.
In case "livePointSelection" is set to false, a unit displacement strategy is applied, and the control points are selected once for the complete simulation.
Interpolation
The sub-dictionary interpolation is used to select the radial basis function. Several functions can be used:
- TPS: thin plate spline. A globally supported radial basis function.
- WendlandC0: Wendland's C0 compactly supported radial basis function. A radius should be set separately in the interpolation sub-dictionary.
- WendlandC2: Wendland's C2 compactly supported radial basis function.
- WendlandC4: Wendland's C4 compactly supported radial basis function.
- WendlandC6: Wendland's C6 compactly supported radial basis function.
Reuse the motion solver
In order to reuse the radial basis function mesh motion solver, a couple lines of code should be added to your solver. Including of the motion solver consists of the following steps:
- Include the header file
RBFMeshMotionSolver.H
- Set the motion via the
setMotion()
method of the RBFMeshMotionSolver class. - Include the path to the header files and link to the shared RBFMeshMotionSolver library.
- Include the path to the header files of the C++ Eigen library, which is located in src/thirdParty/eigen.
Include the header file
The inclusion of the header file is a straightforward step. Include #include "RBFMeshMotionSolver.H"
before the main method of your solver.
Set the motion
The mesh motion solver assumes that the motion of the moving patches is defined in the face centers, and not in the vertices. This is also checked and enforced in the implementation of the setMotion()
method. Here is the method declaration:
void setMotion( const Field<vectorField> & motion );
The motion is defined as the change of the displacement with respect to the previous FSI iteration or time step.
Also, the method expects a list of vectorFields. The length of the list is the total number of patches in the complete domain as defined by blockMeshDict
. The list is ordered by the patch id's as set by OpenFOAM. An empty vectorField can be given for non-moving patches. The length of the vectorField for the moving patches is the ordering of the local patch boundary field.
An example of the inclusion of the setMotion
call in the solver is:
RBFMeshMotionSolver & motionSolver =
const_cast<RBFMeshMotionSolver &>
(
mesh.lookupObject<RBFMeshMotionSolver>( "dynamicMeshDict" )
);
Field<vectorField> patches( mesh.boundaryMesh().size(), vectorField( 0 ) );
patches[movingPatchId] = motion;
motionSolver.setMotion( patches );
mesh.update();
Linking
Add the path to the src/RBFMeshMotionSolver/lnInclude/
folder to EXE_INC, the path to src/thirdParty/eigen
and link to the lRBFMeshMotionSolver shared library. An example is given in:
https://github.com/davidsblom/FOAM-FSI/blob/master/applications/solvers/fsi/fsiFoam/Make/options