Skip to content

Commit

Permalink
plot - update histogram normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Apr 5, 2024
1 parent 9ce6deb commit c3f82f1
Show file tree
Hide file tree
Showing 26 changed files with 4,599 additions and 0 deletions.
12 changes: 12 additions & 0 deletions papers/high-order-bddc-2023/.gitignore
@@ -0,0 +1,12 @@
.*.swp
*.aux
*.bbl
*.blg
*.fdb_latexmk
*.fls
*.log
*.out
*.pdf
*.synctex.gz
*.thm
siamart.cls
33 changes: 33 additions & 0 deletions papers/high-order-bddc-2023/data/bddc-condition-numbers-32.csv
@@ -0,0 +1,33 @@
p,m,kind,θ,λ_min,λ_max,κ
1,4,lumped,1,0.999999999999919,4.44354670514879,4.44354670514915
1,4,lumped,1,0.999999999999919,4.44354670514879,4.44354670514915
1,4,dirichlet,0,0.999999999999946,2.34861818767369,2.34861818767381
1,4,dirichlet,-0.0625,0.999999999999946,2.34861818767369,2.34861818767381
1,6,lumped,1,0.99999999999986,8.16263332834066,8.16263332834181
1,6,lumped,1,0.99999999999986,8.16263332834066,8.16263332834181
1,6,dirichlet,0,0.999999999999777,2.82522182919664,2.82522182919727
1,6,dirichlet,-0.0625,0.999999999999777,2.82522182919664,2.82522182919727
1,8,lumped,1,0.99999999999969,12.2685887833641,12.2685887833679
1,8,lumped,1,0.99999999999969,12.2685887833641,12.2685887833679
1,8,dirichlet,-0.0625,0.999999999999503,3.19260786785099,3.19260786785258
1,8,dirichlet,0,0.999999999999503,3.19260786785099,3.19260786785258
1,10,lumped,1,0.999999999999688,16.6712358297221,16.6712358297273
1,10,lumped,1,0.999999999999688,16.6712358297221,16.6712358297273
1,10,dirichlet,-0.0625,0.999999999999389,3.49525132179121,3.49525132179335
1,10,dirichlet,0,0.999999999999389,3.49525132179121,3.49525132179335
1,12,lumped,1,0.999999999999248,21.314347684091,21.314347684107
1,12,lumped,1,0.999999999999248,21.314347684091,21.314347684107
1,12,dirichlet,-0.0625,0.999999999999161,3.75422422223343,3.75422422223658
1,12,dirichlet,0,0.999999999999161,3.75422422223343,3.75422422223658
1,14,lumped,1,0.99999999999943,26.1594484432303,26.1594484432452
1,14,lumped,1,0.99999999999943,26.1594484432303,26.1594484432452
1,14,dirichlet,0,0.999999999998964,3.98147178391333,3.98147178391745
1,14,dirichlet,-0.0625,0.999999999998964,3.98147178391333,3.98147178391745
1,16,lumped,1,0.999999999999456,31.1786033591328,31.1786033591497
1,16,lumped,1,0.999999999999456,31.1786033591328,31.1786033591497
1,16,dirichlet,0,0.999999999998699,4.18449860326451,4.18449860326995
1,16,dirichlet,-0.0625,0.999999999998699,4.18449860326451,4.18449860326995
1,32,lumped,1,0.999999999998981,75.761107494851,75.7611074949282
1,32,lumped,1,0.999999999998981,75.761107494851,75.7611074949282
1,32,dirichlet,0,0.999999999995734,5.33120628628446,5.3312062863072
1,32,dirichlet,-0.0625,0.999999999995734,5.33120628628446,5.3312062863072
17 changes: 17 additions & 0 deletions papers/high-order-bddc-2023/data/bddc-condition-numbers-64.csv
@@ -0,0 +1,17 @@
p,m,kind,θ,λ_min,λ_max,κ
1,4,lumped,1.0,0.9999999999995242,4.443546705148792,4.443546705150907
1,4,lumped,1.0,0.9999999999995242,4.443546705148792,4.443546705150907
1,4,dirichlet,0.0,0.9999999999996358,2.3508069384136467,2.350806938414503
1,4,dirichlet,-0.031250000000000035,0.9999999999996358,2.3508069384136467,2.350806938414503
1,8,lumped,1.0,0.999999999999014,12.268588783364079,12.268588783376176
1,8,lumped,1.0,0.999999999999014,12.268588783364079,12.268588783376176
1,8,dirichlet,-0.031250000000000035,0.999999999998345,3.1956201298283142,3.195620129833603
1,8,dirichlet,0.0,0.999999999998345,3.1956201298283142,3.195620129833603
1,16,lumped,1.0,0.9999999999973945,31.17860335913278,31.178603359214016
1,16,lumped,1.0,0.9999999999973945,31.17860335913278,31.178603359214016
1,16,dirichlet,0.0,0.9999999999945208,4.188166252021851,4.188166252044799
1,16,dirichlet,-0.031250000000000035,0.9999999999945208,4.188166252021851,4.188166252044799
1,32,lumped,1.0,0.9999999999961624,75.76110749485096,75.7611074951417
1,32,lumped,1.0,0.9999999999961624,75.76110749485096,75.7611074951417
1,32,dirichlet,0.0,0.9999999999831699,5.3354780255459175,5.335478025635714
1,32,dirichlet,-0.031250000000000035,0.9999999999831699,5.3354780255459175,5.335478025635714
@@ -0,0 +1,13 @@
p,m,kind,θ,λ_min,λ_max,κ
2,1,Dirichlet,1.0,0.9999999999999472,2.0416666666666665,2.0416666666667744
2,1,Dirichlet,0.0,0.9999999999999472,2.0416666666666665,2.0416666666667744
3,1,Dirichlet,-0.0625,0.999999999999844,2.614399208665368,2.6143992086657755
3,1,Dirichlet,0.0,0.999999999999844,2.614399208665368,2.6143992086657755
4,1,Dirichlet,-0.0625,0.9999999999996337,3.2414831312996704,3.2414831313008574
4,1,Dirichlet,0.0,0.9999999999996337,3.2414831312996704,3.2414831313008574
8,1,Dirichlet,-0.0625,0.999999999998532,5.194529913448625,5.194529913456251
8,1,Dirichlet,0.0,0.999999999998532,5.194529913448625,5.194529913456251
16,1,Dirichlet,0.0,0.999999999993277,7.756317490204899,7.756317490257044
16,1,Dirichlet,-0.0625,0.999999999993277,7.756317490204899,7.756317490257044
32,1,Dirichlet,-0.0625,0.9999999999587119,10.96078129475398,10.96078129520653
32,1,Dirichlet,0.0,0.9999999999587119,10.96078129475398,10.96078129520653
@@ -0,0 +1,13 @@
p,m,kind,θ,λ_min,λ_max,κ
2,2,Dirichlet,0.0,0.9999999999998268,2.7000272676727954,2.700027267673263
2,2,Dirichlet,-0.0625,0.9999999999998268,2.7000272676727954,2.700027267673263
3,2,Dirichlet,-0.0625,0.9999999999992926,3.567928437112254,3.5679284371147784
3,2,Dirichlet,0.0,0.9999999999992926,3.567928437112254,3.5679284371147784
4,2,Dirichlet,-0.0625,0.9999999999988743,4.305060011561867,4.305060011566713
4,2,Dirichlet,0.0,0.9999999999988743,4.305060011561867,4.305060011566713
8,2,Dirichlet,-0.0625,0.9999999999952132,6.510880021845141,6.510880021876307
8,2,Dirichlet,0.0,0.9999999999952132,6.510880021845141,6.510880021876307
16,2,Dirichlet,-0.0625,0.9999999999808564,9.353764059470207,9.35376405964927
16,2,Dirichlet,0.0,0.9999999999808564,9.353764059470207,9.35376405964927
32,2,Dirichlet,0.0,0.9999999998855446,12.85606582669229,12.856065828163738
32,2,Dirichlet,-0.0625,0.9999999998855446,12.85606582669229,12.856065828163738
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions papers/high-order-bddc-2023/jupyter/.gitignore
@@ -0,0 +1,5 @@
# Jupyter notebook checkpoint files
.ipynb_checkpoints/

