Fluid-Structure Interaction
Dyn3d
can be used to solve rigid body dynamics, to simulate fluid-structure interaction, we use Whirl.jl branch stronglycoupled2d
to solve for fluid dynamics. To make fluid and body dynamics coupling with each other, we also need to construct a series of functions to act as interface between them, and choose appropriate coupling schemes.
Strongly coupled method is finished, and fully coupled method is under construction. Example of working fluid-structure interaction notebook is also provided under /notebook.
Strongly coupled method
Coupling scheme is refered to Wang and Eldredge JCP, detailes are skipped here. The main idea is to use fluid forces on body as the iterating variable, run the body solver Dyn3d
with proposed fluid force as external force for the body-joint system, get updated body coordinates and velocities. Then use these information as boundary condition for fluid solver Whirl
, get updated fluid force on body from Lagrange multipliers. If the proposed force and updated force are close enough, this timestep is said to be converged. Otherwise we use a relaxation scheme to calculate a new proposed force, iterates until it converge.
There are several things that needs to be carefully dealt with, because we are using two packages together and variables need to be consistent from one to another.
Scaling
For example gravity in body solver should be non-dimensionalized to $[0.0, -1.0, 0.0]$ instead of $[0.0, -9.8, 0.0]$. Scaling is done through:
mass ratio $m^* = \frac{\rho_{b}/L}{\rho_{f}} = \frac{\rho_{b}}{\rho_{f} L}$
Reynolds number $Re = \frac{\rho_{f} U_\infty L}{\mu}$
torsion stiffness $k^* = \frac{k}{\rho_{f} {U_\infty}^2 {L}^2}$
bending stiffness $c^* = \frac{c}{\rho_{f} U_\infty {L}^3}$
gravity $g^* = \frac{g L}{{U_\infty}^2}$ if uniform flow is non-zero
Fully coupled method
Under construction
Methods
Dyn3d.FluidInteraction.BodyGrid
— Type.BodyGrid(bid::Int, np::Int, points, q_i, f_ex3d, f_ex6d)
Design this structure to contain body points coord, motion and forces used in fluid-structure interaction
Fields
bid
: body id in the joint-body chainnp
: number of grid points on this bodypoints
: (x,y,z) coordinates of all body points in local body frameq_i
: (x,y,z) coordinates of all body points in inertial framev_i
: velocity of all body points in inertial framef_ex3d
: external force(fluid force) on all body points in inertial framef_ex6d
: f_ex3d integrated through all body points on one body and described in 6d spatial vector form
Constructors
BodyGrid(bid,np,points)
: initialize q_i, v_i, f_ex3d to be Vector of zeros(3), f_ex6d to be zeros(6)
AcquireBodyGridKinematics(bd::BodyDyn, bgs::Vector{BodyGrid})
Given updated bd structure, which contains 3d bs[i].x_i in inertial frame and 6d bs[i].v of each body in the body local frame, return 3d linear q_i and v_i of each body point in the inertial frame.
Dyn3d.FluidInteraction.CutOut2d
— Method.CutOut2d(bd::BodyDyn,bgs::Vector{BodyGrid})
This function need to be called only once after GenerateBodyGrid for 2d case of flat plates.
In Dyn3d
, bodies are constructed by quadrilateral/triangles(not lines) in z-x plane for both 2d/3d cases. In Whirl
, fluid in 2d cases are constructed in x-y plane. Thus to describe plates as lines in x-y space, we cut out the info on the other sides of the plate. Note that verts are formulated in clockwise direction, with the left-bottom corner as origin.
Dyn3d.FluidInteraction.DetermineNP
— Method.DetermineNP(nbody::Int, Δx)
Run this function before running GenerateBodyGrid, to determine number of points on a 2d body, in order to satisfy the desired number of points on the 1d body.
np = (# of points on 1d plate - 1)*4+1. So np=201 has 51 points(1 body), np=101 has 26 points(2 body), np=49 has 13 points(4 body), np=25 has 7 points(8 body), etc.
Dyn3d.FluidInteraction.GenerateBodyGrid
— Method.GenerateBodyGrid(bd::BodyDyn; np=101)
Given BodyDyn structure, where each body only consists of several verts(usually 4 for quadrilateral and 3 for triangle), return the verts position in inertial frame of given number of points np by interpolation, of all bodies in the system.
IntegrateBodyGridDynamics(bd::BodyDyn, bgs::Vector{BodyGrid})
Given external 3d linear fluid force f_ex of each body point contained in updated bgs structure, do intergral to return integrated 6d body force([torque,force]) exerting on the beginning of current body, desribed in inertial frame.