Different subdivisions for mesh segment

This commit is contained in:
Nuwan Yapa 2024-04-25 11:32:52 -04:00
parent 4f166f1ada
commit 13494df20b
5 changed files with 12 additions and 12 deletions

View File

@ -1,8 +1,8 @@
using Plots, LinearAlgebra
include("p_space.jl")
berggren_mesh = get_mesh((0, 0.4 - 0.15im, 0.8, 6), 128)
csm_mesh = get_mesh((0, 8 - 3im), 512)
berggren_mesh = get_mesh([0, 0.4 - 0.15im, 0.8, 6], [128, 128, 128])
csm_mesh = get_mesh([0, 8 - 3im], [512])
for mesh in (berggren_mesh, csm_mesh)
p, w = mesh

View File

@ -16,8 +16,8 @@
"metadata": {},
"outputs": [],
"source": [
"vertices = (0, 0.4 - 0.15im, 0.8, 6)\n",
"subdivisions = 128\n",
"vertices = [0, 0.4 - 0.15im, 0.8, 6]\n",
"subdivisions = [128, 128, 128]\n",
"p, w = get_mesh(vertices, subdivisions)\n",
"mesh_E = p.*p ./ (2*0.5)\n",
"\n",

View File

@ -13,11 +13,11 @@ function gausslegendre_shifted(a, b, n)
return (p, w)
end
function get_mesh(vertices, subdivisions)
function get_mesh(vertices::Vector, subdivs::Vector)
p = Vector{ComplexF64}()
w = Vector{ComplexF64}()
for (a, b) in zip(vertices, vertices[2:end])
p_new, w_new = gausslegendre_shifted(a, b, subdivisions)
for (a, b, subdiv) in zip(vertices, vertices[2:end], subdivs)
p_new, w_new = gausslegendre_shifted(a, b, subdiv)
append!(p, p_new)
append!(w, w_new)
end
@ -46,7 +46,7 @@ function identify_pole_i(p, evals, μ=0.5)
end
function quick_pole_E(V_pq, μ=0.5; cs_angle=0.4, cutoff=8.0, meshpoints=256)
p, w = get_mesh([0, cutoff * exp(-1im * cs_angle)], meshpoints)
p, w = get_mesh([0, cutoff * exp(-1im * cs_angle)], [meshpoints])
evals = eigvals(get_H_matrix(V_pq, p, w, μ))
return evals[identify_pole_i(p, evals, μ)]
end

View File

@ -16,8 +16,8 @@
"metadata": {},
"outputs": [],
"source": [
"vertices = (0, 1 - 0.5im, 2, 6)\n",
"subdivisions = 64\n",
"vertices = [0, 1 - 0.5im, 2, 6]\n",
"subdivisions = [64, 64, 64]\n",
"p, w = get_mesh(vertices, subdivisions)\n",
"\n",
"scatter(real.(p), imag.(p))"

View File

@ -16,8 +16,8 @@
"metadata": {},
"outputs": [],
"source": [
"vertices = (0, 0.5 - 0.3im, 1, 6)\n",
"subdivisions = 64\n",
"vertices = [0, 0.5 - 0.3im, 1, 6]\n",
"subdivisions = [64, 64, 64]\n",
"p, w = get_mesh(vertices, subdivisions)\n",
"\n",
"# resonance example from my thesis\n",