This repository was archived by the owner on Jul 19, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 72
Multidimensional handling for GhostDerivativeOperators (part 3) #279
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
0b57cdc
broadened acceptable types for GhostDerivativeOperator
xtalax d740001
moved GhostDerivativeOperator Concretizations to concretizations.jl, …
xtalax f025ce0
added safechecks for DiffEqOperatorCombinations
xtalax a262263
Allowed AbstractArrays instead of AbstractVecOrMat, allowed AbstractA…
xtalax b0ec736
removed assumptions that `L` is a derivative operator, made `GhostDer…
xtalax ec9c99e
Working full matrix concretization for multi dim bc
xtalax ed2a59b
GhostDerivativeOperator general dimensional methods and combination c…
xtalax db74608
Clearing up unsupported BC usage in tests - getting tests passing
xtalax b9fa871
Changed ldiv to use sparse, added tests for the case in the issue, ad…
xtalax 1dec7f1
update tests
xtalax 6cc4336
Another test
xtalax f0e6269
got rid of some @show
xtalax dcc1321
fixed an issue with DirichletBC
xtalax 6efbc57
trying to make julia call the right methods
xtalax 16a001f
add a Laplacian constructor, extend the f(u,p,t) interface to GhostDe…
xtalax 468a685
added AbstractDiffEqAffineOperator type, Added fast method for when a…
xtalax d604eca
create boundary padded array with no allocations for periodic bc
xtalax 3e3d566
allow mixed types for lower and upper boundaries in composed BPAs
xtalax e81b4a3
- Just use \ rather than bothering with ldiv!
xtalax c511cff
various fixes
xtalax 679c98b
Get tests passing, marked some broken.
xtalax 76c7a21
increased aorder
xtalax 6836799
Fixed rebase syntax problems in tests
grahamas 324163d
Generalize function signature to disambiguate dispatch
grahamas d2a5ffc
Promote AtomicBC to MultiDimBC when multiplying AbstractArray
grahamas 732ae4b
GhostDerivativeOperator equality recovered from pre-rebase
grahamas 4562176
Fix convolve_BC_right! to iterate over boundary stencil correctly
grahamas f7438ac
Mark definitively broken test
grahamas 4d8c526
Restore comments lost in rebase
grahamas 5cd1461
Change tests to use dimension parameter syntax like CenteredDifference
grahamas 28623ed
Restore docstrings lost in rebase
grahamas e9be15f
Fixed multi_dim_bc_test mistake from rebase
grahamas 2103426
fix test by reverting changed size definition
grahamas e2212b2
fix undefvar
grahamas a1f2f30
moving past broken test. upstream issue filed.
grahamas 2e95e6d
Added test dependency (DifferentalEquations)
grahamas b255927
test now reflects cond(A) in approximate equality check
grahamas d2a12cb
Minor test fixes
grahamas d4ce1d6
Test max 6 dims for time considerations
grahamas 1e33fce
[WIP] fallback mul! accounts for multidimensional padding
grahamas 1cd435b
[WIP] 3D_laplacian test works with
grahamas b3f9c78
Modified specialized N=2,3 mul! to work with higher dimensional padding
grahamas 4a679a0
Undo incorrect fix
grahamas 391dfcb
Remove print statements and stop using @gif in test
grahamas a2a9bd0
Make test/3D_laplacian.jl runnable with existing dependencies
grahamas dc0ebc0
Not sure why tests passing locally, failing on remote
grahamas a8c1f1e
Remove DifferentialEquations from test dependencies
grahamas cf6c0d7
Rename and stop exporting c2l -> cartesian_to_linear; test testing error
grahamas b579877
make coefficients safe by zeroing the cache at generation time.
ChrisRackauckas d21a60d
Account for floating point imprecision in multi_dim_bc_test
grahamas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| abstract type AbstractBC{T} <: AbstractDiffEqLinearOperator{T} end | ||
| abstract type AbstractBC{T} <: AbstractDiffEqAffineOperator{T} end | ||
|
|
||
|
|
||
| abstract type AtomicBC{T} <: AbstractBC{T} end | ||
|
|
@@ -14,9 +14,32 @@ struct NeumannBC{N} end | |
| struct Neumann0BC{N} end | ||
| struct DirichletBC{N} end | ||
| struct Dirichlet0BC{N} end | ||
|
|
||
| """ | ||
| q = PeriodicBC{T}() | ||
| Qx, Qy, ... = PeriodicBC{T}(size(u)) #When all dimensions are to be extended with a periodic boundary condition. | ||
| ------------------------------------------------------------------------------------- | ||
| Creates a periodic boundary condition, where the lower index end of some u is extended with the upper index end and vice versa. | ||
| It is not reccomended to concretize this BC type in to a BandedMatrix, since the vast majority of bands will be all 0s. SpatseMatrix concretization is reccomended. | ||
| """ | ||
| struct PeriodicBC{T} <: AtomicBC{T} | ||
| PeriodicBC(T::Type) = new{T}() | ||
| end | ||
|
|
||
| """ | ||
| q = RobinBC(left_coefficients, right_coefficients, dx::T, approximation_order) where T # When this BC extends a dimension with a uniform step size | ||
| q = RobinBC(left_coefficients, right_coefficients, dx::Vector{T}, approximation_order) where T # When this BC extends a dimension with a non uniform step size. dx should be the vector of step sizes for the whole dimension | ||
| ------------------------------------------------------------------------------------- | ||
| The variables in l are [αl, βl, γl], and correspond to a BC of the form αl*u(0) + βl*u'(0) = γl imposed on the lower index boundary. | ||
| The variables in r are [αl, βl, γl], and correspond to an analagous boundary on the higher index end. | ||
| Implements a robin boundary condition operator Q that acts on a vector to give an extended vector as a result | ||
| Referring to (https://github.com/JuliaDiffEq/DiffEqOperators.jl/files/3267835/ghost_node.pdf) | ||
| Write vector b̄₁ as a vertical concatanation with b0 and the rest of the elements of b̄ ₁, denoted b̄`₁, the same with ū into u0 and ū`. b̄`₁ = b̄`_2 = fill(β/Δx, length(stencil)-1) | ||
| Pull out the product of u0 and b0 from the dot product. The stencil used to approximate u` is denoted s. b0 = α+(β/Δx)*s[1] | ||
| Rearrange terms to find a general formula for u0:= -b̄`₁̇⋅ū`/b0 + γ/b0, which is dependent on ū` the robin coefficients and Δx. | ||
| The non identity part of Qa is qa:= -b`₁/b0 = -β.*s[2:end]/(α+β*s[1]/Δx). The constant part is Qb = γ/(α+β*s[1]/Δx) | ||
| do the same at the other boundary (amounts to a flip of s[2:end], with the other set of boundary coeffs) | ||
| """ | ||
| struct RobinBC{T, V<:AbstractVector{T}} <: AffineBC{T} | ||
| a_l::V | ||
| b_l::T | ||
|
|
@@ -57,8 +80,11 @@ struct RobinBC{T, V<:AbstractVector{T}} <: AffineBC{T} | |
| end | ||
| end | ||
|
|
||
| stencil(q::AffineBC{T}, N::Int) where T = ([transpose(q.a_l) transpose(zeros(T, N-length(q.a_l)))], [transpose(zeros(T, N-length(q.a_r))) transpose(q.a_r)]) | ||
| affine(q::AffineBC) = (q.b_l, q.b_r) | ||
|
|
||
|
|
||
| stencil(q::PeriodicBC{T}, N::Int) where T= ([transpose(zeros(T, N-1)) one(T)], [one(T) transpose(zeros(T, N-1))]) | ||
| affine(q::PeriodicBC{T}) where T = (zero(T), zero(T)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The stencil for PeriodicBC? It has the effect of putting the last value in u in the lower padding spot and the first value in the higher padding spot, as you'd expect in the periodic case |
||
| """ | ||
| q = GeneralBC(α_leftboundary, α_rightboundary, dx::T, approximation_order) | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to depend on
N? Can't it be generic? Or is this to fix some kind of ambiguity issues?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the commit comment ("trying to make julia call the right methods") I would guess the latter. But this comment and below are more for @xtalax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there were ambiguity issues.