Grid-based Scale
Grid-based Scale¤
neojax.data.scales.GridBasedScale
¤
Applies spatially-varying scaling factors from a grid.
Used when the scaling depends on the location in the domain, such as varying mesh density or coordinate-dependent physics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scale_field
|
Float[Array, ...]
|
An array of scaling factors defined on the domain grid. |
required |
Internal Attributes
These fields store the internal state of the scale.
- scale_field (
Float[Array, "..."]): The spatially-varying scaling factors.
Examples:
grid_factors = jnp.linspace(1.0, 2.0, 32)
scale = GridBasedScale(scale_field=grid_factors)
factors = scale.get_scale(x_batch)
get_scale(x: Float[Array, ...], eps: float = 1e-07) -> Float[Array, ...]
¤
Returns the spatially-varying scale field, broadcast to x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Float[Array, ...]
|
The input array (e.g., a batch of velocity fields). |
required |
eps
|
float
|
Small value to prevent division by zero. Defaults to 1e-7. |
1e-07
|
Returns:
| Type | Description |
|---|---|
Float[Array, ...]
|
The scaling field broadcast to the shape of |