salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.detail
Implementation details for coarsening policies.
Functions
crossing_layer_allowed()
crossing_layer_allowed()def crossing_layer_allowed(
p: salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.IntralayerCoarseningPolicy,
) -> bool:
...Collection of conditions that allow layers to cross.
Parameters
psalvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.IntralayerCoarseningPolicy — A layer’s coarsening policy.
Returns bool — Whether or not crossing layers should be allowed.
n_elm_dict()
n_elm_dict()def n_elm_dict(
n_elm: List[int],
cs: salvus.project.components.types.CoordinateSystem,
bounds: Dict[str, Tuple[float, float]],
) -> Dict[str, int]:
...A dictionary of nelem_x[y,z] to be passed to a MeshBlock constructor.
Correct argument names will be returned depending on the coordinate system.
Parameters
n_elmList[int] — List of elements in the x, [y] direction.cssalvus.project.components.types.CoordinateSystem — The coordinate system.boundsDict[str, Tuple[float, float]] — The coordinate bounds of the layer.
Returns Dict[str, int] — A dict with the proper parameter names and values.
rotate_cubed_sphere_chunk()
rotate_cubed_sphere_chunk()def rotate_cubed_sphere_chunk(
domain_or_euler_angles: Union[
salvus.project.domain.Domain, Tuple[float, float, float]
],
mb: salvus.mesh.mesh_block.mesh_block.MeshBlock,
) -> salvus.mesh.mesh_block.mesh_block.MeshBlock:
...Rotate the a 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.
Parameters
domain_or_euler_anglesUnion[salvus.project.domain.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.mbsalvus.mesh.mesh_block.mesh_block.MeshBlock — The mesh block.
Returns salvus.mesh.mesh_block.mesh_block.MeshBlock — A potentially rotated mesh block.
solve_interlayer_coarsening()
solve_interlayer_coarsening()def solve_interlayer_coarsening(
nh: List[Tuple[int, ...]],
policies: Optional[
List[
salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.InterlayerCoarseningPolicy
]
] = 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.
Parameters
nhList[Tuple[int, ...]] — The minimum number of elements in each horizontal dimension, for each layer.policiesOptional[List[salvus.mesh.layered_meshing.meshing_protocol.coarsening_policy.InterlayerCoarseningPolicy]] — 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.
Returns List[List[int]] — The optimal number of horizontal elements spanning each layer.