Skip to content

Commit ffae6ab

Browse files
jlk9simone-silvestrinavidcytomchor
authored
Just updating this branch with recent changes to main. (#4707)
* (0.97.6) Move the computation of flux BC before the time-stepping (#4696) * go ahead * ad project * fix tests * start with compute * more changes * more changes * more fixes * Update cubed_sphere_exchange_bcs.jl * Update compute_hydrostatic_flux_bcs.jl * Update hydrostatic_free_surface_tendency_kernel_functions.jl * Update explicit_free_surface.jl --------- Co-authored-by: Navid C. Constantinou <navidcy@users.noreply.github.com> * Create methods for equality of ImmersedBoundaryGrids (#4700) * Move storage space to from `MutableVerticalDiscretization` to `ZStarCoordinate` (#4686) * first change * comment * bugfix * Update hydrostatic_free_surface_model.jl * bugfix * bugfix * bugfix * fix tests * export ZCoordinate, ZStarCoordinate * add summary/show method for ZStarCoordinate * bit of rephrasing * add vertical_coordinate in show method * Update src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl * Update validation/z_star_coordinate/lock_release.jl * Update validation/implicit_free_surface/geostrophic_adjustment_test.jl * fix doctests * bump patch release * slight rephrase * Update lock_release.jl --------- Co-authored-by: Navid C. Constantinou <navidcy@users.noreply.github.com> * Regularize field boundary conditions with a location rather than a name (#4704) * Update field_boundary_conditions.jl * add a field_name --------- Co-authored-by: Simone Silvestri <silvestri.simone0@gmail.com> Co-authored-by: Navid C. Constantinou <navidcy@users.noreply.github.com> Co-authored-by: Tomás Chor <tomaschor@gmail.com>
1 parent 089772d commit ffae6ab

37 files changed

+363
-208
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Oceananigans"
22
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
33
authors = ["Climate Modeling Alliance and contributors"]
4-
version = "0.97.5"
4+
version = "0.97.6"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

docs/src/model_setup/buoyancy_and_equation_of_state.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration =
6565
│ └── solver: FFTImplicitFreeSurfaceSolver
6666
├── advection scheme:
6767
│ └── momentum: VectorInvariant
68+
├── vertical_coordinate: ZCoordinate
6869
└── coriolis: Nothing
6970
```
7071

@@ -100,6 +101,7 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration =
100101
├── advection scheme:
101102
│ ├── momentum: VectorInvariant
102103
│ └── b: Centered(order=2)
104+
├── vertical_coordinate: ZCoordinate
103105
└── coriolis: Nothing
104106
```
105107

@@ -142,6 +144,7 @@ HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration =
142144
│ ├── momentum: VectorInvariant
143145
│ ├── T: Centered(order=2)
144146
│ └── S: Centered(order=2)
147+
├── vertical_coordinate: ZCoordinate
145148
└── coriolis: Nothing
146149
```
147150

@@ -246,4 +249,3 @@ NonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
246249
├── buoyancy: BuoyancyTracer with ĝ = (0.0, 0.707107, 0.707107)
247250
└── coriolis: Nothing
248251
```
249-

docs/src/physics/hydrostatic_free_surface_model.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ equation are
9393

9494
## Vertical coordinates
9595

96-
We can use either `ZCoordinate`, that is height-coordinate, or the
97-
`ZStar` [generalized vertical coordinate](@ref generalized_vertical_coordinates).
96+
We can use either `ZCoordinate`, that is height coordinate, or the
97+
`ZStarCoordinate` [generalized vertical coordinate](@ref generalized_vertical_coordinates).
9898

99-
The `ZStar` vertical coordinate conserves tracers and volume with the grid following the evolution of the
100-
free surface in the domain [adcroft2004rescaled](@citep).
99+
The `ZStarCoordinate` vertical coordinate conserves tracers and volume with the grid following
100+
the evolution of the free surface in the domain [adcroft2004rescaled](@citep).
101101

102102
In terms of the notation in the [Generalized vertical coordinates](@ref generalized_vertical_coordinates)
103103
section, for a `ZCoordinate` we have that
@@ -106,39 +106,40 @@ r(x, y, z, t) = z
106106
```
107107
and the specific thickness is ``\sigma = \partial z / \partial r = 1``.
108108

109-
For the `ZStar` generalized vertical coordinate is often denoted as ``z^*`` (zee-star), i.e.,
109+
The `ZStarCoordinate` generalized vertical coordinate is often denoted as ``z^*`` (zee-star), i.e.,
110110
```math
111111
\begin{equation}
112112
r(x, y, z, t) = z^*(x, y, z, t) = \frac{H(x, y)}{H(x, y) + \eta(x, y, t)}[z - \eta(x, y, t)] \label{zstardef}
113113
\end{equation}
114114
```
115115
where ``\eta`` is the free surface and ``z = -H(x, y)`` is the bottom of the domain.
116116

117-
![Schematic of the quantities involved in the ZStar generalized vertical coordinate](../assets/zstar_schematic.png)
117+
![Schematic of the quantities involved in the ZStarCoordinate generalized vertical coordinate](../assets/zstar_schematic.png)
118118

119-
Note, that in both depth and ``z^*`` coordinates the bottom boundary is the same ``z = z^* = - H(x, y)``.
119+
Note that in both depth and ``z^*`` coordinates, the bottom boundary is the same ``z = z^* = - H(x, y)``.
120120
On the other hand, while in depth coordinates the upper boundary ``z = \eta(x, y, t)`` changes with time,
121-
but in ``z^*`` coordinates it's fixed to ``z^* = 0``.
121+
but in ``z^*`` coordinates is fixed to ``z^* = 0``.
122122

123-
The `ZStar` coordinate definition \eqref{zstardef} implies a specific thickness
123+
The `ZStarCoordinate` definition \eqref{zstardef} implies a specific thickness
124124

125125
```math
126126
\sigma = 1 + \frac{\eta}{H}
127127
```
128128

129-
All the equations transformed in ``r``-coordinates are described in the [Generalized vertical coordinates](@ref generalized_vertical_coordinates)
130-
section.
129+
All the equations transformed in ``r``-coordinates are described in the
130+
[Generalized vertical coordinates](@ref generalized_vertical_coordinates) section.
131131

132-
For the specific choice of `ZStar` coordinate \eqref{zstardef}, the ``\partial \eta/\partial r`` identically vanishes and
133-
thus the horizontal gradient of the free surface remain unchanged under vertical coordinate transformation, i.e.,
132+
For the specific choice of `ZStarCoordinate` coordinate \eqref{zstardef}, the ``\partial \eta/\partial r``
133+
identically vanishes and thus the horizontal gradient of the free surface remain unchanged under vertical
134+
coordinate transformation, i.e.,
134135
```math
135136
\begin{align}
136137
\frac{\partial \eta}{\partial x} \bigg\rvert_z & = \frac{\partial \eta}{\partial x} \bigg\rvert_r \\
137138
\frac{\partial \eta}{\partial y} \bigg\rvert_z & = \frac{\partial \eta}{\partial y} \bigg\rvert_r
138139
\end{align}
139140
```
140141

141-
An example of how the vertical coordinate surfaces differ for `ZCoordinate` and the time-varying `ZStar` coordinate is shown below.
142+
An example of how the vertical coordinate surfaces differ for `ZCoordinate` and the time-varying `ZStarCoordinate` coordinate is shown below.
142143

143144
```@example
144145
using CairoMakie
@@ -165,7 +166,7 @@ t = Observable(0.0)
165166
fig = Figure(size=(1000, 400))
166167
axis_kwargs = (titlesize = 20, xlabel = "x", ygridvisible = false)
167168
ax1 = Axis(fig[1, 1]; title="ZCoordinate", ylabel="z", axis_kwargs...)
168-
ax2 = Axis(fig[1, 2]; title="ZStar", axis_kwargs...)
169+
ax2 = Axis(fig[1, 2]; title="ZStarCoordinate", axis_kwargs...)
169170
170171
for ax in (ax1, ax2)
171172
band!(ax, x, -H, η, color = (:dodgerblue, 0.5))
@@ -179,7 +180,7 @@ for r in range(-Lz, stop=0, length=6)
179180
z = r * ones(size(x))
180181
lines!(ax1, x, z, color=:crimson, linestyle=:dash)
181182
182-
# ZStar
183+
# ZStarCoordinate
183184
z = lift(η) do η_val
184185
@. r * (H + η_val) / H + η_val
185186
end
@@ -197,6 +198,6 @@ nothing #hide
197198

198199
![](z-zstar.gif)
199200

200-
Near the top, the surfaces of `ZStar` mimic that of the free surface.
201-
As we move away from the fluid's surface, the surfaces of `ZStar` resemble more surfaces
201+
Near the top, the surfaces of `ZStarCoordinate` mimic the free surface.
202+
Further away from the fluid's surface, the surfaces of `ZStarCoordinate` resemble more surfaces
202203
of constant depth `ZCoordinate`.

src/BoundaryConditions/BoundaryConditions.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export
77
FluxBoundaryCondition, ValueBoundaryCondition, GradientBoundaryCondition, DistributedCommunicationBoundaryCondition,
88
validate_boundary_condition_topology, validate_boundary_condition_architecture,
99
FieldBoundaryConditions,
10-
apply_x_bcs!, apply_y_bcs!, apply_z_bcs!,
10+
compute_x_bcs!, compute_y_bcs!, compute_z_bcs!,
1111
fill_halo_regions!
1212

1313
using Adapt
@@ -35,7 +35,7 @@ include("fill_halo_regions_flux.jl")
3535
include("fill_halo_regions_nothing.jl")
3636
include("fill_halo_regions_zipper.jl")
3737

38-
include("apply_flux_bcs.jl")
38+
include("compute_flux_bcs.jl")
3939

4040
include("update_boundary_conditions.jl")
4141
include("polar_boundary_condition.jl")

src/BoundaryConditions/apply_flux_bcs.jl renamed to src/BoundaryConditions/compute_flux_bcs.jl

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,95 +9,95 @@ using Oceananigans.Grids: AbstractGrid
99
#####
1010

1111
# Unpack
12-
apply_x_bcs!(Gc, c, args...) = apply_x_bcs!(Gc, Gc.grid, c, c.boundary_conditions.west, c.boundary_conditions.east, args...)
13-
apply_y_bcs!(Gc, c, args...) = apply_y_bcs!(Gc, Gc.grid, c, c.boundary_conditions.south, c.boundary_conditions.north, args...)
14-
apply_z_bcs!(Gc, c, args...) = apply_z_bcs!(Gc, Gc.grid, c, c.boundary_conditions.bottom, c.boundary_conditions.top, args...)
12+
compute_x_bcs!(Gc, c, args...) = compute_x_bcs!(Gc, Gc.grid, c, c.boundary_conditions.west, c.boundary_conditions.east, args...)
13+
compute_y_bcs!(Gc, c, args...) = compute_y_bcs!(Gc, Gc.grid, c, c.boundary_conditions.south, c.boundary_conditions.north, args...)
14+
compute_z_bcs!(Gc, c, args...) = compute_z_bcs!(Gc, Gc.grid, c, c.boundary_conditions.bottom, c.boundary_conditions.top, args...)
1515

1616
# Shortcuts for...
1717
#
1818
# Nothing tendencies.
19-
apply_x_bcs!(::Nothing, args...) = nothing
20-
apply_y_bcs!(::Nothing, args...) = nothing
21-
apply_z_bcs!(::Nothing, args...) = nothing
19+
compute_x_bcs!(::Nothing, args...) = nothing
20+
compute_y_bcs!(::Nothing, args...) = nothing
21+
compute_z_bcs!(::Nothing, args...) = nothing
2222

2323
# Not-flux boundary conditions
2424
const NotFluxBC = Union{PBC, MCBC, DCBC, VBC, GBC, OBC, ZFBC, Nothing}
2525

26-
apply_x_bcs!(Gc, ::AbstractGrid, c, ::NotFluxBC, ::NotFluxBC, ::AbstractArchitecture, args...) = nothing
27-
apply_y_bcs!(Gc, ::AbstractGrid, c, ::NotFluxBC, ::NotFluxBC, ::AbstractArchitecture, args...) = nothing
28-
apply_z_bcs!(Gc, ::AbstractGrid, c, ::NotFluxBC, ::NotFluxBC, ::AbstractArchitecture, args...) = nothing
26+
compute_x_bcs!(Gc, ::AbstractGrid, c, ::NotFluxBC, ::NotFluxBC, ::AbstractArchitecture, args...) = nothing
27+
compute_y_bcs!(Gc, ::AbstractGrid, c, ::NotFluxBC, ::NotFluxBC, ::AbstractArchitecture, args...) = nothing
28+
compute_z_bcs!(Gc, ::AbstractGrid, c, ::NotFluxBC, ::NotFluxBC, ::AbstractArchitecture, args...) = nothing
2929

3030
# The real deal
3131
"""
3232
Apply flux boundary conditions to a field `c` by adding the associated flux divergence to
3333
the source term `Gc` at the left and right.
3434
"""
35-
apply_x_bcs!(Gc, grid::AbstractGrid, c, west_bc, east_bc, arch::AbstractArchitecture, args...) =
36-
launch!(arch, grid, :yz, _apply_x_bcs!, Gc, instantiated_location(Gc), grid, west_bc, east_bc, Tuple(args))
35+
compute_x_bcs!(Gc, grid::AbstractGrid, c, west_bc, east_bc, arch::AbstractArchitecture, args...) =
36+
launch!(arch, grid, :yz, _compute_x_bcs!, Gc, instantiated_location(Gc), grid, west_bc, east_bc, Tuple(args))
3737

3838
"""
3939
Apply flux boundary conditions to a field `c` by adding the associated flux divergence to
4040
the source term `Gc` at the left and right.
4141
"""
42-
apply_y_bcs!(Gc, grid::AbstractGrid, c, south_bc, north_bc, arch::AbstractArchitecture, args...) =
43-
launch!(arch, grid, :xz, _apply_y_bcs!, Gc, instantiated_location(Gc), grid, south_bc, north_bc, Tuple(args))
42+
compute_y_bcs!(Gc, grid::AbstractGrid, c, south_bc, north_bc, arch::AbstractArchitecture, args...) =
43+
launch!(arch, grid, :xz, _compute_y_bcs!, Gc, instantiated_location(Gc), grid, south_bc, north_bc, Tuple(args))
4444

4545
"""
4646
Apply flux boundary conditions to a field `c` by adding the associated flux divergence to
4747
the source term `Gc` at the top and bottom.
4848
"""
49-
apply_z_bcs!(Gc, grid::AbstractGrid, c, bottom_bc, top_bc, arch::AbstractArchitecture, args...) =
50-
launch!(arch, grid, :xy, _apply_z_bcs!, Gc, instantiated_location(Gc), grid, bottom_bc, top_bc, Tuple(args))
49+
compute_z_bcs!(Gc, grid::AbstractGrid, c, bottom_bc, top_bc, arch::AbstractArchitecture, args...) =
50+
launch!(arch, grid, :xy, _compute_z_bcs!, Gc, instantiated_location(Gc), grid, bottom_bc, top_bc, Tuple(args))
5151

5252
"""
53-
_apply_x_bcs!(Gc, grid, west_bc, east_bc, args...)
53+
_compute_x_bcs!(Gc, grid, west_bc, east_bc, args...)
5454
5555
Apply a west and/or east boundary condition to variable `c`.
5656
"""
57-
@kernel function _apply_x_bcs!(Gc, loc, grid, west_bc, east_bc, args)
57+
@kernel function _compute_x_bcs!(Gc, loc, grid, west_bc, east_bc, args)
5858
j, k = @index(Global, NTuple)
59-
apply_x_west_bc!(Gc, loc, west_bc, j, k, grid, args...)
60-
apply_x_east_bc!(Gc, loc, east_bc, j, k, grid, args...)
59+
compute_x_west_bc!(Gc, loc, west_bc, j, k, grid, args...)
60+
compute_x_east_bc!(Gc, loc, east_bc, j, k, grid, args...)
6161
end
6262

6363
"""
64-
_apply_y_bcs!(Gc, grid, south_bc, north_bc, args...)
64+
_compute_y_bcs!(Gc, grid, south_bc, north_bc, args...)
6565
6666
Apply a south and/or north boundary condition to variable `c`.
6767
"""
68-
@kernel function _apply_y_bcs!(Gc, loc, grid, south_bc, north_bc, args)
68+
@kernel function _compute_y_bcs!(Gc, loc, grid, south_bc, north_bc, args)
6969
i, k = @index(Global, NTuple)
70-
apply_y_south_bc!(Gc, loc, south_bc, i, k, grid, args...)
71-
apply_y_north_bc!(Gc, loc, north_bc, i, k, grid, args...)
70+
compute_y_south_bc!(Gc, loc, south_bc, i, k, grid, args...)
71+
compute_y_north_bc!(Gc, loc, north_bc, i, k, grid, args...)
7272
end
7373

7474
"""
75-
_apply_z_bcs!(Gc, grid, bottom_bc, top_bc, args...)
75+
_compute_z_bcs!(Gc, grid, bottom_bc, top_bc, args...)
7676
7777
Apply a top and/or bottom boundary condition to variable `c`.
7878
"""
79-
@kernel function _apply_z_bcs!(Gc, loc, grid, bottom_bc, top_bc, args)
79+
@kernel function _compute_z_bcs!(Gc, loc, grid, bottom_bc, top_bc, args)
8080
i, j = @index(Global, NTuple)
81-
apply_z_bottom_bc!(Gc, loc, bottom_bc, i, j, grid, args...)
82-
apply_z_top_bc!(Gc, loc, top_bc, i, j, grid, args...)
81+
compute_z_bottom_bc!(Gc, loc, bottom_bc, i, j, grid, args...)
82+
compute_z_top_bc!(Gc, loc, top_bc, i, j, grid, args...)
8383
end
8484

8585
# Shortcuts for zero flux or non-flux boundary conditions
86-
@inline apply_x_east_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
87-
@inline apply_x_west_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
88-
@inline apply_y_north_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
89-
@inline apply_y_south_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
90-
@inline apply_z_top_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
91-
@inline apply_z_bottom_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
86+
@inline compute_x_east_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
87+
@inline compute_x_west_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
88+
@inline compute_y_north_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
89+
@inline compute_y_south_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
90+
@inline compute_z_top_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
91+
@inline compute_z_bottom_bc!(Gc, loc, ::NotFluxBC, args...) = nothing
9292

9393
# shortcut for the zipper BC
94-
@inline apply_y_north_bc!(Gc, loc, ::ZBC, args...) = nothing
94+
@inline compute_y_north_bc!(Gc, loc, ::ZBC, args...) = nothing
9595

9696
@inline flip(::Center) = Face()
9797
@inline flip(::Face) = Center()
9898

9999
"""
100-
apply_x_west_bc!(Gc, loc, west_flux::BC{<:Flux}, j, k, grid, args...)
100+
compute_x_west_bc!(Gc, loc, west_flux::BC{<:Flux}, j, k, grid, args...)
101101
102102
Add the flux divergence associated with a west flux boundary condition on `c`.
103103
Note that because
@@ -111,26 +111,26 @@ If `west_bc.condition` is a function, the function must have the signature
111111
112112
The same logic holds for south and bottom boundary conditions in `y`, and `z`, respectively.
113113
"""
114-
@inline function apply_x_west_bc!(Gc, loc, west_flux::BC{<:Flux}, j, k, grid, args...)
114+
@inline function compute_x_west_bc!(Gc, loc, west_flux::BC{<:Flux}, j, k, grid, args...)
115115
LX, LY, LZ = loc
116116
@inbounds Gc[1, j, k] += getbc(west_flux, j, k, grid, args...) * Ax(1, j, k, grid, flip(LX), LY, LZ) / volume(1, j, k, grid, LX, LY, LZ)
117117
return nothing
118118
end
119119

120-
@inline function apply_y_south_bc!(Gc, loc, south_flux::BC{<:Flux}, i, k, grid, args...)
120+
@inline function compute_y_south_bc!(Gc, loc, south_flux::BC{<:Flux}, i, k, grid, args...)
121121
LX, LY, LZ = loc
122122
@inbounds Gc[i, 1, k] += getbc(south_flux, i, k, grid, args...) * Ay(i, 1, k, grid, LX, flip(LY), LZ) / volume(i, 1, k, grid, LX, LY, LZ)
123123
return nothing
124124
end
125125

126-
@inline function apply_z_bottom_bc!(Gc, loc, bottom_flux::BC{<:Flux}, i, j, grid, args...)
126+
@inline function compute_z_bottom_bc!(Gc, loc, bottom_flux::BC{<:Flux}, i, j, grid, args...)
127127
LX, LY, LZ = loc
128128
@inbounds Gc[i, j, 1] += getbc(bottom_flux, i, j, grid, args...) * Az(i, j, 1, grid, LX, LY, flip(LZ)) / volume(i, j, 1, grid, LX, LY, LZ)
129129
return nothing
130130
end
131131

132132
"""
133-
apply_x_east_bc!(Gc, loc, east_flux::BC{<:Flux}, j, k, grid, args...)
133+
compute_x_east_bc!(Gc, loc, east_flux::BC{<:Flux}, j, k, grid, args...)
134134
135135
Add the part of flux divergence associated with a east boundary condition on `c`.
136136
Note that because
@@ -144,19 +144,19 @@ If `east_bc.condition` is a function, the function must have the signature
144144
145145
The same logic holds for north and top boundary conditions in `y`, and `z`, respectively.
146146
"""
147-
@inline function apply_x_east_bc!(Gc, loc, east_flux::BC{<:Flux}, j, k, grid, args...)
147+
@inline function compute_x_east_bc!(Gc, loc, east_flux::BC{<:Flux}, j, k, grid, args...)
148148
LX, LY, LZ = loc
149149
@inbounds Gc[grid.Nx, j, k] -= getbc(east_flux, j, k, grid, args...) * Ax(grid.Nx+1, j, k, grid, flip(LX), LY, LZ) / volume(grid.Nx, j, k, grid, LX, LY, LZ)
150150
return nothing
151151
end
152152

153-
@inline function apply_y_north_bc!(Gc, loc, north_flux::BC{<:Flux}, i, k, grid, args...)
153+
@inline function compute_y_north_bc!(Gc, loc, north_flux::BC{<:Flux}, i, k, grid, args...)
154154
LX, LY, LZ = loc
155155
@inbounds Gc[i, grid.Ny, k] -= getbc(north_flux, i, k, grid, args...) * Ay(i, grid.Ny+1, k, grid, LX, flip(LY), LZ) / volume(i, grid.Ny, k, grid, LX, LY, LZ)
156156
return nothing
157157
end
158158

159-
@inline function apply_z_top_bc!(Gc, loc, top_flux::BC{<:Flux}, i, j, grid, args...)
159+
@inline function compute_z_top_bc!(Gc, loc, top_flux::BC{<:Flux}, i, j, grid, args...)
160160
LX, LY, LZ = loc
161161
@inbounds Gc[i, j, grid.Nz] -= getbc(top_flux, i, j, grid, args...) * Az(i, j, grid.Nz+1, grid, LX, LY, flip(LZ)) / volume(i, j, grid.Nz, grid, LX, LY, LZ)
162162
return nothing

src/BoundaryConditions/field_boundary_conditions.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,15 @@ function regularize_field_boundary_conditions(bcs::FieldBoundaryConditions,
229229
prognostic_names=nothing)
230230

231231
loc = assumed_field_location(field_name)
232+
return regularize_field_boundary_conditions(bcs, grid, loc, prognostic_names, field_name)
233+
end
232234

235+
function regularize_field_boundary_conditions(bcs::FieldBoundaryConditions,
236+
grid::AbstractGrid,
237+
loc::Tuple,
238+
prognostic_names=nothing,
239+
field_name=nothing)
240+
233241
west = regularize_west_boundary_condition(bcs.west, grid, loc, 1, LeftBoundary, prognostic_names)
234242
east = regularize_east_boundary_condition(bcs.east, grid, loc, 1, RightBoundary, prognostic_names)
235243
south = regularize_south_boundary_condition(bcs.south, grid, loc, 2, LeftBoundary, prognostic_names)

0 commit comments

Comments
 (0)