Simultaneous Approximation Terms

FaADE.SATsModule
SATs

Submodule containing the simulatenous approximation term constructor and functions.

source

All SATs belong to the abstract type.

Boundary operators

Dirichlet

FaADE.SATs.SAT_DirichletType
SAT_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)
source
FaADE.SATs.SAT_DirichletMethod
SAT_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 spacing
  • side: Boundary side, either Left, Right, Up, Down
  • order: Order of the $D_x$ operators, either 2 or 4
source
FaADE.SATs.SAT_Dirichlet_data!Function

Dirichlet 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}
source
FaADE.SATs.SAT_Dirichlet_explicit!Function
SAT_Dirichlet_explicit!

Dirichlet SAT for explicit solvers. Currently no explicit solvers are implemented so these haven't been tested and are not used anywhere.

source
FaADE.SATs.SAT_Dirichlet_solution!Function

Dirichlet 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}
source

Neumann

FaADE.SATs.SAT_NeumannType
SAT_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$

source
FaADE.SATs.SAT_NeumannMethod
SAT_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 spacing
  • side: Boundary side, either Left, Right, Up, Down
  • order: Order of the $D_x$ operators, either 2 or 4
source
FaADE.SATs.SAT_Neumann_data!Function

Neumann 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}
source
FaADE.SATs.SAT_Neumann_explicit!Function
SAT_Neumann_explicit!

Neumann boundary SAT for explicit solvers. No explicit solvers are implemented so this has not been tested and is not used.

source
FaADE.SATs.SAT_Neumann_solution!Function

Neumann 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}
source

Robin

FaADE.SATs.SAT_RobinType
SAT_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

source
FaADE.SATs.SAT_RobinMethod
SAT_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 spacing
  • side: Boundary side, either Left, Right, Up, Down
  • order: Order of the $D_x$ operators, either 2 or 4
source
FaADE.SATs.SAT_Robin_data!Method

Robin 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}
source
FaADE.SATs.SAT_Robin_solution!Function

Robin 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}
source

Periodic

FaADE.SATs.SAT_PeriodicType
SAT_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}\]

source
FaADE.SATs.SAT_PeriodicMethod
SAT_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 spacing
  • side: Boundary side, either Left, Right, Up, Down
  • order: Order of the $D_x$ operators, either 2 or 4
source
FaADE.SATs.SAT_Periodic!Function

Periodic 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}
source

Interface

FaADE.SATs.SAT_InterfaceType
SAT_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}\]

source
FaADE.SATs.SAT_InterfaceMethod
SAT_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
  • τ₀: Penalty
  • side: Boundary side, either Left, Right, Up, Down
  • order: Order of the $D_x$ operators, either 2 or 4
source
FaADE.SATs.SAT_Interface!Function

Applies 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}
source
FaADE.SATs.SAT_Interface_cache!Function

Writes 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}
source

Helpers

FaADE.SATs.SATModeType
SATMode{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 includes u such as u-g in Dirichlet conditions,
  • ExplicitMode currently no solver implemented uses this.
source