Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/laplace/laplace.jl @ 616:d9324671b412 feature/volume_and_boundary_operators
Use julian naming conventions
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 07 Dec 2020 11:57:36 +0100 |
parents | e71f2f81b5f8 |
children |
rev | line source |
---|---|
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
1 # """ |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
2 # Laplace{Dim,T<:Real,N,M,K} <: TensorMapping{T,Dim,Dim} |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
3 # |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
4 # Implements the Laplace operator `L` in Dim dimensions as a tensor operator |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
5 # The multi-dimensional tensor operator consists of a tuple of 1D SecondDerivative |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
6 # tensor operators. |
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
7 # """ |
616
d9324671b412
Use julian naming conventions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
611
diff
changeset
|
8 function Laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) where Dim |
d9324671b412
Use julian naming conventions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
611
diff
changeset
|
9 Δ = SecondDerivative(grid, inner_stencil, closure_stencils, 1) |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
10 for d = 2:Dim |
616
d9324671b412
Use julian naming conventions
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
611
diff
changeset
|
11 Δ += SecondDerivative(grid, inner_stencil, closure_stencils, d) |
356
0844069ab5ff
Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents:
333
diff
changeset
|
12 end |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
13 return Δ |
356
0844069ab5ff
Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents:
333
diff
changeset
|
14 end |
611
e71f2f81b5f8
NOT WORKING: Draft implementation of VolumeOperator and make SecondDerivative specialize it. Reformulate Laplace for the new SecondDerivative.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
542
diff
changeset
|
15 export Laplace |
228
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
16 |
312
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
17 # quadrature(L::Laplace) = Quadrature(L.op, L.grid) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
18 # inverse_quadrature(L::Laplace) = InverseQuadrature(L.op, L.grid) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
19 # boundary_value(L::Laplace, bId::CartesianBoundary) = BoundaryValue(L.op, L.grid, bId) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
20 # normal_derivative(L::Laplace, bId::CartesianBoundary) = NormalDerivative(L.op, L.grid, bId) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
21 # boundary_quadrature(L::Laplace, bId::CartesianBoundary) = BoundaryQuadrature(L.op, L.grid, bId) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
22 # export NormalDerivative |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
23 # """ |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
24 # NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
25 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
26 # Implements the boundary operator `d` as a TensorMapping |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
27 # """ |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
28 # struct NormalDerivative{T,N,M,K} <: TensorMapping{T,2,1} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
29 # op::D2{T,N,M,K} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
30 # grid::EquidistantGrid{2} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
31 # bId::CartesianBoundary |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
32 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
33 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
34 # # TODO: This is obviouly strange. Is domain_size just discarded? Is there a way to avoid storing grid in BoundaryValue? |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
35 # # Can we give special treatment to TensorMappings that go to a higher dim? |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
36 # function LazyTensors.range_size(e::NormalDerivative, domain_size::NTuple{1,Integer}) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
37 # if dim(e.bId) == 1 |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
38 # return (UnknownDim, domain_size[1]) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
39 # elseif dim(e.bId) == 2 |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
40 # return (domain_size[1], UnknownDim) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
41 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
42 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
43 # LazyTensors.domain_size(e::NormalDerivative, range_size::NTuple{2,Integer}) = (range_size[3-dim(e.bId)],) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
44 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
45 # # TODO: Not type stable D:< |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
46 # # TODO: Make this independent of dimension |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
47 # function LazyTensors.apply(d::NormalDerivative{T}, v::AbstractArray{T}, I::NTuple{2,Index}) where T |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
48 # i = I[dim(d.bId)] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
49 # j = I[3-dim(d.bId)] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
50 # N_i = size(d.grid)[dim(d.bId)] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
51 # h_inv = inverse_spacing(d.grid)[dim(d.bId)] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
52 # return apply_normal_derivative(d.op, h_inv, v[j], i, N_i, region(d.bId)) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
53 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
54 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
55 # function LazyTensors.apply_transpose(d::NormalDerivative{T}, v::AbstractArray{T}, I::NTuple{1,Index}) where T |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
56 # u = selectdim(v,3-dim(d.bId),Int(I[1])) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
57 # return apply_normal_derivative_transpose(d.op, inverse_spacing(d.grid)[dim(d.bId)], u, region(d.bId)) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
58 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
59 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
60 # """ |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
61 # BoundaryQuadrature{T,N,M,K} <: TensorOperator{T,1} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
62 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
63 # Implements the boundary operator `q` as a TensorOperator |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
64 # """ |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
65 # export BoundaryQuadrature |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
66 # struct BoundaryQuadrature{T,N,M,K} <: TensorOperator{T,1} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
67 # op::D2{T,N,M,K} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
68 # grid::EquidistantGrid{2} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
69 # bId::CartesianBoundary |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
70 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
71 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
72 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
73 # # TODO: Make this independent of dimension |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
74 # function LazyTensors.apply(q::BoundaryQuadrature{T}, v::AbstractArray{T,1}, I::NTuple{1,Index}) where T |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
75 # h = spacing(q.grid)[3-dim(q.bId)] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
76 # N = size(v) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
77 # return apply_quadrature(q.op, h, v[I[1]], I[1], N[1]) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
78 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
79 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
80 # LazyTensors.apply_transpose(q::BoundaryQuadrature{T}, v::AbstractArray{T,1}, I::NTuple{1,Index}) where T = LazyTensors.apply(q,v,I) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
81 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
82 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
83 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
84 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
85 # struct Neumann{Bid<:BoundaryIdentifier} <: BoundaryCondition end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
86 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
87 # function sat(L::Laplace{2,T}, bc::Neumann{Bid}, v::AbstractArray{T,2}, g::AbstractVector{T}, I::CartesianIndex{2}) where {T,Bid} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
88 # e = boundary_value(L, Bid()) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
89 # d = normal_derivative(L, Bid()) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
90 # Hᵧ = boundary_quadrature(L, Bid()) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
91 # H⁻¹ = inverse_quadrature(L) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
92 # return (-H⁻¹*e*Hᵧ*(d'*v - g))[I] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
93 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
94 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
95 # struct Dirichlet{Bid<:BoundaryIdentifier} <: BoundaryCondition |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
96 # tau::Float64 |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
97 # end |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
98 # |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
99 # function sat(L::Laplace{2,T}, bc::Dirichlet{Bid}, v::AbstractArray{T,2}, g::AbstractVector{T}, i::CartesianIndex{2}) where {T,Bid} |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
100 # e = boundary_value(L, Bid()) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
101 # d = normal_derivative(L, Bid()) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
102 # Hᵧ = boundary_quadrature(L, Bid()) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
103 # H⁻¹ = inverse_quadrature(L) |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
104 # return (-H⁻¹*(tau/h*e + d)*Hᵧ*(e'*v - g))[I] |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
105 # # Need to handle scalar multiplication and addition of TensorMapping |
c1fcc35e19cb
Make Laplace consist of tuples of SecondDerivatives. Begin cleanup of functionallity which should be moved to separate files. WIP
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
302
diff
changeset
|
106 # end |
228
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
107 |
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
108 # function apply(s::MyWaveEq{D}, v::AbstractArray{T,D}, i::CartesianIndex{D}) where D |
248
05e7bbe0af97
Merge refactoring of laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
diff
changeset
|
109 # return apply(s.L, v, i) + |
228
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
110 # sat(s.L, Dirichlet{CartesianBoundary{1,Lower}}(s.tau), v, s.g_w, i) + |
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
111 # sat(s.L, Dirichlet{CartesianBoundary{1,Upper}}(s.tau), v, s.g_e, i) + |
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
112 # sat(s.L, Dirichlet{CartesianBoundary{2,Lower}}(s.tau), v, s.g_s, i) + |
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
113 # sat(s.L, Dirichlet{CartesianBoundary{2,Upper}}(s.tau), v, s.g_n, i) |
5acef2d5db2e
Move Laplace operator and related structs/functions to separate file.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
114 # end |