diff src/SbpOperators/boundary_conditions/sat.jl @ 1603:fca4a01d60c9 feature/boundary_conditions

Remove module BoundaryConditions, moving its content to SbpOperators
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Tue, 04 Jun 2024 16:46:14 -0700
parents src/BoundaryConditions/sat.jl@3e7438e2a033
children 77f192b05b1d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/SbpOperators/boundary_conditions/sat.jl	Tue Jun 04 16:46:14 2024 -0700
@@ -0,0 +1,24 @@
+"""
+    sat_tensors(op, grid, bc::BoundaryCondition, params...)
+
+The tensor and boundary operator used to construct a simultaneous-approximation-term
+for imposing `bc` related to `op`.
+
+For `penalty_tensor, L  = sat_tensors(...)` then `SAT = penalty_tensor*(L*u - g)`  where `g` 
+is the boundary data.
+"""
+function sat_tensors end
+
+
+"""
+    sat(op, grid, bc::BoundaryCondition; kwargs...)
+
+Simultaneous-Approximation-Term for a general `bc` to `op`. 
+Returns a function `SAT(u,g)` weakly imposing `bc` when added to `op*u`.
+
+`op` must implement the function `sat_tensors`.
+"""
+function sat(op, grid, bc::BoundaryCondition; kwargs...)
+    penalty_tensor, L = sat_tensors(op, grid, bc; kwargs...)
+    return SAT(u, g) = penalty_tensor*(L*u - g)
+end