# Extending UWOC System Applications through Photon Transmission Dynamics Study in Harbor Waters
## 2 Materials and Methods
### The Process of Monte Carlo Numerical Simulation
#### 2.3.2 The Movement and Scattering of the Photon  
The Monte Carlo simulation process is comprehensively illustrated in Figure 5, which presents a detailed flowchart. A critical aspect of this simulation involves determining the random scattering path length (\(L\)), scattering angle (\(\varphi\)), and azimuth angle (\(\psi\)) for each photon during its movement through the simulated environment. The scattering path length \(L\) is defined as the distance a photon travels between two consecutive scattering events. This length is crucial as it influences the photon's trajectory and the overall simulation accuracy. The scattering angle \(\varphi\) of the photon after each collision with the particles in harbor water is randomly calculated by the scattering phase function \(\tilde{\beta}(\varphi)\) in Equation (3). The new azimuth angle \(\psi\) is calculated randomly by the equation \(\psi=2\pi R\), and the random scattering path length \(L\) is calculated randomly by the Equation (11). \(R\) is also a random value drawn from the normalized interval \([0,1]\) in the calculation of the propagation length \(L\) and azimuth angle \(\psi\). The photon's weight is updated by the equation \(\omega_{n}=\omega_{n-1}*\omega_{0}\), where, \(n\) represents the \(n\)-th photon scattering event. Two critical steps in the simulation are the block <<Calculate Euclidian distance to Rx plane>> and <<Calculate y, z intersection point., which mean that if the Euclidian distance between the photon's position and the Reception Plane's center is smaller than the received aperture, and if the angle between the y axis of the photon moving coordinate system and the z axis of the coordinate system built by the transceiver terminal is smaller than the Received FOV, the photon is thought to be able to reach the Reception Plane, then record the corresponding scattering angle meanwhile. Russian roulette is also introduced, and its function is: when the photon's weight \(\omega_{n}\) is greater than the setting threshold, the photon scattering process continues to be tracked, and the subsequent flow and algorithm are consistent with the previous. When the photon's weight \(\omega_{n}\) is less than the setting threshold, the photon is considered to have been annihilated completely. During the simulation, the Transmission Plane and the Reception Plane are parallel to each other, and the fixed coordinate axis z is always perpendicular to the Reception Plane, so the orientation of the receiver can be confirmed. The position of the receiver can be confirmed by the setting values of the AL during simulation. Equation (10) then provides further detail on how this angle is determined, with \(\varphi^{\prime}\) representing the specific scattering angle chosen during a scattering event, and \(R\) still represents a random value drawn from the normalized interval [0, 1]. These steps are integral to accurately simulating the random paths of photons through water, crucial for understanding light behavior in underwater communication channels. \[\int_{0}^{\varphi^{\prime}}\tilde{\beta}(\varphi,\lambda)sin(\varphi)d\varphi=R \tag{10}\]  
When the random scattering path length \(L\), scattering angle \(\varphi\) and azimuth angle \(\psi\) of the photon are confirmed, the position of the photon can be updated as \([x^{\prime},y^{\prime},z^{\prime}]\) in Equation (12), where \(\mu_{x}\), \(\mu_{y}\), and \(\mu_{z}\) are the Direction Cosine of the photon in the current state, the scattering path length \(L\) is selected randomly in Equation (11) [50, 51], where \(b\) is the scattering coefficient, and \(R\) is a random value drawn from the normalized interval [0, 1]. \[L=-ln(R)/b \tag{11}\]  
Figure 5: The flow chart of Monte Carlo simulation. \[ \begin{cases}x^{\prime}=x_{0}+L\mu_{x}\\ y^{\prime}=y_{0}+L\mu_{y}\\ z^{\prime}=z_{0}+L\mu_{z}\end{cases}  \tag{12}\]  
The photon packet's new weight, \(\omega_{n}\), is obtained further after \(n\) scattering events.