@@ -18,7 +18,7 @@ using JLD2
1818# Implementation of 3-dimensional regridding
1919# TODO : move all the following to Oceananigans!
2020
21- using Oceananigans. Fields: regrid!, interpolate!
21+ using Oceananigans. Fields: interpolate!
2222using Oceananigans. Grids: cpu_face_constructor_x,
2323 cpu_face_constructor_y,
2424 cpu_face_constructor_z,
@@ -31,44 +31,6 @@ construct_grid(::Type{<:RectilinearGrid}, arch, size, extent, topology) =
3131construct_grid (:: Type{<:LatitudeLongitudeGrid} , arch, size, extent, topology) =
3232 LatitudeLongitudeGrid (arch; size, longitude = extent[1 ], latitude = extent[2 ], z = extent[3 ], topology)
3333
34- # Regrid a field in three dimensions
35- function three_dimensional_regrid! (a, b)
36- target_grid = a. grid isa ImmersedBoundaryGrid ? a. grid. underlying_grid : a. grid
37- source_grid = b. grid isa ImmersedBoundaryGrid ? b. grid. underlying_grid : b. grid
38-
39- topo = topology (target_grid)
40- arch = architecture (target_grid)
41- arch = child_architecture (arch)
42-
43- target_y = yt = cpu_face_constructor_y (target_grid)
44- target_z = zt = cpu_face_constructor_z (target_grid)
45-
46- target_size = Nt = size (target_grid)
47-
48- source_x = xs = cpu_face_constructor_x (source_grid)
49- source_y = ys = cpu_face_constructor_y (source_grid)
50-
51- source_size = Ns = size (source_grid)
52-
53- # Start by regridding in z
54- @debug " Regridding in z"
55- zgrid = construct_grid (typeof (target_grid), arch, (Ns[1 ], Ns[2 ], Nt[3 ]), (xs, ys, zt), topo)
56- field_z = Field (location (b), zgrid)
57- regrid! (field_z, zgrid, source_grid, b)
58-
59- # regrid in y
60- @debug " Regridding in y"
61- ygrid = construct_grid (typeof (target_grid), arch, (Ns[1 ], Nt[2 ], Nt[3 ]), (xs, yt, zt), topo)
62- field_y = Field (location (b), ygrid);
63- regrid! (field_y, ygrid, zgrid, field_z);
64-
65- # Finally regrid in x
66- @debug " Regridding in x"
67- regrid! (a, target_grid, ygrid, field_y)
68-
69- return a
70- end
71-
7234include (" diffuse_tracers.jl" )
7335
7436end # module
0 commit comments