Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 9546e13

Browse files
finish README
1 parent 8426dfa commit 9546e13

File tree

1 file changed

+78
-5
lines changed

1 file changed

+78
-5
lines changed

README.md

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ common partial differential equations.
1111

1212
## Automated Finite Difference Method (FDM) Operators
1313

14-
This library provides lazy operators for finite difference discretizations.
14+
This library provides lazy operators for arbitrary order uniform and non-uniform
15+
finite difference discretizations of arbitrary high derivative order and for
16+
arbitrarily high dimensions.
17+
1518
There are two types of `DerivativeOperator`s: the `CenteredDifference` operator
1619
and the `UpwindDifference` operator. The `CenteredDifference` operator utilizes
1720
a central difference scheme while the upwind operator requires a coefficient
@@ -83,9 +86,10 @@ The following concretizations are provided:
8386

8487
Additionally, the function `sparse` is overloaded to give the most efficient
8588
matrix type for a given operator. For one-dimensional derivatives this is a
86-
`BandedMatrix`, while for higher dimensional operators this is a `BlockBandedMatrix`
89+
`BandedMatrix`, while for higher dimensional operators this is a `BlockBandedMatrix`.
90+
The concretizations are made to act on `vec(u)`.
8791

88-
## Boundary Value Operators
92+
## Atomic Boundary Value Operators
8993

9094
Boundary conditions are implemented through a ghost node approach. The discretized
9195
values `u` should be the interior of the domain so that, for the boundary value
@@ -111,8 +115,10 @@ Additionally, the following helpers exist for the Neumann `u'(0) = α` and
111115
Dirichlet `u(0) = α` cases.
112116

113117
```julia
114-
NeumannBC::AbstractVector{T}, dx::AbstractVector{T}, order = 1)
118+
Dirichlet0BC(T::Type)
115119
DirichletBC::AbstractVector{T}, dx::AbstractVector{T}, order = 1)
120+
Neumann0BC(dx::Union{AbstractVector{T}, T}, order = 1)
121+
NeumannBC::AbstractVector{T}, dx::AbstractVector{T}, order = 1)
116122
```
117123

118124
### General Boundary Conditions
@@ -125,6 +131,32 @@ of coefficients. Represents a condition of the form
125131
GeneralBC(αl::AbstractArray{T}, αr::AbstractArray{T}, dx::AbstractArray{T}, order = 1)
126132
```
127133

134+
### Multidimensional Boundary Conditions
135+
136+
```julia
137+
Q_dim = MultiDimBC(Q, size(u), dim)
138+
```
139+
140+
turns `Q` into a boundary condition along the dimension `dim`. Additionally,
141+
to apply the same boundary values to all dimensions, one can use
142+
143+
```julia
144+
Qx,Qy,Qz = MultiDimBC(YourBC, size(u)) # Here u is 3d
145+
```
146+
147+
Multidimensional BCs can then be composed into a single operator with:
148+
149+
```julia
150+
Q = compose(BCs...)
151+
```
152+
153+
### Operator Actions
154+
155+
The boundary condition operators act lazily by appending the appropriate values
156+
to the end of the array, building the ghost-point extended version for the
157+
derivative operator to act on. This utilizes special array types to not require
158+
copying the interior data.
159+
128160
### Concretizations
129161

130162
The following concretizations are provided:
@@ -134,9 +166,50 @@ The following concretizations are provided:
134166

135167
Additionally, the function `sparse` is overloaded to give the most efficient
136168
matrix type for a given operator. For these operators it's `SparseMatrixCSC`.
169+
The concretizations are made to act on `vec(u)`.
137170

138-
## Operator Compositions
171+
## GhostDerivative Operators
172+
173+
When `L` is a `DerivativeOperator` and `Q` is a boundary condition operator,
174+
`L*Q` produces a `GhostDerivative` operator which is the composition of the
175+
two operations.
176+
177+
### Concretizations
178+
179+
The following concretizations are provided:
180+
181+
- `Array`
182+
- `SparseMatrixCSC`
183+
- `BandedMatrix`
184+
185+
Additionally, the function `sparse` is overloaded to give the most efficient
186+
matrix type for a given operator. For these operators it's `BandedMatrix` unless
187+
the boundary conditions are `PeriodicBC`, in which case it's `SparseMatrixCSC`.
188+
The concretizations are made to act on `vec(u)`.
139189

140190
## Matrix-Free Operators
141191

192+
```julia
193+
MatrixFreeOperator(f::F, args::N;
194+
size=nothing, opnorm=true, ishermitian=false) where {F,N}
195+
```
196+
197+
A `MatrixFreeOperator` is a linear operator `A*u` where the action of `A` is
198+
explicitly defined by an in-place function `f(du, u, p, t)`.
199+
142200
## Jacobian-Vector Product Operators
201+
202+
```julia
203+
JacVecOperator{T}(f,u::AbstractArray,p=nothing,t::Union{Nothing,Number}=nothing;autodiff=true,ishermitian=false,opnorm=true)
204+
```
205+
206+
The `JacVecOperator` is a linear operator `J*v` where `J` acts like `df/du`
207+
for some function `f(u,p,t)`. For in-place operations `mul!(w,J,v)`, `f`
208+
is an in-place function `f(du,u,p,t)`.
209+
210+
## Operator Compositions
211+
212+
Multiplying two DiffEqOperators will build a `DiffEqOperatorComposition`, while
213+
adding two DiffEqOperators will build a `DiffEqOperatorCombination`. Multiplying
214+
a DiffEqOperator by a scalar will produce a `DiffEqScaledOperator`. All
215+
will inherit the appropriate action.

0 commit comments

Comments
 (0)