Skip to content

Commit

Permalink
Add in the images
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVandH committed Feb 27, 2023
1 parent 7133dd2 commit 6ab2cd8
Show file tree
Hide file tree
Showing 17 changed files with 380 additions and 369 deletions.
3 changes: 2 additions & 1 deletion docs/src/mean_exit_time.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ using CairoMakie
using OrdinaryDiffEq
using SteadyStateDiffEq
using LinearSolve
using LinearAlgebra
using FastLapackInterface

R = 1.0
Expand Down Expand Up @@ -359,7 +360,7 @@ prob = FVMProblem(mesh, BCs;
final_time=final_time,
initial_condition=initial_guess,
steady=true)
sol = solve(prob, DynamicSS(TRBDF2(linsolve=KrylovJL_GMRES())))
sol = solve(prob, DynamicSS(TRBDF2(linsolve=KrylovJL_GMRES())), parallel = true)
fig = Figure(fontsize=38)
ax = Axis(fig[1, 1], xlabel=L"x", ylabel=L"y", width=600, height=300)
pt_mat = Matrix(get_points(tri)')
Expand Down
Binary file added test/figures/annulus_mean_exit_time.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 test/figures/annulus_test.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 test/figures/ellipse_mean_exit_time.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 test/figures/laplace_equation.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 test/figures/perturbed_annulus_mean_exit_time.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 test/figures/perturbed_circle_mean_exit_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
313 changes: 0 additions & 313 deletions test/mean_exit_time.jl

This file was deleted.

54 changes: 54 additions & 0 deletions test/met_annulus.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

using ..FiniteVolumeMethod
using DelaunayTriangulation
using CairoMakie
using OrdinaryDiffEq
using SteadyStateDiffEq
using Test
using LinearAlgebra
using StatsBase
using LinearSolve
using Krylov
include("test_setup.jl")
R₁ = 2.0
R₂ = 3.0
θ = LinRange(0, 2π, 250)
x = [
[R₂ .* cos.(θ)],
[reverse(R₁ .* cos.(θ))] # inner boundaries are clockwise
]
y = [
[R₂ .* sin.(θ)],
[reverse(R₁ .* sin.(θ))] # inner boundaries are clockwise
]
tri = generate_mesh(x, y, 0.2; gmsh_path=GMSH_PATH)
mesh = FVMGeometry(tri)
outer_bc = (x, y, t, u, p) -> zero(u)
inner_bc = (x, y, t, u, p) -> zero(u)
type = [:D, :N]
BCs = BoundaryConditions(mesh, [outer_bc, inner_bc], type)
D = 6.25e-4
initial_guess = zeros(num_points(tri))
diffusion_function = (x, y, t, u, D) -> D
diffusion_parameters = D
reaction = (x, y, t, u, p) -> one(u)
final_time = Inf
prob = FVMProblem(mesh, BCs;
diffusion_function,
diffusion_parameters,
reaction_function=reaction,
final_time=final_time,
initial_condition=initial_guess,
steady=true)
sol = solve(prob, DynamicSS(TRBDF2(linsolve=KrylovJL_GMRES())))
fig = Figure(fontsize=38)
ax = Axis(fig[1, 1], xlabel=L"x", ylabel=L"y", width=600, height=300)
pt_mat = Matrix(get_points(tri)')
T_mat = [T[j] for T in each_triangle(tri), j in 1:3]
msh = mesh!(ax, pt_mat, T_mat, color=sol, colorrange=(0, 900))
Colorbar(fig[1, 2], msh)
resize_to_layout!(fig)
SAVE_FIGURE && save("figures/annulus_mean_exit_time.png", fig)
exact = [(R₂^2 - norm(p)^2) / (4D) + R₁^2 * log(norm(p) / R₂) / (2D) for p in each_point(tri)]
error_fnc = (fvm_sol, exact_sol) -> 100abs(fvm_sol - exact_sol) / maximum(exact)
@test median(error_fnc.(exact, sol)) < 0.1
Loading

0 comments on commit 6ab2cd8

Please sign in to comment.