Skip to content

Commit b8012d5

Browse files
authored
old_bcs -> global_bcs and new_bcs -> local_bcs (#5481)
1 parent f3c73c9 commit b8012d5

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/DistributedComputations/distributed_fields.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ import Oceananigans.BoundaryConditions: fill_halo_regions!
1919
import LinearAlgebra: norm, dot
2020
import Statistics: mean
2121

22-
function Field(loc::Tuple{<:LX, <:LY, <:LZ}, grid::DistributedGrid, data, old_bcs, indices::Tuple, op, status) where {LX, LY, LZ}
22+
function Field(loc::Tuple{<:LX, <:LY, <:LZ}, grid::DistributedGrid, data, global_bcs, indices::Tuple, op, status) where {LX, LY, LZ}
2323
indices = validate_indices(indices, loc, grid)
2424
validate_field_data(loc, data, grid, indices)
25-
validate_boundary_conditions(loc, grid, old_bcs)
25+
validate_boundary_conditions(loc, grid, global_bcs)
2626

2727
arch = architecture(grid)
2828
rank = arch.local_rank
29-
new_bcs = inject_halo_communication_boundary_conditions(old_bcs, loc, rank, arch.connectivity, topology(grid))
30-
buffers = communication_buffers(grid, data, new_bcs)
29+
local_bcs = inject_halo_communication_boundary_conditions(global_bcs, loc, rank, arch.connectivity, topology(grid))
30+
buffers = communication_buffers(grid, data, local_bcs)
3131

32-
return Field{LX, LY, LZ}(grid, data, new_bcs, indices, op, status, buffers)
32+
return Field{LX, LY, LZ}(grid, data, local_bcs, indices, op, status, buffers)
3333
end
3434

3535
const DistributedField = Field{<:Any, <:Any, <:Any, <:Any, <:DistributedGrid}

src/Fields/field.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ struct Field{LX, LY, LZ, O, G, I, D, T, B, S, F} <: AbstractField{LX, LY, LZ, G,
2929
# Inner constructor that does not validate _anything_!
3030
function Field{LX, LY, LZ}(grid::G, data::D, bcs::B, indices::I, op::O, status::S, buffers::F) where {LX, LY, LZ, G, D, B, O, S, I, F}
3131
T = eltype(data)
32-
@apply_regionally new_bcs = construct_boundary_conditions_kernels(bcs, data, grid, (LX(), LY(), LZ()), indices) # Adding the kernels to the bcs
33-
return new{LX, LY, LZ, O, G, I, D, T, typeof(new_bcs), S, F}(grid, data, new_bcs, indices, op, status, buffers)
32+
@apply_regionally local_bcs = construct_boundary_conditions_kernels(bcs, data, grid, (LX(), LY(), LZ()), indices) # Adding the kernels to the bcs
33+
return new{LX, LY, LZ, O, G, I, D, T, typeof(local_bcs), S, F}(grid, data, local_bcs, indices, op, status, buffers)
3434
end
3535
end
3636

src/OrthogonalSphericalShellGrids/distributed_tripolar_grid.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,52 +277,52 @@ end
277277

278278
# Extension of the constructor for a `Field` on a `TRG` grid. We assumes that the north boundary is a zipper
279279
# with a sign that depends on the location of the field (revert the value of the halos if on edges, keep it if on nodes or centers)
280-
function Field(loc::Tuple{<:LX, <:LY, <:LZ}, grid::MPITripolarGridOfSomeKind, data, old_bcs, indices::Tuple, op, status) where {LX, LY, LZ}
280+
function Field(loc::Tuple{<:LX, <:LY, <:LZ}, grid::MPITripolarGridOfSomeKind, data, global_bcs, indices::Tuple, op, status) where {LX, LY, LZ}
281281
arch = architecture(grid)
282282
yrank = arch.local_index[2] - 1
283283

284284
processor_size = ranks(arch)
285285

286286
indices = validate_indices(indices, loc, grid)
287287
validate_field_data(loc, data, grid, indices)
288-
validate_boundary_conditions(loc, grid, old_bcs)
288+
validate_boundary_conditions(loc, grid, global_bcs)
289289

290-
if isnothing(old_bcs) || ismissing(old_bcs)
291-
new_bcs = old_bcs
290+
if isnothing(global_bcs) || ismissing(global_bcs)
291+
local_bcs = global_bcs
292292
else
293-
new_bcs = inject_halo_communication_boundary_conditions(old_bcs, loc, arch.local_rank, arch.connectivity, topology(grid))
293+
local_bcs = inject_halo_communication_boundary_conditions(global_bcs, loc, arch.local_rank, arch.connectivity, topology(grid))
294294

295295
if yrank == processor_size[2] - 1 && processor_size[1] == 1
296-
north_bc = if !(old_bcs.north isa ZBC)
296+
north_bc = if !(global_bcs.north isa ZBC)
297297
TY = fold_topology(grid.conformal_mapping)
298298
north_fold_boundary_condition(TY)(sign(LX, LY))
299299

300300
else
301-
old_bcs.north
301+
global_bcs.north
302302
end
303303

304304
elseif yrank == processor_size[2] - 1 && processor_size[1] != 1
305-
sgn = old_bcs.north isa ZBC ? old_bcs.north.condition : sign(LX, LY)
305+
sgn = global_bcs.north isa ZBC ? global_bcs.north.condition : sign(LX, LY)
306306
from = arch.local_rank
307307
to = arch.connectivity.north
308308
halo_communication = ZipperHaloCommunicationRanks(sgn; from, to)
309309
north_bc = DistributedCommunicationBoundaryCondition(halo_communication)
310310

311311
else
312-
north_bc = new_bcs.north
312+
north_bc = local_bcs.north
313313
end
314314

315-
new_bcs = FieldBoundaryConditions(; west=new_bcs.west,
316-
east=new_bcs.east,
317-
south=new_bcs.south,
315+
local_bcs = FieldBoundaryConditions(; west=local_bcs.west,
316+
east=local_bcs.east,
317+
south=local_bcs.south,
318318
north=north_bc,
319-
top=new_bcs.top,
320-
bottom=new_bcs.bottom)
319+
top=local_bcs.top,
320+
bottom=local_bcs.bottom)
321321
end
322322

323-
buffers = communication_buffers(grid, data, new_bcs, (LX(), LY(), LZ()))
323+
buffers = communication_buffers(grid, data, local_bcs, (LX(), LY(), LZ()))
324324

325-
return Field{LX, LY, LZ}(grid, data, new_bcs, indices, op, status, buffers)
325+
return Field{LX, LY, LZ}(grid, data, local_bcs, indices, op, status, buffers)
326326
end
327327

328328
# Reconstruction the global tripolar grid for visualization purposes

0 commit comments

Comments
 (0)