## 2 Materials and Methods
### Algorithmic Process of WRF-DA 3D-Var  
After calculating the covariance matrix B (be.dat in WRF terms) and first guess (fg for WRF notation) files, one has to update the namelist of WRF to compute the corrected initial state. The complete algorithmic flow chart is shown in Figure 2, where the order of operations one must follow to achieve a corrected WRF forecast is outlined for the 3D-Var technique specifically. To summarize the process of WRF-DA, one begins by creating initial conditions for WRF (wrfnput) through the WRF Preprocessing System (WPS). This step uses the GFS meteorological fields described in Data Sources IV (Section 2.1). The next step involves applying WRF-DA to the generated wrfnput file, assimilating observational data to produce a refined wrfvar_output file, which serves the purpose of an updated data-assimilated wrfnput. Subsequently, to ensure consistency with the new initial conditions, the boundary conditions need to be updated for the entire forecast period.  
Figure 2: WRF-DA flow chart adapted by [21] with boundary condition (BC) update for all time-steps based on the new analysis computed by WRF-DA. This update was performed on the outer parent  
domain D01 with the 9 km resolution. The WRF output was then used to force hydrodynamic and wave forecasting models. B and R are the background and observational error covariance matrices, and \(x_{\text{b}}\), \(x\), and \(y\) are the background field, analysis field, and observation vector, respectively, as seen in Equation (1).  
Noted by dotted lines in Figure 2, there is an explanation of how boundary conditions are updated using the analysis \(x\) at time step t instead of the initial background field \(x^{b}\) as seen in Equation (1), and then how the background field at time step (t + dt) is updated in subsequent time steps using a perturbed time derivative (\(\text{Field}(t+\text{dt})-\text{Analysis}(\text{t})/\text{dt}\). Since the denominator includes dt (the time increment), as the time interval between the analysis time t and each subsequent step increases, the effect of the data assimilation (DA) analysis at step t on the boundary condition diminishes. This is expected, as the influence of observations at the initialization time on the model should naturally decrease over time. In the whole flow chart, the respective steps are color-coded with their explanation for the readers' convenience.  
Finally, the process concludes with the execution of WRF to generate a new downscaled forecast in all nested subdomains (D01 and D02 in Figure 1). We note that the process mentioned applies only to the parent WRF domain D01, since the initial and boundary conditions for the child domain D02 are inherited by interpolating the values from the parent domain D01 [29]. Then, this updated forecast can be used as alternative forcing for a range of applications, which in our case are based on wave and hydrodynamic forecasting.  
To address the elevated computational demands typically associated with variational methods, the solver chosen for minimizing the functional in Equation (1) is the iterative conjugate gradient. In comparison to alternative optimization methods available within the Weather Research and Forecasting (WRF) framework, such as the quasi-Newton approach, the conjugate gradient method is deemed less computationally demanding. Additionally, preconditioning through WRF-DA options are employed as described in the introduction article of WRF 3D-Var to mitigate the computational complexities associated with inverting the correlation matrix B [12]. The strategic utilization of the conjugate gradient solver and preconditioning techniques contributes to the enhanced computational tractability of the overall variational methodology [30].