# File generated by Pkg, the package manager, based on a corresponding Project.toml
Manifest.toml
@@ -0,0 +1,116 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Dirichlet BDDC Example"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# dependencies\n",
"using Pkg\n",
"Pkg.activate(\"./\")\n",
"Pkg.instantiate()\n",
"using LFAToolkit\n",
"using LinearAlgebra\n",
"using Plots"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"code_folding": []
},
"outputs": [],
"source": [
"# setup\n",
"p = 4\n",
"mesh = Mesh2D(1.0, 1.0)\n",
"\n",
"# diffusion operator\n",
"diffusion = GalleryOperator(\"diffusion\", p + 1, p + 2, mesh)\n",
"\n",
"# Dirichlet BDDC smoother\n",
"bddc = DirichletBDDC(diffusion)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"code_folding": [
14,
16,
27
],
"scrolled": true
},
"outputs": [],
"source": [
"# full operator symbols\n",
"numbersteps = 4\n",
"maxeigenvalue = 0\n",
"θ_min = -π/2\n",
"θ_max = 3π/2\n",
"θ_step = (2π-2π/numbersteps)/(numbersteps-1)\n",
"θ_range = θ_min:θ_step:θ_max\n",
"\n",
"# compute and plot smoothing factor\n",
"# setup\n",
"ω = [1.0]\n",
"eigenvalues = []\n",
"\n",
"# compute\n",
"for i in 1:numbersteps, j in 1:numbersteps\n",
" θ = [θ_range[i], θ_range[j]]\n",
" if sqrt(abs(θ[1])^2 + abs(θ[2])^2) > π/128\n",
" A = computesymbols(bddc, ω, θ)\n",
" currenteigenvalues = [abs(val) for val in eigvals(I - A)]\n",
" push!(eigenvalues, currenteigenvalues)\n",
" end\n",
"end\n",
"\n",
"# plot\n",
"histogram(\n",
" eigenvalues,\n",
" title=\"Dirichlet BDDC Eigenvalues\",\n",
" legend=false,\n",
" aspect_ratio=:equal,\n",
" normalize=:density,\n",
" color=:cividis\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"savefig(\"DirichletBDDCHighOrderEigenvalues\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.2",
"language": "julia",
"name": "julia-1.9"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
126 changes: 126 additions & 0 deletions papers/high-order-bddc-2023/jupyter/Dirichlet-BDDC-High-Order.ipynb
@@ -0,0 +1,126 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Dirichlet BDDC Example"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# dependencies\n",
"using Pkg\n",
"Pkg.activate(\"./\")\n",
"Pkg.instantiate()\n",
"using LFAToolkit\n",
"using LinearAlgebra\n",
"using Plots"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"code_folding": []
},
"outputs": [],
"source": [
"# setup\n",
"p = 4\n",
"mesh = Mesh2D(1.0, 1.0)\n",
"\n",
"# diffusion operator\n",
"diffusion = GalleryOperator(\"diffusion\", p + 1, p + 2, mesh)\n",
"\n",
"# Dirichlet BDDC smoother\n",
"bddc = DirichletBDDC(diffusion)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"code_folding": [
14,
16,
27
],
"scrolled": true
},
"outputs": [],
"source": [
"# full operator symbols\n",
"numbersteps = 250\n",
"maxeigenvalue = 0\n",
"θ_min = -π/2\n",
"θ_max = 3π/2\n",
"θ_step = 2π/(numbersteps-1)\n",
"θ_range = θ_min:θ_step:θ_max\n",
"\n",
"# compute and plot smoothing factor\n",
"# setup\n",
"ω = [1.0]\n",
"maxeigenvalues = zeros(numbersteps, numbersteps)\n",
"\n",
"# compute\n",
"for i in 1:numbersteps, j in 1:numbersteps\n",
" θ = [θ_range[i], θ_range[j]]\n",
" if sqrt(abs(θ[1])^2 + abs(θ[2])^2) > π/128\n",
" A = computesymbols(bddc, ω, θ)\n",
" eigenvalues = [abs(val) for val in eigvals(I - A)]\n",
" maxeigenvalues[i, j] = max(eigenvalues...)\n",
" maxeigenvalue = max(maxeigenvalue, maxeigenvalues[i, j])\n",
" end\n",
"end\n",
"\n",
"# plot\n",
"println(\"max eigenvalue: \", maxeigenvalue)\n",
"xrange = θ_range/π\n",
"heatmap(\n",
" xrange,\n",
" xlabel=\"θ/π\",\n",
" xtickfont=font(12, \"Courier\"),\n",
" xrange,\n",
" ylabel=\"θ/π\",\n",
" ytickfont=font(12, \"Courier\"),\n",
" maxeigenvalues,\n",
" title=\"Dirichlet BDDC Symbol\",\n",
" transpose=true,\n",
" aspect_ratio=:equal,\n",
" color=:cividis\n",
")\n",
"xlims!(θ_min/π, θ_max/π)\n",
"ylims!(θ_min/π, θ_max/π)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"savefig(\"DirichletBDDCHighOrder\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.2",
"language": "julia",
"name": "julia-1.9"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit c3f82f1

Please sign in to comment.