Atmospheric temperature profiles

Here, we plot the atmospheric reference state profiles for a few different polynomial orders and number of elements.

using ClimateMachine
const clima_dir = dirname(dirname(pathof(ClimateMachine)));
using Plots
include(joinpath(clima_dir, "docs", "plothelpers.jl"));
include(joinpath(clima_dir, "test", "Atmos", "Model", "get_atmos_ref_states.jl"));

function export_ref_state_plot(nelem_vert, N_poly)
    solver_config = get_atmos_ref_states(nelem_vert, N_poly, 0.5)
    z = get_z(solver_config.dg.grid)
    dons_arr = dict_of_nodal_states(solver_config)
    T = dons_arr["ref_state.T"]
    ρ = dons_arr["ref_state.ρ"]
    p = dons_arr["ref_state.p"]
    ρe = dons_arr["ref_state.ρe"]
    p1 = plot(T, z./10^3, xlabel="Temperature [K]");
    p2 = plot(ρ, z./10^3, xlabel="Density [kg/m^3]");
    p3 = plot(p./10^3, z./10^3, xlabel="Pressure [kPa]");
    p4 = plot(ρe./10^3, z./10^3, xlabel="Total energy [kJ]");
    plot(p1, p2, p3, p4, layout=(1,4), ylabel="z [km]")
    savefig("N_poly_$(N_poly).png")
end

export_ref_state_plot(80, 1)
export_ref_state_plot(40, 2)
export_ref_state_plot(20, 4)
[1638961140.250606] [hpc-92-37:26669:0]       ib_verbs.h:84   UCX  ERROR ibv_exp_query_device(mlx5_0) returned 38: No space left on device
ClimateMachine.array_type() = Array
┌ Info: Model composition
│     physics = ClimateMachine.Atmos.AtmosPhysics{Float64,Main.##ex-#346.EarthParameterSet,ClimateMachine.Atmos.HydrostaticState{Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64},Float64},ClimateMachine.Atmos.TotalEnergyModel,ClimateMachine.Atmos.EquilMoist{Nothing,Nothing},ClimateMachine.Atmos.Compressible,ClimateMachine.TurbulenceClosures.SmagorinskyLilly{Float64},ClimateMachine.TurbulenceConvection.NoTurbConv,ClimateMachine.TurbulenceClosures.NoHyperDiffusion,ClimateMachine.TurbulenceClosures.NoViscousSponge,ClimateMachine.Atmos.NoPrecipitation,ClimateMachine.Atmos.NoRadiation,ClimateMachine.Atmos.NoTracers,ClimateMachine.Atmos.NoLSForcing}(Main.##ex-#346.EarthParameterSet(), ClimateMachine.Atmos.HydrostaticState{Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64},Float64}(Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64}(290.0, 220.0, 8484.271021693852), 0.5, true), ClimateMachine.Atmos.TotalEnergyModel(), ClimateMachine.Atmos.EquilMoist{Nothing,Nothing}(nothing, nothing), ClimateMachine.Atmos.Compressible(), ClimateMachine.TurbulenceClosures.SmagorinskyLilly{Float64}(0.21), ClimateMachine.TurbulenceConvection.NoTurbConv(), ClimateMachine.TurbulenceClosures.NoHyperDiffusion(), ClimateMachine.TurbulenceClosures.NoViscousSponge(), ClimateMachine.Atmos.NoPrecipitation(), ClimateMachine.Atmos.NoRadiation(), ClimateMachine.Atmos.NoTracers(), ClimateMachine.Atmos.NoLSForcing())
│     problem = ClimateMachine.Atmos.AtmosProblem{Tuple{ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC},ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}},Main.##ex-#346.var"#11#12",typeof(ClimateMachine.Atmos.atmos_problem_init_state_auxiliary)}((ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}(ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip}(ClimateMachine.Atmos.FreeSlip()), ClimateMachine.Atmos.Insulating(), ClimateMachine.Atmos.Impermeable(), ClimateMachine.Atmos.OutflowPrecipitation(), ClimateMachine.Atmos.ImpermeableTracer(), ClimateMachine.TurbulenceConvection.NoTurbConvBC()), ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}(ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip}(ClimateMachine.Atmos.FreeSlip()), ClimateMachine.Atmos.Insulating(), ClimateMachine.Atmos.Impermeable(), ClimateMachine.Atmos.OutflowPrecipitation(), ClimateMachine.Atmos.ImpermeableTracer(), ClimateMachine.TurbulenceConvection.NoTurbConvBC())), Main.##ex-#346.var"#11#12"(), ClimateMachine.Atmos.atmos_problem_init_state_auxiliary)
│     orientation = ClimateMachine.Orientations.FlatOrientation()
│     source = DispatchedTuples.DispatchedTuple{Tuple{Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.Gravity},Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.Coriolis},Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.GeostrophicForcing{Float64}}},DispatchedTuples.NoDefaults} with 3 entries:
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.Gravity()
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.Coriolis()
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.GeostrophicForcing{Float64}(7.62e-5, 0.0, 0.0)
│   default => ()
│
└     data_config = nothing

