dragonfly_sim.core.wall_distance
Distance to the wall, as a CG1 DerivedField with an exact mesh derivative.
d at every CG1 node is the distance to the nearest wall facet: the exact point-to-segment distance for the straight 2D wall facets, the distance to the nearest wall vertex in 3D (an over-estimate between vertices). The nearest facets are found with a KD-tree over the facet midpoints (2D) or the wall vertices (3D).
mesh_jacobian() is the analytic derivative of every nodal distance with respect to the coordinates of the node itself and of the wall vertices of its nearest facet. With P the nearest point on segment AB, t its parameter and r = (x - P)/d,
dd/dx = r, dd/dA = -(1 - t) r, dd/dB = -t r
(t is stationary at an interior foot point, so it does not move to first order; at a clipped end, t = 0 or 1, the same formula holds). On the wall itself, d = 0 and the node moves with the wall, so the row is zero. The derivative is exact wherever the nearest facet does not switch, i.e. almost everywhere.
Classes
Interface. function is the dolfinx Function the forms read. |
Functions
|
Index of the nearest segment, foot parameter t and foot point, per point. |
Module Contents
- class dragonfly_sim.core.wall_distance.WallDistance(mesh_obj, wall_tags)
Bases:
dragonfly_sim.utils.derived_fields.DerivedFieldInterface. function is the dolfinx Function the forms read.
update() recompute the field at the current state and mesh update_geometry() refresh whatever depends on the mesh only (called
after mesh motion, before update())
state_jacobian() PETSc Mat d(field)/dU (only if depends_on_state) alpha_vector() PETSc Vec d(field)/dalpha, or None mesh_jacobian() PETSc Mat d(field)/dx, columns in the mesh’s
coordinate_space, or None
- _geometry_node_to_dof()
Local geometry node -> local coordinate_space block (both ghosted).
- _wall_geometry()
Wall segment endpoints (2D) or vertices (3D) on every rank, with the global coordinate_space block index of each endpoint.
- mesh_jacobian()
- update_geometry()
- function
- mesh_obj
- wall_tags
- dragonfly_sim.core.wall_distance._nearest_segments(x, A, B, k=16)
Index of the nearest segment, foot parameter t and foot point, per point.