The absence of experimentation and analysis regarding the mechanics of the Diaphragm in the active state or the tetanized state of the Diaphragm muscle signals for a need of research to account and simulate the mechanics of this particular state. To simulate a basic structure of the diaphragm in a certain period, mathematical equations outlining the shape of the diaphragm generated by Prof. Yi-Chao Chen from the University of Houston from previous experimentations was utilized in the simulation code. Consequently, a video was created that provided a base simulation of the mechanics and motion of the diaphragm during its expansion and contraction phases. This study and any associated code serves as a foundation for the advancement of the collective research of our lab group, with the lead investigator being Prof. Yi-Chao Chen and as a gateway for future research on the mechanics and mathematics associated with the Diaphragm motion in the active state. Keywords: Diaphragm, Simulation, Python, Mechanics, Mathematics 2020 MSC: 68U05, 68U07 1. Introduction The Diaphragm is a dome-shaped muscle that serves as a separation between the thoracic cavity and the abdominal cav- ity. The importance of the Diaphragm muscle is not only found in the respiratory system, but is also a crucial part in the cer- vical spine and the trigeminal system, which is partly respon- sible for the face’s sensory innervation and mastication motor stimulation [1,2,3]. The failure of the Diaphragm in regards to its function can cause abnormalities such as Chronic obstruc- tive pulmonary disease, which results when there is airflow ob- struction caused by significant exposure to noxious particles or gases [4,5]. Additionally, there are other issues regarding hu- man health and wellness that can be attributed to diaphragm dysfunction. These diaphragm dysfunction medical issues can be directly caused due to irregular shape and movement of the diaphragm and the parts associated with the diaphragm [6]. For example, Unilateral diaphragm paralysis can be attributed to a abnormally elevated left hemidiaphragm sitting >2 cm higher than its right counterpart or a right hemidiaphragm sitting equal or higher than the left hemidiaphragm, as shown in Figure 1 [7]. In addition to using the diaphragm to track medical issues for the diaphragm and respiratory problems, the shape and motion of the diaphragm can be used to track problems related to other organs and systems. For instance, the flattening shape of the diaphragm is the most sensitive sign for the presence of hyper- inflation of the lungs, which is typically caused by emphysema [8]. By tracking the movements and mechanical properties of the diaphragm and through matching the simulation of a model di- aphragm to that of a patient, it is plausible to diagnose a patient with a certain condition related to or caused by the diaphragm more e ffectively. Figure 1: elevation of right-sided hemidiaphragm shown in a patient with Uni- lateral diaphragm paralysis [7] Past studies primarily focused on the types of health and medical issues associated with the diaphragm or on the medical problems associated when comparing an irregular diaphragm to that of a passive diaphragm at it’s rest stage. However, through creating a simulation of the diaphragm in it’s passive and active stages, professionals will be able to not only compare the di- aphragm shape and physical components, but also contrast the simulation and mechanics which include, but are not limited to the diaphragm’s elasticity and acceleration. If the motion of the patient’s diaphragm has a mismatch with an accurate simu- lated model, it can serve as a potential tool for professionals to determine and diagnose the medical issue associated with the patient. Preprint submitted to engrxiv July 6, 2024 2. Overview of Mathematical Modeling Equations of the Diaphragm To create a basic model of the diaphragm that conforms to a dome-shape structure in the active stage and a flat-line shape in the passive stage, mathematical equations outlining the shape of the diaphragm which was generated in previous research was utilized. The equations provided as shown below are intended to be plotted on the cylindrical coordinate system (r, θ, z) which in- cludes the radial distance (r), the azimuthal angle ( θ), and the height(z). ————————————– r=5 cos(s 5) 0≤θ≤2π z=5h 1−H 1−cos2πt Ti ·sins 5 ————————————– 2.1. Initializations and Parameters T is the time period in one respiratory cycle, in our scenario we will take T=5seconds as 5 seconds falls under the average respiratory rate for an adult [9]. t is the time input. H is the amount of the motion of the diaphragm. In this case, we will takeH=0.5which was predetermined through experiments and analysis. To maximize accuracy of the mechanics, we set s=6, where s is a constant relating to the stress. The azimuthal angle ( θ) is given as a parameter from 0 to 2 π so no overlap is shown or displayed during the simulation. 2.2. Mathematical Height Analysis It is given that z, or the height of the diaphragm with respect to t in a certain time period, is: z=5" 1−H 1−cos 2πt T!!# ·sins 5 (1) After applying set given conditions, z=5" 1−0.5 1−cos 2πt 5!!# ·sin 6 5! (2) Further Simplification: z=2.5 1+cos 2πt 5!! sin 6 5! (3) z=2.5 1+2 cos2πt 5 −1 sin 6 5! (4) z=2.5·2 cos2πt 5 sin 6 5! (5) z=5 cos2πt 5 sin6 5 (6) ∴ z≈4.6602 cos2πt 5 (7)The equation for the height confirms to be true as the function value with respect to any x is always positive due to the positive coefficient and the squared cosine value, which transforms any negative function value for the cosine into positive. The Height is positive as we take the base, or 0, to be the flattening shape for the diaphragm. The period of a cos2(x) function is 1 /2 of cos(x) through fun- damental identities. Therefore the period of 5 cos2πt 5 sin6 5 is 5 seconds, which falls under the span of the length of time of one respiratory cycle for a human adult with no significant medical issues. The graph of the height of the simulated diaphragm and the velocity and acceleration in the z axis with respect to time is shown below. Figure 2: Z (Vertical) position vs time - Z(t) Figure 3: Z (Vertical) velocity vs time - Z’(t) Figure 4: Z (Vertical) acceleration vs time - Z”(t) 2 3. Particular Diaphragm Model Methods Before developing a graphical code for simulation intentions and purposes that align with our goals, it is necessary to use python to develop an code that outputs a model of a diaphragm with respect to a given time frame, in step intervals of 5 sec- onds. Using numpy linspace, we integrate the the three equa- tions of r,θ, z that is taken in respect to time into the code. Therefore using the values determined by time and the three parameters (t, T, H) or (Time, Time Period, and Amount of Mo- tion) as seen below in the function for diaphragm motion. Figure 5: Graphical code snippet that creates a model associated with the time given as input 3.1. Generating a complete 3D model The graphical code shown in Figure 5 also displays the np.linspace code that generates the cylindrical coordinate sys- tem and outputs a 3D projection of a particular model of the diaphragm that is associated with respect to a given time as in- putted by the user. The code iterated through all possible co- ordinates within bounds of the system and generates specific points in those coordinates if applicable. After the iteration is complete, a 3D plot representing the diaphragm at the specific time in the period is generated. A model representing the diaphragm at t =5 seconds is shown in Figure 6. With the given parameters and equations that based on analytics of an average adult, this is the value of when the diaphragm reaches its max height [9]. This represents the di- aphragm shape upon the time when the exhalation process for the average human is complete [10]. Similarly, any possible model can be outputted using the time input of the user given (x): q=x 0.05 (1) Then, r=x−0.05q (2) If r=0, xis apossible time input . Figure 6: Example of model generated when input given is 5 seconds 4. Diaphragm Simulation Methods A code will now be created to output a full simulation of a diaphragm for a full period of it’s motion. Iterating through the times 0 to 5 seconds with a step size of 0.05 creates a video of the motion of a full period of the diaphragm with the most optimized simulation of accuracy and time. The finished output can be used for our end objective and for the progression of the lab group. As seen in figure 7, an update plot function is implemented which enabled a 3D model from a given time to be stored based on the coordinates. It is then cleared when the iteration loop moves on to the next frame (next model of the diaphragm after 0.05 seconds). This code is iterated until it reaches 5 seconds or until 100 frames are stored. Figure 7: Graphical code snippet that stores and saves a model associated with the time given as input as the code iterates The ani.save function is used to store the final simulation from t =0 to t=5 (in seconds). Then we saved the simulation and displayed it on the console. In Figure 8, the associated models with the integer times from the time interval t =0 to t =5 can be seen. 3 Figure 8: Graphical code snippet that stores and saves a model associated with the time given as input as the code iterates 5. Summary and Discussion The purpose of this study was to construct an accurate sim- ulated model of the diaphragm that adheres to the respiratory cycle and constraints of the average human adult. By contrast- ing the mechanics of the simulation with an actual diaphragm of a patient, medical abnormalities and dysfunctions related to the diaphragm and other body parts can be diagnosed and ex- amined. This research and any associated code and simula- tions is to be used as a baseline for the e fforts of our lab group in researching and improving the mechanics and mathematical equations associated with Diaphragm motion in the active or the tetanized state. Acknowledgements I would like to acknowledge the Department of Mechanical Engineering at University of Houston and Professor Yi-Chao Chen for providing the base equations and software needed to create the base simulations and plots.