Base Nonlinear Function¤
exponax.nonlin_fun.BaseNonlinearFun
¤
Bases: Module
, ABC
Source code in exponax/nonlin_fun/_base.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 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 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 |
|
__init__
¤
__init__(
num_spatial_dims: int,
num_points: int,
*,
dealiasing_fraction: Optional[float] = None
)
Base class for all nonlinear functions. This class provides the basic functionality to dealias the nonlinear terms and perform forward and inverse Fourier transforms.
Arguments:
num_spatial_dims
: The number of spatial dimensionsD
.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.dealiasing_fraction
: The fraction of the highest resolved mode to keep for dealiasing. For example,2/3
corresponds to Orszag's 2/3 rule typically used for quadratic nonlinearities. IfNone
, no dealiasing is performed.
Info
Some dealiasing strategies (like Orszag's 2/3 rule) are designed to not fully remove aliasing (which would require 1/2 in the case of quadratic nonlinearities), rather to only have aliases being created in those modes that will be zeroed out anyway in the next dealiasing step. See also Orszag (1971)
Source code in exponax/nonlin_fun/_base.py
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 |
|
__call__
abstractmethod
¤
__call__(
u_hat: Complex[Array, "C ... (N//2)+1"]
) -> Complex[Array, "C ... (N//2)+1"]
Evaluates the nonlinear function with a pseudo-spectral treatment and accounts for dealiasing.
Use this in combination with exponax.etdrk
routines to solve
semi-linear PDEs in Fourier space.
Arguments:
u_hat
: The Fourier representation of the stateu
.
Returns:
𝒩(u_hat)
: The Fourier representation of the nonlinear term.
Source code in exponax/nonlin_fun/_base.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|