pihnn.geometries.curve#
- class pihnn.geometries.curve(bc_type, bc_value=0, order=1, ref_loc='center', check_consistency=True, on_boundary=True, sampling_ratio=None)#
Portion of boundary, identified with a shape and a type of boundary condition (BC).
- Parameters:
bc_type (int) – Type of boundary condition to assign to the curve (see above).
bc_value (callable / complex) – Value assigned at the boundary condition. It can be either a constant or a variable value defined through a function.
order (float) – Order of sampling refinement at the edges, 1 for no refinement (uniform distribution). For example, if the curve is \([0,1]\) and we want to refine on the right side, then the sampled points are distributed as \(u^{1/order}\), where \(u \sim \mathcal{U}(0,1)\) and \(order\ge1\).
ref_loc (str) – Where to apply refinement. ‘center’ for symmetric refinement (i.e., both edges), ‘start’ only at the first edge and ‘end’ only at the second edge.
check_consistency (bool) – If False, the current curve is excluded from the
pihnn.geometries.boundary.check_consistency()
check.on_boundary (bool) – Set to False if the current curve is not really part of the domain boundary.
sampling_ratio – Number of sampled points on the curve with respect to the total sampled points on the boundary. By default, it’s the ratio between the length curve and the boundary perimeter.
- abstractmethod map_point(s)#
Parametrization of the curve, i.e., the bijective function \([0,1] \rightarrow \gamma \subset \mathbb{C}\).
- Parameters:
s (float/
torch.tensor
) – Value(s) in [0,1], typically obtained from a pseudo-random generator.- Returns:
point (
torch.tensor
) - Coordinates of the mapped point(s).normal (
torch.tensor
) - Coordinates of the boundary outward vectors at the mapped point(s).
- abstractmethod is_inside(points, tol=1e-06)#
Verifies whether a point lies on the curve, considering a tolerance.
- Parameters:
points (
torch.tensor
) – Batch of points to inspect.tol (float) – Tolerance for the measure of distance.
- Returns:
inside (
torch.tensor
) - For each input point, True if it is inside and False if it outside.
- abstractmethod intersect_ray(points)#
Verifies whether a point is on the left of the curve, i.e., if the horizontal leftward straight line starting from the point intersects the curve. This function is used for the ‘ray casting algorithm’ in
pihnn.geometries.boundary.is_inside()
.- Parameters:
points (
torch.tensor
) – Batch of points to inspect.- Returns:
inside (
torch.tensor
) - For each input point, True if it is inside and False if it outside.
- add_crack_tip(tip_side=0, branch_cut_rotation=[0.1, -0.1], initial_sif=0.0)#
Add crack tip for enriched PIHNNs. :param tip_side: Which side to consider for the crack tip, 0 is the starting point of the curve, 1 the end. :type tip_side: bool :param branch_cut_rotation: Rotation of the square root branch cuts with respect to the domain on the left and on the right of the crack, respectively. In radiants and anti-clockwise. Only used for Williams enrichment. :type branch_cut_rotation: list of floats :param initial_sif: Initial values for the trainable stress intensity factors \(K_I\) and \(K_{II}\). Only used for Williams enrichment. :type initial_sif: int/float/complex/list/tuple/tensor