# Aerodynamic Effects of Ceiling and Ground Vicinity on Flapping Wings
## 2 Materials and Methods
### Numerical Methods
The stationary background mesh calculated the solution until the far field, capturing the flow structures such as the vortex wake. Data were interpolated from one grid to the other using a tri-linear interpolation at inter-grid boundary points. A Poisson solver was used to generate wing grids from [PERSON]'s work [39], with the background grid being algebraically generated. Figure 3: Wing meshes in a background mesh. The wing grid's dimensions for this work were 54 \(\times\) 99 \(\times\) 86 normally, around the wings and spanwise directions, respectively, where the thickness of the first-layer was 0.001\(c\). As it moved away from the wing surface in the normal direction, the grid spacing increased by a ratio of about 1.46. The X, Y, and Z-directional dimensions for the background grid were 115 \(\times\) 115 \(\times\) 74, respectively (the number of Z-directional points were changed because of the ceiling and ground vicinity). The wing grid's outermost cylindrical boundary had a 2.5\(c\) radius, with the center point at the wing's spanwise axis. The grid also extended in the spanwise direction from both the wing root and the tip to a 1.5\(c\) distance. The distances between the background grid boundaries and the wing root in the X and Y directions were 20\(c\), while in the Z-direction, they varied with the ceiling and ground distances. For the calculations, a 0.02 time step (\(\Delta t^{*}\)) was used. Variables such as time step, domain size, first layer thickness and mesh dimensions have already been tested [31], so the suitable values for these variables (stated above) were used directly in this study. The viscous stress and the pressure at wing surface points were integrated to obtain the aerodynamic forces acting on the wing surface. We define the lift (\(L\)) on the wing as the component of force perpendicular to the stroke's plane, while the drag (\(D\)) is the component of force perpendicular to the wing's spanwise axis on the stroke plane. The pressure (\(C_{p}\)), lift (\(C_{L}\)), and drag (\(C_{D}\)) coefficients are equated as \(C_{p}\ =\ \left(p\ -\ p_{\infty}\right)/\left(0.5\rho U^{2}\right)\ =\ p^{*}-p_{\infty}/0.5\rho U^{2}\), \(C_{L}\ =\ L/\left(0.5\rho U^{2}S\right)\) and \(C_{D}\ =\ D/\left(0.5\rho U^{2}S\right)\), respectively, where, \(p\) means the pressure, \(p_{\infty}\) means the pressure at infinity, \(\rho\) means the fluid's density (air), and \(S\) means the wing's area. Additionally, \(C_{p}\) can directly express the pressure difference between a specific grid location and the far field. The code was tested previously by comparing aerodynamic data obtained with the measured data for a rotating [31] and translating insect wing [40]. It verified that the computed results are in good agreement with experimental measurements. In studying the aerodynamic interactions of the spatially arranged wings [41], the aerodynamic forces of two 3D wings in an in tandem configuration, calculated by our code, also fit well with previous numerical results in Ref. [42]. Additionally, the validation of our method in the presence of wall influence can also be found in our recent work [24], which studied the ground-only effect on a flapping wing. In Ref. [24], the comparisons between the aerodynamic forces at systematic wall clearances calculated by our method, and those experimentally measured by Ref. [23], also demonstrated that our method is reliable and authentic.