Version:

salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.detail

salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.detail salvus mesh layered_meshing meshing_protocol coarsening_policy detail
Implementation details for coarsening policies.

Functions

construct_interlayer_policies()

Construct a set of interlayer policies given a layered model.
This function is primarily useful for preventing the introduction of mesh coarsenings where the host layer is too thin.
SIGNATURE
def construct_interlayer_policies(
    layered_model: layered_model.LayeredModel,
    thickness_threshold: float,
    n_dim: int,
    mesh_resolution: MeshResolution,
    coarsening_policy: InterlayerCoarseningPolicy = InterlayerDoubling(
        n_layers="auto"
    ),
) -> list[InterlayerCoarseningPolicy]: ...
ARGUMENTS
Required
layered_model
Type:layered_model.LayeredModel
Description:
The layered model.
Required
thickness_threshold
Type:float
Description:
The minimum thickness above which coarsening is allowed. Should be expressed as a ratio of the minimum thickness to the maximum edge length.
Required
n_dim
Type:int
Description:
The dimension of the layered model.
Required
mesh_resolution
Type:MeshResolution
Description:
The resolution of the mesh.
Optional
coarsening_policy
Type:InterlayerCoarseningPolicy
Default value:InterlayerDoubling(n_layers='auto')
Description:
Which coarsening policy to introduce within layers that are thick enough.
RETURNS
Return type: list[InterlayerCoarseningPolicy]
A list of coarsening policies.

crossing_layer_allowed()

Collection of conditions that allow layers to cross.
SIGNATURE
def crossing_layer_allowed(p: IntralayerCoarseningPolicy) -> bool: ...
ARGUMENTS
Required
p
Type:IntralayerCoarseningPolicy
Description:
A layer's coarsening policy.
RETURNS
Return type: bool
Whether or not crossing layers should be allowed.

n_elm_dict()

A dictionary of element_count_x[y,z] to be passed to a MeshBlock constructor.
Correct argument names will be returned depending on the coordinate system.
SIGNATURE
def n_elm_dict(
    n_elm: list[int],
    cs: CoordinateSystem,
    bounds: dict[str, tuple[float, float]],
) -> dict[str, int]: ...
ARGUMENTS
Required
n_elm
Type:list[int]
Description:
List of elements in the x, [y] direction.
Required
cs
Type:CoordinateSystem
Description:
The coordinate system.
Required
bounds
Type:dict[str, tuple[float, float]]
Description:
The coordinate bounds of the layer.
RETURNS
Return type: dict[str, int]
A dict with the proper parameter names and values.

rotate_cubed_sphere_chunk()

Rotate the cubed sphere to center it within a SphericalChunkDomain.
If the domain is not a SphericalChunkDomain, simply return the mesh blocks as they were passed in.
SIGNATURE
def rotate_cubed_sphere_chunk(
    domain_or_euler_angles: domain.Domain | tuple[float, float, float],
    mb: MeshBlock,
) -> MeshBlock: ...
ARGUMENTS
Required
domain_or_euler_angles
Type:domain.Domain | tuple[float, float, float]
Description:
The domain of the cubed sphere, or a set of explicit euler angles to rotate by. If euler angles, they should be in degrees and describe an extrinsic rotation around the z->y->z axes, respectively.
Required
mb
Type:MeshBlock
Description:
The mesh block.
RETURNS
Return type: MeshBlock
A potentially rotated mesh block.

solve_interlayer_coarsening()

Compute the number of horizontal elements across successive layers.
Will return a solution that respects the interlayer coarsening policies while minimizing the total number of elements in the mesh.
SIGNATURE
def solve_interlayer_coarsening(
    nh: list[tuple[int, ...]],
    policies: list[InterlayerCoarseningPolicy] | None = None,
    layer_modulo_constraint: int = 1,
    bottom_layer_modulo_constraint: int = 1,
) -> list[list[int]]: ...
ARGUMENTS
Required
nh
Type:list[tuple[int, ...]]
Description:
The minimum number of elements in each horizontal dimension, for each layer.
Optional
policies
Type:list[InterlayerCoarseningPolicy] | None
Default value:None
Description:
A list of interlayer coarsening policies. Should either be equal to the number of interfaces, or None, in which a constant policy will be applied to each interface.
Optional
layer_modulo_constraint
Type:int
Default value:1
Description:
Ensure that all layers include elements along each dimension that are multiples of this number.
Optional
bottom_layer_modulo_constraint
Type:int
Default value:1
Description:
Ensure that the bottom layer (i.e. the last entry in nh) is a multiple of this number.
RETURNS
Return type: list[list[int]]
The optimal number of horizontal elements spanning each layer.
PAGE CONTENTS