Skip to content

Commit

Permalink
Improve tutorial (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmigot authored Jan 30, 2023
1 parent c04c1a7 commit 7482344
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ partition = (n, n)
model = CartesianDiscreteModel(domain, partition)

# Then, we introduce the definition of the finite element spaces.
reffe = ReferenceFE(lagrangian, Float64, 2)
reffe = ReferenceFE(lagrangian, Float64, 1)
Xpde = TestFESpace(model, reffe; conformity = :H1, dirichlet_tags = "boundary")
y0(x) = 0.0
Ypde = TrialFESpace(Xpde, y0)
Expand All @@ -47,7 +47,7 @@ dΩ = Measure(trian, degree)
yd(x) = -x[1]^2
α = 1e-2
function f(y, u)
(0.5 * (yd - y) * (yd - y) + 0.5 * α * u * u) *
(0.5 * 1e2 * (yd - y) * (yd - y) + 0.5 * α * u * u) *
end

ω = π - 1 / 8
Expand Down Expand Up @@ -101,7 +101,7 @@ using NLPModelsIpopt
stats_ipopt = ipopt(nlp, x0 = stats_trunk.solution, tol = 1e-5, print_level = 0)

# The problem was successfully solved, and we can extract the function evaluations from the stats.
stats_ipopt.counters
nlp.counters

# Reinitialize the counters before re-solving.
reset!(nlp);
Expand All @@ -115,7 +115,7 @@ stats_dci = with_logger(NullLogger()) do
end

# The problem was successfully solved, and we can extract the function evaluations from the stats.
stats_dci.counters
nlp.counters

# We now compare the two solvers with respect to the time spent,
stats_ipopt.elapsed_time, stats_dci.elapsed_time
Expand Down

0 comments on commit 7482344

Please sign in to comment.