Skip to content

selah_kernels_constraint ​

SELAH, L1: the box kernel of the inequality constraints on a step's result.

A component may have to stay non-negative (a density, a concentration), positive, non-positive or negative. After the stages of a step, before finish_step, the kernel reads the step's result u = q + dt sum_k b_k R_k at each cell (q and the residual registers only read, nothing written) and returns the smallest ratio r of the step that keeps every constrained component admissible, the solution moving along u(r) = q + r (u - q):

  • admissible: 1;
  • u past the bound and q inside it: q / (q - u), where the straight path crosses the bound;
  • u = 0 for a strict constraint (> 0, < 0): 1/2 (no crossing to locate);
  • q itself not admissible: 0.

The caller reduces it (a min over its boxes and ranks), rejects the step when it is below 1 and redoes it with dt times the ratio times a safety factor below 1 (the step's path is not straight). The constraint of component v is cons(v) = CONSTRAINT_NONE (0), CONSTRAINT_NONNEGATIVE (1), CONSTRAINT_POSITIVE (2), CONSTRAINT_NONPOSITIVE (-1) or CONSTRAINT_NEGATIVE (-2), v counted from the field's first component; cons is device resident. No mask.

Source: src/lib/selah_kernels_constraint.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
CONSTRAINT_NONEinteger(kind=I4P)parameterNo constraint.
CONSTRAINT_NONNEGATIVEinteger(kind=I4P)parameteru >= 0.
CONSTRAINT_POSITIVEinteger(kind=I4P)parameteru > 0.
CONSTRAINT_NONPOSITIVEinteger(kind=I4P)parameteru <= 0.
CONSTRAINT_NEGATIVEinteger(kind=I4P)parameteru < 0.

Subroutines ​

step_constraint_box ​

The smallest admissible ratio of the step over the box, u = q + dt sum_{k=1..n} coef(k) regs(k).

fortran
subroutine step_constraint_box(bx, n, dt, coef, regs, q, cons, ratio)

Arguments

NameTypeIntentAttributesDescription
bxtype(box)inBox.
ninteger(kind=I4P)inRegisters summed.
dtreal(kind=R_P)inTime step.
coefreal(kind=R_P)inThe weights b [n or more].
regsreal(kind=R_P)inResidual registers [..., n or more].
qreal(kind=R_P)inSolution, q^n.
consinteger(kind=I4P)inConstraint per component.
ratioreal(kind=R_P)outSmallest admissible ratio (1: every cell admissible).

Call graph