Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb"
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8"
PDEBase = "a7812802-0625-4b9e-961c-d332478797e5"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[compat]
Expand All @@ -24,6 +26,8 @@ Gmsh = "0.3"
LinearSolve = "5"
ModelingToolkit = "11"
OrdinaryDiffEqBDF = "2.4"
PDEBase = "0.1.40"
Printf = "1"
SciMLBase = "3"
Symbolics = "7"
TOML = "1"
1 change: 1 addition & 0 deletions docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pages = [
"Boundary conditions and limitations" => "boundary_conditions.md",
"Discretization" => "discretization.md",
"Navier–Stokes example" => "navier_stokes.md",
"Axisymmetric swirl: a collapsing core" => "axisymmetric_swirl.md",
"Extension contract" => "extension_contract.md",
"API" => "api.md",
]
Binary file added docs/src/assets/axisym_core.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/axisym_mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/src/assets/axisym_swirl.fnv1a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e369978afda92609
Binary file added docs/src/assets/axisym_swirl.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/src/assets/axisym_swirl_animation.fnv1a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3bb1f417d3ec6ef4
286 changes: 286 additions & 0 deletions docs/src/axisymmetric_swirl.md

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions examples/axisym_swirl/animation.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Renders the animation of docs/src/axisymmetric_swirl.md into docs/src/assets (committed; the documentation build
# does not solve anything). From the repository root, with the docs environment (it has CairoMakie):
#
# julia --project=docs examples/axisym_swirl/animation.jl
#
# One solve of `axisym_swirl.jl` at c = 0.1, tau_end = 1e-2 (the coarsest of the page's three meshes, 32k unknowns,
# about half a minute after compilation), sampled at frames spaced evenly in log(tau). Rendering also writes the
# checksum of the source files that test/NavierStokes/axisym_swirl.jl compares.
using CairoMakie

include(joinpath(@__DIR__, "axisym_swirl.jl"))
include(joinpath(@__DIR__, "checksum.jl"))

const AXISYM_ASSETS = joinpath(@__DIR__, "..", "..", "docs", "src", "assets")

function render_axisym_animation(directory = AXISYM_ASSETS; c = 0.1, tau_end = 1.0e-2, frames = 72, tau_start = 0.8)
mkpath(directory)
grid = axisym_grid(; c, tau_end)
run = axisym_solve(; c, tau_end, report = ())
nodes = [Ferrite.get_node_coordinate(n).data for n in Ferrite.getnodes(grid)]
edges = Point2f[]
for cell in Ferrite.getcells(grid), (a, b) in ((1, 2), (2, 3), (3, 1))
push!(edges, Point2f(nodes[cell.nodes[a]]), Point2f(nodes[cell.nodes[b]]), Point2f(NaN, NaN))
end
taus = exp.(range(log(tau_start), log(tau_end), frames))
fixed = 2.0 # the fixed window is r in [0, 2], z in [-2, 2]
rs_fixed, zs_fixed = range(0, fixed, 100), range(-fixed, fixed, 200)
rs_unit, zs_unit = range(0, 3, 90), range(-3, 3, 180) # the following window, in units of the core's scales
fixed_swirl(tau) = run.sol(1 - tau, collect(rs_fixed), collect(zs_fixed); dv = ut(t, r, z))
# In the following window r = x sqrt(tau), z = y tau^(1/2 - h) and the fields are multiplied by tau^(1/2 + h),
# which is the self-similar shape of manufactured.jl: it changes only through the ramp and the mesh.
function following(tau, field)
rs, zs = collect(rs_unit .* sqrt(tau)), collect(zs_unit .* tau^EXPONENT_D)
return run.sol(1 - tau, rs, zs; dv = field) .* tau^EXPONENT_A
end
swirl_max = maximum(maximum(fixed_swirl(tau)) for tau in taus)

frame = Observable(1)
tau = @lift taus[$frame]
fig = Figure(size = (1260, 500))
Label(
fig[0, 1:6], @lift("t = $(round(1 - $tau; digits = 4)), τ = 1 - t = $(round($tau; sigdigits = 3))");
fontsize = 22, tellwidth = false
)
ax1 = Axis(
fig[1, 1]; title = "u_θ in a fixed window", xlabel = "r", ylabel = "z", aspect = DataAspect(),
limits = (0, fixed, -fixed, fixed)
)
hm1 = heatmap!(ax1, rs_fixed, zs_fixed, @lift(fixed_swirl(taus[$frame])); colormap = :viridis, colorrange = (0, swirl_max))
lines!(ax1, edges; linewidth = 0.3, color = (:white, 0.35))
Colorbar(fig[1, 2], hm1; label = "u_θ")
for (k, (field, name)) in enumerate(((ut(t, r, z), "u_θ"), (uz(t, r, z), "u_z")))
ax = Axis(
fig[1, 2k + 1]; title = "$name · τ^(1/2+h), in a window that follows the core", xlabel = "r / τ^(1/2)",
ylabel = k == 1 ? "z / τ^(1/2-h)" : "", aspect = DataAspect(), titlesize = 13
)
hm = heatmap!(
ax, rs_unit, zs_unit, @lift(following(taus[$frame], field));
colormap = k == 1 ? :viridis : :balance, colorrange = k == 1 ? (0, 3.2) : (-1.4, 1.4)
)
Colorbar(fig[1, 2k + 2], hm)
end
record(fig, joinpath(directory, "axisym_swirl.gif"), 1:frames; framerate = 12, px_per_unit = 1) do index
frame[] = index
end
write(joinpath(directory, "axisym_swirl_animation.fnv1a"), animation_sources_hash() * "\n")
return directory
end

if abspath(PROGRAM_FILE) == @__FILE__
render_axisym_animation(isempty(ARGS) ? AXISYM_ASSETS : ARGS[1])
end
160 changes: 160 additions & 0 deletions examples/axisym_swirl/axisym_swirl.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Axisymmetric Navier–Stokes with swirl in the half plane (r, z): a manufactured vortex core that collapses
# self-similarly toward the origin, solved with Taylor–Hood P2/P1 triangles on a mesh graded toward the origin.
#
# julia --project=docs examples/axisym_swirl/axisym_swirl.jl [c] [tau_end]
#
# This is our own discretization driven by our own manufactured field (`manufactured.jl`); it is not a
# reproduction of any blowup result. The pieces, each explained on the documentation page:
#
# - Each momentum equation is written in the textbook strong form of the (r, z) system and integrated by parts
# with `Weighted(r)`, the axisymmetric measure r dr dz. The continuity equation is written already weighted,
# `0 ~ Dr(r ur) + r Dz(uz)`, and paired with the pressure.
# - u_r = u_theta = 0 on the axis; u_z carries the natural condition there (`natural = [Γaxis]`). The far
# boundaries carry the exact velocity and the exact pressure is pinned on `outer`.
# - The mesh comes from `mesh.geo` through the Gmsh API; the size is c times the distance to the origin,
# between hmin = c sqrt(tau_end) / 2 and hmax = 5c.
using FiniteElementMethod, ModelingToolkit, DomainSets, OrdinaryDiffEqBDF
using OrdinaryDiffEqBDF: NLNewton
using LinearSolve: UMFPACKFactorization
using PDEBase.StrongForm: Weighted
using SciMLBase: SciMLBase, CheckInit, solve
using Ferrite: Ferrite, Lagrange, RefTriangle
using FerriteGmsh: FerriteGmsh
using Gmsh: Gmsh, gmsh

include(joinpath(@__DIR__, "manufactured.jl"))

const AXISYM_MESH = joinpath(@__DIR__, "mesh.geo")

@variables ur(..) ut(..) uz(..) p(..)

"""
axisym_grid(; c, tau_end, R = 8.0, hmax = 5c)

The graded triangle mesh of `mesh.geo` on `r ∈ [0, R]`, `z ∈ [-R, R]` as a `Ferrite.Grid` with facet sets `axis`,
`outer`, `top` and `bottom`. The element size is `c` times the distance to the origin, clamped to
`[c sqrt(tau_end) / 2, hmax]`, so halving `c` halves the size everywhere. Parameters reach the `.geo` file through
`gmsh.onelab.setNumber` before `gmsh.open`.
"""
function axisym_grid(; c, tau_end, R = 8.0, hmax = 5c)
Gmsh.initialize()
try
gmsh.option.setNumber("General.Terminal", 0)
for (name, value) in (("R", R), ("c", c), ("hmin", c * sqrt(tau_end) / 2), ("hmax", hmax), ("order", 1))
gmsh.onelab.setNumber("Parameters/$name", [Float64(value)])
end
gmsh.open(AXISYM_MESH)
gmsh.model.mesh.generate(2)
return FerriteGmsh.togrid()
finally
Gmsh.finalize()
end
end

"""
axisym_problem(grid; tend, abstol = 1e-8)

The `DAEProblem` of the axisymmetric swirl system on `grid` from t = 0 to `tend`. `abstol` is the absolute
tolerance of the differential rows; the pressure and Dirichlet rows are left out of the error control.
"""
function axisym_problem(grid; tend, abstol = 1.0e-8)
Ω = MeshDomain(grid)
Γaxis, Γout, Γtop, Γbottom = boundarypiece.(Ω, (:axis, :outer, :top, :bottom))
UR, UT, UZ, P = ur(t, r, z), ut(t, r, z), uz(t, r, z), p(t, r, z)
eqs = [
Dt(UR) + UR * Dr(UR) + UZ * Dz(UR) - UT^2 / r + Dr(P) ~ laplacian(UR) - UR / r^2 + force_r(t, r, z),
Dt(UT) + UR * Dr(UT) + UZ * Dz(UT) + UR * UT / r ~ laplacian(UT) - UT / r^2 + force_t(t, r, z),
Dt(UZ) + UR * Dr(UZ) + UZ * Dz(UZ) + Dz(P) ~ laplacian(UZ) + force_z(t, r, z),
0 ~ Dr(r * UR) + r * Dz(UZ),
]
far = (Γout, Γtop, Γbottom)
bcs = [
[ur(t, Γ) ~ EXACT[:ur] for Γ in far]; [ut(t, Γ) ~ EXACT[:ut] for Γ in far];
[uz(t, Γ) ~ EXACT[:uz] for Γ in far];
ur(t, Γaxis) ~ 0; ut(t, Γaxis) ~ 0;
p(t, Γout) ~ EXACT[:p];
ur(0, r, z) ~ 0; ut(0, r, z) ~ 0; uz(0, r, z) ~ 0
]
@named axisym = PDESystem(eqs, bcs, [(r, z) ∈ Ω, t ∈ Interval(0.0, tend)], [t, r, z], [UR, UT, UZ, P], [])
P2, P1 = Lagrange{RefTriangle, 2}(), Lagrange{RefTriangle, 1}()
disc = FEMDiscretization(
Ω, t; spaces = Dict(ur => P2, ut => P2, uz => P2, p => P1), pairing = Dict(eqs[4] => p),
ibp = Dict(eqs[i] => Weighted(r) for i in 1:3), natural = [Γaxis], initializealg = CheckInit(), abstol
)
return DAEProblem(axisym, disc)
end

"""
weighted_errors(sol, tt, exact)

The r-weighted L² errors `sqrt(∫ r (u_h - u)² dr dz)` and norms `sqrt(∫ r u² dr dz)` at time `tt` of each field in
`exact`, a `Dict` from field name to a function `(t, r, z) -> value`, as two dictionaries `(err, nrm)`. Integrated
with an order-6 triangle rule on the solver's dense output.
"""
function weighted_errors(sol, tt, exact)
dh = sol.disc_data.space.dh
U = sol.original_sol(tt)
sdh = only(dh.subdofhandlers)
geometry = Ferrite.geometric_interpolation(Ferrite.getcelltype(dh.grid))
rule = Ferrite.QuadratureRule{Ferrite.RefTriangle}(6)
values = Dict(f => Ferrite.CellValues(rule, Ferrite.getfieldinterpolation(sdh, f), geometry) for f in keys(exact))
err2, norm2 = Dict(f => 0.0 for f in keys(exact)), Dict(f => 0.0 for f in keys(exact))
for cell in Ferrite.CellIterator(dh)
dofs, xs = Ferrite.celldofs(cell), Ferrite.getcoordinates(cell)
for (f, exact_f) in exact
cv = values[f]
Ferrite.reinit!(cv, xs)
local_dofs = U[dofs[Ferrite.dof_range(sdh, f)]]
for q in 1:Ferrite.getnquadpoints(cv)
X = Ferrite.spatial_coordinate(cv, q, xs)
weight = Ferrite.getdetJdV(cv, q) * X[1]
value = exact_f(tt, X[1], X[2])
err2[f] += (Ferrite.function_value(cv, q, local_dofs) - value)^2 * weight
norm2[f] += value^2 * weight
end
end
end
return Dict(f => sqrt(err2[f]) for f in keys(exact)), Dict(f => sqrt(norm2[f]) for f in keys(exact))
end

"""
axisym_errors(sol, tt)

Relative r-weighted L² errors of the swirl solution at `tt` against `EXACT_FUNCTIONS`, as `(velocity, pressure)`;
the velocity error combines the three components.
"""
function axisym_errors(sol, tt)
err, nrm = weighted_errors(sol, tt, EXACT_FUNCTIONS)
velocity = (:ur, :ut, :uz)
return sqrt(sum(err[f]^2 for f in velocity) / sum(nrm[f]^2 for f in velocity)), err[:p] / nrm[:p]
end

# A fresh Newton matrix every step (`new_W_dt_cutoff = 0`): with the default cutoff the pressure error at t = 0.5 is
# 22% larger at c = 0.05 (the velocity is unchanged) for a solve that is 16% faster.
const AXISYM_ALG = DFBDF(nlsolve = NLNewton(new_W_dt_cutoff = 0), linsolve = UMFPACKFactorization())

"""
axisym_solve(; c = 0.1, tau_end = 1e-2, tol = 1e-8, alg = AXISYM_ALG, report = (0.5, 0.9, 0.99))

Mesh, discretize and solve to `t = 1 - tau_end`, and return the solution with the unknown count, the cell count,
the wall times and the relative errors `(t, velocity, pressure)` at the `report` times that were reached.
"""
function axisym_solve(; c = 0.1, tau_end = 1.0e-2, tol = 1.0e-8, alg = AXISYM_ALG, report = (0.5, 0.9, 0.99))
tend = 1 - tau_end
mesh_s = @elapsed grid = axisym_grid(; c, tau_end)
build_s = @elapsed prob = axisym_problem(grid; tend, abstol = tol)
saveat = [tt for tt in report if tt <= tend]
solve_s = @elapsed sol = solve(prob, alg; reltol = tol, saveat)
errors = [(tt, axisym_errors(sol, tt)...) for tt in saveat]
return (; sol, prob, ncells = Ferrite.getncells(grid), ndofs = length(prob.u0), mesh_s, build_s, solve_s, errors)
end

if abspath(PROGRAM_FILE) == @__FILE__
c = length(ARGS) >= 1 ? parse(Float64, ARGS[1]) : 0.1
tau_end = length(ARGS) >= 2 ? parse(Float64, ARGS[2]) : 1.0e-2
run = axisym_solve(; c, tau_end)
println("c = $c, tau_end = $tau_end: $(run.ncells) cells, $(run.ndofs) unknowns, solve $(round(run.solve_s; digits = 1)) s")
for (tt, velocity, pressure) in run.errors
println(" t = $tt: velocity error $velocity, pressure error $pressure")
end
end
17 changes: 17 additions & 0 deletions examples/axisym_swirl/checksum.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# FNV-1a checksums of the files the committed images of the axisymmetric swirl page are rendered from. Each checksum
# is committed next to its images (docs/src/assets/axisym_swirl.fnv1a for the two figures, axisym_swirl_animation.fnv1a
# for the animation) and test/NavierStokes/axisym_swirl.jl fails when these files change without a re-render with
# `julia --project=docs examples/axisym_swirl/figures.jl` or `animation.jl`.
const FIGURE_SOURCES = ("mesh.geo", "manufactured.jl", "axisym_swirl.jl", "figures.jl")
const ANIMATION_SOURCES = ("mesh.geo", "manufactured.jl", "axisym_swirl.jl", "animation.jl")

function sources_hash(files, directory = @__DIR__)
checksum = 0xcbf29ce484222325
for file in files, byte in read(joinpath(directory, file))
checksum = (checksum ⊻ byte) * 0x00000100000001b3
end
return string(checksum; base = 16, pad = 16)
end

figure_sources_hash(directory = @__DIR__) = sources_hash(FIGURE_SOURCES, directory)
animation_sources_hash(directory = @__DIR__) = sources_hash(ANIMATION_SOURCES, directory)
58 changes: 58 additions & 0 deletions examples/axisym_swirl/figures.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Renders the two figures of docs/src/axisymmetric_swirl.md into docs/src/assets (committed; the documentation
# build does not solve anything). From the repository root, with the docs environment (it has CairoMakie):
#
# julia --project=docs examples/axisym_swirl/figures.jl
#
# One solve at c = 0.1, tau_end = 1e-2 (32k unknowns, about half a minute after compilation). Rendering also
# writes the checksum of the source files that test/NavierStokes/axisym_swirl.jl compares.
using CairoMakie

include(joinpath(@__DIR__, "axisym_swirl.jl"))
include(joinpath(@__DIR__, "checksum.jl"))

const AXISYM_ASSETS = joinpath(@__DIR__, "..", "..", "docs", "src", "assets")

function render_axisym_figures(directory = AXISYM_ASSETS; c = 0.1, tau_end = 1.0e-2)
mkpath(directory)
grid = axisym_grid(; c, tau_end)
nodes = [Ferrite.get_node_coordinate(n).data for n in Ferrite.getnodes(grid)]
edges = Point2f[]
for cell in Ferrite.getcells(grid), (a, b) in ((1, 2), (2, 3), (3, 1))
push!(edges, Point2f(nodes[cell.nodes[a]]), Point2f(nodes[cell.nodes[b]]), Point2f(NaN, NaN))
end
fig = Figure(size = (900, 430))
for (k, (extent, title)) in enumerate(((8.0, "whole domain"), (0.3, "within 0.3 of the origin")))
ax = Axis(fig[1, k]; title, xlabel = "r", ylabel = "z", aspect = DataAspect(), limits = (0, extent, -extent, extent))
lines!(ax, edges; linewidth = 0.4, color = :black)
end
save(joinpath(directory, "axisym_mesh.png"), fig; px_per_unit = 1)

report = vcat(0.05:0.05:0.95, 0.96:0.01:0.99)
run = axisym_solve(; c, tau_end, report)
fig = Figure(size = (950, 780))
for (k, tt) in enumerate((0.5, 0.9, 0.99))
scale = sqrt(1 - tt)
rs, zs = range(0, 3scale, 120), range(-3scale, 3scale, 240)
swirl = run.sol(tt, collect(rs), collect(zs); dv = ut(t, r, z))
ax = Axis(
fig[1, k]; title = "swirl u_θ at t = $tt", xlabel = "r", ylabel = k == 1 ? "z" : "",
aspect = DataAspect()
)
hm = heatmap!(ax, rs, zs, swirl; colormap = :viridis)
Colorbar(fig[2, k], hm; vertical = false, flipaxis = false)
end
ax = Axis(
fig[3, 1:3]; xlabel = "t", ylabel = "relative r-weighted L² error", yscale = log10,
title = "c = $c: the error stays flat while the core collapses"
)
scatterlines!(ax, [e[1] for e in run.errors], [e[2] for e in run.errors]; label = "velocity")
scatterlines!(ax, [e[1] for e in run.errors], [e[3] for e in run.errors]; label = "pressure")
axislegend(ax; position = :rc)
save(joinpath(directory, "axisym_core.png"), fig; px_per_unit = 1)
write(joinpath(directory, "axisym_swirl.fnv1a"), figure_sources_hash() * "\n")
return directory
end

if abspath(PROGRAM_FILE) == @__FILE__
render_axisym_figures(isempty(ARGS) ? AXISYM_ASSETS : ARGS[1])
end
45 changes: 45 additions & 0 deletions examples/axisym_swirl/linear_residual.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Accuracy of the sparse direct solvers on the Newton matrix of the axisymmetric swirl problem.
#
# julia --project=docs examples/axisym_swirl/linear_residual.jl extract c t_stop file
# julia --project=docs examples/axisym_swirl/linear_residual.jl solve file umfpack|klu
#
# `extract` steps the integrator to `t_stop`, then writes the Newton matrix W = dF/du + γ dF/d(du) at that state
# (γ is the one DFBDF built its own W with) and a representative right-hand side to `file`: minus the residual at the
# accepted state with the time advanced by one step. It is not DFBDF's own Newton right-hand side, which uses the
# predicted state, so the check is of the solver on this matrix with a right-hand side of the right size and kind. `solve`
# factorizes the saved matrix once with the named solver, in a process of its own so that the peak memory is that
# solver's, and prints the factorization time and the relative residual ‖W x - b‖ / ‖b‖.
using LinearAlgebra, SparseArrays, Serialization, Printf
using LinearSolve: LinearSolve, LinearProblem, KLUFactorization, init
using SciMLBase: SciMLBase, step!, solve!

if ARGS[1] == "extract"
include(joinpath(@__DIR__, "axisym_swirl.jl"))
c, t_stop, file = parse(Float64, ARGS[2]), parse(Float64, ARGS[3]), ARGS[4]
prob = axisym_problem(axisym_grid(; c, tau_end = 1.0e-2); tend = 0.99)
integ = SciMLBase.init(prob, AXISYM_ALG; reltol = 1.0e-8, save_everystep = false)
while integ.t < t_stop
step!(integ)
end
stats = integ.stats
@printf("t = %.4g, dt = %.3g, steps %d, Newton iterations %d, Newton failures %d\n", integ.t, integ.dt, stats.naccept, stats.nnonliniter, stats.nnonlinconvfail)
γ = integ.cache.nlsolver.cache.W_γdt
u, du, p, tt = copy(integ.u), copy(integ.du), integ.p, integ.t
W = copy(prob.f.jac_prototype)
prob.f.jac(W, du, u, p, γ, tt)
residual = zeros(length(u))
prob.f.f(residual, du, u, p, tt + integ.dt)
serialize(file, (; W, b = -residual, γ, t = tt, naccept = stats.naccept, newton = stats.nnonliniter))
@printf("saved %s: %d unknowns, %d nonzeros\n", file, size(W, 1), nnz(W))
else
W, b = let m = deserialize(ARGS[2])
m.W, m.b
end
solver = ARGS[3] == "klu" ? KLUFactorization() : LinearSolve.UMFPACKFactorization()
cache = init(LinearProblem(W, b), solver)
factor_s = @elapsed x = solve!(cache).u
@printf(
"%s: %d unknowns, factor+solve %.1f s, relative residual %.3e, peak memory %.2f GiB\n",
ARGS[3], size(W, 1), factor_s, norm(W * x - b) / norm(b), Sys.maxrss() / 2^30
)
end
Loading
Loading