# Aerodynamic Effects of Ceiling and Ground Vicinity on Flapping Wings
## 2 Materials and Methods
### Numerical Methods  
Since the Reynolds number and the velocity of the flapping wing are very low, the laminar incompressible 3D Navier-Stokes equations are the flow's governing equations. The dimensionless form is given by:  
\[\
abla\cdot\mathbf{u}\ =\ 0 \tag{2}\]  
\[\frac{\partial\mathbf{u}}{\partial t^{*}}\ +\ \mathbf{u}\cdot\
abla\mathbf{u}\ =\ -\
abla\ p^{*}\ +\ \tfrac{1}{Kc}\
abla^{2}\mathbf{u} \tag{3}\]  
For the above equations, the non-dimensional parameters of fluid velocity, pressure, and time are abbreviated as \(\mathbf{u}\), \(p^{*}\) and \(t^{*}\), respectively. The wing's mean velocity at the radius of gyration \(U\ =\ 2\Phi nr_{2}\), the mean chord length \(c\), and the time \(c/U\) were employed for nondimensionalization. \(Re\) is the Reynolds number, calculated as \(Re\ =\ cU/v\) and \(v\) means the fluid kinematics viscosity. The N-S equations were numerically solved for moving overset meshes using the method of artificial compressibility, as in previous works [31; 36]. In the following, we just provide the method's outline. First, a general time-dependent coordinate transformation  
Figure 2: (a) Coordinate system and two angles (\(\psi\) and \(\phi\)) of the flapping motion; (b) time course curves of \(\psi(\tau)\) and \(\phi(\tau)\) in a flapping cycle. was used to transform the equations from the inertial Cartesian coordinate system to the body-fixed and non-inertial curvilinear coordinate system. A three-point backwards differencing scheme of second-order accuracy was implemented to discretize the time derivatives of the momentum equation. To solve the time discretized moment equations for a divergence-free velocity at a new physical time level, a pseudo-time level was introduced into the equations. Then a pseudo-time derivative of pressure divided by the artificial compressibility constant was added in the continuity equations. The resultant hyperbolic equations system was iterated using pseudo-time until the pressure derivative became zero in pseudo-time; therefore, the velocity divergence also became zero for the new time instance. The central difference method was employed for approximating the viscous-flux derivative in the equations. The upwind differencing formula based on the flux-difference-splitting method was employed for convective flux derivatives. The third-order and second-order upwind differencing methods were employed for interior points and boundary points, respectively. The overall accuracy of the code was two-order. The algorithm's details are present in Refs. [37, 38]. The following are the boundary conditions in detail. At far-field boundaries, there was no way to simply specify which far-field boundary is the inflow or outflow boundary, because the flapping wings were in the hovering state. Therefore, at each far-field boundary, the calculation result of the previous time step was used to determine whether the boundary adopted the inflow boundary condition or the outflow boundary condition. If it adopted an inflow boundary condition, the velocity components would be set to zero because of the hovering condition and flight speed equal to zero, and pressure was extrapolated from the interior. Meanwhile, if it adopted an outflow boundary condition, pressure would be set equal to the air static pressure, and velocity was extrapolated from the interior. At the wing surface, the no-slip boundary and impermeable wall conditions were applied, and the pressure was calculated through the normal component of the momentum equation, written in the moving coordinate system. On the ceiling and the ground, the pressure gradient normal to the wall and the velocity were fixed as zero. The domain discretizing grid had two curvilinear (body-fitted) wing grids extending from the surface of the wing to various distances. These wing grids were within another background Cartesian grid covering the domain until the far fields (Figure 3). The moving wing grids captured detailed aerodynamics, e.g., boundary layers, vortices, etc.