From b4aeb7ad26c1cb06c042498acafecd00cc4ef692 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Tue, 14 Nov 2023 13:52:24 -0800 Subject: [PATCH] Fix FT scope for some examples --- examples/column/bb_fct_advection.jl | 4 +++- examples/column/fct_advection.jl | 3 ++- examples/column/zalesak_fct_advection.jl | 4 +++- examples/hybrid/box/limiters_advection.jl | 1 + lib/ClimaCoreSpectra/test/gcm_visual_test.jl | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/column/bb_fct_advection.jl b/examples/column/bb_fct_advection.jl index fd3de087e9..bf547e632d 100644 --- a/examples/column/bb_fct_advection.jl +++ b/examples/column/bb_fct_advection.jl @@ -38,6 +38,7 @@ end function tendency!(yₜ, y, parameters, t) (; w, Δt) = parameters + FT = Spaces.undertype(axes(y.q)) divf2c = Operators.DivergenceF2C( bottom = Operators.SetValue(Geometry.WVector(FT(0))), top = Operators.SetValue(Geometry.WVector(FT(0))), @@ -91,13 +92,14 @@ for (i, stretch_fn) in enumerate(stretch_fns) cent_space = Spaces.CenterFiniteDifferenceSpace(mesh) face_space = Spaces.FaceFiniteDifferenceSpace(cent_space) z = Fields.coordinate_field(cent_space).z + O = ones(FT, face_space) # Initial condition q_init = pulse.(z, 0.0, z₀, zₕ, z₁) y = Fields.FieldVector(q = q_init) # Unitary, constant advective velocity - w = Geometry.WVector.(speed .* ones(FT, face_space)) + w = Geometry.WVector.(speed .* O) # Solve the ODE parameters = (; w, Δt) diff --git a/examples/column/fct_advection.jl b/examples/column/fct_advection.jl index 8b047367f0..e514bb0c60 100644 --- a/examples/column/fct_advection.jl +++ b/examples/column/fct_advection.jl @@ -94,9 +94,10 @@ for (i, stretch_fn) in enumerate(stretch_fns) cs = Spaces.CenterFiniteDifferenceSpace(mesh) fs = Spaces.FaceFiniteDifferenceSpace(cs) zc = Fields.coordinate_field(cs) + O = ones(FT, fs) # Unitary, constant advective velocity - w = Geometry.WVector.(speed .* ones(FT, fs)) + w = Geometry.WVector.(speed .* O) # Initial condition y0 = pulse.(zc, 0.0, z₀, zₕ, z₁) diff --git a/examples/column/zalesak_fct_advection.jl b/examples/column/zalesak_fct_advection.jl index f88749fed0..123c43a332 100644 --- a/examples/column/zalesak_fct_advection.jl +++ b/examples/column/zalesak_fct_advection.jl @@ -38,6 +38,7 @@ end function tendency!(yₜ, y, parameters, t) (; w, Δt) = parameters + FT = Spaces.undertype(axes(y.q)) divf2c = Operators.DivergenceF2C( bottom = Operators.SetValue(Geometry.WVector(FT(0))), top = Operators.SetValue(Geometry.WVector(FT(0))), @@ -92,13 +93,14 @@ for (i, stretch_fn) in enumerate(stretch_fns) cent_space = Spaces.CenterFiniteDifferenceSpace(mesh) face_space = Spaces.FaceFiniteDifferenceSpace(cent_space) z = Fields.coordinate_field(cent_space).z + O = ones(FT, face_space) # Initial condition q_init = pulse.(z, 0.0, z₀, zₕ, z₁) y = Fields.FieldVector(q = q_init) # Unitary, constant advective velocity - w = Geometry.WVector.(speed .* ones(FT, face_space)) + w = Geometry.WVector.(speed .* O) # Solve the ODE parameters = (; w, Δt) diff --git a/examples/hybrid/box/limiters_advection.jl b/examples/hybrid/box/limiters_advection.jl index 10ea8db729..c32acff36b 100644 --- a/examples/hybrid/box/limiters_advection.jl +++ b/examples/hybrid/box/limiters_advection.jl @@ -172,6 +172,7 @@ end function vertical_tendency!(yₜ, y, cache, t) (; face_u) = cache + FT = Spaces.undertype(axes(y.ρ)) Ic2f = Operators.InterpolateC2F() vdivf2c = Operators.DivergenceF2C( top = Operators.SetValue(Geometry.Contravariant3Vector(FT(0))), diff --git a/lib/ClimaCoreSpectra/test/gcm_visual_test.jl b/lib/ClimaCoreSpectra/test/gcm_visual_test.jl index 5e00d2b443..af4b8d8fad 100644 --- a/lib/ClimaCoreSpectra/test/gcm_visual_test.jl +++ b/lib/ClimaCoreSpectra/test/gcm_visual_test.jl @@ -14,7 +14,7 @@ using FFTW # Adapted from: https://github.com/CliMA/ClimateMachine.jl/blob/master/test/Common/Spectra/spherical_helper_test.jl include(joinpath(@__DIR__, "spherical_helper.jl")) -FT = Float64 +const FT = Float64 # -- TEST 1: power_spectrum_1d n_gauss_lats = 32