Fill the two OWNED surface-flux components from the solved
interface. FULL OVERWRITE of the whole plane, never += —
the same rule the sea-ice coupler’s fillers follow, and for the
same reason (a += ratchets across outer steps with no bound).
See the module docstring for the sign derivation. In one line:
the ocean loses the heat the interface takes (-q_ocean), and
the dilution by meltwater of salinity s_ice is emulated at
fixed column mass by -m_mass*(S_far - s_ice).
No wet-mask factor here: active already carries it (the
sampler composes it), and the assembler multiplies Q_heat /
Q_salt by ms%wet_mask again.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx |
First dimension (ghosts included). |
||
| integer, | intent(in) | :: | ny |
Second dimension. |
||
| real(kind=wp), | intent(in) | :: | s_ice |
Ice salinity (g/kg). |
||
| real(kind=wp), | intent(in) | :: | active(nx,ny) |
Composed solve mask. |
||
| real(kind=wp), | intent(in) | :: | melt(nx,ny) |
Melt mass flux (kg/m^2/s), > 0 melting. |
||
| real(kind=wp), | intent(in) | :: | q_ocean(nx,ny) |
Ocean → interface heat flux (W/m^2). |
||
| real(kind=wp), | intent(in) | :: | s_far(nx,ny) |
Far-field salinity the solve used (g/kg). |
||
| real(kind=wp), | intent(out) | :: | heat_cavity(nx,ny) |
Heat component (W/m^2), positive down into the ocean. |
||
| real(kind=wp), | intent(out) | :: | salt_cavity(nx,ny) |
Virtual salt component, positive salinifies. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| integer, | private | :: | j |
pure subroutine cavity_flux_fill_impl(nx, ny, s_ice, active, melt, q_ocean, s_far, & heat_cavity, salt_cavity) !! Fill the two OWNED surface-flux components from the solved !! interface. FULL OVERWRITE of the whole plane, never `+=` — !! the same rule the sea-ice coupler's fillers follow, and for the !! same reason (a `+=` ratchets across outer steps with no bound). !! !! See the module docstring for the sign derivation. In one line: !! the ocean loses the heat the interface takes (`-q_ocean`), and !! the dilution by meltwater of salinity `s_ice` is emulated at !! fixed column mass by `-m_mass*(S_far - s_ice)`. !! !! No wet-mask factor here: `active` already carries it (the !! sampler composes it), and the assembler multiplies `Q_heat` / !! `Q_salt` by `ms%wet_mask` again. integer, intent(in) :: nx !! First dimension (ghosts included). integer, intent(in) :: ny !! Second dimension. real(wp), intent(in) :: s_ice !! Ice salinity (g/kg). real(wp), intent(in) :: active(nx, ny) !! Composed solve mask. real(wp), intent(in) :: melt(nx, ny) !! Melt mass flux (kg/m^2/s), > 0 melting. real(wp), intent(in) :: q_ocean(nx, ny) !! Ocean → interface heat flux (W/m^2). real(wp), intent(in) :: s_far(nx, ny) !! Far-field salinity the solve used (g/kg). real(wp), intent(out) :: heat_cavity(nx, ny) !! Heat component (W/m^2), positive down into the ocean. real(wp), intent(out) :: salt_cavity(nx, ny) !! Virtual salt component, positive salinifies. integer :: i, j do concurrent(j=1:ny, i=1:nx) if (active(i, j) > 0.5_wp) then heat_cavity(i, j) = -q_ocean(i, j) salt_cavity(i, j) = -melt(i, j)*(s_far(i, j) - s_ice) else heat_cavity(i, j) = 0.0_wp salt_cavity(i, j) = 0.0_wp end if end do end subroutine cavity_flux_fill_impl