### Define a New Setup Structure Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Example of creating a new setup struct, `MyCase`, for custom configurations. Includes a description and citation. ```julia struct MyCase end ``` -------------------------------- ### Initialize Rico Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the RICO setup for ocean cumulus research. Requires thermodynamic parameters. ```julia import Thermodynamics as TD import ClimaParams as CP FT = Float64 toml_dict = CP.create_toml_dict(FT) thermo_params = TD.Parameters.ThermodynamicsParameters(toml_dict) setup = Rico(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### Implement Center Initial Condition for Custom Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Example implementation of the `center_initial_condition` method for a custom setup (`MyCase`). It calculates temperature and pressure based on altitude. ```julia function center_initial_condition(::MyCase, local_geometry, params) FT = eltype(params) (; z) = local_geometry.coordinates T = FT(300) - FT(0.01) * z p = FT(101500) return physical_state(; T, p) end ``` -------------------------------- ### Initialize AMIPFromERA5 Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use AMIPFromERA5 for AMIP initial conditions using ERA5 monthly reanalysis data. Provide a start date; the setup uses the 'era5_inst_model_levels' ClimaArtifact. ```julia AMIPFromERA5(start_date) ``` -------------------------------- ### Run ClimaAtmos with BOMEX Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/first_simulation Configure a simulation with specific initial conditions, boundary conditions, and forcing by using a predefined setup like the BOMEX shallow cumulus case. This example also customizes the grid, timestep, and job ID. ```julia simulation = CA.AtmosSimulation{Float32}( grid = CA.ColumnGrid(Float32; z_elem = 60, z_max = 3000.0), initial_condition = CA.Setups.Bomex(), dt = 5, t_end = 3600 * 6, job_id = "my_bomex", ) CA.solve_atmos!(simulation) ``` -------------------------------- ### Initialize Soares Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the Soares setup. Requires thermodynamic parameters. ```julia setup = Soares(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### Wire Custom Setup in get_setup_type Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Example of adding a new branch to the `get_setup_type` function to map a configuration string ('MyCase') to the custom setup constructor. ```julia elseif ic_name == "MyCase" return Setups.MyCase() ``` -------------------------------- ### Initialize DYCOMS Setups Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate either the DYCOMS_RF01 or DYCOMS_RF02 setup. Requires thermodynamic parameters. ```julia setup = DYCOMS_RF01(; prognostic_tke = true, thermo_params) ``` ```julia setup = DYCOMS_RF02(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### Initialize Bomex Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the Bomex setup, which models a hydrostatically balanced pressure profile. Requires thermodynamic parameters. ```julia import Thermodynamics as TD import ClimaParams as CP FT = Float64 toml_dict = CP.create_toml_dict(FT) thermo_params = TD.Parameters.ThermodynamicsParameters(toml_dict) setup = Bomex(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### Initialize GATE_III Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the GATE_III setup, which uses temperature for hydrostatic integration. Requires thermodynamic parameters. ```julia setup = GATE_III(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### Initialize WeatherModel Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use WeatherModel for ERA5-derived initial conditions for weather/forecast simulations. Provide a start date and optionally an ERA5 initial condition directory. ```julia WeatherModel ``` -------------------------------- ### Initialize ISDAC Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the ISDAC setup, with an option to apply temperature perturbations. Requires thermodynamic parameters. ```julia setup = ISDAC(; prognostic_tke = true, perturb = false, thermo_params) ``` -------------------------------- ### Minimal Setup Implementation Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Implement `center_initial_condition` for a basic setup. This function returns a `physical_state` NamedTuple with temperature and pressure. ```julia struct MySetup end function Setups.center_initial_condition(::MySetup, local_geometry, params) z = local_geometry.coordinates.z FT = typeof(z) return physical_state(; T = FT(300), p = FT(101500)) end ``` -------------------------------- ### Adding a New Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Guidance on how to add a new setup to ClimaAtmos, involving creating a setup file, including it, and wiring it in `get_setup_type`. ```APIDOC ### 1. Create the setup file Create `src/setups/MyCase.jl` with a struct and a `center_initial_condition` method: ```julia """ MyCase Description of the case and citation. """ struct MyCase end function center_initial_condition(::MyCase, local_geometry, params) FT = eltype(params) (; z) = local_geometry.coordinates T = FT(300) - FT(0.01) * z p = FT(101500) return physical_state(; T, p) end ``` Optionally implement any of the other interface methods detailed above. ### 2. Include the file in `Setups.jl` Add an `include("MyCase.jl")` line in `src/setups/Setups.jl` under the setup implementations section. ### 3. Wire the setup in `get_setup_type` Add a branch in `get_setup_type` in `src/solver/type_getters.jl` that maps the `initial_condition` config string to your setup constructor: ```julia elseif ic_name == "MyCase" return Setups.MyCase() ``` Then set `initial_condition: "MyCase"` in your YAML config file to use it. ``` -------------------------------- ### Initialize GABLS Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the GABLS setup, featuring time-varying surface temperature. Requires thermodynamic parameters. ```julia setup = GABLS(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### REPL Debugging Workflow Setup and Execution Source: https://clima.github.io/ClimaAtmos.jl/dev/repl_scripts This snippet demonstrates the setup for a REPL debugging session. It includes activating the Buildkite environment, importing ClimaAtmos, and configuring a simulation using a YAML file. It shows how to run a single timestep and then how to update configuration arguments, reset the simulation, and re-run to completion. It also includes steps to reactivate the documentation environment. ```julia ca_dir = joinpath(@__DIR__, "..", "..") buildkite_env = joinpath(ca_dir, ".buildkite") using Pkg Pkg.activate(buildkite_env) # julia> using Revise # This is useful For REPL debugging. See also: Infiltrator.jl and Main.@infiltrate import ClimaAtmos as CA import ClimaTimeSteppers: step! # If you wish to run your simulation on a `CUDA` device, use # import ClimaComms # ClimaComms.@import_required_backends # ENV["CLIMACOMMS_DEVICE"]="CUDA" # (Note that the example below runs on a single CPU, which uses # ENV["CLIMACOMMS_DEVICE"]="CPU") config_file = joinpath(ca_dir, "config/model_configs/baroclinic_wave.yml") config = CA.AtmosConfig(config_file) # Generate temporary directory for Documenter run-script, clear after # demo is completed. temp_output_dir = mktempdir(ca_dir, cleanup=true) config.parsed_args["output_dir"]=temp_output_dir simulation = CA.AtmosSimulation(config) # Example: Advance a single timestep and explore the solution # stored in `simulation.integrator.u` step!(simulation.integrator) # Example: Update command line argument, reset simulation, re-run to completion # Note that you can also to update the configuration `.yml` and # load the simulation again from the `config_file` as above in the same REPL session. # Note that you'd need to use `Revise` at the start of your session to apply changes # to the source code within your REPL session. # e.g. # julia> simulation = CA.AtmosSimulation(config_file) @info "----------------------------------" @info "Update config arguments and re-run" @info "----------------------------------" config.parsed_args["dt"]="400secs" config.parsed_args["t_end"]="800secs" simulation = CA.AtmosSimulation(config) CA.solve_atmos!(simulation) @info "----------------------------------" @info "Reactivate docs environment" @info "----------------------------------" # The final step, which is not part of the standard workflow # resets the environment to `docs`. # (it is necessary for the documentation generation only) ca_dir = joinpath(@__DIR__, "..", "..") docs_env = joinpath(ca_dir, "docs") Pkg.activate(docs_env) ``` -------------------------------- ### Initialize SimplePlume Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the SimplePlume setup for testing EDMFX plume dynamics. Prognostic TKE is enabled. ```julia setup = SimplePlume(; prognostic_tke = true) ``` -------------------------------- ### Run Single-Column BOMEX Case Simulation Source: https://clima.github.io/ClimaAtmos.jl/dev/api Sets up and solves a single-column BOMEX case simulation. This example demonstrates configuring a specific grid, initial setup, timestep, and duration. ```julia import ClimaAtmos as CA # Single-column BOMEX case simulation = CA.AtmosSimulation{Float64}(; grid = CA.ColumnGrid(Float64; z_elem = 60, z_max = 3000.0), setup = CA.Setups.Bomex(), dt = 5, t_end = 3600 * 6, ) ``` -------------------------------- ### Initialize TRMM_LBA Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Instantiate the TRMM_LBA setup, which has time-varying surface heat fluxes. Requires thermodynamic parameters. ```julia setup = TRMM_LBA(; prognostic_tke = true, thermo_params) ``` -------------------------------- ### Install JuliaFormatter Source: https://clima.github.io/ClimaAtmos.jl/dev/contributor_guide Install the JuliaFormatter package in your base environment to format code according to project standards. ```bash julia -e 'using Pkg; Pkg.add("JuliaFormatter")' ``` -------------------------------- ### Model Methods Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Setups can return model objects directly. When a method returns `nothing` (the default), the model construction layer falls through to config-based dispatch. ```APIDOC ## `ClimaAtmos.Setups.external_forcing` — Function ```julia external_forcing(setup, ::Type{FT}) ``` ### Description Return the external forcing model for this setup, or `nothing`. Default: `nothing`. ``` ```APIDOC ## `ClimaAtmos.Setups.insolation_model` — Function ```julia insolation_model(setup) ``` ### Description Return the insolation model for this setup, or `nothing`. Default: `nothing`. ``` ```APIDOC ## `ClimaAtmos.Setups.surface_temperature_model` — Function ```julia surface_temperature_model(setup) ``` ### Description Return the surface temperature model for this setup. Default: `ZonallySymmetricSST()`. ``` ```APIDOC ## `ClimaAtmos.Setups.prescribed_flow_model` — Function ```julia prescribed_flow_model(setup, ::Type{FT}) ``` ### Description Return the prescribed flow model for this setup, or `nothing`. Default: `nothing`. ``` ```APIDOC ## `ClimaAtmos.Setups.radiation_model` — Function ```julia radiation_model(setup, ::Type{FT}) ``` ### Description Return the radiation model for this setup, or `nothing`. Default: `nothing`. ``` -------------------------------- ### Verify ClimaAtmos and CUDA Installation Source: https://clima.github.io/ClimaAtmos.jl/dev/installation Import ClimaAtmos and CUDA to verify that the installation was successful and both packages are loaded without errors. ```julia import ClimaAtmos as CA import CUDA ``` -------------------------------- ### Initialize IsothermalProfile Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use IsothermalProfile for simulations with uniform temperature and barometric pressure. Specify the desired temperature. ```julia setup = IsothermalProfile(; temperature = 300) ``` -------------------------------- ### Instantiate ClimaAtmos Development Environment Source: https://clima.github.io/ClimaAtmos.jl/dev/contributor_guide Open Julia in development mode and install all project dependencies. This command reads the Project.toml file and installs necessary packages. ```julia julia --project ] instantiate ``` -------------------------------- ### Initialize MoistBaroclinicWaveWithEDMF Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use MoistBaroclinicWaveWithEDMF for simulations similar to MoistBaroclinicWave but with initial TKE of 0 and a draft area fraction of 0.2. ```julia setup = MoistBaroclinicWaveWithEDMF(; perturb = true, deep_atmosphere = false) ``` -------------------------------- ### Clone and Install ClimaAtmos for Development Source: https://clima.github.io/ClimaAtmos.jl/dev/installation Clone the ClimaAtmos repository and instantiate its project dependencies for development or to use the latest changes. ```bash git clone https://github.com/CliMA/ClimaAtmos.jl.git cd ClimaAtmos.jl julia --project -e 'using Pkg; Pkg.instantiate()' ``` -------------------------------- ### Initialize DryBaroclinicWave Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use DryBaroclinicWave for dry baroclinic wave initial conditions. Set perturb to true to add a localized perturbation for instability. ```julia DryBaroclinicWave(; perturb = true, deep_atmosphere = false) ``` -------------------------------- ### Initialize MoistBaroclinicWave Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use MoistBaroclinicWave for moist baroclinic wave simulations. It includes moisture profiles and virtual temperature conversion. Set perturb to true to trigger instability. ```julia setup = MoistBaroclinicWave(; perturb = true, deep_atmosphere = false) ``` -------------------------------- ### Initialize GCMDriven Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use GCMDriven for pointwise column IC driven by GCM forcing NetCDF data. Specify the forcing file path and site number. ```julia setup = GCMDriven("path/to/HadGEM2-A_amip.2004-2008.07.nc", "site23") ``` -------------------------------- ### Specify External Forcing File in Configuration Source: https://clima.github.io/ClimaAtmos.jl/dev/config This example shows how to specify an external forcing file using an artifact. The format is `artifact""/`. ```yaml insolation: "gcmdriven" external_forcing_file: artifact"cfsite_gcm_forcing"/HadGEM2-A_amip.2004-2008.07.nc ``` -------------------------------- ### Get Default Diagnostics from AtmosModel Source: https://clima.github.io/ClimaAtmos.jl/dev/diagnostics Obtain a list of default diagnostics for an atmospheric model using the `default_diagnostics` function. This provides a starting point for simulation diagnostics. ```julia model = ClimaAtmos.AtmosModel(..., microphysics_model = ClimaAtmos.DryModel(), ...) diagnostics = ClimaAtmos.default_diagnostics(model) # => List of diagnostics that include the ones specified for the DryModel ``` -------------------------------- ### Example: Gravitational Acceleration Parameter Source: https://clima.github.io/ClimaAtmos.jl/dev/parameters An example of defining the gravitational acceleration parameter with a float value in a TOML file. ```toml [gravitational_acceleration] value = 9.81 type = "float" ``` -------------------------------- ### Initialize RCEMIPIIProfile Constructors Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Construct initial conditions for RCEMIPII using predefined sea surface temperatures. ```julia RCEMIPIIProfile_295() ``` ```julia RCEMIPIIProfile_300() ``` ```julia RCEMIPIIProfile_305() ``` -------------------------------- ### Build Documentation Locally Source: https://clima.github.io/ClimaAtmos.jl/dev/contributor_guide Run these commands to build the documentation locally and preview changes. Set JULIA_DEBUG=Documenter for more verbose output during the build process. ```bash julia --project -e 'using Pkg; Pkg.instantiate()' ``` ```bash julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); develop(PackageSpec(path=pwd()))' ``` ```bash JULIA_DEBUG=Documenter julia --project=docs/ docs/make.jl ``` -------------------------------- ### Run Minimal 1-Day Global Simulation Source: https://clima.github.io/ClimaAtmos.jl/dev/api Sets up and solves a minimal 1-day global atmospheric simulation using default parameters. Requires importing the ClimaAtmos library. ```julia import ClimaAtmos as CA # Minimal: 1-day global simulation with defaults simulation = CA.AtmosSimulation{Float64}(; t_end = 86400) CA.solve_atmos!(simulation) ``` -------------------------------- ### ClimaAtmos.Setups.surface_condition Function Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Returns surface boundary data for the setup. Can be static, time-varying, or `nothing` to fall back to config-based setup. ```julia surface_condition(setup, params) ``` -------------------------------- ### `center_initial_condition` Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Every setup must implement this method. It is called pointwise over the grid and returns a `ClimaAtmos.Setups.physical_state` NamedTuple, defining the thermodynamic and kinematic state at each grid point. Temperature (`T`) and at least one of pressure (`p`) or density (`ρ`) are required. ```APIDOC ## `center_initial_condition` Every setup must implement this method. It is called pointwise over the grid and returns a `ClimaAtmos.Setups.physical_state` NamedTuple. Only `T` and one of `p` or `ρ` are required; all other fields default to zero. For example, a minimal setup: ```julia struct MySetup end function Setups.center_initial_condition(::MySetup, local_geometry, params) z = local_geometry.coordinates.z FT = typeof(z) return physical_state(; T = FT(300), p = FT(101500)) end ``` `ClimaAtmos.Setups.physical_state` — Function ``` physical_state(; T, p=NaN, ρ=NaN, kwargs...) ``` Construct a NamedTuple representing the physical state at a grid point. This is the return type of `center_initial_condition` — it describes the thermodynamic and kinematic state without any knowledge of the atmos model. The assembly layer (`prognostic_variables.jl`) converts this into model-specific prognostic variables. **Required arguments** * `T` : Temperature (K) * At least one of `p` (pressure, Pa) or `ρ` (density, kg/m³). If only one is provided, the assembly layer computes the other via `Thermodynamics`. **Optional arguments (default to zero)** * `u` , `v`: Zonal and meridional velocity (m/s) * `q_tot`, `q_liq`, `q_ice`: Specific humidities * `tke`: Turbulent kinetic energy (specific) * `draft_area`: EDMF draft area fraction * `q_rai`, `q_sno`: Precipitation specific humidities * `n_liq`, `n_rai`: Number densities (2-moment microphysics) * `n_ice`, `q_rim`, `b_rim`: P3 microphysics fields ``` -------------------------------- ### `surface_condition` Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Returns surface boundary data for the setup. The return value can be a `SurfaceConditions.SurfaceState` (static), a callable function for time-varying conditions, or `nothing` to fall through to config-based setup. ```APIDOC ## `surface_condition` Returns surface boundary data for the setup. The return value can be: * A `SurfaceConditions.SurfaceState` (static surface conditions) * A callable `(surface_coordinates, interior_z, t) -> SurfaceState` (time-varying) * `nothing` (falls through to config-based surface setup) Not all setups need this — only those that prescribe case-specific surface properties (e.g., roughness length, surface fluxes, surface temperature). `ClimaAtmos.Setups.surface_condition` — Function ``` surface_condition(setup, params) ``` Return the surface state for this setup, or `nothing`. The return value may be: * A `SurfaceState` (static surface conditions) * A callable `(surface_coordinates, interior_z, t) -> SurfaceState` (time-varying) * `nothing` (falls through to config-based surface condition) Default: `nothing`. ``` -------------------------------- ### Construct AtmosSimulation with Configuration Source: https://clima.github.io/ClimaAtmos.jl/dev/api Construct a simulation from a YAML-based configuration. This is the primary way to initialize a simulation with predefined settings. ```julia AtmosSimulation(config::AtmosConfig) ``` -------------------------------- ### Diagnostic Variable Table Example Source: https://clima.github.io/ClimaAtmos.jl/dev/available_diagnostics This is an example of the autogenerated table that lists available diagnostic variables. It includes short name, long name, units, comments, and standard name for each variable. ```text ┌────────────┬─────────────────┬──────────┬──────────────────────────────────┬─────────────────┐ │ Short name │ Long name │ Units │ Comments │ Standard name │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ waerror │ Error of Upward │ m s^-1 │ Error of steady-state vertical │ │ │ │ Air Velocity │ │ wind component │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ hussn_neg_ │ Vertical │ kg/kg │ Sum of negative Snow Specific │ │ │ sum │ Profile of Sum │ │ Humidity at each vertical level │ │ │ │ of Negative │ │ │ │ │ │ Snow Specific │ │ │ │ │ │ Humidity │ │ │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ rhoa │ Air Density │ kg m^-3 │ │ air_density │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ rldscs │ Surface │ W m^-2 │ Downwelling clear-sky longwave │ surface_downwel │ │ │ Downwelling │ │ radiation at the surface │ ling_longwave_f │ │ │ Clear-Sky │ │ │ lux_in_air_assu │ │ │ Longwave │ │ │ ming_clear_sky │ │ │ Radiation │ │ │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ taen │ Environment Air │ K │ │ │ │ │ Temperature │ │ │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ cdncup │ Updraft Number │ kg^-1 │ This is calculated as the number │ │ │ │ Mixing Ratio of │ │ of cloud water droplets in the │ │ │ │ Cloud Liquid │ │ updraft divided by │ │ │ │ Water │ │ the mass of air (including the │ │ │ │ │ │ water in all phases) in the │ │ │ │ │ │ updraft. │ │ │ │ │ │ │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ env_q_tot_ │ Environment │ 1 │ │ │ │ temperatur │ Correlation of │ │ │ │ │ e_correlat │ Total Specific │ │ │ │ │ ion │ Humidity and │ │ │ │ │ │ Temperature │ │ │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ cape │ Convective │ J kg^-1 │ Energy available to a parcel │ convective_avai │ │ │ Available │ │ lifted moist adiabatically from │ lable_potential │ │ │ Potential │ │ the surface. Assumes fully │ _energy │ │ │ Energy │ │ reversible phase changes and no │ │ │ │ │ │ precipitation. │ │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ rld │ Downwelling │ W m^-2 │ Downwelling longwave radiation │ surface_downwel │ │ │ Longwave │ │ │ ling_longwave_f │ │ │ Radiation │ │ │ lux_in_air │ ├────────────┼─────────────────┼──────────┼──────────────────────────────────┼─────────────────┤ │ mmrdust │ Dust Aerosol │ kg kg^-1 │ Prescribed dry mass fraction of │ mass_fraction_o │ │ │ Mass Mixing │ │ dust aerosol particles in air. │ f_dust_dry_aero │ │ │ Ratio │ │ │ sol_particles_i │ ``` -------------------------------- ### Surface Temperature Model Function Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Returns the surface temperature model for the setup. Defaults to `ZonallySymmetricSST()`. ```julia surface_temperature_model(setup) ``` -------------------------------- ### Initialize MoistFromFile Setup Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Use MoistFromFile to initialize thermodynamic and kinematic state from a NetCDF file, regridding it onto the model grid. Ensure the file contains expected variables like 'p', 't', 'q', and 'u, v, w'. ```julia MoistFromFile(file_path) ``` -------------------------------- ### Add CUDA Package for GPU Support Source: https://clima.github.io/ClimaAtmos.jl/dev/installation Install the CUDA package to enable GPU support for ClimaAtmos. ```julia using Pkg Pkg.add("CUDA") ``` -------------------------------- ### Run Simulation and Enter Julia REPL Source: https://clima.github.io/ClimaAtmos.jl/dev/radiative_equilibrium Run a radiative equilibrium simulation and enter an interactive Julia environment upon completion. This allows for immediate post-simulation analysis of the state variables. ```bash julia -i --project=.buildkite .buildkite/ci_driver.jl --config_file filepath ``` -------------------------------- ### ClimaAtmos.Setups.overwrite_initial_state! Function Source: https://clima.github.io/ClimaAtmos.jl/dev/setups Optionally overwrites the initial state `Y` after construction. Used by file-based setups to apply regridded file data. ```julia overwrite_initial_state!(setup, Y, thermo_params) ``` -------------------------------- ### Configure SimplePlume Column Simulation Source: https://clima.github.io/ClimaAtmos.jl/dev/repl_scripts Sets up a configuration dictionary for a simple plume column simulation, specifying parameters like initial condition, diffusion, microphysics, and time-stepping. This configuration is then used to initialize the Clima Atmos simulation. ```julia using Revise; import ClimaAtmos as CA; config_dict = Dict(); config_dict["initial_condition"] = "SimplePlume"; config_dict["implicit_diffusion"] = false; config_dict["edmfx_entr_model"] = "Generalized"; config_dict["approximate_linear_solve_iters"] = 2; config_dict["edmfx_sgs_mass_flux"] = false; config_dict["z_elem"] = 40; config_dict["prognostic_tke"] = false; config_dict["perturb_initstate"] = false; config_dict["dt"] = "30secs"; config_dict["implicit_sgs_advection"] = false; config_dict["microphysics_model"] = "0M"; config_dict["t_end"] = "12hours"; config_dict["disable_surface_flux_tendency"] = true; config_dict["edmfx_sgs_diffusive_flux"] = false; config_dict["turbconv"] = "prognostic_edmfx"; config_dict["z_stretch"] = false; config_dict["dt_save_state_to_disk"] = "10mins"; config_dict["ode_algo"] = "ARS222"; config_dict["config"] = "column"; config_dict["netcdf_interpolation_num_points"] = [2, 2, 80]; config_dict["edmfx_nh_pressure"] = true; config_dict["z_max"] = 4000.0; config_dict["toml"] = ["toml/prognostic_edmfx_simpleplume.toml"]; config_dict["diagnostics"] = Dict{Any, Any}[Dict("short_name" => ["ts", "ta", "thetaa", "ha", "pfull", "rhoa", "ua", "va", "wa", "hur", "hus", "cl", "clw", "cli", "hussfc", "evspsbl", "pr"], "period" => "10mins"), Dict("short_name" => ["arup", "waup", "taup", "thetaaup", "haup", "husup", "hurup", "clwup", "cliup", "waen", "taen", "thetaaen", "haen", "husen", "huren", "clwen", "clien", "tke"], "period" => "10mins"), Dict("short_name" => ["entr", "detr", "lmix", "bgrad", "strain", "edt", "evu"], "period" => "10mins")]; config_dict["edmfx_detr_model"] = "SmoothArea"; config_dict["edmfx_vertical_diffusion"] = true; config_dict["edmfx_filter"] = true; config = CA.AtmosConfig(config_dict); include(".buildkite/ci_driver.jl") ``` -------------------------------- ### Floating Point Inaccuracy Example Source: https://clima.github.io/ClimaAtmos.jl/dev/itime Demonstrates how floating-point arithmetic can lead to inaccuracies and time stopping incrementing, especially with Float32. ```julia julia> 0.1 + 0.1 + 0.1 == 0.3false ``` ```julia julia> Float32(16777216) + Float32(1) == Float32(16777216)true ``` -------------------------------- ### Run a 1-Day Global Simulation with ClimaAtmos.jl Source: https://clima.github.io/ClimaAtmos.jl/dev This snippet demonstrates how to run a basic 1-day global atmospheric simulation using ClimaAtmos.jl with default settings. Ensure ClimaAtmos is imported before execution. ```julia import ClimaAtmos as CA simulation = CA.AtmosSimulation{Float64}(; t_end = 86400) CA.solve_atmos!(simulation) ``` -------------------------------- ### Format Package Code (Command Line) Source: https://clima.github.io/ClimaAtmos.jl/dev/contributor_guide Install JuliaFormatter in your base environment and use this command to format code from the command line. ```bash julia -e 'using JuliaFormatter; format(".")' ```