Skip to content

Commit 728ddcb

Browse files
authored
Fix anelastic_pressure_solver tests (#71)
* Fix anelastic_pressure_solver tests * fix indexing * deduce kernel parameters for horizontally flat grids * fix * fix * cleanup
1 parent 0c1bf6f commit 728ddcb

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/AtmosphereModels/anelastic_formulation.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ end
6666
function thermodynamic_state(i, j, k, grid, formulation::AnelasticFormulation, thermo, energy, absolute_humidity)
6767
@inbounds begin
6868
e = energy[i, j, k]
69-
pᵣ = formulation.reference_pressure[i, j, k]
70-
ρᵣ = formulation.reference_density[i, j, k]
69+
pᵣ = formulation.reference_pressure[1, 1, k]
70+
ρᵣ = formulation.reference_density[1, 1, k]
7171
ρq = absolute_humidity[i, j, k]
7272
end
7373

@@ -87,7 +87,7 @@ end
8787
@inline function specific_volume(i, j, k, grid, formulation, temperature, specific_humidity, thermo)
8888
@inbounds begin
8989
q = specific_humidity[i, j, k]
90-
pᵣ = formulation.reference_pressure[i, j, k]
90+
pᵣ = formulation.reference_pressure[1, 1, k]
9191
T = temperature[i, j, k]
9292
end
9393

@@ -98,7 +98,7 @@ end
9898

9999
@inline function reference_specific_volume(i, j, k, grid, formulation, thermo)
100100
Rᵈ = dry_air_gas_constant(thermo)
101-
pᵣ = @inbounds formulation.reference_pressure[i, j, k]
101+
pᵣ = @inbounds formulation.reference_pressure[1, 1, k]
102102
θᵣ = formulation.constants.reference_potential_temperature
103103
return Rᵈ * θᵣ / pᵣ
104104
end
@@ -165,16 +165,16 @@ end
165165

166166
# Using a homogeneous Neumann (zero Gradient) boundary condition:
167167
@inbounds begin
168-
ρ¹ = ρʳ[i, j, 1]
169-
ρᴺ = ρʳ[i, j, Nz]
168+
ρ¹ = ρʳ[1, 1, 1]
169+
ρᴺ = ρʳ[1, 1, Nz]
170170
ρ̄² = ℑzᵃᵃᶠ(i, j, 2, grid, ρʳ)
171171
ρ̄ᴺ = ℑzᵃᵃᶠ(i, j, Nz, grid, ρʳ)
172172

173173
D[i, j, 1] = - ρ̄² / Δzᵃᵃᶠ(i, j, 2, grid) - ρ¹ * Δzᵃᵃᶜ(i, j, 1, grid) * (λx[i] + λy[j])
174174
D[i, j, Nz] = - ρ̄ᴺ / Δzᵃᵃᶠ(i, j, Nz, grid) - ρᴺ * Δzᵃᵃᶜ(i, j, Nz, grid) * (λx[i] + λy[j])
175175

176176
for k in 2:Nz-1
177-
ρᵏ = ρʳ[i, j, k]
177+
ρᵏ = ρʳ[1, 1, k]
178178
ρ̄⁺ = ℑzᵃᵃᶠ(i, j, k+1, grid, ρʳ)
179179
ρ̄ᵏ = ℑzᵃᵃᶠ(i, j, k, grid, ρʳ)
180180

src/AtmosphereModels/update_hydrostatic_pressure.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ function update_hydrostatic_pressure!(model)
4040
T = model.temperature
4141
q = model.specific_humidity
4242
thermo = model.thermodynamics
43-
Nx, Ny, Nz = size(grid)
44-
kernel_parameters = KernelParameters(0:Nx+1, 0:Ny+1)
43+
44+
Nx, Ny, _ = size(grid)
45+
TX, TY, _ = topology(grid)
46+
ii = TX == Flat ? (1:Nx) : (0:Nx+1)
47+
jj = TY == Flat ? (1:Ny) : (0:Ny+1)
48+
kernel_parameters = KernelParameters(ii, jj)
49+
4550
launch!(arch, grid, kernel_parameters, _update_hydrostatic_pressure!, pₕ′, grid, formulation, T, q, thermo)
46-
fill_halo_regions!(pₕ′)
51+
4752
return nothing
4853
end

test/runtests.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,4 @@ testsuite = find_tests(@__DIR__)
77
# Parse arguments
88
args = parse_args(ARGS)
99

10-
if filter_tests!(testsuite, args)
11-
# Skip this one for the time being
12-
delete!(testsuite, "anelastic_pressure_solver")
13-
end
14-
1510
runtests(Breeze, args; testsuite)

0 commit comments

Comments
 (0)