subroutine ocean_surfflux_alloc_components(this, grid)
!! Allocate the 22-field component set + the two `p_surf*` fields,
!! all `source=0.0_wp`, shape `(nx_total, ny_total)`. Private —
!! called only from `set_components`.
class(ocean_surface_flux_t), intent(inout) :: this
type(hgrid_t), intent(in) :: grid
integer :: nx, ny
nx = grid%nx_total
ny = grid%ny_total
allocate (this%q_sw(nx, ny), source=0.0_wp)
allocate (this%q_lw(nx, ny), source=0.0_wp)
allocate (this%q_lat(nx, ny), source=0.0_wp)
allocate (this%q_sens(nx, ny), source=0.0_wp)
allocate (this%heat_added(nx, ny), source=0.0_wp)
allocate (this%heat_cavity(nx, ny), source=0.0_wp)
allocate (this%evap(nx, ny), source=0.0_wp)
allocate (this%lprec(nx, ny), source=0.0_wp)
allocate (this%fprec(nx, ny), source=0.0_wp)
allocate (this%vprec(nx, ny), source=0.0_wp)
allocate (this%lrunoff(nx, ny), source=0.0_wp)
allocate (this%frunoff(nx, ny), source=0.0_wp)
allocate (this%seaice_melt(nx, ny), source=0.0_wp)
allocate (this%heat_content_lprec(nx, ny), source=0.0_wp)
allocate (this%heat_content_fprec(nx, ny), source=0.0_wp)
allocate (this%heat_content_vprec(nx, ny), source=0.0_wp)
allocate (this%heat_content_lrunoff(nx, ny), source=0.0_wp)
allocate (this%heat_content_frunoff(nx, ny), source=0.0_wp)
allocate (this%heat_content_seaice_melt(nx, ny), source=0.0_wp)
allocate (this%heat_content_massin(nx, ny), source=0.0_wp)
allocate (this%heat_content_massout(nx, ny), source=0.0_wp)
allocate (this%salt_flux(nx, ny), source=0.0_wp)
allocate (this%salt_cavity(nx, ny), source=0.0_wp)
allocate (this%p_surf_atm(nx, ny), source=0.0_wp)
allocate (this%p_surf(nx, ny), source=0.0_wp)
end subroutine ocean_surfflux_alloc_components