Skip to content

Commit 2f6196b

Browse files
Akshay SridharAkshay Sridhar
authored andcommitted
modified: docs/src/repl_scripts.md
1 parent c2dadf1 commit 2f6196b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/src/repl_scripts.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# REPL script (debugging workflow example)
2+
3+
4+
```@example
5+
ca_dir = joinpath(@__DIR__, "..", "..")
6+
using Pkg
7+
buildkite_env = joinpath(ca_dir, ".buildkite")
8+
Pkg.activate(buildkite_env)
9+
10+
# julia> using Revise # This is useful For REPL debugging. See also: Infiltrator.jl and Main.@infiltrate
11+
12+
import ClimaAtmos as CA
13+
import SciMLBase: step!
14+
15+
config_file = joinpath(ca_dir, "config/model_configs/baroclinic_wave.yml")
16+
config = CA.AtmosConfig(config_file)
17+
18+
# Generate temporary directory for Documenter run-script, clear after
19+
# demo is completed.
20+
21+
temp_output_dir = mktempdir(ca_dir, cleanup=true)
22+
config.parsed_args["output_dir"]=temp_output_dir
23+
simulation = CA.AtmosSimulation(config)
24+
25+
# Example: Advance a single timestep and explore the solution
26+
# stored in `simulation.integrator.u`
27+
step!(simulation.integrator)
28+
29+
# Example: Update command line argument, reset simulation, re-run to completion
30+
# Note that you can also to update the configuration `.yml` and
31+
# load the simulation again from the `config_file` as above in the same REPL session.
32+
# Note that you'd need to use `Revise` at the start of your session to apply changes
33+
# to the source code within your REPL session.
34+
# e.g.
35+
# julia> simulation = CA.AtmosSimulation(config_file)
36+
37+
config.parsed_args["dt"]="400secs"
38+
config.parsed_args["t_end"]="800secs"
39+
simulation = CA.AtmosSimulation(config)
40+
CA.solve_atmos!(simulation)
41+
```
42+
143
# Julia scripts per Buildkite job
244

345
```@example

0 commit comments

Comments
 (0)