LorentzEliminator Struct ReferenceΒΆ
|
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
|
LorentzEliminator: operator B = [[1,-w],[w,1]] and its analytic inverse. More...
#include <lorentz_eliminator.hpp>
Collaboration diagram for pops::LorentzEliminator:Public Member Functions | |
| POPS_HD | LorentzEliminator (Real theta, Real dt, Real B_z) |
| Builds from (theta, dt, B_z): w = theta*dt*B_z, det = 1 + w^2. POPS_HD. | |
| POPS_HD void | apply_B (Real vx, Real vy, Real &Bx, Real &By) const |
| apply_B: applies B = [[1,-w],[w,1]] to (vx, vy), writes (Bx, By). POPS_HD. | |
| POPS_HD void | apply_Binv (Real vx, Real vy, Real &vxp, Real &vyp) const |
| apply_Binv: applies B^{-1} = (1/det)*[[1,w],[-w,1]] to (vx, vy), writes (vxp, vyp). POPS_HD. | |
Scalar entries of B^{-1} (to assemble the Schur operator A = rho * B^{-1}). | |
| POPS_HD Real | binv_11 () const |
| POPS_HD Real | binv_12 () const |
| POPS_HD Real | binv_21 () const |
| POPS_HD Real | binv_22 () const |
Public Attributes | |
| Real | w |
| Real | det |
Detailed Description
LorentzEliminator: operator B = [[1,-w],[w,1]] and its analytic inverse.
Built from (theta, dt, B_z); encodes the implicit Lorentz term in a Crank-Nicolson or theta-implicit scheme. Used to assemble the Schur operator A = rho * B^{-1} in the implicit velocity solver.
SIGN CONVENTION: B_field = B_z z_hat in the (x,y) plane. v x B_field = (v_y B_z, -v_x B_z) => B = [[1, -w], [w, 1]] with w = theta*dt*B_z. Do not modify without re-reading the derivation below.
We work in 2D in the (x, y) plane with B oriented along z: B_field = B_z * z_hat. The Lorentz term on the velocity v is: F_L = q/m * (v x B_field) In the 2D plane, with v = (v_x, v_y, 0) and B_field = (0, 0, B_z): v x B_field = (v_y * B_z, -v_x * B_z, 0) So the x component is +v_y*B_z and the y component is -v_x*B_z.
The operator B encodes the implicit term theta*dt*F_L in the time advance: B v = v - theta*dt*(v x B_field) which gives, by the convention above: (B v)_x = v_x - theta*dt * v_y * B_z (B v)_y = v_y + theta*dt * v_x * B_z In 2x2 matrix form: B = [[1, -w], [w, 1]] with w = theta*dt*B_z
WARNING: the negative sign is on the upper-right entry (-w term for v_x) and the positive sign is on the lower-left entry (+w term for v_y). This choice follows DIRECTLY from v x B_field above and must not be modified.
Analytic inverse: det(B) = 1 + w^2 (always > 0, B is invertible for any real w) B^{-1} = (1/det) * [[1, w], [-w, 1]]
Intended use: assembly of the Schur operator A = rho * B^{-1} in the implicit velocity solver. Generic: theta, dt, B_z are parameters; no physical dependency hard-coded.
INVARIANT: trivially copyable struct (static_assert below), device-safe, zero allocation, zero std:: call. Can be captured by value in a Kokkos/CUDA kernel.
Constructor & Destructor Documentation
◆ LorentzEliminator()
Builds from (theta, dt, B_z): w = theta*dt*B_z, det = 1 + w^2. POPS_HD.
Member Function Documentation
◆ apply_B()
|
inline |
apply_B: applies B = [[1,-w],[w,1]] to (vx, vy), writes (Bx, By). POPS_HD.
◆ apply_Binv()
|
inline |
apply_Binv: applies B^{-1} = (1/det)*[[1,w],[-w,1]] to (vx, vy), writes (vxp, vyp). POPS_HD.
Here is the caller graph for this function:◆ binv_11()
Here is the caller graph for this function:◆ binv_12()
Here is the caller graph for this function:◆ binv_21()
Here is the caller graph for this function:◆ binv_22()
Here is the caller graph for this function:Member Data Documentation
◆ det
| Real pops::LorentzEliminator::det |
◆ w
| Real pops::LorentzEliminator::w |
The documentation for this struct was generated from the following file:
- include/pops/numerics/linalg/lorentz_eliminator.hpp
Generated by