Skip to content

Commit

Permalink
Merge pull request #101 from IntegralEquations/dev
Browse files Browse the repository at this point in the history
Minor improvements to the docstrings as well as some renaming.
  • Loading branch information
maltezfaria authored Oct 14, 2024
2 parents cc78dea + 5f0b313 commit 597cc23
Show file tree
Hide file tree
Showing 41 changed files with 786 additions and 678 deletions.
8 changes: 8 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project:
default: # default is the status check's name, not default settings
target: auto
threshold: 5
flags:
- unit
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
permissions:
contents: write
statuses: write
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand Down
6 changes: 3 additions & 3 deletions docs/src/examples/cavity2d_scattering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Q = Inti.Quadrature(Γ_msh; qorder)
println("Number of quadrature points: ", length(Q))

## Setup the integral operators
pde = Inti.Helmholtz(; dim = 2, k)
op = Inti.Helmholtz(; dim = 2, k)
S, D = Inti.single_double_layer(;
pde,
op
target = Q,
source = Q,
correction = (method = :none,),
Expand All @@ -76,7 +76,7 @@ L = I / 2 + LinearMap(D) - im * k * LinearMap(S)
σ = gmres(L, g; restart = 1000, maxiter = 400, abstol = 1e-4, verbose = true)

## Plot a heatmap of the solution
𝒮, 𝒟 = Inti.single_double_layer_potential(; pde, source = Q)
𝒮, 𝒟 = Inti.single_double_layer_potential(; op, source = Q)
u = (x) -> 𝒟[σ](x) - im * k * 𝒮[σ](x)
xx = yy = range(-2, 2; step = meshsize)
colorrange = (-2, 2)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/examples/graded_mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ Q = Inti.Quadrature(msh; qorder = 3)
##

## Create integral operators
pde = Inti.Helmholtz(; dim = 2, k)
op = Inti.Helmholtz(; dim = 2, k)
S, D = Inti.single_double_layer(;
pde,
op,
target = Q,
source = Q,
compression = (method = :fmm, tol = 1e-6),
correction = (method = :dim,),
)
L = I / 2 + D - im * k * S

𝒮, 𝒟 = Inti.single_double_layer_potential(; pde, source = Q)
𝒮, 𝒟 = Inti.single_double_layer_potential(; op, source = Q)

## Test with a source inside for validation
if TEST
G = Inti.SingleLayerKernel(pde)
G = Inti.SingleLayerKernel(op)
uₑ = x -> G(x, SVector(0.4, 0.4))
rhs = map(q -> uₑ(q.coords), Q)
σ = gmres(L, rhs; restart = 100, maxiter = 100, abstol = 1e-8, verbose = true)
Expand All @@ -76,7 +76,7 @@ if PLOT
target = [SVector(x, y) for x in xx, y in yy]

Spot, Dpot = Inti.single_double_layer(;
pde,
op,
target = target,
source = Q,
compression = (method = :fmm, tol = 1e-4),
Expand Down
18 changes: 9 additions & 9 deletions docs/src/examples/helmholtz_scattering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ abs(Inti.integrate(x -> 1, Q) - 2π)
# discrete approximation to the integral operators ``\mathrm{S}`` and
# ``\mathrm{D}`` as follows:

pde = Inti.Helmholtz(; k, dim = 2)
op = Inti.Helmholtz(; k, dim = 2)
S, D = Inti.single_double_layer(;
pde,
op,
target = Q,
source = Q,
compression = (method = :none,),
Expand Down Expand Up @@ -259,7 +259,7 @@ nothing #hide
# Inti.single_double_layer_potential) to obtain the single- and double-layer
# potentials, and then combine them as follows:

𝒮, 𝒟 = Inti.single_double_layer_potential(; pde, source = Q)
𝒮, 𝒟 = Inti.single_double_layer_potential(; op, source = Q)
uₛ = x -> 𝒟[σ](x) - im * k * 𝒮[σ](x)
nothing #hide

Expand Down Expand Up @@ -338,7 +338,7 @@ msh = Inti.meshgen(Γ; meshsize)
Γ_msh = view(msh, Γ)
Q = Inti.Quadrature(Γ_msh; qorder)
S, D = Inti.single_double_layer(;
pde,
op,
target = Q,
source = Q,
compression = (method = :none,),
Expand All @@ -347,7 +347,7 @@ S, D = Inti.single_double_layer(;
L = I / 2 + D - im * k * S
rhs = map(q -> -uᵢ(q.coords), Q)
σ = L \ rhs
𝒮, 𝒟 = Inti.single_double_layer_potential(; pde, source = Q)
𝒮, 𝒟 = Inti.single_double_layer_potential(; op, source = Q)
uₛ = x -> 𝒟[σ](x) - im * k * 𝒮[σ](x)
vals =
map(pt -> Inti.isinside(pt, Q) ? NaN : real(uₛ(pt) + uᵢ(pt)), Iterators.product(xx, yy))
Expand Down Expand Up @@ -445,9 +445,9 @@ nothing #hide
# Next we assemble the integral operators, indicating that we wish to compress
# them using hierarchical matrices:
using HMatrices
pde = Inti.Helmholtz(; k, dim = 3)
op = Inti.Helmholtz(; k, dim = 3)
S, D = Inti.single_double_layer(;
pde,
op,
target = Q,
source = Q,
compression = (method = :hmatrix, tol = 1e-4),
Expand Down Expand Up @@ -497,7 +497,7 @@ end

# As before, let us represent the solution using `IntegralPotential`s:

𝒮, 𝒟 = Inti.single_double_layer_potential(; pde, source = Q)
𝒮, 𝒟 = Inti.single_double_layer_potential(; op, source = Q)
uₛ = x -> 𝒟[σ](x) - im * k * 𝒮[σ](x)
nothing #hide

Expand Down Expand Up @@ -550,7 +550,7 @@ end
target = Inti.nodes(Σ_msh)

S, D = Inti.single_double_layer(;
pde,
op,
target,
source = Q,
compression = (method = :hmatrix, tol = 1e-4),
Expand Down
6 changes: 3 additions & 3 deletions docs/src/examples/lippmann_schwinger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ dict = Dict(E => Q for E in Inti.element_types(Ωₕ))
# ## Volume Integral Operators and Volume Integral Equations
using FMMLIB2D

pde = Inti.Helmholtz(; dim = 2, k = k₁)
op = Inti.Helmholtz(; dim = 2, k = k₁)

# With quadratures constructed on the volume, we can define a discrete approximation
# to the volume integral operator ``\mathcal{V}`` using VDIM.
V_d2d = Inti.volume_potential(;
pde,
op,
target = Ωₕ_quad,
source = Ωₕ_quad,
compression = (method = :fmm, tol = 1e-7),
Expand Down Expand Up @@ -124,7 +124,7 @@ u, hist =
gmres(L, rhs; log = true, abstol = 1e-7, verbose = false, restart = 200, maxiter = 200)
@show hist

𝒱 = Inti.IntegralPotential(Inti.SingleLayerKernel(pde), Ωₕ_quad)
𝒱 = Inti.IntegralPotential(Inti.SingleLayerKernel(op), Ωₕ_quad)

# The representation formula gives the solution in $\R^2 \setminus \Omega$:
= (x) -> uⁱ(x) - k₁^2 * 𝒱[refr_map_d.*u](x)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/examples/poisson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ fₑ = (x) -> -8 * uₑ(x)
# ## Boundary and integral operators
using FMM2D

pde = Inti.Laplace(; dim = 2)
op = Inti.Laplace(; dim = 2)

## Boundary operators
S_b2b, D_b2b = Inti.single_double_layer(;
pde,
op,
target = Γₕ_quad,
source = Γₕ_quad,
compression = (method = :fmm, tol = 1e-12),
correction = (method = :dim,),
)
S_b2d, D_b2d = Inti.single_double_layer(;
pde,
op,
target = Ωₕ_quad,
source = Γₕ_quad,
compression = (method = :fmm, tol = 1e-12),
Expand All @@ -127,14 +127,14 @@ S_b2d, D_b2d = Inti.single_double_layer(;

## Volume potentials
V_d2d = Inti.volume_potential(;
pde,
op,
target = Ωₕ_quad,
source = Ωₕ_quad,
compression = (method = :fmm, tol = 1e-12),
correction = (method = :dim, interpolation_order),
)
V_d2b = Inti.volume_potential(;
pde,
op,
target = Γₕ_quad,
source = Ωₕ_quad,
compression = (method = :fmm, tol = 1e-12),
Expand Down
14 changes: 7 additions & 7 deletions docs/src/examples/poisson.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ operator mapping to points on the boundary, i.e. operator:

```@example poisson
using FMM2D #to accelerate the maps
pde = Inti.Laplace(; dim = 2)
op = Inti.Laplace(; dim = 2)
# Newtonian potential mapping domain to boundary
V_d2b = Inti.volume_potential(;
pde,
op,
target = Γ_quad,
source = Ω_quad,
compression = (method = :fmm, tol = 1e-12),
Expand All @@ -144,7 +144,7 @@ equation:
```@example poisson
# Single and double layer operators on Γ
S_b2b, D_b2b = Inti.single_double_layer(;
pde,
op,
target = Γ_quad,
source = Γ_quad,
compression = (method = :fmm, tol = 1e-12),
Expand Down Expand Up @@ -193,8 +193,8 @@ nothing # hide
With the density function at hand, we can now reconstruct our approximate solution:

```@example poisson
G = Inti.SingleLayerKernel(pde)
dG = Inti.DoubleLayerKernel(pde)
G = Inti.SingleLayerKernel(op)
dG = Inti.DoubleLayerKernel(op)
𝒱 = Inti.IntegralPotential(G, Ω_quad)
𝒟 = Inti.IntegralPotential(dG, Γ_quad)
u = (x) -> 𝒱[f](x) + 𝒟[σ](x)
Expand Down Expand Up @@ -223,7 +223,7 @@ solution ``u`` at all the quadrature nodes of ``\Omega``:

```@example poisson
V_d2d = Inti.volume_potential(;
pde,
op,
target = Ω_quad,
source = Ω_quad,
compression = (method = :fmm, tol = 1e-8),
Expand All @@ -236,7 +236,7 @@ our mesh nodes:

```@example poisson
S_b2d, D_b2d = Inti.single_double_layer(;
pde,
op,
target = Ω_quad,
source = Γ_quad,
compression = (method = :fmm, tol = 1e-8),
Expand Down
10 changes: 5 additions & 5 deletions docs/src/examples/stokes_drag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ Q = Inti.Quadrature(Γ_msh; qorder = 2)
@show length(Q)
@show abs(Inti.integrate(x -> 1, Q) - 4π * R^2)

## the pde and its integral kernels
pde = Inti.Stokes(; dim = 3, μ)
G = Inti.SingleLayerKernel(pde)
dG = Inti.DoubleLayerKernel(pde)
## the op and its integral kernels
op = Inti.Stokes(; dim = 3, μ)
G = Inti.SingleLayerKernel(op)
dG = Inti.DoubleLayerKernel(op)

## choice of a integral representation
T = SVector{3,Float64}
Expand All @@ -85,7 +85,7 @@ Smat = Inti.assemble_matrix(Sop)

## integral operators defined on the boundary
S, D = Inti.single_double_layer(;
pde,
op,
target = Q,
source = Q,
compression = (method = :none,),
Expand Down
16 changes: 8 additions & 8 deletions docs/src/examples/transmission.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,36 @@ msh = Inti.import_mesh(name; dim = 2)

Q = Inti.Quadrature(Γ_msh; qorder)

pde= Inti.Helmholtz(; k = k₁, dim = 2)
pde= Inti.Helmholtz(; k = k₂, dim = 2)
op= Inti.Helmholtz(; k = k₁, dim = 2)
op= Inti.Helmholtz(; k = k₂, dim = 2)

using FMMLIB2D
S₁, D₁ = Inti.single_double_layer(;
pde = pde₁,
op = op₁,
target = Q,
source = Q,
compression = (method = :fmm, tol = :1e-8),
correction = (method = :dim, maxdist = 5 * meshsize),
)

K₁, N₁ = Inti.adj_double_layer_hypersingular(;
pde = pde₁,
op = op₁,
target = Q,
source = Q,
compression = (method = :fmm, tol = :1e-8),
correction = (method = :dim, maxdist = 5 * meshsize),
)

S₂, D₂ = Inti.single_double_layer(;
pde = pde₂,
op = op₂,
target = Q,
source = Q,
compression = (method = :fmm, tol = :1e-8),
correction = (method = :dim, maxdist = 5 * meshsize),
)

K₂, N₂ = Inti.adj_double_layer_hypersingular(;
pde = pde₂,
op = op₂,
target = Q,
source = Q,
compression = (method = :fmm, tol = :1e-8),
Expand Down Expand Up @@ -120,8 +120,8 @@ nQ = size(Q, 1)
sol = reshape(sol, nQ, 2)
φ, ψ = sol[:, 1], sol[:, 2]

𝒮₁, 𝒟₁ = Inti.single_double_layer_potential(; pde = pde₁, source = Q)
𝒮₂, 𝒟₂ = Inti.single_double_layer_potential(; pde = pde₂, source = Q)
𝒮₁, 𝒟₁ = Inti.single_double_layer_potential(; op = op₁, source = Q)
𝒮₂, 𝒟₂ = Inti.single_double_layer_potential(; op = op₂, source = Q)

v₁ = x -> 𝒟₁[φ](x) - 𝒮₁[ψ](x)
v₂ = x -> -𝒟₂[φ](x) + 𝒮₂[ψ](x)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ end
msh = Inti.meshgen(Γ; meshsize = 0.1)
Q = Inti.Quadrature(msh; qorder = 5)
# create the integral operators
pde = Inti.Laplace(;dim=2)
op = Inti.Laplace(;dim=2)
S, _ = Inti.single_double_layer(;
pde,
op,
target = Q,
source = Q,
compression = (method = :none,),
Expand All @@ -148,7 +148,7 @@ g = map(q -> uₑ(q.coords), Q) # value at quad nodes
# solve for σ
σ = S \ g
# use the single-layer potential to evaluate the solution
𝒮, 𝒟 = Inti.single_double_layer_potential(; pde, source = Q)
𝒮, 𝒟 = Inti.single_double_layer_potential(; op, source = Q)
uₕ = x -> 𝒮[σ](x)
```

Expand Down
Loading

0 comments on commit 597cc23

Please sign in to comment.