"""
Diagnostic views for a line vortex element.
This module contains the diagnostic views for one panel of various line vortex
element types.
"""
from dataclasses import dataclass, field
import numpy as np
from buffalo_panel.basis.descriptors import LINE_CONSTANT, LINE_POINT
from buffalo_panel.families.dof_maps import PerElementDofMap
from buffalo_panel.families.element_family import ElementFamily
from buffalo_panel.geometry.line2d import (
LinePanelGeometry2D,
PointElementLineGeometry2D,
)
from buffalo_panel.geometry.supports import LINE_2D
from buffalo_panel.kernels.internal.line_vortex_constant_2d import (
LineVortexConstant2D,
)
from buffalo_panel.kernels.internal.line_vortex_point_2d import (
LineVortexPoint2D,
)
from buffalo_panel.singularities.descriptors import VORTEX
from buffalo_panel.views.internal.line_family_2d import LineFamily2DView
def make_diagnostic_line_vortex_point_family() -> ElementFamily:
"""Create diagnostic point vortex family for one panel."""
return ElementFamily(
name="diagnostic_point_vortex_panel",
support=LINE_2D,
singularity=VORTEX,
basis=LINE_POINT,
n_elements=1,
panel_indices=np.array([0], dtype=np.int32),
dof_map=PerElementDofMap(
global_indices=np.array([0], dtype=np.int32),
),
)
[docs]
@dataclass(frozen=True, slots=True)
class LineVortexPoint2DView(LineFamily2DView[PointElementLineGeometry2D]):
"""
Field view for one point vortex line panel.
The view evaluates the velocity, potential, and stream-function
contribution from one geometry panel whose vortex coefficient is
concentrated at the panel point.
"""
kernel: LineVortexPoint2D = field(
default_factory=LineVortexPoint2D,
repr=False,
compare=False,
init=False,
)
"""Kernel used to evaluate unit point vortex influence values."""
family: ElementFamily = field(
default_factory=make_diagnostic_line_vortex_point_family,
repr=False,
compare=False,
init=False,
)
"""Element family defining panel ownership and local coefficient layout."""
def make_diagnostic_line_vortex_constant_family() -> ElementFamily:
"""Create diagnostic constant strength line vortex family."""
return ElementFamily(
name="diagnostic_vortex_panel",
support=LINE_2D,
singularity=VORTEX,
basis=LINE_CONSTANT,
n_elements=1,
panel_indices=np.array([0], dtype=np.int32),
dof_map=PerElementDofMap(
global_indices=np.array([0], dtype=np.int32),
),
)
[docs]
@dataclass(frozen=True, slots=True)
class LineVortexConstant2DView(LineFamily2DView[LinePanelGeometry2D]):
"""
Field view for one constant-strength vortex line panel.
The view evaluates the velocity, potential, and stream-function
contribution from one geometry panel with one vortex strength.
It is intended for diagnostics, visualization, and kernel-level
demonstrations rather than solver assembly.
"""
kernel: LineVortexConstant2D = field(
default_factory=LineVortexConstant2D,
repr=False,
compare=False,
init=False,
)
"""Kernel used to evaluate unit constant-vortex influence values."""
family: ElementFamily = field(
default_factory=make_diagnostic_line_vortex_constant_family,
repr=False,
compare=False,
init=False,
)
"""Element family defining panel ownership and local coefficient layout."""