geometry
Domain
Bases: Module
Domain class describing a rectangular domain
Attributes:
| Name | Type | Description |
|---|---|---|
size |
Tuple[int]
|
The size of the domain in absolute units. |
dx |
Tuple(float
|
The unit of measure |
boundary_sampler
property
Returns a function that samples a point on the boundary of the domain
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
A function that samples a point on the boundary of the domain. This function takes a seed and an integer number of samples and returns a list of samples. |
Example
>>> domain = Domain((10, 10), (0.1, 0.1))
>>> boundary_sampler = domain.boundary_sampler
>>> boundary_sampler(random.PRNGKey(0), 10)
Array([[-0.02072918, 0.5 ],
[-0.5 , 0.49063694],
[-0.18872023, -0.5 ],
[ 0.31801188, -0.5 ],
[-0.1319474 , -0.5 ],
[ 0.5 , -0.36944878],
[ 0.5 , 0.46956718],
[ 0.4608934 , -0.5 ],
[-0.09031796, 0.5 ],
[-0.5 , 0.40659428]], dtype=float32)
cell_volume
property
The volume of a single cell
Returns:
| Name | Type | Description |
|---|---|---|
float |
The volume of a single cell |
domain_sampler
property
Returns a function that samples a point in the domain
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
A function that samples a point in the domain. This function takes a seed and an integer number of samples and returns a list of samples. |
Example
>>> domain = Domain((10, 10), (0.1, 0.1))
>>> domain_sampler = domain.domain_sampler
>>> domain_sampler(random.PRNGKey(0), 10)
Array([[ 0.06298566, 0.35970068],
[-0.20049798, 0.05455852],
[ 0.33402848, -0.04824698],
[ 0.27945423, 0.2805649 ],
[ 0.49464726, 0.3473643 ],
[-0.16299951, -0.27665186],
[-0.06442916, 0.04995835],
[ 0.05011427, -0.17267668],
[-0.39805043, -0.05386746],
[ 0.46900105, 0.21520817]], dtype=float32)
grid
property
A grid of spatial position, of size
Nx x Ny x Nz x ... x num_axis such that the element
[x1,x2,x3, .., :] is a coordinate vector.
Returns:
| Type | Description |
|---|---|
|
jnp.array: A grid of spatial position |
ndim
property
The number of dimensions of the domain
Returns:
| Name | Type | Description |
|---|---|---|
int |
The number of dimensions of the domain |
size
property
The lenght of the grid sides
Returns:
| Type | Description |
|---|---|
|
Tuple[float]: The size of the domain, in absolute units |
spatial_axis
property
The spatial axis of the domain
Returns:
| Type | Description |
|---|---|
|
Tuple[jnp.array]: The spatial axis of the domain |