pyoomph.meshes.mesh module

class pyoomph.meshes.mesh.MeshTemplate[source]

Bases: MeshTemplate

A class to construct meshes by defining nodes with the add_node() or add_node_unique() method. Elements must be specified by first creating one or multiple domains with the new_domain() method and adding elements on each domain. Nodes can be also marked to be on particular boundaries with the add_node_on_boundary() method.

add_facet_to_curve_entity(self: _pyoomph.MeshTemplate, arg0: collections.abc.Sequence[SupportsInt], arg1: _pyoomph.MeshTemplateCurvedEntityBase) None

Adds a facet to a curved boundary so that e.g. additional nodes of refined meshes will be exactly on this curve

add_node(self: _pyoomph.MeshTemplate, x: SupportsFloat, y: SupportsFloat = 0.0, z: SupportsFloat = 0.0) int

Adds a node at the given position. Creates overlapping nodes, if there is already a node at this position.

add_node_unique(self: _pyoomph.MeshTemplate, x: SupportsFloat, y: SupportsFloat = 0.0, z: SupportsFloat = 0.0) int

Adds a node at the given position. If there is already a node at this position,no new node is created

add_nodes_to_boundary(self: _pyoomph.MeshTemplate, arg0: str, arg1: collections.abc.Sequence[SupportsInt]) None

Adds a list of nodes, i.e. a facet, to a boundary

add_periodic_node_pair(self: _pyoomph.MeshTemplate, n_mst: SupportsInt, n_slv: SupportsInt) None
available_domains()[source]

Returns a list of all available domains constructed with new_domain().

Return type:

Set[str]

create_curved_entity(typ, *args, **kwargs)[source]

Creates a curved entity on the mesh. Currently only the type "circle_arc" is supported, which requires the start and end point as positional arguments and either the center or through_point as keyword argument.

Parameters:
  • typ (str) – Type of the curved entity. Currently only "circle_arc" is supported.

  • args (Any) – Positional arguments for the curved entity.

  • kwargs (Any) – Keyword arguments for the curved entity.

Return type:

MeshTemplateCurvedEntityBase

Returns:

The created curved entity to be used in add_facet_to_curve_entity().

define_geometry()[source]

This method must be specialized in a derived class to define the geometry, i.e. the nodes, domains and elements of the mesh.

Return type:

None

get_domain(name)[source]

Get a domain by name constructed with the method new_domain() before.

Return type:

MeshTemplateElementCollection

get_node_position(self: _pyoomph.MeshTemplate, arg0: SupportsInt) list[float]
has_domain(name)[source]

Test if a domain with the given name is available, i.e. constructed with new_domain() before.

Return type:

bool

max_permitted_error

The maximum permitted error for the spatial error estimator. If None, we use the value from the Problem object.

max_refinement_level

The maximum refinement level for spatial adaptivity. If None, we use the value from the Problem object.

min_permitted_error

The minimum permitted error for the spatial error estimator. If None, we use the value from the Problem object.

min_refinement_level

The minimum refinement level for spatial adaptivity. If None, we use the value from the Problem object.

new_bulk_element_collection(self: _pyoomph.MeshTemplate, arg0: str) _pyoomph.MeshTemplateElementCollection
new_domain(name, nodal_dimension=None)[source]

Create a new domain with the given name. With the help of this domain, elements can be added to the mesh.

Return type:

MeshTemplateElementCollection

nondim_size(a)[source]

Nondimensionalize a coordinate or a length scale by dividing by the spatial scale of the problem.

Parameters:

a (Union[Expression, int, float, List[Union[Expression, int, float]]]) – The coordinate or length scale to nondimensionalize.

Return type:

Union[float, List[float]]

Returns:

The arguments divided by the spatial scale of the problem.

remesher: Optional[RemesherBase]

Must be set to allow for remeshing.

class pyoomph.meshes.mesh.ODEStorageMesh(problem, eqtree, domainname)[source]

Bases: ODEStorageMesh

