Mercurial > repos > public > sbplib_julia
changeset 59:60d575e4a2d8
Merge with latest changes
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 16 Jan 2019 12:40:20 +0100 |
parents | f3ea15c8ebb6 (current diff) c62ea0112d4d (diff) |
children | 8a7a537f54e5 8cd8d83b92e7 |
files | |
diffstat | 3 files changed, 20 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/diffOp.jl Wed Jan 16 12:39:42 2019 +0100 +++ b/diffOp.jl Wed Jan 16 12:40:20 2019 +0100 @@ -12,14 +12,25 @@ error("not implemented") end -function boundaryCondition(D::DiffOp) +function boundaryCondition(D::DiffOp,b::Grid.BoundaryId,type)::(Closure, Penalty) + error("not implemented") +end + +function interface(Du::DiffOp, Dv::DiffOp, b::Grid.BoundaryId; type) error("not implemented") end -function interface(Du::DiffOp, Dv::DiffOp, b::grid.BoundaryId; type) +abstract type Closure end + +function apply(c::Closure, v::AbstractVector, i::Int) error("not implemented") end +abstract type Penalty end + +function apply(c::Penalty, g, i::Int) + error("not implemented") +end # Differential operator for a*d^2/dx^2 struct Laplace1D <: DiffOp @@ -30,7 +41,7 @@ # u = L*v function apply!(L::Laplace1D, u::AbstractVector, v::AbstractVector) - h = grid.spacings(L.grid)[1] + h = Grid.spacings(L.grid)[1] apply!(L.op, u, v, h) u .= L.a * u return nothing @@ -47,7 +58,7 @@ # u = L*v function apply!(L::Laplace2D, u::AbstractVector, v::AbstractVector) u .= 0*u - h = grid.spacings(L.grid) + h = Grid.spacings(L.grid) li = LinearIndices(L.grid.numberOfPointsPerDim) n_x, n_y = L.grid.numberOfPointsPerDim
--- a/plotDerivative.jl Wed Jan 16 12:39:42 2019 +0100 +++ b/plotDerivative.jl Wed Jan 16 12:40:20 2019 +0100 @@ -1,4 +1,4 @@ -g = sbp.grid.EquidistantGrid(200,(0, 2pi)) +g = sbp.Grid.EquidistantGrid(200,(0, 2pi)) op =sbp.readOperator("d2_4th.txt","h_4th.txt") Laplace = sbp.Laplace1D(g,1,op) @@ -9,4 +9,4 @@ sbp.apply!(Laplace,u,v) @show u -sbp.grid.plotgridfunction(g,u) +sbp.Grid.plotgridfunction(g,u)
--- a/plotDerivative2d.jl Wed Jan 16 12:39:42 2019 +0100 +++ b/plotDerivative2d.jl Wed Jan 16 12:40:20 2019 +0100 @@ -1,9 +1,9 @@ -g = sbp.grid.EquidistantGrid((100,75),((0, 0), (2pi, 3/2*pi))) +g = sbp.Grid.EquidistantGrid((100,75),((0, 0), (2pi, 3/2*pi))) op = sbp.readOperator("d2_4th.txt","h_4th.txt") Laplace = sbp.Laplace2D(g,1,op) init(x,y) = sin(x) + cos(y) -v = sbp.grid.evalOn(g,init) +v = sbp.Grid.evalOn(g,init) u = zeros(length(v)) @@ -12,5 +12,5 @@ @show u @show u'*u -sbp.grid.plotgridfunction(g,u) +sbp.Grid.plotgridfunction(g,u)