cashocs.geometry.deformations#

Management of mesh deformations.

Classes

DeformationHandler(mesh, a_priori_tester, ...)

A class, which implements mesh deformations.

class cashocs.geometry.deformations.DeformationHandler(mesh, a_priori_tester, intersection_tester)[source]#

Bases: object

A class, which implements mesh deformations.

The deformations can be due to a deformation vector field or a (piecewise) update of the mesh coordinates.

Initializes self.

Parameters:
assign_coordinates(coordinates)[source]#

Assigns coordinates to self.mesh.

Parameters:

coordinates (ndarray) – Array of mesh coordinates, which you want to assign.

Returns:

True if the assignment was possible, False if not.

Return type:

bool

coordinate_to_dof(coordinate_deformation)[source]#

Converts a coordinate deformation to a deformation vector field (dof based).

Parameters:

coordinate_deformation (ndarray) – The deformation for the mesh coordinates.

Returns:

The deformation vector field.

Return type:

fenics.Function

dof_to_coordinate(dof_deformation)[source]#

Converts a deformation vector field to a coordinate based deformation.

Parameters:

dof_deformation (fenics.Function) – The deformation vector field.

Returns:

The array which can be used to deform the mesh coordinates.

Return type:

ndarray

move_mesh(transformation, validated_a_priori=False, test_for_intersections=True)[source]#

Transforms the mesh by perturbation of identity.

Moves the mesh according to the deformation given by

\[\text{id} + \mathcal{V}(x),\]

where \(\mathcal{V}\) is the transformation. This represents the perturbation of identity.

Parameters:
  • transformation (fenics.Function | ndarray) – The transformation for the mesh, a vector CG1 Function.

  • validated_a_priori (bool) – A boolean flag, which indicates whether an a-priori check has already been performed before moving the mesh. Default is False

  • test_for_intersections (bool) – A boolean flag which indicates whether an a-posteriori check for (self)-intersections of the mesh should be performed.

Returns:

True if the mesh movement was successful, False otherwise.

Return type:

bool

revert_transformation()[source]#

Reverts the previous mesh transformation.

This is used when the mesh quality for the resulting deformed mesh is not sufficient, or when the solution algorithm terminates, e.g., due to lack of sufficient decrease in the Armijo rule

Return type:

None