Forced Stepper¤
exponax.ForcedStepper
¤
Bases: Module
Source code in exponax/_forced_stepper.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
__init__
¤
__init__(stepper: BaseStepper)
Transform a stepper of signature (u,) -> u_next
into a stepper of
signature (u, f) -> u_next
that also accepts a forcing vector f
.
Transforms a stepper for a PDE of the form u_t = Lu + N(u) into a stepper for a PDE of the form u_t = Lu + N(u) + f, where f is a forcing term. For this, we split by operators
v_t = f
u_t = Lv + N(v)
Since we assume to only have access to the forcing function evaluated at one time level (but on the same grid as the state), we use a forward Euler scheme to integrate the first equation. The second equation is integrated using the original stepper.
Note: This operator splitting makes the total scheme only first order accurate in time. It is a quick hack to extend the other sophisticated transient integrators to forced problems.
Arguments:
stepper
: The stepper to be transformed.
Source code in exponax/_forced_stepper.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
__call__
¤
__call__(
u: Float[Array, "C ... N"], f: Float[Array, "C ... N"]
) -> Float[Array, "C ... N"]
Step the PDE forward in time by one time step given the current state
u
and the forcing term f
.
The forcing term f
is assumed to be evaluated on the same grid as u
.
Arguments:
u
: The current state.f
: The forcing term.
Returns:
u_next
: The state after one time step.
Source code in exponax/_forced_stepper.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|