From 8074709dd712b97c0f8fcbb6eb7b4f15c5fad346 Mon Sep 17 00:00:00 2001 From: kmdeck Date: Fri, 12 Jul 2024 15:16:13 -0700 Subject: [PATCH] fixing bugs --- experiments/benchmarks/land.jl | 4 ++-- src/shared_utilities/implicit_timestepping.jl | 10 ++++------ src/standalone/Vegetation/Canopy.jl | 12 ++++++------ src/standalone/Vegetation/component_models.jl | 8 ++++---- test/standalone/Vegetation/canopy_model.jl | 8 +++----- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/experiments/benchmarks/land.jl b/experiments/benchmarks/land.jl index 013ae3abaf..8276542670 100644 --- a/experiments/benchmarks/land.jl +++ b/experiments/benchmarks/land.jl @@ -601,10 +601,10 @@ function setup_and_solve_problem(; greet = false) # to set up for both CPU/GPU at the same time t0 = 0.0 tf = 60 * 60.0 * 6 - Δt = 900.0 + Δt = 1800.0 nelements = (101, 15) if greet - @info "Run: Global RichardsModel" + @info "Run: Global Land Model" @info "Resolution: $nelements" @info "Timestep: $Δt s" @info "Duration: $(tf - t0) s" diff --git a/src/shared_utilities/implicit_timestepping.jl b/src/shared_utilities/implicit_timestepping.jl index bf0a44a15a..9ab76f8081 100644 --- a/src/shared_utilities/implicit_timestepping.jl +++ b/src/shared_utilities/implicit_timestepping.jl @@ -113,12 +113,10 @@ function ImplicitEquationJacobian(Y::ClimaCore.Fields.FieldVector) is_in_Y(var) = MatrixFields.has_field(Y, var) # Define the implicit and explicit variables of any model we use - implicit_names = (@name(soil.ϑ_l), @name(soil.ρe_int), @name(canopy.energy.T)) - explicit_names = ( - @name(soilco2.C), - @name(soil.θ_i), - @name(canopy.hydraulics.ϑ_l), - ) + implicit_names = + (@name(soil.ϑ_l), @name(soil.ρe_int), @name(canopy.energy.T)) + explicit_names = + (@name(soilco2.C), @name(soil.θ_i), @name(canopy.hydraulics.ϑ_l)) # Filter out the variables that are not in this model's state, `Y` available_implicit_vars = diff --git a/src/standalone/Vegetation/Canopy.jl b/src/standalone/Vegetation/Canopy.jl index 8bdc4b4408..8499652e46 100644 --- a/src/standalone/Vegetation/Canopy.jl +++ b/src/standalone/Vegetation/Canopy.jl @@ -642,11 +642,11 @@ function make_compute_imp_tendency( end """ - make_update_jacobian(canopy::CanopyModel) + ClimaLand.make_compute_jacobian(canopy::CanopyModel) -Creates and returns the update_jacobian! for the `CanopyModel`. +Creates and returns the compute_jacobian! for the `CanopyModel`. """ -function make_update_jacobian( +function ClimaLand.make_compute_jacobian( canopy::CanopyModel{ FT, <:AutotrophicRespirationModel, @@ -659,16 +659,16 @@ function make_update_jacobian( ) where {FT} components = canopy_components(canopy) update_jacobian_list = map( - x -> make_update_jacobian(getproperty(canopy, x), canopy), + x -> make_compute_jacobian(getproperty(canopy, x), canopy), components, ) - function update_jacobian!(W, Y, p, dtγ, t) + function compute_jacobian!(W, Y, p, dtγ, t) for f! in update_jacobian_list f!(W, Y, p, dtγ, t) end end - return update_jacobian! + return compute_jacobian! end diff --git a/src/standalone/Vegetation/component_models.jl b/src/standalone/Vegetation/component_models.jl index 2b95ec0c79..f936e83916 100644 --- a/src/standalone/Vegetation/component_models.jl +++ b/src/standalone/Vegetation/component_models.jl @@ -137,7 +137,7 @@ function ClimaLand.make_compute_exp_tendency( end """ - ClimaLand.make_compute_exp_tendency(component::AbstractCanopyComponent, canopy) + ClimaLand.make_compute_imp_tendency(component::AbstractCanopyComponent, canopy) Creates the compute_imp_tendency!(dY,Y,p,t) function for the canopy `component`. @@ -161,9 +161,9 @@ function ClimaLand.make_compute_imp_tendency( end -function make_update_jacobian(component::AbstractCanopyComponent, canopy) - function update_jacobian!(W, Y, p, dtγ, t) end - return update_jacobian! +function make_compute_jacobian(component::AbstractCanopyComponent, canopy) + function compute_jacobian!(W, Y, p, dtγ, t) end + return compute_jacobian! end """ diff --git a/test/standalone/Vegetation/canopy_model.jl b/test/standalone/Vegetation/canopy_model.jl index 4c77bb9850..e0a44c93b4 100644 --- a/test/standalone/Vegetation/canopy_model.jl +++ b/test/standalone/Vegetation/canopy_model.jl @@ -720,12 +720,10 @@ for FT in (Float32, Float64) set_initial_cache!(p, Y, t0) exp_tendency! = make_exp_tendency(canopy) imp_tendency! = ClimaLand.make_imp_tendency(canopy) - tendency_jacobian! = ClimaLand.make_tendency_jacobian(canopy) + jacobian! = ClimaLand.make_jacobian(canopy) # set up jacobian info - jac_kwargs = (; - jac_prototype = ImplicitEquationJacobian(Y), - Wfact = tendency_jacobian!, - ) + jac_kwargs = + (; jac_prototype = ImplicitEquationJacobian(Y), Wfact = jacobian!) dY = similar(Y) exp_tendency!(dY, Y, p, t0)