From 6bac83d68809ef6e42ce27b702e9600b3b06977d Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 1 Mar 2024 15:49:48 -0500 Subject: [PATCH 01/19] bugfix --- test/test_distributed_hydrostatic_model.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_distributed_hydrostatic_model.jl b/test/test_distributed_hydrostatic_model.jl index 8511a4c8ad..dc2b7b5d6e 100644 --- a/test/test_distributed_hydrostatic_model.jl +++ b/test/test_distributed_hydrostatic_model.jl @@ -79,7 +79,7 @@ Ny = 32 for arch in archs @testset "Testing distributed solid body rotation" begin grid = LatitudeLongitudeGrid(arch, size = (Nx, Ny, 1), - halo = (3, 3, 3), + halo = (4, 4, 4), latitude = (-80, 80), longitude = (-160, 160), z = (-1, 0), From a03e98016a4d5886a463c24a1d2239e4160ae198 Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Thu, 18 Apr 2024 10:04:17 -0400 Subject: [PATCH 02/19] remove evals --- src/Grids/latitude_longitude_grid.jl | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Grids/latitude_longitude_grid.jl b/src/Grids/latitude_longitude_grid.jl index eab9f81dd2..0117dacb4e 100644 --- a/src/Grids/latitude_longitude_grid.jl +++ b/src/Grids/latitude_longitude_grid.jl @@ -528,16 +528,6 @@ end function allocate_metrics(grid::LatitudeLongitudeGrid) FT = eltype(grid) - - # preallocate quantities to ensure correct type and size - grid_metrics = (:Δxᶠᶜ, - :Δxᶜᶠ, - :Δxᶠᶠ, - :Δxᶜᶜ, - :Azᶠᶜ, - :Azᶜᶠ, - :Azᶠᶠ, - :Azᶜᶜ) arch = grid.architecture @@ -549,11 +539,14 @@ function allocate_metrics(grid::LatitudeLongitudeGrid) metric_size = (length(grid.Δλᶜᵃᵃ) , length(grid.φᵃᶜᵃ)) end - for metric in grid_metrics - parentM = Symbol(metric, :_parent) - @eval $parentM = zeros($FT, $metric_size...) - @eval $metric = OffsetArray(on_architecture($arch, $parentM), $offsets...) - end + Δxᶠᶜ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Δxᶜᶠ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Δxᶠᶠ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Δxᶜᶜ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Azᶠᶜ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Azᶜᶠ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Azᶠᶠ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) + Azᶜᶜ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) if grid isa YRegularLLG Δyᶠᶜ = FT(0.0) From d1d013a69f4832090148db75470e4533b1882485 Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:13:01 -0400 Subject: [PATCH 03/19] remove other eval --- src/Advection/reconstruction_coefficients.jl | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Advection/reconstruction_coefficients.jl b/src/Advection/reconstruction_coefficients.jl index adcf18c925..251913222c 100644 --- a/src/Advection/reconstruction_coefficients.jl +++ b/src/Advection/reconstruction_coefficients.jl @@ -210,24 +210,24 @@ end method = scheme == :Centered ? 1 : scheme == :Upwind ? 2 : 3 - rect_metrics = (:xᶠᵃᵃ, :xᶜᵃᵃ, :yᵃᶠᵃ, :yᵃᶜᵃ, :zᵃᵃᶠ, :zᵃᵃᶜ) - if grid isa Nothing - for metric in rect_metrics - @eval $(Symbol(:coeff_ , metric)) = nothing - @eval $(Symbol(:smooth_, metric)) = nothing - end + coeff_xᶠᵃᵃ = nothing + coeff_xᶜᵃᵃ = nothing + coeff_yᵃᶠᵃ = nothing + coeff_yᵃᶜᵃ = nothing + coeff_zᵃᵃᶠ = nothing + coeff_zᵃᵃᶜ = nothing else - metrics = coordinates(grid) - dirsize = (:Nx, :Nx, :Ny, :Ny, :Nz, :Nz) - arch = architecture(grid) Hx, Hy, Hz = halo_size(grid) new_grid = with_halo((Hx+1, Hy+1, Hz+1), grid) - for (dir, metric, rect_metric) in zip(dirsize, metrics, rect_metrics) - @eval $(Symbol(:coeff_ , rect_metric)) = calc_reconstruction_coefficients($FT, $new_grid.$metric, $arch, $new_grid.$dir, Val($method); order = $order) - end + coeff_xᶠᵃᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[1], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_xᶜᵃᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[2], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_yᵃᶠᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_yᵃᶜᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[4], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_zᵃᵃᶠ = calc_reconstruction_coefficients(FT, getproperty(metrics[5], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_zᵃᵃᶜ = calc_reconstruction_coefficients(FT, getproperty(metrics[6], new_grid), arch, new_grid.Nx, Val(method); order) end return (coeff_xᶠᵃᵃ, coeff_xᶜᵃᵃ, coeff_yᵃᶠᵃ, coeff_yᵃᶜᵃ, coeff_zᵃᵃᶠ, coeff_zᵃᵃᶜ) From 34903d902a9e2eee169ccf682384219d9564732b Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 19 Apr 2024 07:20:22 -0400 Subject: [PATCH 04/19] bugfix --- src/Advection/reconstruction_coefficients.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Advection/reconstruction_coefficients.jl b/src/Advection/reconstruction_coefficients.jl index 251913222c..0462b54ee1 100644 --- a/src/Advection/reconstruction_coefficients.jl +++ b/src/Advection/reconstruction_coefficients.jl @@ -224,10 +224,10 @@ end coeff_xᶠᵃᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[1], new_grid), arch, new_grid.Nx, Val(method); order) coeff_xᶜᵃᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[2], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_yᵃᶠᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_yᵃᶜᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[4], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_zᵃᵃᶠ = calc_reconstruction_coefficients(FT, getproperty(metrics[5], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_zᵃᵃᶜ = calc_reconstruction_coefficients(FT, getproperty(metrics[6], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_yᵃᶠᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Ny, Val(method); order) + coeff_yᵃᶜᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[4], new_grid), arch, new_grid.Ny, Val(method); order) + coeff_zᵃᵃᶠ = calc_reconstruction_coefficients(FT, getproperty(metrics[5], new_grid), arch, new_grid.Nz, Val(method); order) + coeff_zᵃᵃᶜ = calc_reconstruction_coefficients(FT, getproperty(metrics[6], new_grid), arch, new_grid.Nz, Val(method); order) end return (coeff_xᶠᵃᵃ, coeff_xᶜᵃᵃ, coeff_yᵃᶠᵃ, coeff_yᵃᶜᵃ, coeff_zᵃᵃᶠ, coeff_zᵃᵃᶜ) From 107facad67de76f3d9b28ff1e6c364bbf1c99144 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Fri, 19 Apr 2024 11:54:29 -0400 Subject: [PATCH 05/19] Update src/Grids/latitude_longitude_grid.jl Co-authored-by: Gregory L. Wagner --- src/Grids/latitude_longitude_grid.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Grids/latitude_longitude_grid.jl b/src/Grids/latitude_longitude_grid.jl index 0117dacb4e..cdef2e81b8 100644 --- a/src/Grids/latitude_longitude_grid.jl +++ b/src/Grids/latitude_longitude_grid.jl @@ -549,7 +549,7 @@ function allocate_metrics(grid::LatitudeLongitudeGrid) Azᶜᶜ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) if grid isa YRegularLLG - Δyᶠᶜ = FT(0.0) + Δyᶠᶜ = FT(0) Δyᶜᶠ = FT(0.0) else parentC = zeros(FT, length(grid.Δφᵃᶜᵃ)) From 9b7cf491f824082c5610bae7073f7ec3fef4b8b7 Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:41:11 -0400 Subject: [PATCH 06/19] remove yet another eval --- src/Grids/nodes_and_spacings.jl | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Grids/nodes_and_spacings.jl b/src/Grids/nodes_and_spacings.jl index 858edd0b5c..0e6978d3dc 100644 --- a/src/Grids/nodes_and_spacings.jl +++ b/src/Grids/nodes_and_spacings.jl @@ -195,7 +195,6 @@ julia> xspacings(grid, Center(), Face(), Center()) """ @inline xspacings(grid, ℓx, ℓy, ℓz; with_halos=true) = xspacings(grid, ℓx; with_halos) - """ yspacings(grid, ℓx, ℓy, ℓz; with_halos=true) @@ -233,10 +232,23 @@ julia> zspacings(grid, Center(), Center(), Center()) destantiate(::Face) = Face destantiate(::Center) = Center -function minimum_spacing(dir, grid, ℓx, ℓy, ℓz) - spacing = eval(Symbol(dir, :spacing)) +function minimum_spacing(::Val{x}, grid, ℓx, ℓy, ℓz) + LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) + Δ = KernelFunctionOperation{LX, LY, LZ}(xpacing, grid, ℓx, ℓy, ℓz) + + return minimum(Δ) +end + +function minimum_spacing(::Val{y}, grid, ℓx, ℓy, ℓz) + LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) + Δ = KernelFunctionOperation{LX, LY, LZ}(yspacing, grid, ℓx, ℓy, ℓz) + + return minimum(Δ) +end + +function minimum_spacing(::Val{z}, grid, ℓx, ℓy, ℓz) LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) - Δ = KernelFunctionOperation{LX, LY, LZ}(spacing, grid, ℓx, ℓy, ℓz) + Δ = KernelFunctionOperation{LX, LY, LZ}(zspacing, grid, ℓx, ℓy, ℓz) return minimum(Δ) end @@ -258,8 +270,8 @@ julia> minimum_xspacing(grid, Center(), Center(), Center()) 0.5 ``` """ -minimum_xspacing(grid, ℓx, ℓy, ℓz) = minimum_spacing(:x, grid, ℓx, ℓy, ℓz) -minimum_xspacing(grid) = minimum_spacing(:x, grid, Center(), Center(), Center()) +minimum_xspacing(grid, ℓx, ℓy, ℓz) = minimum_spacing(Val(:x), grid, ℓx, ℓy, ℓz) +minimum_xspacing(grid) = minimum_spacing(Val(:x), grid, Center(), Center(), Center()) """ minimum_yspacing(grid, ℓx, ℓy, ℓz) minimum_yspacing(grid) = minimum_yspacing(grid, Center(), Center(), Center()) @@ -277,8 +289,8 @@ julia> minimum_yspacing(grid, Center(), Center(), Center()) 0.25 ``` """ -minimum_yspacing(grid, ℓx, ℓy, ℓz) = minimum_spacing(:y, grid, ℓx, ℓy, ℓz) -minimum_yspacing(grid) = minimum_spacing(:y, grid, Center(), Center(), Center()) +minimum_yspacing(grid, ℓx, ℓy, ℓz) = minimum_spacing(Val(:y), grid, ℓx, ℓy, ℓz) +minimum_yspacing(grid) = minimum_spacing(Val(:y), grid, Center(), Center(), Center()) """ minimum_zspacing(grid, ℓx, ℓy, ℓz) @@ -297,7 +309,7 @@ julia> minimum_zspacing(grid, Center(), Center(), Center()) 0.125 ``` """ -minimum_zspacing(grid, ℓx, ℓy, ℓz) = minimum_spacing(:z, grid, ℓx, ℓy, ℓz) -minimum_zspacing(grid) = minimum_spacing(:z, grid, Center(), Center(), Center()) +minimum_zspacing(grid, ℓx, ℓy, ℓz) = minimum_spacing(Val(:z), grid, ℓx, ℓy, ℓz) +minimum_zspacing(grid) = minimum_spacing(Val(:z), grid, Center(), Center(), Center()) From 9984ddf71759421f8ff4ace9be21543e25a48f2a Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:41:45 -0400 Subject: [PATCH 07/19] bugfix --- src/Grids/nodes_and_spacings.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Grids/nodes_and_spacings.jl b/src/Grids/nodes_and_spacings.jl index 0e6978d3dc..ee52925dee 100644 --- a/src/Grids/nodes_and_spacings.jl +++ b/src/Grids/nodes_and_spacings.jl @@ -232,21 +232,21 @@ julia> zspacings(grid, Center(), Center(), Center()) destantiate(::Face) = Face destantiate(::Center) = Center -function minimum_spacing(::Val{x}, grid, ℓx, ℓy, ℓz) +function minimum_spacing(::Val{:x}, grid, ℓx, ℓy, ℓz) LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) Δ = KernelFunctionOperation{LX, LY, LZ}(xpacing, grid, ℓx, ℓy, ℓz) return minimum(Δ) end -function minimum_spacing(::Val{y}, grid, ℓx, ℓy, ℓz) +function minimum_spacing(::Val{:y}, grid, ℓx, ℓy, ℓz) LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) Δ = KernelFunctionOperation{LX, LY, LZ}(yspacing, grid, ℓx, ℓy, ℓz) return minimum(Δ) end -function minimum_spacing(::Val{z}, grid, ℓx, ℓy, ℓz) +function minimum_spacing(::Val{:z}, grid, ℓx, ℓy, ℓz) LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) Δ = KernelFunctionOperation{LX, LY, LZ}(zspacing, grid, ℓx, ℓy, ℓz) From 15e93ef82e61112cc5202604a4c5d3122255287a Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Sat, 20 Apr 2024 09:32:42 -0400 Subject: [PATCH 08/19] Update src/Grids/latitude_longitude_grid.jl Co-authored-by: Gregory L. Wagner --- src/Grids/latitude_longitude_grid.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Grids/latitude_longitude_grid.jl b/src/Grids/latitude_longitude_grid.jl index cdef2e81b8..fca2f5d34d 100644 --- a/src/Grids/latitude_longitude_grid.jl +++ b/src/Grids/latitude_longitude_grid.jl @@ -550,7 +550,7 @@ function allocate_metrics(grid::LatitudeLongitudeGrid) if grid isa YRegularLLG Δyᶠᶜ = FT(0) - Δyᶜᶠ = FT(0.0) + Δyᶜᶠ = FT(0) else parentC = zeros(FT, length(grid.Δφᵃᶜᵃ)) parentF = zeros(FT, length(grid.Δφᵃᶜᵃ)) From 4616d177fbd5e2e0dba953d7ace1b013cf223fa3 Mon Sep 17 00:00:00 2001 From: Simone Silvestri Date: Tue, 14 May 2024 16:35:19 -0400 Subject: [PATCH 09/19] Update src/Grids/latitude_longitude_grid.jl Co-authored-by: Gregory L. Wagner --- src/Grids/latitude_longitude_grid.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Grids/latitude_longitude_grid.jl b/src/Grids/latitude_longitude_grid.jl index fca2f5d34d..b944b59220 100644 --- a/src/Grids/latitude_longitude_grid.jl +++ b/src/Grids/latitude_longitude_grid.jl @@ -536,7 +536,7 @@ function allocate_metrics(grid::LatitudeLongitudeGrid) metric_size = length(grid.φᵃᶜᵃ) else offsets = (grid.Δλᶜᵃᵃ.offsets[1], grid.φᵃᶜᵃ.offsets[1]) - metric_size = (length(grid.Δλᶜᵃᵃ) , length(grid.φᵃᶜᵃ)) + metric_size = (length(grid.Δλᶜᵃᵃ), length(grid.φᵃᶜᵃ)) end Δxᶠᶜ = OffsetArray(zeros(FT, arch, metric_size...), offsets...) From 62bdad4172bc8219957a7ae1b42e27cc7ecdd34e Mon Sep 17 00:00:00 2001 From: simone silvestri Date: Tue, 14 May 2024 16:38:15 -0400 Subject: [PATCH 10/19] simplify code --- src/Grids/nodes_and_spacings.jl | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Grids/nodes_and_spacings.jl b/src/Grids/nodes_and_spacings.jl index ee52925dee..f5538d1aa4 100644 --- a/src/Grids/nodes_and_spacings.jl +++ b/src/Grids/nodes_and_spacings.jl @@ -232,23 +232,14 @@ julia> zspacings(grid, Center(), Center(), Center()) destantiate(::Face) = Face destantiate(::Center) = Center -function minimum_spacing(::Val{:x}, grid, ℓx, ℓy, ℓz) - LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) - Δ = KernelFunctionOperation{LX, LY, LZ}(xpacing, grid, ℓx, ℓy, ℓz) - - return minimum(Δ) -end - -function minimum_spacing(::Val{:y}, grid, ℓx, ℓy, ℓz) - LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) - Δ = KernelFunctionOperation{LX, LY, LZ}(yspacing, grid, ℓx, ℓy, ℓz) - - return minimum(Δ) -end +spacing_function(::Val{:x}) = xspacing +spacing_function(::Val{:y}) = yspacing +spacing_function(::Val{:z}) = zspacing -function minimum_spacing(::Val{:z}, grid, ℓx, ℓy, ℓz) +function minimum_spacing(s, grid, ℓx, ℓy, ℓz) + spacing = spacing_function(s) LX, LY, LZ = map(destantiate, (ℓx, ℓy, ℓz)) - Δ = KernelFunctionOperation{LX, LY, LZ}(zspacing, grid, ℓx, ℓy, ℓz) + Δ = KernelFunctionOperation{LX, LY, LZ}(spacing, grid, ℓx, ℓy, ℓz) return minimum(Δ) end From 4226ef3e3adcb32a7e8b1747764dd59c57dc5400 Mon Sep 17 00:00:00 2001 From: simone silvestri Date: Tue, 14 May 2024 16:43:57 -0400 Subject: [PATCH 11/19] name change to reconstruction_coefficients function --- src/Advection/reconstruction_coefficients.jl | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Advection/reconstruction_coefficients.jl b/src/Advection/reconstruction_coefficients.jl index 0462b54ee1..693050a6dd 100644 --- a/src/Advection/reconstruction_coefficients.jl +++ b/src/Advection/reconstruction_coefficients.jl @@ -222,12 +222,12 @@ end Hx, Hy, Hz = halo_size(grid) new_grid = with_halo((Hx+1, Hy+1, Hz+1), grid) - coeff_xᶠᵃᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[1], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_xᶜᵃᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[2], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_yᵃᶠᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Ny, Val(method); order) - coeff_yᵃᶜᵃ = calc_reconstruction_coefficients(FT, getproperty(metrics[4], new_grid), arch, new_grid.Ny, Val(method); order) - coeff_zᵃᵃᶠ = calc_reconstruction_coefficients(FT, getproperty(metrics[5], new_grid), arch, new_grid.Nz, Val(method); order) - coeff_zᵃᵃᶜ = calc_reconstruction_coefficients(FT, getproperty(metrics[6], new_grid), arch, new_grid.Nz, Val(method); order) + coeff_xᶠᵃᵃ = reconstruction_coefficients(FT, getproperty(metrics[1], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_xᶜᵃᵃ = reconstruction_coefficients(FT, getproperty(metrics[2], new_grid), arch, new_grid.Nx, Val(method); order) + coeff_yᵃᶠᵃ = reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Ny, Val(method); order) + coeff_yᵃᶜᵃ = reconstruction_coefficients(FT, getproperty(metrics[4], new_grid), arch, new_grid.Ny, Val(method); order) + coeff_zᵃᵃᶠ = reconstruction_coefficients(FT, getproperty(metrics[5], new_grid), arch, new_grid.Nz, Val(method); order) + coeff_zᵃᵃᶜ = reconstruction_coefficients(FT, getproperty(metrics[6], new_grid), arch, new_grid.Nz, Val(method); order) end return (coeff_xᶠᵃᵃ, coeff_xᶜᵃᵃ, coeff_yᵃᶠᵃ, coeff_yᵃᶜᵃ, coeff_zᵃᵃᶠ, coeff_zᵃᵃᶜ) @@ -236,13 +236,13 @@ end # Fallback for uniform directions for val in [1, 2, 3] @eval begin - @inline calc_reconstruction_coefficients(FT, coord::OffsetArray{<:Any, <:Any, <:AbstractRange}, arch, N, ::Val{$val}; order) = nothing - @inline calc_reconstruction_coefficients(FT, coord::AbstractRange, arch, N, ::Val{$val}; order) = nothing + @inline reconstruction_coefficients(FT, coord::OffsetArray{<:Any, <:Any, <:AbstractRange}, arch, N, ::Val{$val}; order) = nothing + @inline reconstruction_coefficients(FT, coord::AbstractRange, arch, N, ::Val{$val}; order) = nothing end end # Stretched reconstruction coefficients for `Centered` schemes -@inline function calc_reconstruction_coefficients(FT, coord, arch, N, ::Val{1}; order) +@inline function reconstruction_coefficients(FT, coord, arch, N, ::Val{1}; order) cpu_coord = on_architecture(CPU(), coord) r = ((order + 1) ÷ 2) - 1 s = create_reconstruction_coefficients(FT, r, cpu_coord, arch, N; order) @@ -250,7 +250,7 @@ end end # Stretched reconstruction coefficients for `UpwindBiased` schemes -@inline function calc_reconstruction_coefficients(FT, coord, arch, N, ::Val{2}; order) +@inline function reconstruction_coefficients(FT, coord, arch, N, ::Val{2}; order) cpu_coord = on_architecture(CPU(), coord) rleft = ((order + 1) ÷ 2) - 2 rright = ((order + 1) ÷ 2) - 1 @@ -262,7 +262,7 @@ end end # Stretched reconstruction coefficients for `WENO` schemes -@inline function calc_reconstruction_coefficients(FT, coord, arch, N, ::Val{3}; order) +@inline function reconstruction_coefficients(FT, coord, arch, N, ::Val{3}; order) cpu_coord = on_architecture(CPU(), coord) s = [] From 974d786cdaa31a34200d667e912c95b80c476a17 Mon Sep 17 00:00:00 2001 From: simone silvestri Date: Sun, 19 May 2024 18:24:14 -0400 Subject: [PATCH 12/19] bugfix --- src/Advection/reconstruction_coefficients.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Advection/reconstruction_coefficients.jl b/src/Advection/reconstruction_coefficients.jl index 693050a6dd..8f2d3028a5 100644 --- a/src/Advection/reconstruction_coefficients.jl +++ b/src/Advection/reconstruction_coefficients.jl @@ -209,7 +209,7 @@ end @inline function compute_reconstruction_coefficients(grid, FT, scheme; order) method = scheme == :Centered ? 1 : scheme == :Upwind ? 2 : 3 - + if grid isa Nothing coeff_xᶠᵃᵃ = nothing coeff_xᶜᵃᵃ = nothing @@ -221,7 +221,8 @@ end arch = architecture(grid) Hx, Hy, Hz = halo_size(grid) new_grid = with_halo((Hx+1, Hy+1, Hz+1), grid) - + metrics = coordinates(grid) + coeff_xᶠᵃᵃ = reconstruction_coefficients(FT, getproperty(metrics[1], new_grid), arch, new_grid.Nx, Val(method); order) coeff_xᶜᵃᵃ = reconstruction_coefficients(FT, getproperty(metrics[2], new_grid), arch, new_grid.Nx, Val(method); order) coeff_yᵃᶠᵃ = reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Ny, Val(method); order) From f7722fd2c3e114168c44d0a0796158cd44ecd5f0 Mon Sep 17 00:00:00 2001 From: simone silvestri Date: Mon, 20 May 2024 06:07:36 -0400 Subject: [PATCH 13/19] last bugfix --- src/Advection/reconstruction_coefficients.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Advection/reconstruction_coefficients.jl b/src/Advection/reconstruction_coefficients.jl index 8f2d3028a5..f66112063a 100644 --- a/src/Advection/reconstruction_coefficients.jl +++ b/src/Advection/reconstruction_coefficients.jl @@ -223,12 +223,12 @@ end new_grid = with_halo((Hx+1, Hy+1, Hz+1), grid) metrics = coordinates(grid) - coeff_xᶠᵃᵃ = reconstruction_coefficients(FT, getproperty(metrics[1], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_xᶜᵃᵃ = reconstruction_coefficients(FT, getproperty(metrics[2], new_grid), arch, new_grid.Nx, Val(method); order) - coeff_yᵃᶠᵃ = reconstruction_coefficients(FT, getproperty(metrics[3], new_grid), arch, new_grid.Ny, Val(method); order) - coeff_yᵃᶜᵃ = reconstruction_coefficients(FT, getproperty(metrics[4], new_grid), arch, new_grid.Ny, Val(method); order) - coeff_zᵃᵃᶠ = reconstruction_coefficients(FT, getproperty(metrics[5], new_grid), arch, new_grid.Nz, Val(method); order) - coeff_zᵃᵃᶜ = reconstruction_coefficients(FT, getproperty(metrics[6], new_grid), arch, new_grid.Nz, Val(method); order) + coeff_xᶠᵃᵃ = reconstruction_coefficients(FT, getproperty(new_grid, metrics[1]), arch, new_grid.Nx, Val(method); order) + coeff_xᶜᵃᵃ = reconstruction_coefficients(FT, getproperty(new_grid, metrics[2]), arch, new_grid.Nx, Val(method); order) + coeff_yᵃᶠᵃ = reconstruction_coefficients(FT, getproperty(new_grid, metrics[3]), arch, new_grid.Ny, Val(method); order) + coeff_yᵃᶜᵃ = reconstruction_coefficients(FT, getproperty(new_grid, metrics[4]), arch, new_grid.Ny, Val(method); order) + coeff_zᵃᵃᶠ = reconstruction_coefficients(FT, getproperty(new_grid, metrics[5]), arch, new_grid.Nz, Val(method); order) + coeff_zᵃᵃᶜ = reconstruction_coefficients(FT, getproperty(new_grid, metrics[6]), arch, new_grid.Nz, Val(method); order) end return (coeff_xᶠᵃᵃ, coeff_xᶜᵃᵃ, coeff_yᵃᶠᵃ, coeff_yᵃᶜᵃ, coeff_zᵃᵃᶠ, coeff_zᵃᵃᶜ) From db17a93e493548b5e3c4f0933e8ccb57947fdeb5 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Fri, 21 Jun 2024 11:05:32 -0400 Subject: [PATCH 14/19] Replace a couple of evals with getglobal --- src/AbstractOperations/grid_metrics.jl | 2 +- src/MultiRegion/multi_region_models.jl | 2 +- src/TimeSteppers/TimeSteppers.jl | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AbstractOperations/grid_metrics.jl b/src/AbstractOperations/grid_metrics.jl index c7bee46871..f873242aa1 100644 --- a/src/AbstractOperations/grid_metrics.jl +++ b/src/AbstractOperations/grid_metrics.jl @@ -114,7 +114,7 @@ function metric_function(loc, metric::AbstractGridMetric) code = Tuple(interpolation_code(ℓ) for ℓ in loc) prefix = metric_function_prefix(metric) metric_function_symbol = Symbol(prefix, code...) - return eval(metric_function_symbol) + return getglobal(@__MODULE__, metric_function_symbol) end struct GridMetricOperation{LX, LY, LZ, G, T, M} <: AbstractOperation{LX, LY, LZ, G, T} diff --git a/src/MultiRegion/multi_region_models.jl b/src/MultiRegion/multi_region_models.jl index 5159a031ac..56bb00dc9a 100644 --- a/src/MultiRegion/multi_region_models.jl +++ b/src/MultiRegion/multi_region_models.jl @@ -17,7 +17,7 @@ const MultiRegionModel = HydrostaticFreeSurfaceModel{<:Any, <:Any, <:AbstractArc # Utility to generate the inputs to complex `getregion`s function getregionalproperties(T, inner=true) - type = eval(T) + type = getglobal(@__MODULE__, T) names = fieldnames(type) args = Vector(undef, length(names)) for (n, name) in enumerate(names) diff --git a/src/TimeSteppers/TimeSteppers.jl b/src/TimeSteppers/TimeSteppers.jl index a935da5c20..2955ca6999 100644 --- a/src/TimeSteppers/TimeSteppers.jl +++ b/src/TimeSteppers/TimeSteppers.jl @@ -35,7 +35,8 @@ julia> stepper = TimeStepper(:QuasiAdamsBashforth2, CPU(), grid, tracernames) """ function TimeStepper(name::Symbol, args...; kwargs...) fullname = Symbol(name, :TimeStepper) - return @eval $fullname($args...; $kwargs...) + TS = getglobal(@__MODULE__, fullname) + return TS(args...; kwargs...) end # Fallback From 01d4c22b425db1123f8fbc75718778ce0245198f Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Fri, 21 Jun 2024 11:05:55 -0400 Subject: [PATCH 15/19] Mark a few places where eval needs to be removed --- src/MultiRegion/cubed_sphere_grid.jl | 2 ++ src/Operators/interpolation_utils.jl | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/MultiRegion/cubed_sphere_grid.jl b/src/MultiRegion/cubed_sphere_grid.jl index 6dedb3746f..f5f572ab5c 100644 --- a/src/MultiRegion/cubed_sphere_grid.jl +++ b/src/MultiRegion/cubed_sphere_grid.jl @@ -262,6 +262,7 @@ function ConformalCubedSphereGrid(arch::AbstractArchitecture=CPU(), FT=Float64; end end # quote + # TODO: Remove eval eval(expr) end @@ -293,6 +294,7 @@ function ConformalCubedSphereGrid(arch::AbstractArchitecture=CPU(), FT=Float64; end end # quote + # TODO: Remove eval eval(expr) end diff --git a/src/Operators/interpolation_utils.jl b/src/Operators/interpolation_utils.jl index 2148d2570e..d923e57cab 100644 --- a/src/Operators/interpolation_utils.jl +++ b/src/Operators/interpolation_utils.jl @@ -62,8 +62,10 @@ function interpolation_operator(from, to) global identity_counter += 1 identity = identify_an_identity(identity_counter) + # TODO: Remove eval return @eval $identity else + # TODO: Remove eval return eval(Symbol(:ℑ, ℑxsym(x), ℑysym(y), ℑzsym(z), x, y, z)) end end @@ -77,6 +79,7 @@ operator for fields that have no intrinsic location, like numbers or functions. function interpolation_operator(::Nothing, to) global identity_counter += 1 identity = identify_an_identity(identity_counter) + # TODO: Remove eval return @eval $identity end From 87f73b48564007de6f809fd888228196e12de1bd Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Fri, 21 Jun 2024 11:56:24 -0400 Subject: [PATCH 16/19] Replace eval within interpolations utils with getglobal --- src/Operators/interpolation_utils.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Operators/interpolation_utils.jl b/src/Operators/interpolation_utils.jl index d923e57cab..750391b1e2 100644 --- a/src/Operators/interpolation_utils.jl +++ b/src/Operators/interpolation_utils.jl @@ -62,11 +62,9 @@ function interpolation_operator(from, to) global identity_counter += 1 identity = identify_an_identity(identity_counter) - # TODO: Remove eval - return @eval $identity + return getglobal(@__MODULE__, identity) else - # TODO: Remove eval - return eval(Symbol(:ℑ, ℑxsym(x), ℑysym(y), ℑzsym(z), x, y, z)) + return getglobal(@__MODULE__, Symbol(:ℑ, ℑxsym(x), ℑysym(y), ℑzsym(z), x, y, z)) end end @@ -79,8 +77,7 @@ operator for fields that have no intrinsic location, like numbers or functions. function interpolation_operator(::Nothing, to) global identity_counter += 1 identity = identify_an_identity(identity_counter) - # TODO: Remove eval - return @eval $identity + return getglobal(@__MODULE__, identity) end assumed_field_location(name) = name === :u ? (Face, Center, Center) : From 4f977f2a8881834f26dc6089d22a435c742482c3 Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 21 Jun 2024 13:54:37 -0400 Subject: [PATCH 17/19] removed last evals --- src/MultiRegion/cubed_sphere_grid.jl | 102 ++++++++++++++------------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/src/MultiRegion/cubed_sphere_grid.jl b/src/MultiRegion/cubed_sphere_grid.jl index f5f572ab5c..0eac6e955d 100644 --- a/src/MultiRegion/cubed_sphere_grid.jl +++ b/src/MultiRegion/cubed_sphere_grid.jl @@ -241,61 +241,65 @@ function ConformalCubedSphereGrid(arch::AbstractArchitecture=CPU(), FT=Float64; region_grids, devices) - fields = (:λᶜᶜᵃ, :φᶜᶜᵃ, :Azᶜᶜᵃ , :λᶠᶠᵃ, :φᶠᶠᵃ, :Azᶠᶠᵃ) - LXs = (:Center, :Center, :Center, :Face, :Face, :Face ) - LYs = (:Center, :Center, :Center, :Face, :Face, :Face ) - - for (field, LX, LY) in zip(fields, LXs, LYs) - expr = quote - $(Symbol(field)) = Field{$(Symbol(LX)), $(Symbol(LY)), Nothing}($(grid)) - - for region in 1:number_of_regions($(grid)) - getregion($(Symbol(field)), region).data .= getregion($(grid), region).$(Symbol(field)) - end - - if $(horizontal_topology) == FullyConnected - fill_halo_regions!($(Symbol(field))) - end + λᶜᶜᵃ = Field((Center, Center, Nothing), grid) + φᶜᶜᵃ = Field((Center, Center, Nothing), grid) + Azᶜᶜᵃ = Field((Center, Center, Nothing), grid) + λᶠᶠᵃ = Field((Face, Face, Nothing), grid) + φᶠᶠᵃ = Field((Face, Face, Nothing), grid) + Azᶠᶠᵃ = Field((Face, Face, Nothing), grid) + + for (field, name) in zip(( λᶜᶜᵃ, φᶜᶜᵃ, Azᶜᶜᵃ, λᶠᶠᵃ, φᶠᶠᵃ, Azᶠᶠᵃ), + (:λᶜᶜᵃ, :φᶜᶜᵃ, :Azᶜᶜᵃ, :λᶠᶠᵃ, :φᶠᶠᵃ, :Azᶠᶠᵃ)) + + for region in 1:number_of_regions(grid) + getregion(field, region).data .= getproperty(getregion(grid, region), name) + end - for region in 1:number_of_regions($(grid)) - getregion($(grid), region).$(Symbol(field)) .= getregion($(Symbol(field)), region).data - end - end # quote + if horizontal_topology == FullyConnected + fill_halo_regions!(field) + end - # TODO: Remove eval - eval(expr) + for region in 1:number_of_regions(grid) + getproperty(getregion(grid, region), name) .= getregion(field, region).data + end end - fields₁ = (:Δxᶜᶜᵃ, :Δxᶠᶜᵃ, :Δyᶠᶜᵃ, :λᶠᶜᵃ, :φᶠᶜᵃ, :Azᶠᶜᵃ , :Δxᶠᶠᵃ) - LXs₁ = (:Center, :Face, :Face, :Face, :Face, :Face , :Face ) - LYs₁ = (:Center, :Center, :Center, :Center, :Center, :Center, :Face ) - - fields₂ = (:Δyᶜᶜᵃ, :Δyᶜᶠᵃ, :Δxᶜᶠᵃ, :λᶜᶠᵃ, :φᶜᶠᵃ, :Azᶜᶠᵃ , :Δyᶠᶠᵃ) - LXs₂ = (:Center, :Center, :Center, :Center, :Center, :Center, :Face ) - LYs₂ = (:Center, :Face, :Face, :Face, :Face, :Face , :Face ) - - for (field₁, LX₁, LY₁, field₂, LX₂, LY₂) in zip(fields₁, LXs₁, LYs₁, fields₂, LXs₂, LYs₂) - expr = quote - $(Symbol(field₁)) = Field{$(Symbol(LX₁)), $(Symbol(LY₁)), Nothing}($(grid)) - $(Symbol(field₂)) = Field{$(Symbol(LX₂)), $(Symbol(LY₂)), Nothing}($(grid)) - - for region in 1:number_of_regions($(grid)) - getregion($(Symbol(field₁)), region).data .= getregion($(grid), region).$(Symbol(field₁)) - getregion($(Symbol(field₂)), region).data .= getregion($(grid), region).$(Symbol(field₂)) - end - - if $(horizontal_topology) == FullyConnected - fill_halo_regions!(($(Symbol(field₁)), $(Symbol(field₂))); signed = false) - end + Δxᶜᶜᵃ = Field((Center, Center, Nothing), grid) + Δxᶠᶜᵃ = Field((Center, Center, Nothing), grid) + Δyᶠᶜᵃ = Field((Center, Center, Nothing), grid) + λᶠᶜᵃ = Field((Face, Face, Nothing), grid) + φᶠᶜᵃ = Field((Face, Face, Nothing), grid) + Azᶠᶜᵃ = Field((Face, Face, Nothing), grid) + Δxᶠᶠᵃ = Field((Face, Face, Nothing), grid) + + fields₁ = ( Δxᶜᶜᵃ, Δxᶠᶜᵃ, Δyᶠᶜᵃ, λᶠᶜᵃ, φᶠᶜᵃ, Azᶠᶜᵃ , Δxᶠᶠᵃ) + names₁ = (:Δxᶜᶜᵃ, :Δxᶠᶜᵃ, :Δyᶠᶜᵃ, :λᶠᶜᵃ, :φᶠᶜᵃ, :Azᶠᶜᵃ , :Δxᶠᶠᵃ) + + Δyᶜᶜᵃ = Field((Center, Center, Nothing), grid) + Δyᶜᶠᵃ = Field((Center, Center, Nothing), grid) + Δxᶜᶠᵃ = Field((Center, Center, Nothing), grid) + λᶜᶠᵃ = Field((Face, Face, Nothing), grid) + φᶜᶠᵃ = Field((Face, Face, Nothing), grid) + Azᶜᶠᵃ = Field((Face, Face, Nothing), grid) + Δyᶠᶠᵃ = Field((Face, Face, Nothing), grid) + + fields₂ = ( Δyᶜᶜᵃ, Δyᶜᶠᵃ, Δxᶜᶠᵃ, λᶜᶠᵃ, φᶜᶠᵃ, Azᶜᶠᵃ , Δyᶠᶠᵃ) + names₂ = (:Δyᶜᶜᵃ, :Δyᶜᶠᵃ, :Δxᶜᶠᵃ, :λᶜᶠᵃ, :φᶜᶠᵃ, :Azᶜᶠᵃ , :Δyᶠᶠᵃ) + + for (field₁, field₂, name₁, name₂) in zip(fields₁, fields₂, names₁, names₂) + for region in 1:number_of_regions(grid) + getregion(field₁, region).data .= geproperty(getregion(grid, region), name₁) + getregion(field₂, region).data .= geproperty(getregion(grid, region), name₂) + end - for region in 1:number_of_regions($(grid)) - getregion($(grid), region).$(Symbol(field₁)) .= getregion($(Symbol(field₁)), region).data - getregion($(grid), region).$(Symbol(field₂)) .= getregion($(Symbol(field₂)), region).data - end - end # quote + if horizontal_topology == FullyConnected + fill_halo_regions!(field₁, field₂; signed = false) + end - # TODO: Remove eval - eval(expr) + for region in 1:number_of_regions(grid) + geproperty(getregion(grid, region), name₁) .= getregion(field₁, region).data + geproperty(getregion(grid, region), name₂) .= getregion(field₂, region).data + end end ################################################### From ba63e1701204b5234eba3c7436d2e6735a1db8ef Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:46:18 -0400 Subject: [PATCH 18/19] correct typo --- src/MultiRegion/cubed_sphere_grid.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MultiRegion/cubed_sphere_grid.jl b/src/MultiRegion/cubed_sphere_grid.jl index 0eac6e955d..6dc52dd60f 100644 --- a/src/MultiRegion/cubed_sphere_grid.jl +++ b/src/MultiRegion/cubed_sphere_grid.jl @@ -288,8 +288,8 @@ function ConformalCubedSphereGrid(arch::AbstractArchitecture=CPU(), FT=Float64; for (field₁, field₂, name₁, name₂) in zip(fields₁, fields₂, names₁, names₂) for region in 1:number_of_regions(grid) - getregion(field₁, region).data .= geproperty(getregion(grid, region), name₁) - getregion(field₂, region).data .= geproperty(getregion(grid, region), name₂) + getregion(field₁, region).data .= getproperty(getregion(grid, region), name₁) + getregion(field₂, region).data .= getproperty(getregion(grid, region), name₂) end if horizontal_topology == FullyConnected @@ -297,8 +297,8 @@ function ConformalCubedSphereGrid(arch::AbstractArchitecture=CPU(), FT=Float64; end for region in 1:number_of_regions(grid) - geproperty(getregion(grid, region), name₁) .= getregion(field₁, region).data - geproperty(getregion(grid, region), name₂) .= getregion(field₂, region).data + getproperty(getregion(grid, region), name₁) .= getregion(field₁, region).data + getproperty(getregion(grid, region), name₂) .= getregion(field₂, region).data end end From 67dab949952f923f6a848b43c1e8f1467d88175a Mon Sep 17 00:00:00 2001 From: Simone Silvestri <33547697+simone-silvestri@users.noreply.github.com> Date: Sun, 23 Jun 2024 15:25:40 -0400 Subject: [PATCH 19/19] correct typos --- src/MultiRegion/cubed_sphere_grid.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/MultiRegion/cubed_sphere_grid.jl b/src/MultiRegion/cubed_sphere_grid.jl index 6dc52dd60f..f4ae660b1e 100644 --- a/src/MultiRegion/cubed_sphere_grid.jl +++ b/src/MultiRegion/cubed_sphere_grid.jl @@ -265,22 +265,22 @@ function ConformalCubedSphereGrid(arch::AbstractArchitecture=CPU(), FT=Float64; end Δxᶜᶜᵃ = Field((Center, Center, Nothing), grid) - Δxᶠᶜᵃ = Field((Center, Center, Nothing), grid) - Δyᶠᶜᵃ = Field((Center, Center, Nothing), grid) - λᶠᶜᵃ = Field((Face, Face, Nothing), grid) - φᶠᶜᵃ = Field((Face, Face, Nothing), grid) - Azᶠᶜᵃ = Field((Face, Face, Nothing), grid) + Δxᶠᶜᵃ = Field((Face, Center, Nothing), grid) + Δyᶠᶜᵃ = Field((Face, Center, Nothing), grid) + λᶠᶜᵃ = Field((Face, Center, Nothing), grid) + φᶠᶜᵃ = Field((Face, Center, Nothing), grid) + Azᶠᶜᵃ = Field((Face, Center, Nothing), grid) Δxᶠᶠᵃ = Field((Face, Face, Nothing), grid) fields₁ = ( Δxᶜᶜᵃ, Δxᶠᶜᵃ, Δyᶠᶜᵃ, λᶠᶜᵃ, φᶠᶜᵃ, Azᶠᶜᵃ , Δxᶠᶠᵃ) names₁ = (:Δxᶜᶜᵃ, :Δxᶠᶜᵃ, :Δyᶠᶜᵃ, :λᶠᶜᵃ, :φᶠᶜᵃ, :Azᶠᶜᵃ , :Δxᶠᶠᵃ) Δyᶜᶜᵃ = Field((Center, Center, Nothing), grid) - Δyᶜᶠᵃ = Field((Center, Center, Nothing), grid) - Δxᶜᶠᵃ = Field((Center, Center, Nothing), grid) - λᶜᶠᵃ = Field((Face, Face, Nothing), grid) - φᶜᶠᵃ = Field((Face, Face, Nothing), grid) - Azᶜᶠᵃ = Field((Face, Face, Nothing), grid) + Δyᶜᶠᵃ = Field((Center, Face, Nothing), grid) + Δxᶜᶠᵃ = Field((Center, Face, Nothing), grid) + λᶜᶠᵃ = Field((Center, Face, Nothing), grid) + φᶜᶠᵃ = Field((Center, Face, Nothing), grid) + Azᶜᶠᵃ = Field((Center, Face, Nothing), grid) Δyᶠᶠᵃ = Field((Face, Face, Nothing), grid) fields₂ = ( Δyᶜᶜᵃ, Δyᶜᶠᵃ, Δxᶜᶠᵃ, λᶜᶠᵃ, φᶜᶠᵃ, Azᶜᶠᵃ , Δyᶠᶠᵃ)