@@ -114,7 +114,7 @@ function get_atmos(config::AtmosConfig, params)
114114 FT,
115115 )
116116
117- if parsed_args[" prescribed_flow" ] === true
117+ if parsed_args[" prescribed_flow" ] == " ShipwayHill2012 "
118118 prescribed_flow = ShipwayHill2012VelocityProfile {FT} ()
119119 else
120120 prescribed_flow = nothing
@@ -724,21 +724,40 @@ function get_sim_info(config::AtmosConfig)
724724 return sim
725725end
726726
727+ """
728+ fully_explicit_tendency!
729+
730+ Experimental timestepping mode where all implicit tendencies are treated explicitly.
731+ """
732+ function fully_explicit_tendency! (Yₜ, Yₜ_lim, Y, p, t)
733+ (; temp_Yₜ_imp) = p. scratch
734+ implicit_tendency! (temp_Yₜ_imp, Y, p, t)
735+ remaining_tendency! (Yₜ, Yₜ_lim, Y, p, t)
736+ Yₜ .+ = temp_Yₜ_imp
737+ end
738+
727739function args_integrator (parsed_args, Y, p, tspan, ode_algo, callback)
728740 (; atmos, dt) = p
729741 s = @timed_str begin
730- T_imp! = SciMLBase. ODEFunction (
731- implicit_tendency!;
732- jac_prototype = get_jacobian (ode_algo, Y, atmos, parsed_args),
733- Wfact = update_jacobian!,
734- )
742+ if isnothing (parsed_args[" prescribed_flow" ])
743+ # This is the default case
744+ T_exp_T_lim! = remaining_tendency!
745+ T_imp! = SciMLBase. ODEFunction (implicit_tendency!;
746+ jac_prototype = get_jacobian (ode_algo, Y, atmos, parsed_args),
747+ Wfact = update_jacobian!,
748+ )
749+ cache_imp! = set_implicit_precomputed_quantities!
750+ else
751+ # `prescribed_flow` is an experimental case where the flow is prescribed,
752+ # so implicit tendencies are treated explicitly to avoid treatment of sound waves
753+ T_exp_T_lim! = fully_explicit_tendency!
754+ T_imp! = nothing
755+ cache_imp! = nothing
756+ end
735757 tendency_function = CTS. ClimaODEFunction (;
736- T_exp_T_lim! = remaining_tendency!,
737- T_imp!,
738- lim! = limiters_func!,
739- dss!,
740- cache! = set_precomputed_quantities!,
741- cache_imp! = set_implicit_precomputed_quantities!,
758+ T_exp_T_lim!, T_imp!,
759+ cache! = set_precomputed_quantities!, cache_imp!,
760+ lim! = limiters_func!, dss!,
742761 )
743762 end
744763 @info " Define ode function: $s "
@@ -748,8 +767,7 @@ function args_integrator(parsed_args, Y, p, tspan, ode_algo, callback)
748767 saveat = [t_begin, t_end]
749768 args = (problem, ode_algo)
750769 allow_custom_kwargs = (; kwargshandle = CTS. DiffEqBase. KeywordArgSilent)
751- kwargs =
752- (; saveat, callback, dt, adjustfinal = true , allow_custom_kwargs... )
770+ kwargs = (; saveat, callback, dt, adjustfinal = true , allow_custom_kwargs... )
753771 return (args, kwargs)
754772end
755773
0 commit comments