"""
Diagnostic views for a line doublet element.
This module contains the diagnostic views for one panel of various line doublet
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_doublet_constant_2d import (
LineDoubletConstant2D,
)
from buffalo_panel.kernels.internal.line_doublet_point_2d import (
LineDoubletPoint2D,
)
from buffalo_panel.singularities.descriptors import DOUBLET
from buffalo_panel.views.internal.line_family_2d import LineFamily2DView
def make_diagnostic_line_doublet_point_family() -> ElementFamily:
"""Create diagnostic point doublet family for one panel."""
return ElementFamily(
name="diagnostic_point_doublet_panel",
support=LINE_2D,
singularity=DOUBLET,
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 LineDoubletPoint2DView(LineFamily2DView[PointElementLineGeometry2D]):
"""
Field view for one point doublet line panel.
The view evaluates the velocity, potential, and stream-function
contribution from one geometry panel whose doublet coefficient is
concentrated at the panel point.
"""
kernel: LineDoubletPoint2D = field(
default_factory=LineDoubletPoint2D,
repr=False,
compare=False,
init=False,
)
"""Kernel used to evaluate unit point doublet influence values."""
family: ElementFamily = field(
default_factory=make_diagnostic_line_doublet_point_family,
repr=False,
compare=False,
init=False,
)
"""Element family defining panel ownership and local coefficient layout."""
def make_diagnostic_line_doublet_constant_family() -> ElementFamily:
"""Create diagnostic constant strength line doublet family."""
return ElementFamily(
name="diagnostic_doublet_panel",
support=LINE_2D,
singularity=DOUBLET,
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 LineDoubletConstant2DView(LineFamily2DView[LinePanelGeometry2D]):
"""
Field view for one constant-strength doublet line panel.
The view evaluates the velocity, potential, and stream-function
contribution from one geometry panel with one doublet strength.
It is intended for diagnostics, visualization, and kernel-level
demonstrations rather than solver assembly.
"""
kernel: LineDoubletConstant2D = field(
default_factory=LineDoubletConstant2D,
repr=False,
compare=False,
init=False,
)
"""Kernel used to evaluate unit constant-doublet influence values."""
family: ElementFamily = field(
default_factory=make_diagnostic_line_doublet_constant_family,
repr=False,
compare=False,
init=False,
)
"""Element family defining panel ownership and local coefficient layout."""