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_interlayer_policies()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]: ...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.
layered_modellayered_model.LayeredModel — The layered model.thickness_thresholdfloat — The minimum thickness above which coarsening is allowed. Should be expressed as a ratio of the minimum thickness to the maximum edge length.n_dimint — The dimension of the layered model.mesh_resolutionMeshResolution — The resolution of the mesh.coarsening_policyInterlayerCoarseningPolicy — Which coarsening policy to introduce within layers that are thick enough.
crossing_layer_allowed()
crossing_layer_allowed()def crossing_layer_allowed(p: IntralayerCoarseningPolicy) -> bool: ...Collection of conditions that allow layers to cross.
pIntralayerCoarseningPolicy — A layer’s coarsening policy.
n_elm_dict()
n_elm_dict()def n_elm_dict(
n_elm: list[int],
cs: CoordinateSystem,
bounds: dict[str, tuple[float, float]],
) -> dict[str, int]: ...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.
n_elmlist[int] — List of elements in the x, [y] direction.csCoordinateSystem — The coordinate system.boundsdict[str, tuple[float, float]] — The coordinate bounds of the layer.
rotate_cubed_sphere_chunk()
rotate_cubed_sphere_chunk()def rotate_cubed_sphere_chunk(
domain_or_euler_angles: domain.Domain | tuple[float, float, float],
mb: MeshBlock,
) -> MeshBlock: ...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.
domain_or_euler_anglesdomain.Domain | tuple[float, float, float] — 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.mbMeshBlock — The mesh block.
solve_interlayer_coarsening()
solve_interlayer_coarsening()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]]: ...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.
nhlist[tuple[int, ...]] — The minimum number of elements in each horizontal dimension, for each layer.policieslist[InterlayerCoarseningPolicy] | None — A list of interlayer coarsening policies. Should either be equal to the number of interfaces, orNone, in which a constant policy will be applied to each interface.layer_modulo_constraintint — Ensure that all layers include elements along each dimension that are multiples of this number.bottom_layer_modulo_constraintint — Ensure that the bottom layer (i.e. the last entry innh) is a multiple of this number.