Kuramoto-Sivashinsky (conservative format)¤
Uses the convection nonlinearity similar to Burgers, but only works in 1D:
exponax.stepper.KuramotoSivashinskyConservative
¤
Bases: BaseStepper
Source code in exponax/stepper/_kuramoto_sivashinsky.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
__init__
¤
__init__(
num_spatial_dims: int,
domain_extent: float,
num_points: int,
dt: float,
*,
convection_scale: float = 1.0,
second_order_scale: float = 1.0,
fourth_order_scale: float = 1.0,
single_channel: bool = False,
conservative: bool = True,
dealiasing_fraction: float = 2 / 3,
order: int = 2,
num_circle_points: int = 16,
circle_radius: float = 1.0
)
Using the fluid dynamics form of the KS equation (i.e. similar to the Burgers equation).
In 1d, the KS equation is given by
uₜ + b₁ 1/2 (u²)ₓ + ψ₁ uₓₓ + ψ₂ uₓₓₓₓ = 0
with b₁
the convection coefficient, ψ₁
the second-order scale and
ψ₂
the fourth-order. If the latter two terms were on the right-hand
side, they could be interpreted as diffusivity and hyper-diffusivity,
respectively. Here, the second-order term acts destabilizing (increases
the energy of the system) and the fourth-order term acts stabilizing
(decreases the energy of the system). A common configuration is b₁ = ψ₁
= ψ₂ = 1
and the dynamics are only adapted using the domain_extent
.
For this, we espect the KS equation to experience spatio-temporal chaos
roughly once L > 60
.
Info
In this fluid dynamics (=conservative) format, the number of
channels grows with the spatial dimension. However, it seems that
this format does not generalize well to higher dimensions. For
higher dimensions, consider using the combustion format
(exponax.stepper.KuramotoSivashinsky
) instead.
Arguments:
num_spatial_dims
: The number of spatial dimensionsd
.domain_extent
: The size of the domainL
; in higher dimensions the domain is assumed to be a scaled hypercubeΩ = (0, L)ᵈ
.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ᵈ
.dt
: The timestep sizeΔt
between two consecutive states.convection_scale
: The convection coefficientb₁
. Note that the convection term is already scaled by 1/2. This factor allows for further modification. Default: 1.0.second_order_scale
: The "diffusivity"ψ₁
in the KS equation.fourth_order_diffusivity
: The "hyper-diffusivity"ψ₂
in the KS equation.single_channel
: Whether to use a single channel for the spatial dimension. Default:False
.conservative
: Whether to use the conservative format. Default:True
.dealiasing_fraction
: The fraction of the wavenumbers to keep before evaluating the nonlinearity. The default 2/3 corresponds to Orszag's 2/3 rule. To fully eliminate aliasing, use 1/2. Default: 2/3.order
: The order of the Exponential Time Differencing Runge Kutta method. Must be one of {0, 1, 2, 3, 4}. The option0
only solves the linear part of the equation. Use higher values for higher accuracy and stability. The default choice of2
is a good compromise for single precision floats.num_circle_points
: How many points to use in the complex contour integral method to compute the coefficients of the exponential time differencing Runge Kutta method. Default: 16.circle_radius
: The radius of the contour used to compute the coefficients of the exponential time differencing Runge Kutta method. Default: 1.0.
Source code in exponax/stepper/_kuramoto_sivashinsky.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
__call__
¤
__call__(
u: Float[Array, "C ... N"]
) -> Float[Array, "C ... N"]
Perform one step of the time integration for a single state.
Arguments:
u
: The state vector, shape(C, ..., N,)
.
Returns:
u_next
: The state vector after one step, shape(C, ..., N,)
.
Tip
Use this call method together with exponax.rollout
to efficiently
produce temporal trajectories.
Info
For batched operation, use jax.vmap
on this function.
Source code in exponax/_base_stepper.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|