dragonfly_sim.core.wall_distance ================================ .. py:module:: dragonfly_sim.core.wall_distance .. autoapi-nested-parse:: 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. .. !! processed by numpydoc !! Classes ------- .. autoapisummary:: dragonfly_sim.core.wall_distance.WallDistance Functions --------- .. autoapisummary:: dragonfly_sim.core.wall_distance._nearest_segments Module Contents --------------- .. py:class:: WallDistance(mesh_obj, wall_tags) Bases: :py:obj:`dragonfly_sim.utils.derived_fields.DerivedField` Interface. `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 .. !! processed by numpydoc !! .. py:method:: _geometry_node_to_dof() Local geometry node -> local coordinate_space block (both ghosted). .. !! processed by numpydoc !! .. py:method:: _wall_geometry() Wall segment endpoints (2D) or vertices (3D) on every rank, with the global coordinate_space block index of each endpoint. .. !! processed by numpydoc !! .. py:method:: mesh_jacobian() .. py:method:: update_geometry() .. py:attribute:: function .. py:attribute:: mesh_obj .. py:attribute:: wall_tags .. py:function:: _nearest_segments(x, A, B, k=16) Index of the nearest segment, foot parameter t and foot point, per point. .. !! processed by numpydoc !!