Mercurial > repos > public > sbplib_julia
annotate src/SbpOperators/volumeops/laplace/laplace.jl @ 866:1784b1c0af3e feature/laplace_opset
Merge with default
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Wed, 19 Jan 2022 14:44:24 +0100 |
| parents | 1970ebceabe4 b4acd25943f4 |
| children | 4bd35ba8f34a |
| rev | line source |
|---|---|
|
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
1 """ |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
2 Laplace{T, Dim, TMdiffop} <: TensorMapping{T,Dim,Dim} |
| 866 | 3 Laplace(grid, filename; order) |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
4 |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
5 Implements the Laplace operator, approximating ∑d²/xᵢ² , i = 1,...,`Dim` as a |
| 704 | 6 `TensorMapping`. Additionally, `Laplace` stores the inner product and boundary |
| 866 | 7 operators relevant for constructing a SBP finite difference scheme as a `TensorMapping`. |
|
677
011863b3f24c
Make use of the function boundary_quadrature in Laplace constructor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
668
diff
changeset
|
8 |
| 866 | 9 `Laplace(grid, filename; order)` creates the Laplace operator defined on `grid`, |
|
723
c16abc564b82
Change from EquidistantGrid to AbstractGrid in Laplace interface
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
722
diff
changeset
|
10 where the operators are read from TOML. The differential operator is created |
| 866 | 11 using `laplace(grid,...)`. |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
12 |
| 866 | 13 Note that all properties of Laplace, excluding the differential operator `Laplace.D`, are |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
14 abstract types. For performance reasons, they should therefore be |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
15 accessed via the provided getter functions (e.g `inner_product(::Laplace)`). |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
16 |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
17 """ |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
18 struct Laplace{T, Dim, TMdiffop<:TensorMapping{T,Dim,Dim}} <: TensorMapping{T,Dim,Dim} |
| 722 | 19 D::TMdiffop # Differential operator |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
20 H::TensorMapping # Inner product operator |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
21 H_inv::TensorMapping # Inverse inner product operator |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
22 e::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Boundary restriction operators. |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
23 d::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Normal derivative operators |
| 866 | 24 H_boundary::StaticDict{<:BoundaryIdentifier,<:TensorMapping} # Boundary quadrature operators |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
25 end |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
26 export Laplace |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
27 |
| 866 | 28 function Laplace(grid, filename; order) |
| 29 | |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
30 # Read stencils |
| 866 | 31 stencil_set = read_stencil_set(filename; order) |
| 32 # TODO: Removed once we can construct the volume and | |
| 33 # boundary operators by op(grid, read_stencil_set(fn; order,...)). | |
| 34 D_inner_stecil = parse_stencil(stencil_set["D2"]["inner_stencil"]) | |
| 35 D_closure_stencils = parse_stencil.(stencil_set["D2"]["closure_stencils"]) | |
| 36 H_inner_stencils = parse_scalar(stencil_set["H"]["inner"]) | |
| 37 H_closure_stencils = parse_tuple(stencil_set["H"]["closure"]) | |
| 38 e_closure_stencil = parse_stencil(stencil_set["e"]["closure"]) | |
| 39 d_closure_stencil = parse_stencil(stencil_set["d1"]["closure"]) | |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
40 |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
41 # Volume operators |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
42 Δ = laplace(grid, D_inner_stecil, D_closure_stencils) |
| 866 | 43 H = inner_product(grid, H_inner_stencils, H_closure_stencils) |
| 44 H⁻¹ = inverse_inner_product(grid, H_inner_stencils, H_closure_stencils) | |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
45 |
|
677
011863b3f24c
Make use of the function boundary_quadrature in Laplace constructor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
668
diff
changeset
|
46 # Boundary operator - id pairs |
|
708
693f5487ddba
Minor clean up
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
704
diff
changeset
|
47 ids = boundary_identifiers(grid) |
|
693f5487ddba
Minor clean up
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
704
diff
changeset
|
48 n_ids = length(ids) |
| 866 | 49 e_pairs = ntuple(i -> ids[i] => boundary_restriction(grid, e_closure_stencil, ids[i]), n_ids) |
| 50 d_pairs = ntuple(i -> ids[i] => normal_derivative(grid, d_closure_stencil, ids[i]), n_ids) | |
| 51 Hᵧ_pairs = ntuple(i -> ids[i] => inner_product(boundary_grid(grid, ids[i]), H_inner_stencils, H_closure_stencils), n_ids) | |
|
668
2d56a53a1646
Simplify construction of boundary-operator pairs in Laplace constructor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
667
diff
changeset
|
52 |
|
751
f94feb005e7d
Change from Dict to StaticDict in Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
723
diff
changeset
|
53 return Laplace(Δ, H, H⁻¹, StaticDict(e_pairs), StaticDict(d_pairs), StaticDict(Hᵧ_pairs)) |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
54 end |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
55 |
|
756
1970ebceabe4
Add suggestion for pretty printing of Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
755
diff
changeset
|
56 # TODO: Consider pretty printing of the following form |
|
1970ebceabe4
Add suggestion for pretty printing of Laplace
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
755
diff
changeset
|
57 # Base.show(io::IO, L::Laplace{T, Dim}) where {T,Dim,TM} = print(io, "Laplace{$T, $Dim, $TM}(", L.D, L.H, L.H_inv, L.e, L.d, L.H_boundary, ")") |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
58 |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
59 LazyTensors.range_size(L::Laplace) = LazyTensors.range_size(L.D) |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
60 LazyTensors.domain_size(L::Laplace) = LazyTensors.domain_size(L.D) |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
61 LazyTensors.apply(L::Laplace, v::AbstractArray, I...) = LazyTensors.apply(L.D,v,I...) |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
62 |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
63 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
64 """ |
| 866 | 65 inner_product(L::Laplace) |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
66 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
67 Returns the inner product operator associated with `L` |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
68 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
69 """ |
| 704 | 70 inner_product(L::Laplace) = L.H |
| 71 export inner_product | |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
72 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
73 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
74 """ |
| 866 | 75 inverse_inner_product(L::Laplace) |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
76 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
77 Returns the inverse of the inner product operator associated with `L` |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
78 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
79 """ |
| 704 | 80 inverse_inner_product(L::Laplace) = L.H_inv |
| 81 export inverse_inner_product | |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
82 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
83 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
84 """ |
| 866 | 85 boundary_restriction(L::Laplace, id::BoundaryIdentifier) |
| 86 boundary_restriction(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) | |
| 87 boundary_restriction(L::Laplace, ids...) | |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
88 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
89 Returns boundary restriction operator(s) associated with `L` for the boundary(s) |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
90 identified by id(s). |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
91 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
92 """ |
| 866 | 93 boundary_restriction(L::Laplace, id::BoundaryIdentifier) = L.e[id] |
| 94 boundary_restriction(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.e[ids[i]],N) | |
| 95 boundary_restriction(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.e[ids[i]],N) | |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
96 export boundary_restriction |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
97 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
98 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
99 """ |
| 866 | 100 normal_derivative(L::Laplace, id::BoundaryIdentifier) |
| 101 normal_derivative(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) | |
| 102 normal_derivative(L::Laplace, ids...) | |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
103 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
104 Returns normal derivative operator(s) associated with `L` for the boundary(s) |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
105 identified by id(s). |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
106 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
107 """ |
| 866 | 108 normal_derivative(L::Laplace, id::BoundaryIdentifier) = L.d[id] |
| 109 normal_derivative(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.d[ids[i]],N) | |
| 110 normal_derivative(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.d[ids[i]],N) | |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
111 export normal_derivative |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
112 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
113 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
114 """ |
| 866 | 115 boundary_quadrature(L::Laplace, id::BoundaryIdentifier) |
| 116 boundary_quadrature(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) | |
| 117 boundary_quadrature(L::Laplace, ids...) | |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
118 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
119 Returns boundary quadrature operator(s) associated with `L` for the boundary(s) |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
120 identified by id(s). |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
121 |
|
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
122 """ |
| 866 | 123 boundary_quadrature(L::Laplace, id::BoundaryIdentifier) = L.H_boundary[id] |
| 124 boundary_quadrature(L::Laplace, ids::NTuple{N,BoundaryIdentifier}) where N = ntuple(i->L.H_boundary[ids[i]],N) | |
| 125 boundary_quadrature(L::Laplace, ids::Vararg{BoundaryIdentifier,N}) where N = ntuple(i->L.H_boundary[ids[i]],N) | |
|
667
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
126 export boundary_quadrature |
|
f3a0d1f7d842
Make Laplace a type storing relevant operators used when writing a scheme, e.g. quadratures, normal derivatives etc.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
127 |
|
755
36adc15d3935
Reduce the number of type perameters used by Laplace.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
754
diff
changeset
|
128 |
|
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
129 """ |
|
690
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
130 laplace(grid::EquidistantGrid{Dim}, inner_stencil, closure_stencils) |
|
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
131 |
|
648
d6edde60909b
Fix typo in documentation and remove obsolete out-commented code.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
624
diff
changeset
|
132 Creates the Laplace operator operator `Δ` as a `TensorMapping` |
|
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
133 |
|
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
134 `Δ` approximates the Laplace operator ∑d²/xᵢ² , i = 1,...,`Dim` on `grid`, using |
|
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
135 the stencil `inner_stencil` in the interior and a set of stencils `closure_stencils` |
|
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
136 for the points in the closure regions. |
|
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
137 |
|
690
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
138 On a one-dimensional `grid`, `Δ` is equivalent to `second_derivative`. On a |
|
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
139 multi-dimensional `grid`, `Δ` is the sum of multi-dimensional `second_derivative`s |
|
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
140 where the sum is carried out lazily. |
|
624
a85db383484f
Update documentation and remove some out-commented lines
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
618
diff
changeset
|
141 """ |
|
820
b4acd25943f4
Remove some more types and type parameters
Jonatan Werpers <jonatan@werpers.com>
parents:
690
diff
changeset
|
142 function laplace(grid::EquidistantGrid, inner_stencil, closure_stencils) |
|
690
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
143 Δ = second_derivative(grid, inner_stencil, closure_stencils, 1) |
|
820
b4acd25943f4
Remove some more types and type parameters
Jonatan Werpers <jonatan@werpers.com>
parents:
690
diff
changeset
|
144 for d = 2:dimension(grid) |
|
690
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
145 Δ += second_derivative(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
|
146 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
|
147 return Δ |
|
356
0844069ab5ff
Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents:
333
diff
changeset
|
148 end |
|
690
1accc3e051d0
Start changing the name of functions creating operators that are not types to lower case. E.g SecondDerivative->second_derivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
648
diff
changeset
|
149 export laplace |
