raddiff.h file
Rosseland diffusion coefficient and flux limiter.
The diffusion coefficient is $D = 1/(3\kappa_R)$. The Levermore–Pomraning limiter is $\lambda(R) = (\coth R - 1/R)/R$ with $R = |\nabla E|/(\kappa E)$. In the optically thick limit $\lambda(0) = 1/3$, and $\lambda$ stays in $(0, 1/3]$. The limited coefficient is $D\lambda(R)$.
The variable-D operator fills a caller-owned CSR. Constant $D = 1$ matches the assembled grid Laplacian. The solve stays vm_.
Functions
-
auto vm_raddiff_d(vm_
float_ t* D, const vm_ float_ t* kappa, int n) -> bool - Rosseland diffusion coefficient
$D = 1/(3\kappa_R)$. -
auto vm_raddiff_limiter(vm_
float_ t R) -> vm_ float_ t - Levermore–Pomraning flux limiter
$\lambda(R)$. -
auto vm_raddiff_ratio(vm_
float_ t grad_e, vm_ float_ t kappa, vm_ float_ t E) -> vm_ float_ t - Dimensionless gradient
$R = |\nabla E|/(\kappa E)$. -
auto vm_raddiff_residual(vm_
float_ t* r, const vm_ float_ t* kappa_a, const vm_ float_ t* E, const vm_ float_ t* aT4, int n) -> bool - Gray emission–absorption residual
$\kappa_a (E - a T^4)$. -
auto vm_raddiff_laplacian(vm_
spmat* A, const vm_ float_ t* D, vm_ grid3 g, vm_ bc_ t bc) -> bool - Fill a caller-owned CSR with
$-\nabla\cdot(D\nabla)$.
Function documentation
bool vm_raddiff_d(vm_ float_ t* D,
const vm_ float_ t* kappa,
int n)
Rosseland diffusion coefficient $D = 1/(3\kappa_R)$.
| Parameters | |
|---|---|
| D | Output coefficient; length n. |
| kappa | Rosseland opacity; length n. |
| n | |
| Returns | false if a pointer is NULL or any opacity is non-positive. |
vm_ float_ t vm_raddiff_limiter(vm_ float_ t R)
Levermore–Pomraning flux limiter $\lambda(R)$.
| Parameters | |
|---|---|
| R | Dimensionless gradient $R = |\nabla E|/(\kappa E)$. Negative values are taken in absolute value. |
| Returns | Limiter in $(0, 1/3]$. |
$\lambda(0) = 1/3$ and $\lambda$ decreases toward 0 as $R$ grows.
vm_ float_ t vm_raddiff_ratio(vm_ float_ t grad_e,
vm_ float_ t kappa,
vm_ float_ t E)
Dimensionless gradient $R = |\nabla E|/(\kappa E)$.
| Parameters | |
|---|---|
| grad_e | Magnitude of the energy gradient. |
| kappa | Rosseland opacity. |
| E | Energy density. |
| Returns | R, or 0 if the denominator is non-positive. |
bool vm_raddiff_residual(vm_ float_ t* r,
const vm_ float_ t* kappa_a,
const vm_ float_ t* E,
const vm_ float_ t* aT4,
int n)
Gray emission–absorption residual $\kappa_a (E - a T^4)$.
| Parameters | |
|---|---|
| r | Output residual; length n. |
| kappa_a | Absorption opacity; length n. |
| E | Energy density; length n. |
| aT4 | Radiation constant times $T^4$; length n. |
| n | |
| Returns | false if a pointer is NULL. |
bool vm_raddiff_laplacian(vm_ spmat* A,
const vm_ float_ t* D,
vm_ grid3 g,
vm_ bc_ t bc)
Fill a caller-owned CSR with $-\nabla\cdot(D\nabla)$.
| Parameters | |
|---|---|
| A | Output sparse matrix; size vm_. |
| D | Cell-centered diffusion coefficient, length vm_, or NULL. |
| g | Grid dimensions and spacing. |
| bc | Boundary condition (VM_ or VM_). |
| Returns | false if a pointer is NULL, the grid is invalid, or a coefficient is non-positive. |
Same boundary treatment as vm_. Face coefficient is the arithmetic mean of the two cell values; a domain boundary face uses the cell value. Constant D == 1 matches the assembled Laplacian. NULL D means coefficient 1 everywhere.