Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

WIP: refining elliptic-grid-gen.jl #26

Closed
Closed
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "submodules/gmsh"]
path = submodules/gmsh
url = https://github.com/live-clones/gmsh.git
[submodule "submodules/SchwarzChristoffel.jl"]
path = submodules/SchwarzChristoffel.jl
url = https://github.com/jdeldre/SchwarzChristoffel.jl.git
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"git.fetchOnPull": true,
"git.useCommitInputAsStashMessage": true,
"cSpell.words": [
"eltype"
"eltype",
"myblue",
"normp",
"println",
"xlims",
"ylims"
]
}
22 changes: 20 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ git-tree-sha1 = "3ebb967819b284dc1e3c0422229b58a40a255649"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
version = "0.26.3"

[[DocumenterTools]]
deps = ["Base64", "DocStringExtensions", "Documenter", "FileWatching", "LibGit2", "Sass"]
git-tree-sha1 = "fd313c343451ff8f88ff711662ea13f9629b9a58"
uuid = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
version = "0.1.10"

[[DoubleFloats]]
deps = ["LinearAlgebra", "Polynomials", "Printf", "Quadmath", "Random", "Requires", "SpecialFunctions"]
git-tree-sha1 = "2e43ebdac158a9ccb42aed91f0be658d6bb5f81c"
Expand Down Expand Up @@ -1348,9 +1354,9 @@ uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[ProgressMeter]]
deps = ["Distributed", "Printf"]
git-tree-sha1 = "6e9c89cba09f6ef134b00e10625590746ba1e036"
git-tree-sha1 = "d85d8f0339a9937afac93e152c76f4745b386202"
uuid = "92933f4c-e287-5a05-a399-4b506db050ca"
version = "1.5.0"
version = "1.6.0"

[[Qt5Base_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "xkbcommon_jll"]
Expand Down Expand Up @@ -1523,6 +1529,12 @@ git-tree-sha1 = "36ebc5622c82eb9324005cc75e7e2cc51181d181"
uuid = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
version = "0.0.1"

[[Sass]]
deps = ["libsass_jll"]
git-tree-sha1 = "aa841c3738cec78b5dbccd56dda332710f35f6a5"
uuid = "322a6be2-4ae8-5d68-aaf1-3e960788d1d9"
version = "0.2.0"

[[SciMLBase]]
deps = ["ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "RecipesBase", "RecursiveArrayTools", "StaticArrays", "Statistics", "Tables", "TreeViews"]
git-tree-sha1 = "5d91d6098eaffa03eb371f3f3699f01983ba174e"
Expand Down Expand Up @@ -2107,6 +2119,12 @@ git-tree-sha1 = "6abbc424248097d69c0c87ba50fcb0753f93e0ee"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.37+6"

[[libsass_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "663428b7ebaf60c60ee147f0f9466430e9959ad6"
uuid = "47bcb7c8-5119-555a-9eeb-0afcc36cd728"
version = "3.5.5+0"

[[libsodium_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "848ab3d00fe39d6fbc2a8641048f8f272af1c51e"
Expand Down
36 changes: 20 additions & 16 deletions Project-1/example/demo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
using Pkg
Pkg.activate(normpath(joinpath(@__DIR__, "../..")))
# using Revise
using BenchmarkTools
using Plots
using OffsetArrays

myblue = RGB(0.368417, 0.506779, 0.709798) # <==> 94, 129, 181 (the default style in Wolfram Mathematica)
using BenchmarkTools, ProgressMeter
using Plots, OffsetArrays, LinearAlgebra

"""
yt0012(ξ)
Expand Down Expand Up @@ -58,7 +55,7 @@ Base.@pure function yt0012(ξ::T where {T<:Real})
end)
end

const Mx, My = 100+1, 20+1
const Mx, My = 100+1, 100+1

include(normpath(joinpath(@__DIR__, "../../src/misc-util.jl")))
using .__CFD2021__misc_util__: tuplejoin
Expand All @@ -71,6 +68,8 @@ using .__CFD2021__misc_util__: tuplejoin
```
"""

include(normpath(joinpath(@__DIR__, "../src/visualization.jl")))

include(normpath(joinpath(@__DIR__, "../src/transfinite-interpolate.jl")))
import .transfinite_interpolate: transfinite_interpolate_2d!, transfinite_interpolate_2d

Expand Down Expand Up @@ -121,15 +120,20 @@ y_hi = (5sinpi.(LinRange(1, 0, Mx)), [LinRange(0, 0, My)...]);
```
"""

p = plot(; xlims=(-5, 5), ylims=(-5, 5), aspect_ratio=:equal)
# p = plot(xlims = (-.6, .6), ylims = (0, .5), aspect_ratio = :equal)
interpolated_x = Array{Float64}(undef, (length(v) for v in x_lo)...);
interpolated_y = Array{Float64}(undef, (length(v) for v in y_lo)...);
@btime transfinite_interpolate_2d!(interpolated_x, x_lo, x_hi)
@btime transfinite_interpolate_2d!(interpolated_y, y_lo, y_hi)
for u in axes(interpolated_x)[begin] plot!(p,interpolated_x[u,:], interpolated_y[u,:], label = nothing, color = myblue); end
for u in axes(interpolated_x)[ end ] plot!(p,interpolated_x[:,u], interpolated_y[:,u], label = nothing, color = myblue); end
# for u in axes(interpolated_x)[begin] plot!(p,interpolated_x[u,:],-interpolated_y[u,:], label = nothing, color = myblue); end
# for u in axes(interpolated_x)[ end ] plot!(p,interpolated_x[:,u],-interpolated_y[:,u], label = nothing, color = myblue); end
plot!(p, yt0012, 0, 1; label=nothing, color=:red)
display(p) # savefig(normpath(joinpath(@__DIR__, "img/tf-hO.svg")))
#= @btime =# transfinite_interpolate_2d!(interpolated_x, x_lo, x_hi)
#= @btime =# transfinite_interpolate_2d!(interpolated_y, y_lo, y_hi)
p = plot(; xlims=(-5,5), ylims=(-5,5), aspect_ratio=:equal)
# p = grid_plot!(p, interpolated_x, interpolated_y; title="tf", mirror=true, xlims=(-5, 5), ylims=(-5, 5), aspect_ratio=:equal)
# savefig(normpath(joinpath(@__DIR__, "img/tf-hO.png")))

include(normpath(joinpath(@__DIR__, "../src/elliptic-grid-gen.jl")))
import .elliptic_grid_gen: inverted_poisson_2d_jacobi_step , inverted_poisson_2d_jacobi_step! ,
inverted_poisson_2d_jacobi_iterate, inverted_poisson_2d_jacobi_iterate!
P = Q = ((x, y)->(norm([x, y]-[-3., 3.])) < 1. ? 20. : 0. )
inverted_poisson_2d_jacobi_iterate!(interpolated_x, interpolated_y, 1e-2, nothing, P, Q, 2.)
p = plot(; xlims=(-5,5), ylims=(-5,5), aspect_ratio=:equal)
p = grid_plot!(p, interpolated_x, interpolated_y; title="el", mirror=true, xlims=(-5, 5), ylims=(-5, 5), aspect_ratio=:equal)
display(p)
# savefig(normpath(joinpath(@__DIR__, "img/el-hO.png")))
Loading