PDE: ∂_t Y_i + (∇•F_1(Y))_i + (∇•F_2(Y,G)))_i = (S(Y,G))_i
┌───────────────┬────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┐
│      Equation │           Flux{FirstOrder} │                  Flux{SecondOrder} │                                  Source │
│         (Y_i) │                      (F_1) │                              (F_2) │                                     (S) │
├───────────────┼────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┤
│          Mass │                   (Advect) │                (MoistureDiffusion) │                                      () │
│      Momentum │ (Advect, PressureGradient) │ (ViscousStress, MoistureDiffusion) │ (Gravity, Coriolis, GeostrophicForcing) │
│        Energy │         (Advect, Pressure) │    (ViscousFlux, DiffEnthalpyFlux) │                                      () │
│ TotalMoisture │                   (Advect) │                (MoistureDiffusion) │                                      () │
└───────────────┴────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┘

┌ Info: Establishing single stack configuration for ref_state
│     precision               = Float64
│     horiz polynomial order  = 1
│     vert polynomial order   = 1
│     domain_min              = 0.00 m, 0.00 m, 0.00 m
│     domain_max              = 1.00 m, 1.00 m, 25000.00 m
│     # vert elems            = 80
│     MPI ranks               = 1
│     min(Δ_horz)             = 1.00 m
└     min(Δ_vert)             = 312.50 m
[ Info: Initializing ref_state
ClimateMachine.array_type() = Array
┌ Info: Model composition
│     physics = ClimateMachine.Atmos.AtmosPhysics{Float64,Main.##ex-#346.EarthParameterSet,ClimateMachine.Atmos.HydrostaticState{Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64},Float64},ClimateMachine.Atmos.TotalEnergyModel,ClimateMachine.Atmos.EquilMoist{Nothing,Nothing},ClimateMachine.Atmos.Compressible,ClimateMachine.TurbulenceClosures.SmagorinskyLilly{Float64},ClimateMachine.TurbulenceConvection.NoTurbConv,ClimateMachine.TurbulenceClosures.NoHyperDiffusion,ClimateMachine.TurbulenceClosures.NoViscousSponge,ClimateMachine.Atmos.NoPrecipitation,ClimateMachine.Atmos.NoRadiation,ClimateMachine.Atmos.NoTracers,ClimateMachine.Atmos.NoLSForcing}(Main.##ex-#346.EarthParameterSet(), ClimateMachine.Atmos.HydrostaticState{Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64},Float64}(Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64}(290.0, 220.0, 8484.271021693852), 0.5, true), ClimateMachine.Atmos.TotalEnergyModel(), ClimateMachine.Atmos.EquilMoist{Nothing,Nothing}(nothing, nothing), ClimateMachine.Atmos.Compressible(), ClimateMachine.TurbulenceClosures.SmagorinskyLilly{Float64}(0.21), ClimateMachine.TurbulenceConvection.NoTurbConv(), ClimateMachine.TurbulenceClosures.NoHyperDiffusion(), ClimateMachine.TurbulenceClosures.NoViscousSponge(), ClimateMachine.Atmos.NoPrecipitation(), ClimateMachine.Atmos.NoRadiation(), ClimateMachine.Atmos.NoTracers(), ClimateMachine.Atmos.NoLSForcing())
│     problem = ClimateMachine.Atmos.AtmosProblem{Tuple{ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC},ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}},Main.##ex-#346.var"#11#12",typeof(ClimateMachine.Atmos.atmos_problem_init_state_auxiliary)}((ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}(ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip}(ClimateMachine.Atmos.FreeSlip()), ClimateMachine.Atmos.Insulating(), ClimateMachine.Atmos.Impermeable(), ClimateMachine.Atmos.OutflowPrecipitation(), ClimateMachine.Atmos.ImpermeableTracer(), ClimateMachine.TurbulenceConvection.NoTurbConvBC()), ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}(ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip}(ClimateMachine.Atmos.FreeSlip()), ClimateMachine.Atmos.Insulating(), ClimateMachine.Atmos.Impermeable(), ClimateMachine.Atmos.OutflowPrecipitation(), ClimateMachine.Atmos.ImpermeableTracer(), ClimateMachine.TurbulenceConvection.NoTurbConvBC())), Main.##ex-#346.var"#11#12"(), ClimateMachine.Atmos.atmos_problem_init_state_auxiliary)
│     orientation = ClimateMachine.Orientations.FlatOrientation()
│     source = DispatchedTuples.DispatchedTuple{Tuple{Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.Gravity},Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.Coriolis},Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.GeostrophicForcing{Float64}}},DispatchedTuples.NoDefaults} with 3 entries:
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.Gravity()
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.Coriolis()
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.GeostrophicForcing{Float64}(7.62e-5, 0.0, 0.0)
│   default => ()
│
└     data_config = nothing

