-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeplots.jl
133 lines (128 loc) · 3.69 KB
/
makeplots.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using Plots
include("isolatedmodel.jl")
function getn(c)
if length(size(c))==3
return size(c)[1],size(c)[3]
else
return size(c)
end
end
function singleconcplot(r,c)
n_spatial,ntime = getn(c)
c10min= c[:,ntime÷6]
c30min=c[:,ntime÷2]
c60min=c[:,ntime]
concentrationplot= plot(r,[c10min,c30min,c60min],
xlabel="Dimensionless Distance",
ylabel="Dimensionless Concentration",
title="Concentration vs Radial Postion",
label=["10min" "30min" "1hr"],
legend=:topleft,
reuse=false
)
return concentrationplot
end
function doubleconcplot(r,c1,c2,custlabel)
n_spatial1,ntime1 = getn(c1)
n_spatial2,ntime2 = getn(c2)
c10min= c1[:,ntime1÷6]
c30min=c1[:,ntime1÷2]
c60min=c1[:,ntime1]
c10min2= c2[:,ntime2÷6]
c30min2=c2[:,ntime2÷2]
c60min2=c2[:,ntime2]
concentrationplot= plot(r,[c10min,c30min,c60min,c10min2,c30min2,c60min2],
xlabel="Dimensionless Distance",
ylabel="Dimensionless Concentration",
title="Concentration vs Radial Postion",
label=custlabel,
legend=:topleft,
reuse=false
)
return concentrationplot
end
function errorconcplot(r,c1,c2)
n_spatial1,ntime1 = getn(c1)
n_spatial2,ntime2 = getn(c2)
c10min= c1[:,ntime1÷6]
c30min=c1[:,ntime1÷2]
c60min=c1[:,ntime1]
c10min2= c2[:,ntime2÷6]
c30min2=c2[:,ntime2÷2]
c60min2=c2[:,ntime2]
c10minerror=broadcast(abs,(c10min .- c10min2)./(c10min2))
c30minerror=broadcast(abs,(c30min .- c30min2)./(c30min2))
c60minerror=broadcast(abs,(c60min .- c60min2)./(c60min2))
errorplot= plot(r,[c10minerror,c30minerror,c60minerror],
xlabel="Dimensionless Distance",
ylabel="ϵ",
title="ϵ vs Radial Postion",
label=["10min-error" "30min-error" "1hr-error" ],
legend=:topleft,
reuse=false
)
return errorplot
end
function singleaccumplot(c)
n_spatial,n_time = getn(c)
t,accum =Accumulation_Model(c,n_spatial,n_time)
accumplot= plot(t,accum,
xlabel="Time(min)",
ylabel="Dimensionless Concentration Accumulation",
title="Accumulation vs Time",
legend=:topleft,
reuse=false
)
return accumplot
end
function doubleaccumplot(c1,c2,custlabel)
n_spatial1,n_time1 = getn(c1)
n_spatial2,n_time2 = getn(c2)
t,accum1=Accumulation_Model(c1,n_spatial1,n_time1)
t,accum2=Accumulation_Model(c2,n_spatial2,n_time2)
accumplot= plot(t,[accum1,accum2],
xlabel="Time(min)",
ylabel="Dimensionless Concentration Accumulation",
title="Accumulation vs Time",
label=custlabel,
legend=:topleft,
reuse=false
)
return accumplot
end
function Accumerrorplot(c1,c2)
n_spatial1,n_time1 = getn(c1)
n_spatial2,n_time2 = getn(c2)
t,accum1=Accumulation_Model(c1,n_spatial1,n_time1)
t,accum2=Accumulation_Model(c2,n_spatial2,n_time2)
caccum_error=broadcast(abs,(accum1 .- accum2)./(accum1))
accumeplot= plot(t,caccum_error,
xlabel="Time(min)",
ylabel="ϵ",
title="Accumulation Error vs Time",
label=["ϵ"],
legend=:topleft,
reuse=false
)
return accumeplot
end
function velocityplot(r,v)
vplot = plot(r,v,
xlabel="Dimensionless Radial Position",
ylabel="Dimensionless Velocity",
title="Velocity vs Radial Position",
label="Velocity",
legend=:topleft,
reuse = false)
return vplot
end
function pressureplot(r,pressure)
pplot= plot(r,pressure,
xlabel="Dimensionless Radial Position",
ylabel="Dimensionless Pressure",
title="Pressure vs Radial Position",
label="Pressure",
legend=:bottomleft
)
return pplot
end