-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.jl
More file actions
187 lines (175 loc) · 10.7 KB
/
run.jl
File metadata and controls
187 lines (175 loc) · 10.7 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# dependencies: everything
include("src/includes.jl")
# This is the primary execution file for the acoustic scattering code by parsing an
# input file containing all of the desired run settings. Examples of such files
# exist in the examples directory. This is not a rigorous routine so if there are
# errors in the formatting of the input files, they will likely just cause errors in
# the code at runtime
if length(ARGS) == 1
inputs_filename = ARGS[1]
no_tag = ""
println("Julia utilizing ", Threads.nthreads(), " threads")
println("Parsing input parameters in: ", inputs_filename,"...")
inputs = parseInputParams(inputs_filename)
src_quadrature_rule = rule_lookup_dict[inputs.src_quadrature_string]
test_quadrature_rule = rule_lookup_dict[inputs.test_quadrature_string]
@unpack mesh_filename,
equation,
distance_to_edge_tol,
near_singular_tol,
excitation_params,
ACA_params,
WS_params = inputs
println("Parsing mesh in: ", mesh_filename, "...")
pulse_mesh = buildPulseMesh(mesh_filename, src_quadrature_rule, test_quadrature_rule)
println("Number of elements = ",pulse_mesh.num_elements)
# Excitation building, skipped if running WS mode
if excitation_params.type == "planewave"
println("Excitation: Plavewave")
excitationFunc(x_test,y_test,z_test) = planeWave(excitation_params.amplitude,
excitation_params.wavevector,
[x_test,y_test,z_test])
excitationFuncNormalDeriv(x_test,y_test,z_test,normal) = planeWaveNormalDerivative(excitation_params.amplitude,
excitation_params.wavevector,
[x_test,y_test,z_test],
normal)
elseif excitation_params.type == "sphericalwave"
println("Excitation: Sphericalwave")
excitationFunc(x_test,y_test,z_test) = sphericalWave(excitation_params.amplitude,
excitation_params.wavenumber,
[x_test,y_test,z_test],
excitation_params.l,
excitation_params.m)
excitationFuncNormalDeriv(x_test,y_test,z_test,normal) = sphericalWaveNormalDerivative(excitation_params.amplitude,
excitation_params.wavenumber,
[x_test,y_test,z_test],
excitation_params.l,
excitation_params.m,
normal)
end
run_time = 0.0
# Determine which solver to run
if equation == "sound soft IE"
println("Equation: Sound Soft IE")
if ACA_params.use_ACA == true
println("Running with ACA...")
run_time = @elapsed sources, octree, metrics = solveSoftIEACA(pulse_mesh,
ACA_params.num_levels,
excitationFunc,
excitation_params.wavenumber,
distance_to_edge_tol,
near_singular_tol,
ACA_params.compression_distance,
ACA_params.approximation_tol)
printACAMetrics(metrics)
else
run_time = @elapsed sources = solveSoftIE(pulse_mesh,
excitationFunc,
excitation_params.wavenumber,
distance_to_edge_tol,
near_singular_tol)
end
exportSourcesBundled(mesh_filename, no_tag, sources)
elseif equation == "sound soft normal derivative IE"
println("Equation: Sound Soft Normal Derivative IE")
if ACA_params.use_ACA == true
println("ACA not implemented for this equation yet")
else
run_time = @elapsed sources = solveSoftIENormalDeriv(pulse_mesh,
excitationFuncNormalDeriv,
excitation_params.wavenumber)
end
exportSourcesBundled(mesh_filename, no_tag, sources)
elseif equation == "sound soft CFIE"
println("Equation: Sound Soft CFIE")
if ACA_params.use_ACA == true
run_time = @elapsed sources, octree, metrics = solveSoftCFIEACA(pulse_mesh,
ACA_params.num_levels,
excitationFunc,
excitationFuncNormalDeriv,
excitation_params.wavenumber,
inputs.CFIE_weight,
distance_to_edge_tol,
near_singular_tol,
ACA_params.compression_distance,
ACA_params.approximation_tol)
printACAMetrics(metrics)
else
run_time = @elapsed sources = solveSoftCFIE(pulse_mesh,
excitationFunc,
excitationFuncNormalDeriv,
excitation_params.wavenumber,
distance_to_edge_tol,
near_singular_tol,
inputs.CFIE_weight)
end
exportSourcesBundled(mesh_filename, no_tag, sources)
elseif equation == "WS mode"
println("Equation: WS Mode") # this mode only runs sound soft IE right now
if inputs.src_quadrature_string != inputs.test_quadrature_string
println("When running at WS modes, test and src quadrature rules must be identical. Change settings and rerun.")
else
if ACA_params.use_ACA == true
println("Running with ACA...")
run_time = @elapsed sources, octree, metrics = solveWSModeSoftACA(WS_params,
pulse_mesh,
distance_to_edge_tol,
near_singular_tol,
ACA_params.num_levels,
ACA_params.compression_distance,
ACA_params.approximation_tol)
printACAMetrics(metrics)
# for local_mode_idx = 1:length(WS_params.mode_idxs)
# mode_idx = WS_params.mode_idxs[local_mode_idx]
# mode_tag = string("_mode", mode_idx)
# exportSourcesBundled(mesh_filename, mode_tag, sources[local_mode_idx])
# end
else
run_time = @elapsed sources = solveWSModeSoft(WS_params, pulse_mesh,
distance_to_edge_tol, near_singular_tol)
# for local_mode_idx = 1:length(WS_params.mode_idxs)
# mode_idx = WS_params.mode_idxs[local_mode_idx]
# mode_tag = string("_mode", mode_idx)
# exportSourcesBundled(mesh_filename, mode_tag, sources[local_mode_idx])
# end
end
end
elseif equation == "WS mode CFIE"
println("Equation: WS Mode CFIE") # this mode only runs sound soft IE right now
if inputs.src_quadrature_string != inputs.test_quadrature_string
println("When running at a WS mode, test and src quadrature rules must be identical. Change settings and rerun.")
else
if ACA_params.use_ACA == true
println("Running with ACA...")
run_time = @elapsed sources, octree, metrics = solveWSModeSoftCFIEACA(WS_params,
pulse_mesh,
distance_to_edge_tol,
near_singular_tol,
inputs.CFIE_weight,
ACA_params.num_levels,
ACA_params.compression_distance,
ACA_params.approximation_tol)
printACAMetrics(metrics)
# for local_mode_idx = 1:length(WS_params.mode_idxs)
# mode_idx = WS_params.mode_idxs[local_mode_idx]
# mode_tag = string("_mode", mode_idx)
# exportSourcesBundled(mesh_filename, mode_tag, sources[local_mode_idx])
# end
else
println("Not Implemented")# run_time = @elapsed sources = solveWSMode(WS_params.max_l, WS_params.mode_idxs,
# WS_params.wavenumber, pulse_mesh,
# distance_to_edge_tol, near_singular_tol)
# for local_mode_idx = 1:length(WS_params.mode_idxs)
# mode_idx = WS_params.mode_idxs[local_mode_idx]
# mode_tag = string("_mode", mode_idx)
# exportSourcesBundled(mesh_filename, mode_tag, sources[local_mode_idx])
# end
end
end
end
println("Total Runtime = ", run_time, " seconds")
elseif length(ARGS) > 1
println("Please provide only one input filename as argument")
else
println("No input filename provided")
end