PDE: ∂_t Y_i + (∇•F_1(Y))_i + (∇•F_2(Y,G)))_i = (S(Y,G))_i
┌───────────────┬────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┐
│      Equation │           Flux{FirstOrder} │                  Flux{SecondOrder} │                                  Source │
│         (Y_i) │                      (F_1) │                              (F_2) │                                     (S) │
├───────────────┼────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┤
│          Mass │                   (Advect) │                (MoistureDiffusion) │                                      () │
│      Momentum │ (Advect, PressureGradient) │ (ViscousStress, MoistureDiffusion) │ (Gravity, Coriolis, GeostrophicForcing) │
│        Energy │         (Advect, Pressure) │    (ViscousFlux, DiffEnthalpyFlux) │                                      () │
│ TotalMoisture │                   (Advect) │                (MoistureDiffusion) │                                      () │
└───────────────┴────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┘

┌ Info: Establishing single stack configuration for ref_state
│     precision               = Float64
│     horiz polynomial order  = 2
│     vert polynomial order   = 2
│     domain_min              = 0.00 m, 0.00 m, 0.00 m
│     domain_max              = 1.00 m, 1.00 m, 25000.00 m
│     # vert elems            = 40
│     MPI ranks               = 1
│     min(Δ_horz)             = 0.50 m
└     min(Δ_vert)             = 312.50 m
[ Info: Initializing ref_state
ClimateMachine.array_type() = Array
┌ Info: Model composition
│     physics = ClimateMachine.Atmos.AtmosPhysics{Float64,Main.##ex-#346.EarthParameterSet,ClimateMachine.Atmos.HydrostaticState{Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64},Float64},ClimateMachine.Atmos.TotalEnergyModel,ClimateMachine.Atmos.EquilMoist{Nothing,Nothing},ClimateMachine.Atmos.Compressible,ClimateMachine.TurbulenceClosures.SmagorinskyLilly{Float64},ClimateMachine.TurbulenceConvection.NoTurbConv,ClimateMachine.TurbulenceClosures.NoHyperDiffusion,ClimateMachine.TurbulenceClosures.NoViscousSponge,ClimateMachine.Atmos.NoPrecipitation,ClimateMachine.Atmos.NoRadiation,ClimateMachine.Atmos.NoTracers,ClimateMachine.Atmos.NoLSForcing}(Main.##ex-#346.EarthParameterSet(), ClimateMachine.Atmos.HydrostaticState{Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64},Float64}(Thermodynamics.TemperatureProfiles.DecayingTemperatureProfile{Float64}(290.0, 220.0, 8484.271021693852), 0.5, true), ClimateMachine.Atmos.TotalEnergyModel(), ClimateMachine.Atmos.EquilMoist{Nothing,Nothing}(nothing, nothing), ClimateMachine.Atmos.Compressible(), ClimateMachine.TurbulenceClosures.SmagorinskyLilly{Float64}(0.21), ClimateMachine.TurbulenceConvection.NoTurbConv(), ClimateMachine.TurbulenceClosures.NoHyperDiffusion(), ClimateMachine.TurbulenceClosures.NoViscousSponge(), ClimateMachine.Atmos.NoPrecipitation(), ClimateMachine.Atmos.NoRadiation(), ClimateMachine.Atmos.NoTracers(), ClimateMachine.Atmos.NoLSForcing())
│     problem = ClimateMachine.Atmos.AtmosProblem{Tuple{ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC},ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}},Main.##ex-#346.var"#11#12",typeof(ClimateMachine.Atmos.atmos_problem_init_state_auxiliary)}((ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}(ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip}(ClimateMachine.Atmos.FreeSlip()), ClimateMachine.Atmos.Insulating(), ClimateMachine.Atmos.Impermeable(), ClimateMachine.Atmos.OutflowPrecipitation(), ClimateMachine.Atmos.ImpermeableTracer(), ClimateMachine.TurbulenceConvection.NoTurbConvBC()), ClimateMachine.Atmos.AtmosBC{ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip},ClimateMachine.Atmos.Insulating,ClimateMachine.Atmos.Impermeable,ClimateMachine.Atmos.OutflowPrecipitation,ClimateMachine.Atmos.ImpermeableTracer,ClimateMachine.TurbulenceConvection.NoTurbConvBC}(ClimateMachine.Atmos.Impenetrable{ClimateMachine.Atmos.FreeSlip}(ClimateMachine.Atmos.FreeSlip()), ClimateMachine.Atmos.Insulating(), ClimateMachine.Atmos.Impermeable(), ClimateMachine.Atmos.OutflowPrecipitation(), ClimateMachine.Atmos.ImpermeableTracer(), ClimateMachine.TurbulenceConvection.NoTurbConvBC())), Main.##ex-#346.var"#11#12"(), ClimateMachine.Atmos.atmos_problem_init_state_auxiliary)
│     orientation = ClimateMachine.Orientations.FlatOrientation()
│     source = DispatchedTuples.DispatchedTuple{Tuple{Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.Gravity},Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.Coriolis},Tuple{ClimateMachine.Atmos.Momentum,ClimateMachine.Atmos.GeostrophicForcing{Float64}}},DispatchedTuples.NoDefaults} with 3 entries:
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.Gravity()
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.Coriolis()
│   ClimateMachine.Atmos.Momentum() => ClimateMachine.Atmos.GeostrophicForcing{Float64}(7.62e-5, 0.0, 0.0)
│   default => ()
│
└     data_config = nothing