A sort of a mesh storing ODE values. This is not a real mesh, but a container for ODE values.

activate_duarte_debug(self: _pyoomph.Mesh) None
adapt_by_elemental_errors(self: _pyoomph.Mesh, arg0: collections.abc.Sequence[SupportsFloat]) None
add_boundary_node(self: _pyoomph.Mesh, arg0: SupportsInt, arg1: _pyoomph.Node) None
add_interpolated_nodes_at(self: _pyoomph.Mesh, arg0: collections.abc.Sequence[collections.abc.Sequence[SupportsFloat]], arg1: bool) list[_pyoomph.Node]
add_node_to_mesh(self: _pyoomph.OomphMesh, arg0: _pyoomph.Node) None
as_pyoomph_mesh(self: _pyoomph.OomphMesh) _pyoomph.Mesh
boundary_coordinate_bool(self: _pyoomph.Mesh, arg0: SupportsInt) None
boundary_element_pt(self: _pyoomph.OomphMesh, arg0: SupportsInt, arg1: SupportsInt) _pyoomph.OomphGeneralisedElement
boundary_node_pt(self: _pyoomph.OomphMesh, arg0: SupportsInt, arg1: SupportsInt) _pyoomph.Node
check_integrity(self: _pyoomph.Mesh) None
describe_global_dofs(self: _pyoomph.Mesh) tuple[list[int], list[str]]
describe_my_dofs(self: _pyoomph.Mesh, arg0: str) str
element_pt(self: _pyoomph.OomphMesh, arg0: SupportsInt) _pyoomph.OomphGeneralisedElement
ensure_external_data(self: _pyoomph.Mesh) None
ensure_halos_for_periodic_boundaries(self: _pyoomph.Mesh) None
evaluate_local_expression_at_nodes(self: _pyoomph.Mesh, arg0: SupportsInt, arg1: bool, arg2: bool) list[float]
face_index_at_boundary(self: _pyoomph.OomphMesh, arg0: SupportsInt, arg1: SupportsInt) int
fill_dof_types(self: _pyoomph.Mesh, arg0: Annotated[numpy.typing.ArrayLike, numpy.int32]) None
fill_node_index_to_node_map(self: _pyoomph.Mesh) list[_pyoomph.Node]
flush_element_storage(self: _pyoomph.Mesh) None
generate_interface_elements(self: _pyoomph.Mesh, arg0: str, arg1: _pyoomph.Mesh, arg2: _pyoomph.DynamicBulkElementInstance) None
get_boundary_index(self: _pyoomph.Mesh, arg0: str) int
get_boundary_names(self: _pyoomph.Mesh) list[str]
get_element_dimension(self: _pyoomph.Mesh) int
get_elemental_errors(self: _pyoomph.OomphMesh) list[float]
get_field_information(self: _pyoomph.Mesh) dict[str, str]
get_node_reordering(self: _pyoomph.Mesh, arg0: bool) list[_pyoomph.Node]
get_output_scale(self: _pyoomph.Mesh, arg0: str) float
get_refinement_pattern(self: _pyoomph.Mesh) list[numpy.typing.NDArray[numpy.uint32]]
get_value(name, *, dimensional=True, as_float=False)[source]

Get the value(s) associated with the given name(s) from the ODE.

Parameters:
  • name (Union[str, pyoomph.expressions.NameStrSequence]) – The name(s) of the value(s) to retrieve.

  • dimensional (bool, optional) – Whether to return the value(s) in dimensional form. Defaults to True.

  • as_float (bool, optional) – Whether to return the value(s) as float(s). Defaults to False.

Returns:

The value(s) associated with the given name(s).

Return type:

Union[ExpressionOrNum, Tuple[ExpressionOrNum, …]]

Raises:

RuntimeError – If the ODE has no value with the given name(s).

