Skip to content

Commit d6551fc

Browse files
Use BFGS as default in optimization for function space operators (#416)
* use BFGS as default in function space operators * increase some tolerances again
1 parent ede5990 commit d6551fc

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

ext/SummationByPartsOperatorsOptimForwardDiffExt.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module SummationByPartsOperatorsOptimForwardDiffExt
22

3-
using Optim: Optim, Options, LBFGS, optimize, minimizer
3+
using Optim: Optim, Options, BFGS, optimize, minimizer
44
using ForwardDiff: ForwardDiff
55

66
using SummationByPartsOperators: SummationByPartsOperators, GlaubitzNordströmÖffner2023,
@@ -13,7 +13,7 @@ function SummationByPartsOperators.function_space_operator(basis_functions,
1313
source::SourceOfCoefficients;
1414
derivative_order = 1,
1515
accuracy_order = 0,
16-
opt_alg = LBFGS(),
16+
opt_alg = BFGS(),
1717
options = Options(g_tol = 1e-14,
1818
iterations = 10000),
1919
verbose = false) where {T,

test/function_space_operators_test.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Optim, ForwardDiff # to enable loading the function space operator optimi
3131
D = function_space_operator(basis_functions, nodes, source)
3232

3333
@test grid(D) nodes
34-
@test all(isapprox.(D * ones(N), zeros(N); atol = 1e-12))
34+
@test all(isapprox.(D * ones(N), zeros(N); atol = 1e-13))
3535
@test D * nodes ones(N)
3636
@test D * exp.(nodes) exp.(nodes)
3737
M = mass_matrix(D)
@@ -44,12 +44,10 @@ import Optim, ForwardDiff # to enable loading the function space operator optimi
4444
0.8574665549914025, 1.0]
4545
N = length(nodes)
4646
let basis_functions = [one, identity, exp]
47-
D = function_space_operator(basis_functions, nodes, source, verbose = true,
48-
options = Optim.Options(g_tol = 1e-15,
49-
iterations = 25000))
47+
D = function_space_operator(basis_functions, nodes, source, verbose = true)
5048

5149
@test grid(D) nodes
52-
@test all(isapprox.(D * ones(N), zeros(N); atol = 1e-11))
50+
@test all(isapprox.(D * ones(N), zeros(N); atol = 1e-12))
5351
@test D * nodes ones(N)
5452
@test D * exp.(nodes) exp.(nodes)
5553
M = mass_matrix(D)

0 commit comments

Comments
 (0)