Skip to content

Commit 8b242f4

Browse files
authored
Its ok to iterate on land a fixed number of times (#376)
1 parent 09d0a10 commit 8b242f4

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/OceanSeaIceModels/InterfaceComputations/atmosphere_ocean_fluxes.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ end
116116
qₛ = saturation_specific_humidity(q_formulation, ℂₐ, 𝒬ₐ.ρ, Tᵢ, Sᵢ)
117117
initial_interface_state = InterfaceState(u★, u★, u★, uᵢ, vᵢ, Tᵢ, Sᵢ, qₛ)
118118

119-
if inactive_node(i, j, kᴺ, grid, Center(), Center(), Center())
119+
# Don't use convergence criteria in an inactive cell
120+
stop_criteria = turbulent_flux_formulation.solver_stop_criteria
121+
needs_to_converge = stop_criteria isa ConvergenceStopCriteria
122+
not_water = inactive_node(i, j, kᴺ, grid, Center(), Center(), Center())
123+
124+
if needs_to_converge && not_water
120125
interface_state = zero_interface_state(FT)
121126
else
122127
interface_state = compute_interface_state(turbulent_flux_formulation,
@@ -129,6 +134,9 @@ end
129134
ocean_properties)
130135
end
131136

137+
# In the case of FixedIterations, make sure interface state is zero'd
138+
interface_state = ifelse(not_water, zero_interface_state(FT), interface_state)
139+
132140
u★ = interface_state.u★
133141
θ★ = interface_state.θ★
134142
q★ = interface_state.q★

src/OceanSeaIceModels/InterfaceComputations/atmosphere_sea_ice_fluxes.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,13 @@ end
129129
# Guess
130130
Sₛ = zero(FT) # what should we use for interface salinity?
131131
initial_interface_state = InterfaceState(u★, u★, u★, uᵢ, vᵢ, Tₛ, Sₛ, convert(FT, qₛ))
132-
land = inactive_node(i, j, kᴺ, grid, Center(), Center(), Center())
132+
not_water = inactive_node(i, j, kᴺ, grid, Center(), Center(), Center())
133133
ice_free = ℵᵢ == 0
134134

135-
if (land | ice_free)
135+
stop_criteria = turbulent_flux_formulation.solver_stop_criteria
136+
needs_to_converge = stop_criteria isa ConvergenceStopCriteria
137+
138+
if needs_to_converge && not_water || ice_free
136139
interface_state = InterfaceState(zero(FT), zero(FT), zero(FT), uᵢ, vᵢ, Tᵢ, Sₛ, zero(FT))
137140
else
138141
interface_state = compute_interface_state(turbulent_flux_formulation,

0 commit comments

Comments
 (0)