get_values_at_zetas(self: _pyoomph.Mesh, arg0: Annotated[numpy.typing.ArrayLike, numpy.float64], arg1: bool) tuple[list[list[float]], list[bool], dict[str, int]]
has_interface_dof_id(self: _pyoomph.Mesh, arg0: str) int
invalidate_lagrangian_kdtree(self: _pyoomph.Mesh) None
is_boundary_coordinate_defined(self: _pyoomph.Mesh, arg0: SupportsInt) bool
is_mesh_distributed(self: _pyoomph.Mesh) bool
list_integral_functions(self: _pyoomph.Mesh) list[str]
list_local_expressions(self: _pyoomph.Mesh) list[str]
nboundary(self: _pyoomph.OomphMesh) int
nboundary_element(self: _pyoomph.OomphMesh, arg0: SupportsInt) int
nboundary_node(self: _pyoomph.OomphMesh, arg0: SupportsInt) int
nelement(self: _pyoomph.OomphMesh) int
nnode(self: _pyoomph.OomphMesh) int
nodal_interpolate_along_boundary(self: _pyoomph.Mesh, arg0: _pyoomph.Mesh, arg1: SupportsInt, arg2: SupportsInt, arg3: _pyoomph.Mesh, arg4: _pyoomph.Mesh, arg5: SupportsFloat) None
nodal_interpolate_from(self: _pyoomph.Mesh, arg0: _pyoomph.Mesh, arg1: SupportsInt) None
node_pt(self: _pyoomph.OomphMesh, arg0: SupportsInt) _pyoomph.Node
nrefined(self: _pyoomph.Mesh) int
nunrefined(self: _pyoomph.Mesh) int
output_paraview(self: _pyoomph.OomphMesh, arg0: str, arg1: SupportsInt) None
prepare_interpolation(self: _pyoomph.Mesh) None
prepare_zeta_interpolation(self: _pyoomph.Mesh, arg0: _pyoomph.Mesh) None
prune_dead_nodes(self: _pyoomph.OomphMesh, arg0: bool) None
refine_base_mesh(self: _pyoomph.Mesh, arg0: collections.abc.Sequence[collections.abc.Sequence[SupportsInt]]) None
remove_boundary_nodes(self: _pyoomph.Mesh) None
remove_boundary_nodes_of_bound(self: _pyoomph.Mesh, arg0: SupportsInt) None
reorder_nodes(self: _pyoomph.Mesh, arg0: bool) None
resolve_copy_master_node(self: _pyoomph.OomphMesh, arg0: _pyoomph.Node) _pyoomph.Node
set_initial_condition(self: _pyoomph.Mesh, arg0: str, arg1: _pyoomph.Expression) None
set_lagrangian_nodal_coordinates(self: _pyoomph.Mesh) None
set_output_scale(self: _pyoomph.Mesh, arg0: str, arg1: _pyoomph.Expression, arg2: _pyoomph.DynamicBulkElementInstance) None
set_spatial_error_estimator_pt(self: _pyoomph.Mesh, arg0: _pyoomph.Z2ErrorEstimator) None
set_value(dimensional=True, **namvals)[source]

Set the current values of ODE variables.

Parameters:
  • dimensional (bool, optional) – Flag indicating whether the values should be set in dimensional form. Defaults to True.

  • **namvals (Union[Expression, int, float]) – Keyword arguments representing the names and values of the ODE variables to be set.

Raises:
  • RuntimeError – If the ODE variable does not exist.

  • RuntimeError – If the value cannot be converted to the required unit.

Return type:

None

Returns:

None

setup_Dirichlet_conditions(self: _pyoomph.Mesh, arg0: bool) None
setup_initial_conditions(self: _pyoomph.Mesh, arg0: bool, arg1: str) None
setup_interior_boundary_elements(self: _pyoomph.Mesh, arg0: SupportsInt) None
to_numpy(self: _pyoomph.Mesh, tesselate_tri: bool, nondimensional: bool, history_index: SupportsInt = 0, discontinuous: bool = False) tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.int32], numpy.typing.NDArray[numpy.int32], dict[str, int], numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64], dict[str, int]]