# Algorithmic Design of an FPGA-Based Calculator for Fast Evaluation of Tsunami Wave Danger
## 2 Materials and Methods
### HLS-Based Algorithm Porting
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Implementation** & **Lines of Code** & \begin{tabular}{c} **Maximum** \\ **Frequency** \\ \end{tabular} & \begin{tabular}{c} **Number of** \\ **LUTs** \\ \end{tabular} & \begin{tabular}{c} **Number of** \\ **Flip-Flops** \\ \end{tabular} & \
\begin{tabular}{c} **Number of** \\ **BRAMs (36 K)** \\ \end{tabular} &
\begin{tabular}{c} **Number of** \\ **DSP Blocks** \\ \end{tabular} \\ \hline MacCormack & \(\sim\)280 & 462 MHz & 29,242 & 49,520 & 64 & 189 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Resource utilization for MacCormack implementation. direction coincides with the offshore direction. The propagation of the wave generated by the described round-shaped source was simulated using MOST software, and by the MacCormack difference scheme implemented on an FPGA. According to the results of calculations for each of the schemes, isolines of distributions of wave height's maxima over the sloping bottom (Figure 2a) and at the parabolic bottom topography (Figure 2b) were visualized. ### Numerical Results

To simulate a tsunami on real bathymetry, the tsunami source proposed in [11] was taken as the initial vertical displacement of the water surface; its location in the computational domain is shown in Figure 3 in the form of isolines of the vertical displacement field. Figure 3: Digital bathymetry and tsunami source of the 11 March 2011 event. The isolines of the field of vertical elevation of the water surface at an interval of 1 m are drawn in white, and the isolines of the initial abatement of water level are drawn in black. The source is outlined by \(\pm\)0.05 m level lines. The maximum elevation in the source is limited to +9 m, and the lowest value is equal to \(-\)4 m.

Figure 2: Comparison of the wave height maxima distributions for the exact solution (green); results obtained via the proposed FPGA-based method (red dashed lines) and MOST single-precision results (blue). (**a**) The comparison results for sloping bottom topography; (**b**) the comparison results for the parabolic bottom topography. Based on the results of numerical calculation of the propagation of the tsunami wave generated by the source shown in Figure 3, the estimates of maximum tsunami height in the entire computational domain and along the coast were obtained (see Figure 4). The obtained numerical results show that for the tsunami source considered (see Figure 3), the maximum tsunami height (over 6 m) was observed only on the sections of the coastline located in the projection of the source on the coast. At the same time, it should be noted that modeling of 1 h of wave propagation in this area (9,600,000 computational nodes) requires less than 1 min of processing time using the proposed FPGA-based calculator. ## 4 Discussion

This paper shows the advantages of HLS technology, which allows us to significantly simplify and accelerate the development of data processing algorithms. Thus, a relatively insignificant modification of the code of the convolutional algorithm allowed us to construct an effective computational pipeline for the calculation of wave propagation via [PERSON]'s finite-difference scheme. It should be noted that the application of HLS technology does not require a developer to be professionally acquainted with hardware description languages, such as Verilog; it can also enables hardware paralleling on FPGAs for engineers who are familiar with technologies of parallel programming and know about the structure and features of FPGAs. As an application of the obtained realization of the [PERSON] scheme for numerical solution of the system of shallow water equations, computational experiments were carried out to calculate the maximum heights of tsunami waves generated by a model tsunami source above the linear and parabolic bottom slopes.