PDE: ∂_t Y_i + (∇•F_1(Y))_i + (∇•F_2(Y,G)))_i = (S(Y,G))_i
┌───────────────┬────────────────────────────┬────────────────────────────────────┬─────────────────────────────────────────┐
│      Equation │           Flux{FirstOrder} │                  Flux{SecondOrder} │                                  Source │
│         (Y_i) │                      (F_1) │                              (F_2) │                                     (S) │
├───────────────┼────────────────────────────┼────────────────────────────────────┼─────────────────────────────────────────┤
│          Mass │                   (Advect) │                (MoistureDiffusion) │                                      () │
│      Momentum │ (Advect, PressureGradient) │ (ViscousStress, MoistureDiffusion) │ (Gravity, Coriolis, GeostrophicForcing) │
│        Energy │         (Advect, Pressure) │    (ViscousFlux, DiffEnthalpyFlux) │                                      () │
│ TotalMoisture │                   (Advect) │                (MoistureDiffusion) │                                      () │
└───────────────┴────────────────────────────┴────────────────────────────────────┴─────────────────────────────────────────┘

┌ Info: Establishing single stack configuration for ref_state
│     precision               = Float64
│     horiz polynomial order  = 4
│     vert polynomial order   = 4
│     domain_min              = 0.00 m, 0.00 m, 0.00 m
│     domain_max              = 1.00 m, 1.00 m, 25000.00 m
│     # vert elems            = 20
│     MPI ranks               = 1
│     min(Δ_horz)             = 0.17 m
└     min(Δ_vert)             = 215.84 m
[ Info: Initializing ref_state

Polynomial order 1, 80 elements

Polynomial order 2, 40 elements

Polynomial order 4, 20 elements