-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimeTests.jl
executable file
·152 lines (137 loc) · 4.78 KB
/
TimeTests.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
function main(Days, barrPerPart, timeStep, depths)
## Initialize variable for specific run Days = 3
startDate = DateTime(2010,04,22)
endDate =startDate + Dates.Day(Days)
components = [0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.3; 0.0 0.0 0.0 0.1 0.1 0.1 0.2 0.5; 0.0 0.0 0.0 0.0 0.0 0.1 0.2 0.7; ]
subSurfaceFraction = [1/3, 1/3]
initPartSize = 10
totComponents = 8
windContrib = 0.035
turbulentDiff = 0.2
diffusion = 0.005
evaporate = [1]
biodeg = [1]
burned = [1]
collected = [1]
byComponent = threshold(95,[4, 8, 12, 16, 20, 24, 28, 32], timeStep)
ArrVF1 = zeros(3)
ArrVF3 = zeros(3,3,3) # Initial array for vectorFields 3x3
ArrVF2 = zeros(3,2) # Initial array for vectorFields 3x2
ArrIntVF2 = ones(Int64,1,1)
ArrIntVF1 = ones(Int64,1)
ArrDepthIndx = zeros(length(depths),2)
ArrTR = GeometricalPredicates.UnOrientedTriangle{Point2D}[]
#startJulianDate = toJulianDate(startDate)
#endJulianDate = toJulianDate(endDate)
decay = Decay(burned,collected, evaporate, biodeg, byComponent)
lat = [28.0]
lon = [-88.0]
# bbox = [-92, 25, -80, 31]
#bbox = [-94, 23, -78, 33]
bbox = [-92, 25, -80, 31]
# bbox = [-180, -90, -180, 90]
visualize = false
# visualize = true
model = "hycom"
VF3D = false
positions = [[28, -88], [20, -95]]
spillType = "oil"
Statistics = false
configPath = "./ConfigurationFiles/"
dataPath = "/home/olmozavala/Desktop/PETROLEO_OUT/"
lims = [-97 -80; 20 31]
# lims = bbox
if spillType == "simple" #multiple oil spills
FileName = string(configPath,"/ndatos_derrame.csv")
lims = [-98 -80; 18 31]
else #one oil spill from Oil Budget Calculator (2010)
FileName = string(configPath,"/spill_data.csv")
end
modelConfigs = modelConfig(startDate,endDate, depths, components, subSurfaceFraction, decay, timeStep, initPartSize, totComponents, windContrib, turbulentDiff, diffusion, model, spillType,bbox)
particles = oilSpillModel(dataPath, configPath, modelConfigs, FileName, ArrVF3, ArrVF2, ArrVF1,ArrIntVF2,ArrIntVF1,ArrTR, ArrDepthIndx, startDate, endDate, visualize, timeStep, lat, lon, VF3D, positions, barrPerPart, lims, Statistics)
println("Final number of particles:", size(particles))
if Statistics
modelStatistics(particles,[28.0 -88.0; 38.0 -88.0; 37.8 -88], 10.0 )
end
#particlesByLocation(particles,[28.0 -88.0; 38.0 -88.0; 37.8 -88], 10.0 )
#particlesByTypeAndDate(particles,12)
# particlesByGroup(particles)
#print(particles)
# funciones para guardar posiciones de partículas
#lat = [i.lat for i in particles]
#lon = [i.lon for i in particles]
#writedlm("particleslats$days30.txt", lat)
#writedlm("particleslons$days.txt", lon)
end #Main
include("IncludeAll.jl")
println("Compiling.....")
depths = [0,100,1000]
main(1, 400.0, 12, depths)
function timeTests()
Days = 7
# timeStep = 1
# depths = [0,100,1000]
# # println("Running .....")
# for particlesPerBarrel = range(1,10)
# #for particlesPerBarrel = range(10,10)
# println("Particles per barrel: ", particlesPerBarrel)
# @time main(Days, 1/particlesPerBarrel,timeStep, depths)
# end
println("New set of tests..................")
timeStep = 1
barrPerPart = 1.0
for Days = 2:2:20
println("Days: ", Days)
@time main(Days, barrPerPart,timeStep, depths)
end
## -------- Test 1 -------
#Days = 2
#barrPerPart = 50
#Depths = [0,100,1000]
#println("Days:", Days, " BarrelsPerPart", barrPerPart)
#@time main(Days, barrPerPart)
## -------- Test 2 -------
#Days = 2
#barrPerPart = 50
#Depths = [0,99,1001]
#println("Days:", Days, " BarrelsPerPart", barrPerPart)
#@time main(Days, barrPerPart)
## -------- Test 3 -------
#Days = 4
#barrPerPart = 50
#Depths = [0,100,1000]
#println("Days:", Days, " BarrelsPerPart", barrPerPart)
#@time main(Days, barrPerPart)
## -------- Test 4 -------
#Days = 4
#barrPerPart = 50
#Depths = [0,99,1001]
#println("Days:", Days, " BarrelsPerPart", barrPerPart)
#@time main(Days, barrPerPart)
## -------- Test 5 -------
# Days = 7
# barrPerPart = 10
# Depths = [0,100,1000]
# println("Days:", Days, " BarrelsPerPart", barrPerPart)
# @time main(Days, barrPerPart)
## -------- Test 6 -------
# Days = 7
# barrPerPart = 10
# Depths = [0,99,1001]
# println("Days:", Days, " BarrelsPerPart", barrPerPart)
# @time main(Days, barrPerPart)
end # timeTests
timeTests()
# println("*************************************************")
# using ProfileView
# PROFILEVIEW_USEGTCK = true
# include("IncludeAll.jl")
# @time main(1, 400)
# @time main(3, 40)
# Profile.clear_malloc_data()
# main(2, 40)
# ProfileView.closeall()
# Profile.clear()
# @profile main(3, 40)
# Profile.print(format=:flat)
# ProfileView.view()