Linear¤
exponax.normalized.DifficultyLinearStepper
¤
Bases: NormalizedLinearStepper
Source code in exponax/normalized/_linear.py
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
__init__
¤
__init__(
num_spatial_dims: int = 1,
num_points: int = 48,
*,
difficulties: tuple[float, ...] = (0.0, -2.0)
)
Timestepper for d-dimensional (d ∈ {1, 2, 3}
) linear PDEs on periodic
boundary conditions with normalized dynamics in a difficulty-based
interface.
Different to NormalizedLinearStepper
, the dynamics are defined by
difficulties. The difficulties are a different combination of normalized
dynamics, num_spatial_dims
, and num_points
.
γᵢ = αᵢ Nⁱ 2ⁱ⁻¹ d
with d
the number of spatial dimensions, N
the number of points, and
αᵢ
the normalized coefficient.
This interface is more natural because the difficulties for all orders
(given by i
) are around 1.0. Additionally, they relate to stability
condition of explicit Finite Difference schemes for the particular
equations. For example, for advection (i=1
), the absolute of the
difficulty is the Courant-Friedrichs-Lewy (CFL) number.
In the default configuration of this timestepper, the PDE is an advection equation with CFL number 2 solved in 1d with 48 resolution points to discretize the domain.
Arguments:
num_spatial_dims
: The number of spatial dimensionsd
. Default is 1.num_points
: The number of pointsN
used to discretize the domain. This includes the left boundary point and excludes the right boundary point. In higher dimensions; the number of points in each dimension is the same. Hence, the total number of degrees of freedom isNᵈ
. Default is 48.difficulties
: The difficulties of the normalized dynamics. This must be a tuple of floats. The length of the tuple defines the highest occuring linear derivative in the PDE. Default is(0.0, -2.0)
.
Source code in exponax/normalized/_linear.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
__call__
¤
__call__(
u: Float[Array, "C ... N"]
) -> Float[Array, "C ... N"]
Performs a check
Source code in exponax/_base_stepper.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|