Simultaneous Approximation Terms
FaADE.SATs
— ModuleSATs
Submodule containing the simulatenous approximation term constructor and functions.
All SATs
belong to the abstract type
.
FaADE.SATs.SimultanousApproximationTerm
— TypeSimultanousApproximationTerm{Type}
Boundary operators
Dirichlet
FaADE.SATs.SAT_Dirichlet
— TypeSAT_Dirichlet{
TN<:NodeType,
COORD,
TT<:Real,
VT<:Vector{TT},
F1<:Function, LAT<:Function} <: SimultanousApproximationTerm{:Dirichlet}
Storage of all objects needed for a Dirichlet SAT $u(x_i) - g(t) = 0$.
In Cartesian coordinates the SAT reads
$\operatorname{SAT}_D = \tau_0 H^{-1} E H^{-1} E (u - g) + \tau_1 H^{-1} (K H D_x^T) H^{-1} E (u - g)$
In Curivlinear coordinates cross derivatives are included giving
$\operatorname{SAT}_D = \tau_0 H_q^{-1} E H_q^{-1} E (u - g) + \tau_1 H^{-1}_q ((K_q H_q D_q^T) H_q^{-1} E + (K_{qr} H_r D_r^T) H_r^{-1} E) (u - g)$
where $E$ picks out the relevant boundary term.
julia> RHS(X,t) = 0.0
julia> Δx = 1.0
julia> SAT_Dirichlet(RHS,Δx,Left,2)
FaADE.SATs.SAT_Dirichlet
— MethodSAT_Dirichlet(RHS::F1,Δx::TT,side::NodeType{SIDE,AX},order::Int,Δy=TT(0),coord=:Cartesian;τ₀=nothing,τ₁=nothing) where {TT,F1,SIDE,AX}
Constructor for the Dirichlet SAT.
Required arguments:
RHS
: Right hand side functionΔx
: Grid spacingside
: Boundary side, eitherLeft
,Right
,Up
,Down
order
: Order of the $D_x$ operators, either2
or4
FaADE.SATs.SAT_Dirichlet_data!
— FunctionDirichlet SAT method for implicit solvers. Applys boundary data i.e. the portion of the SAT which operates on $g$ only.
All methods wrap around the 1D method.
SAT_Dirichlet_data!(dest::VT,data::VT,c::VT,SD::SAT_Dirichlet{TN}) where {VT<:AbstractVector,TN<:NodeType{SIDE}} where SIDE
The 2D method loops over the 1D method using the loopaxis
value in SAT_Dirichlet
.
SAT_Dirichlet_data!(dest::AT,data::AT,c::AT,SD::SAT_Dirichlet{TN,:Cartesian,TT}) where {AT<:AbstractMatrix,TN<:NodeType,TT}
The curvilinear call wraps around the 1D method and then calls the FirstDerivativeTranspose!
for the cross derivative term.
SAT_Dirichlet_data!(dest::AT,data::AT,cx::KT,cxy::KT,SD::SAT_Dirichlet{TN,:Curvilinear,TT}) where {AT<:AbstractMatrix,TN<:NodeType,KT,TT}
FaADE.SATs.SAT_Dirichlet_explicit!
— FunctionSAT_Dirichlet_explicit!
Dirichlet SAT for explicit solvers. Currently no explicit solvers are implemented so these haven't been tested and are not used anywhere.
FaADE.SATs.SAT_Dirichlet_solution!
— FunctionDirichlet SAT method for implicit solvers. Applys portion of SAT related to the solution.
All methods wrap around the 1D method.
SAT_Dirichlet_solution!(dest::VT,data::VT,c::VT,SD::SAT_Dirichlet{TN}) where {VT<:AbstractVector,TN<:NodeType{SIDE}} where SIDE
The 2D method loops over the 1D method using the loopaxis
value in SAT_Dirichlet
.
SAT_Dirichlet_solution!(dest::AT,data::AT,c::KT,SD::SAT_Dirichlet{TN,:Cartesian,TT}) where {AT<:AbstractMatrix,TN<:NodeType,TT,KT}
The curvilinear call wraps around the 1D method and then calls the FirstDerivativeTranspose!
for the cross derivative term.
SAT_Dirichlet_solution!(dest::AT,data::AT,cx::KT,cxy::KT,SD::SAT_Dirichlet{TN,:Curvilinear,TT}) where {AT<:AbstractMatrix,TN<:NodeType,TT,KT}
Neumann
FaADE.SATs.SAT_Neumann
— TypeSAT_Neumann{
TN<:NodeType,
COORD,
TT<:Real,
VT<:Vector{TT},
F1<:Function, LAT<:Function} <: SimultanousApproximationTerm{:Neumann}
Simulatenous approximation term for Neumann boundary conditions $\left.\frac{\partial u}{\partial x}\right|_{x_i} = g(t) \iff \frac{\partial}{\partial x} u(x_i) - g(t) = 0$
In Cartesian coordinates the SAT reads
$\operatorname{SAT}_N = \tau H^{-1} E (K D_x u - g)$
In curvilinear coordinates the SAT is
$\operatorname{SAT}_N = \tau H_x^{-1} E (K_x D_x u - g) + \tau H_x^{-1} E K_{xy} D_y u$
FaADE.SATs.SAT_Neumann
— MethodSAT_Neumann(RHS::F1,Δx::TT,side::NodeType{SIDE,AX},order::Int,Δy=TT(0),coord=:Cartesian;τ=nothing,Δy=TT(0),coord=:Cartesian) where {TT,F1,SIDE,AX}
Constructor for the Neumann SAT
Required arguments:
RHS
: Right hand side functionΔx
: Grid spacingside
: Boundary side, eitherLeft
,Right
,Up
,Down
order
: Order of the $D_x$ operators, either2
or4
FaADE.SATs.SAT_Neumann_data!
— FunctionNeumann SAT method for implicit solvers. Applies boundary data i.e. the portion of the SAT which operates on $g$ only.
All methods wrap around the 1D method.
SAT_Neumann_data!(dest::VT,u::VT,SN::SAT_Neumann{TN}) where {VT<:AbstractVector,TN<:NodeType{SIDE}} where SIDE
The 2D method loops over the 1D method using the loopaxis
value in SAT_Neumann
.
SAT_Neumann_data!(dest::AT,u,SN::SAT_Neumann{TN,:Cartesian,TT}) where {AT<:AbstractMatrix,TN,TT}
The curvilinear call wraps around the 1D method.
SAT_Neumann_data!(dest::AT,data::AT,SN::SAT_Neumann{TN,:Curvilinear,TT}) where {AT<:AbstractMatrix,TN<:NodeType,TT}
FaADE.SATs.SAT_Neumann_explicit!
— FunctionSAT_Neumann_explicit!
Neumann boundary SAT for explicit solvers. No explicit solvers are implemented so this has not been tested and is not used.
FaADE.SATs.SAT_Neumann_solution!
— FunctionNeumann SAT method for implicit solvers. Applys portion of SAT related to the solution.
All methods wrap around the 1D method.
SAT_Neumann_solution!(dest::VT,u::VT,c::VT,SN::SAT_Neumann{TN}) where {VT<:AbstractVector,TN<:NodeType{SIDE}} where SIDE
The 2D method loops over the 1D method using the loopaxis
value in SAT_Neumann
.
SAT_Neumann_solution!(dest::AT,u::AT,c::AT,SN::SAT_Neumann{TN,:Cartesian,TT}) where {AT<:AbstractMatrix,TN,TT}
The curvilinear call wraps around the 1D method. Calls the D₁!
operator from FaADE.Derivatives
SAT_Neumann_solution!(dest::AT,data::AT,c::AT,cxy::AT,SN::SAT_Neumann{TN,:Curvilinear,TT}) where {AT,TN<:NodeType,TT}
Robin
FaADE.SATs.SAT_Robin
— TypeSAT_Robin{
TN<:NodeType,
COORD,
TT<:Real,
F1<:Function, LAT<:Function} <: SimultanousApproximationTerm{:Robin}
Simulatenous approximation term for Robin boundary conditions $\left.\alpha u(x_i) + \beta\left.\frac{\partial u}{\partial x}\right|_{x_i} - g(t) = 0$
In Cartesian coordinates the SAT reads
$\operatorname{SAT}_R = \tau H^{-1} E (\alpha u + \kappa D_x u - g)$
In curvilinear coordinates the SAT is
$\operatorname{SAT}_R = \tau H^{-1}_q E (\alpha u + K_q D_q u + K_{qr} D_r u - g)$
TODO: Testing
FaADE.SATs.SAT_Robin
— MethodSAT_Robin(RHS::F1,Δx::TT,side::TN,order::Int,Δy=TT(0),coord=:Cartesian;α=TT(1),β=TT(1),τ=nothing) where {TT,TN<:NodeType{SIDE,AX},F1} where {SIDE,AX}
Constructor for Robin SAT
Required arguments:
RHS
: Right hand side functionΔx
: Grid spacingside
: Boundary side, eitherLeft
,Right
,Up
,Down
order
: Order of the $D_x$ operators, either2
or4
FaADE.SATs.SAT_Robin_data!
— MethodRobin SAT method for implicit solvers. Applies boundary data i.e. the portion of the SAT which operates on $g$ only.
Only one method is used for both Cartesian and curvilinear coordinates.
SAT_Robin_data!(dest::AT,data::AT,SR::SAT_Robin{TN}) where {AT,TN<:NodeType{SIDE,AX}} where {SIDE,AX}
FaADE.SATs.SAT_Robin_solution!
— FunctionRobin SAT method for implicit solvers. Applys portion of SAT related to the solution.
2D method which loops over 2D domains using the loopaxis
value from SAT_Robin
.
SAT_Robin_solution!(dest::AT,u::AT,c::AT,SR::SAT_Robin{TN}) where {AT,TN<:NodeType{SIDE,AX}} where {SIDE,AX}
The curvilinear call wraps around the Cartesian method. Calls the D₁!
operator from FaADE.Derivatives
SAT_Robin_solution!(dest::AT,u::AT,c::AT,cxy::AT,SR::SAT_Robin{TN,:Curvilinear,TT}) where {TT,AT,TN}
Periodic
FaADE.SATs.SAT_Periodic
— TypeSAT_Periodic{
TN<:NodeType,
COORD,
TT<:Real,
VT<:Vector{TT},
F1<:Function,F2<:Function} <: SimultanousApproximationTerm{:Periodic}
Storage of all objects needed for a Periodic SAT $u(x_0) = u(x_N)$ and $\left.\partial_x u\right|_{x_0} = \left.\partial_x u\right|_{x_N}$.
In Cartesian coordinates the SAT is
$\operatorname{SAT}_P = \tau_0 H^{-1}L_0u + \tau_1 H^{-1}KD_x^TL_1u \alpha_0 H^{-1}L_1KD_xu$
In curvilinear coordinates the SAT is
$\operatorname{SAT}_P = \tau_0 H^{-1}L_0u + \tau_1 H^{-1}K_qD_q^TL_1u + \tau_2H^{-1}K_{qr}D_r^TL_1 u + \alpha_1 H^{-1}L_1K_qD_qu + \alpha_2 H^{-1}L_1K_{qr}D_ru$
where in both cases,
\[L_0 = \begin{bmatrix} 1 & 0 & 0 & -1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ -1 & 0 & 0 & 1 \end{bmatrix} \qquad L_1 = \begin{bmatrix} 1 & 0 & 0 & -1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & -1 \end{bmatrix}\]
FaADE.SATs.SAT_Periodic
— MethodSAT_Periodic(Δx::TT,side::NodeType{SIDE,AX},order::Int,Δy=TT(0),coord=:Cartesian) where {TT,SIDE,AX}
Constructor for periodic SAT
Required arguments:
Δx
: Grid spacingside
: Boundary side, eitherLeft
,Right
,Up
,Down
order
: Order of the $D_x$ operators, either2
or4
FaADE.SATs.SAT_Periodic!
— FunctionPeriodic SAT.
1D methods for Left
and Down
boundaries and Right
and Up
boundaries respectively are
SAT_Periodic!(cache::AT,u::AT,c::AT,SP::SAT_Periodic{NodeType{:Left}},::SATMode{:SolutionMode}) where {AT}
SAT_Periodic!(cache::AT,u::AT,c::AT,SP::SAT_Periodic{NodeType{:Right}},::SATMode{:SolutionMode}) where {AT}
The 2D method loops over the 1D methods by loopaxis
SAT_Periodic!(dest::AT,u::AT,c::AT,SP::SAT_Periodic{TN,:Cartesian,TT}) where {TT,AT<:AbstractMatrix{TT},TN<:NodeType}
The curvilinear method wraps the 2D Cartesian method and calls the FirstDerivativeTranspose!
function.
SAT_Periodic!(dest::AT,u::AT,cx::AT,cxy::AT,SP::SAT_Periodic{TN,:Curvilinear,TT}) where {TT,AT<:AbstractMatrix{TT},TN<:NodeType}
Interface
FaADE.SATs.SAT_Interface
— TypeSAT_Interface{
TN<:NodeType,
COORD,
TT<:Real,
TV<:Vector{TT},
F1<:Function} <: SimultanousApproximationTerm{:Interface}
Struct for storage of the interface SAT which enforces $u^-(x_I) = u^+(x_I)$ and $\left.\partial_x u^-\right|_{x_I} = \left.\partial_x u^+\right|_{x_I}$
In Cartesian coordinates the SAT is
$\operatorname{SAT}_I = \tau_0 H^{-1} \hat{L}_0 u + \tau_1 H^{-1} K_x D_x^T \hat{L}_1 u + \tau_2 H^{-1} \hat{L}_1 K_x D_x u$
and in curvilinear coordinates the SAT isnan
$\operatorname{SAT}_I = \tau_0 H^{-1} \hat{L}_0 u + \tau_1 H^{-1} (K_q D_q^T + K_{qr} D_r^T)\hat{L}_1 u + \tau_2 H^{-1} \hat{L}_1 (K_q D_q + K_{qr} D_r)u$
where in both cases
\[\hat{L}_0 = \begin{bmatrix} 0 & \dots & \dots & 0 \\ \vdots & 1 & -1 & \vdots \\ \vdots & -1& 1 & \vdots \\ 0 & \dots & \dots & 0 \end{bmatrix} \qquad \hat{L}_1 = \begin{bmatrix} 0 & \dots & \dots & 0 \\ \vdots & 1 & -1 & \vdots \\ \vdots & 1 & -1 & \vdots \\ 0 & \dots & \dots & 0 \end{bmatrix}\]
FaADE.SATs.SAT_Interface
— MethodSAT_Interface(Δx₁::TT,Δx₂::TT,τ₀::AT,side::TN,axis::Int,order::Int;Δy=TT(0),coordinates=:Cartesian,normal=TT(1)) where {TT,AT,TN}
Constructor for the interface SAT
Required arguments:
Δx₁
,Δx₂
: Grid spacingτ₀
: Penaltyside
: Boundary side, eitherLeft
,Right
,Up
,Down
order
: Order of the $D_x$ operators, either2
or4
FaADE.SATs.SAT_Interface!
— FunctionApplies the interface SAT where buffer
contains the required data from the neighbouring block
SAT_Interface!(dest::AT,u::AT,c::AT,buffer::AT,SI::SAT_Interface{TN},::SATMode{:SolutionMode}) where {AT,TN<:NodeType{:Left}}
Left handed SAT for interface conditions. Correspond to block 2 in the setup:
$\begin{bmatrix} 1 & 2 \end{bmatrix}$
SAT_Interface!(dest::AT,u::AT,c::AT,buffer::AT,SI::SAT_Interface{TN},::SATMode{:SolutionMode}) where {AT,TN<:NodeType{:Left}}
Right handed SAT for interface conditions. Correspond to block 1 in the setup:
$\begin{bmatrix} 1 & 2 \end{bmatrix}$
SAT_Interface!(dest::AT,u::AT,c::AT,buffer::AT,SI::SAT_Interface{TN},::SATMode{:SolutionMode}) where {AT,TN<:NodeType{:Right}}
The curvilinear function calls the Cartesian functions and D₁!
and FirstDerivativeTranspose!
functions
SAT_Interface!(dest::AT,u::AT,cx::AT,cxy::AT,buffer::AT,SI::SAT_Interface{TN,:Curvilinear,TT},::SATMode{:SolutionMode}) where {AT,TN,TT}
FaADE.SATs.SAT_Interface_cache!
— FunctionWrites the interface interface terms to a buffer for sending to a neighbouring block.
1D and 2D Cartesian functions for Left
, Down
and Right
, Up
boundaries respectively
SAT_Interface_cache!(dest::AT,u::AT,c::AT,SI::SAT_Interface{TN,COORD,TT}) where {TT,AT,COORD,TN<:NodeType{:Left}}
SAT_Interface_cache!(dest::AT,u::AT,c::AT,SI::SAT_Interface{TN,COORD,TT}) where {TT,AT,COORD,TN<:NodeType{:Right}}
For curvilinear coordinates the D₁!
operator is used from FaADE.Derivatives
SAT_Interface_cache!(dest::AT,u::AT,c::AT,cxy::AT,SI::SAT_Interface{TN,:Curvilinear,TT}) where {TT,AT,TN}
Helpers
FaADE.SATs.SATMode
— TypeSATMode{T}
Used with the conjugate gradient solver so the appropriate function call can be used.
Values are
DataMode
for applying boundary data,SolutionMode
for applying the term which only includesu
such asu-g
in Dirichlet conditions,ExplicitMode
currently no solver implemented uses this.