Skip to content

Commit f975636

Browse files
committed
DEV FIX: Fix error tolerances and export, add rejectionsample-method.
1 parent 0d34501 commit f975636

File tree

3 files changed

+44
-11
lines changed

3 files changed

+44
-11
lines changed

src/TraceParticles.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ export
107107
TerminationCode
108108
# problem_functions.jl
109109
export
110-
DposMBvelGCA,
111-
DposMBvelHybrid,
110+
MHDSamplingGCA,
111+
MHDSamplingHybrid,
112112
PposPvel
113113
# output_functions.jl
114114
export

src/statistics.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,38 @@ function rejectionsample(
280280
return x, y, z, numrejections
281281
end
282282

283+
function rejectionsample(
284+
rng::AbstractRNG,
285+
target::Any,
286+
maxvalue::Real,
287+
x0::Real,
288+
xf::Real,
289+
y0::Real,
290+
yf::Real,
291+
z0::Real,
292+
zf::Real,
293+
t0::Real,
294+
tf::Real,
295+
)
296+
numrejections = 0
297+
x = rand(rng, x0, xf)
298+
y = rand(rng, y0, yf)
299+
z = rand(rng, z0, zf)
300+
t = rand(rng, t0, tf)
301+
u = rand(rng, 0.0, maxvalue)
302+
v = target(x, y, z, t)
303+
while u > v
304+
numrejections += 1
305+
x = rand(rng, x0, xf)
306+
y = rand(rng, y0, yf)
307+
z = rand(rng, z0, zf)
308+
t = rand(rng, t0, tf)
309+
u = rand(rng, 0.0, maxvalue)
310+
v = target(x, y, z, t)
311+
end
312+
return x, y, z, t, numrejections
313+
end
314+
283315
"""
284316
rejectionsample(
285317
target ::Function,

test/experiments/2Dcoronaljet/2Dcoronaljet.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ rtols = Dict(
194194
rtols_errorprone = Dict(
195195
"xf" => 1e-6,
196196
"zf" => 1e-6,
197-
"tf" => 1e-5,
198-
"nt" => 1e-2,
199-
"vparalf" => 1e-2,
200-
"maxrl" => 1e-4,
201-
"maxscalesratio" => 1e-3,
202-
"minlb" => 1e-3,
203-
"meanrl" => 1e-6,
204-
"meanlb" => 1e-1,
205-
"meanscalesratio" => 1e-4,
197+
#"tf" => 1e-5,
198+
#"nt" => 1e-2,
199+
"vparalf" => 1e-4,
200+
"maxrl" => 5e-3,
201+
#"maxscalesratio" => 1e-3,
202+
#"minlb" => 1e-3,
203+
#"meanrl" => 1e-6,
204+
#"meanlb" => 1e-1,
205+
#"meanscalesratio" => 1e-4,
206206
)
207207

208208
# Retrieve the solutions for which to test the results against.
@@ -217,6 +217,7 @@ df = h5_getall(fname)
217217

218218
# The particles that have larger errors
219219
errorprone = [
220+
40, 50, 99
220221
# 15, 75, 81, 1, 14, 49, 70, 46, 93,
221222
# 84, 44, 53, 80, 27, 9, 13, 41, 30,
222223
# 39, 26, 7

0 commit comments

Comments
 (0)