@@ -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,45 @@ 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+ function fully_explicit_cache! (Y, p, t)
739+ set_precomputed_quantities! (Y, p, t)
740+ set_implicit_precomputed_quantities! (Y, p, t)
741+ end
742+
743+
727744function args_integrator (parsed_args, Y, p, tspan, ode_algo, callback)
728745 (; atmos, dt) = p
729746 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- )
747+ if isnothing (parsed_args[" prescribed_flow" ])
748+ # This is the default case
749+ T_exp_T_lim! = remaining_tendency!
750+ T_imp! = SciMLBase. ODEFunction (implicit_tendency!;
751+ jac_prototype = get_jacobian (ode_algo, Y, atmos, parsed_args),
752+ Wfact = update_jacobian!,
753+ )
754+ cache! = set_precomputed_quantities!
755+ cache_imp! = set_implicit_precomputed_quantities!
756+ else
757+ # `prescribed_flow` is an experimental case where the flow is prescribed,
758+ # so implicit tendencies are treated explicitly to avoid treatment of sound waves
759+ T_exp_T_lim! = fully_explicit_tendency!
760+ T_imp! = nothing
761+ cache! = fully_explicit_cache!
762+ cache_imp! = nothing
763+ end
735764 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!,
765+ T_exp_T_lim!, T_imp!, cache!, cache_imp!, lim! = limiters_func!, dss!,
742766 )
743767 end
744768 @info " Define ode function: $s "
@@ -748,8 +772,7 @@ function args_integrator(parsed_args, Y, p, tspan, ode_algo, callback)
748772 saveat = [t_begin, t_end]
749773 args = (problem, ode_algo)
750774 allow_custom_kwargs = (; kwargshandle = CTS. DiffEqBase. KeywordArgSilent)
751- kwargs =
752- (; saveat, callback, dt, adjustfinal = true , allow_custom_kwargs... )
775+ kwargs = (; saveat, callback, dt, adjustfinal = true , allow_custom_kwargs... )
753776 return (args, kwargs)
754777end
755778
0 commit comments