Skip to content

Commit

Permalink
Merge #1402 #1405
Browse files Browse the repository at this point in the history
1402: Error on NaNs in driver solution r=charleskawczynski a=charleskawczynski

This PR adds a check for NaNs in the hybrid examples driver.

1405: Make helem a kwarg in test utils r=charleskawczynski a=charleskawczynski

This is helpful for more flexible MWEs

Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
  • Loading branch information
bors[bot] and charleskawczynski authored Aug 2, 2023
3 parents dae7298 + 661543c + d468227 commit 0223c70
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,7 @@ steps:
- "examples/hybrid/sphere/output/held_suarez_rhoe/Float32/*"
env:
TEST_NAME: "sphere/held_suarez_rhoe"
soft_fail: true

- label: ":computer: Float64 3D sphere dry Held-Suarez (ρθ)"
key: "cpu_held_suarez_rho_theta_float64"
Expand Down
1 change: 1 addition & 0 deletions examples/hybrid/driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ end
@info "on a vertical $z_stretch_string grid"

walltime = @elapsed sol = OrdinaryDiffEq.solve!(integrator)
any(isnan, sol.u[end]) && error("NaNs found in result.")

if is_distributed # replace sol.u on the root processor with the global sol.u
if ClimaComms.iamroot(comms_ctx)
Expand Down
12 changes: 7 additions & 5 deletions test/TestUtilities/TestUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ function CenterExtrudedFiniteDifferenceSpace(
::Type{FT};
zelem = 10,
context = ClimaComms.SingletonCommsContext(),
helem = 4,
Nq = 4,
) where {FT}
radius = FT(128)
zlim = (0, 1)
helem = 4
Nq = 4
vertdomain = Domains.IntervalDomain(
Geometry.ZPoint{FT}(zlim[1]),
Geometry.ZPoint{FT}(zlim[2]);
Expand All @@ -131,15 +131,17 @@ end
function FaceExtrudedFiniteDifferenceSpace(
::Type{FT};
zelem = 10,
helem = 4,
context = ClimaComms.SingletonCommsContext(),
) where {FT}
cspace = CenterExtrudedFiniteDifferenceSpace(FT; zelem, context)
cspace = CenterExtrudedFiniteDifferenceSpace(FT; zelem, context, helem)
return Spaces.ExtrudedFiniteDifferenceSpace{Spaces.CellFace}(cspace)
end

function all_spaces(
::Type{FT};
zelem = 10,
helem = 4,
context = ClimaComms.SingletonCommsContext(),
) where {FT}
return [
Expand All @@ -152,8 +154,8 @@ function all_spaces(
ColumnCenterFiniteDifferenceSpace(FT; zelem, context),
ColumnFaceFiniteDifferenceSpace(FT; zelem, context),
SphereSpectralElementSpace(FT; context),
CenterExtrudedFiniteDifferenceSpace(FT; zelem, context),
# FaceExtrudedFiniteDifferenceSpace(FT; zelem, context), # errors on sum
CenterExtrudedFiniteDifferenceSpace(FT; zelem, context, helem),
# FaceExtrudedFiniteDifferenceSpace(FT; zelem, context, helem), # errors on sum
# TODO: incorporate this list of spaces somehow:
# space_vf = Spaces.CenterFiniteDifferenceSpace(topology_z)
# space_ifh = Spaces.SpectralElementSpace1D(topology_x, quad)
Expand Down

0 comments on commit 0223c70

Please sign in to comment.