-
Notifications
You must be signed in to change notification settings - Fork 0
/
runscript.jl
63 lines (46 loc) · 1.57 KB
/
runscript.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using miniWeather
using ArgParse
function parse_commandline()
s = ArgParseSettings()
choices_weather_types = ["collision", "thermal", "mountain_waves",
"turbulence", "density_current", "injection"]
@add_arg_table s begin
"--nx_glob"
help = "Total number of cells in the x-direction"
arg_type = Int
default = 100
"--nz_glob"
help = "Total number of cells in the z-direction"
arg_type = Int
default = 50
"--sim_time"
help = "How many seconds to run the simulation"
arg_type = Int
default = 50
"--output_freq"
help = "How frequently to output data to file (in seconds)"
arg_type = Int
default = 10
"--weather_type"
help = "Choose weather scenario and how to initialize the data. " *
"Must be one of " * join(choices_weather_types, ", ", " or ")
range_tester = (x->x ∈ choices_weather_types)
default = "thermal"
end
return parse_args(s)
end
function main()
config = parse_commandline()
println("Parsed args:")
for (arg, val) in config
println(" $arg => $val")
end
model, grid = init(config["nx_glob"], config["nz_glob"], config["sim_time"], config["weather_type"])
mass0, te0 = reductions(model, grid)
println("mass = $mass0, te = $te0")
run!(model, grid, config["output_freq"], verbose=true)
mass, te = reductions(model, grid)
println("d_mass: ", (mass - mass0) / mass0)
println("d_te: ", (te - te0) / te0)
end
main()