-
Notifications
You must be signed in to change notification settings - Fork 2
/
header.jl
65 lines (55 loc) · 1.39 KB
/
header.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
64
65
using Arrhenius
using Sundials
using LinearAlgebra
using OrdinaryDiffEq
using ForwardDiff
using ForwardDiff: jacobian, jacobian!
using DiffEqSensitivity
using YAML
using BSON: @save, @load
using Plots, Printf, Random
using Statistics
using ProgressBars
using Base.Threads
using BandedMatrices
using SparseArrays
using Dierckx # for interpolation
ENV["GKSwstype"] = "100"
# load input.yaml
runtime = YAML.load_file("./input.yaml")
expr_name = runtime["expr_name"]
is_restart = runtime["is_restart"]
# load $expr_name/config.yaml
conf = YAML.load_file("$expr_name/config.yaml")
mech = conf["mech"]
fuel = conf["fuel"]
fuel2air = Float64(conf["fuel2air"])
oxygen = conf["oxygen"]
inert = conf["inert"]
dT = Float64(conf["dTign"])
dTabort = Float64(conf["dTabort"])
method = conf["method"]
n_plot = Int64(conf["n_plot"])
if is_restart
println("Continue to run $expr_name ...\n")
else
println("Runing $expr_name ...\n")
end
exp_path = string(expr_name)
fig_path = string(exp_path, "/figs")
ckpt_path = string(exp_path, "/checkpoint")
if !is_restart
if ispath(fig_path)
rm(fig_path, recursive=true)
end
if ispath(ckpt_path)
rm(ckpt_path, recursive=true)
end
end
if ispath(fig_path) == false
mkdir(fig_path)
mkdir(string(fig_path, "/conditions"))
end
if ispath(ckpt_path) == false
mkdir(ckpt_path)
end