Overview
The Penis Function Simulation Laboratory provides an interactive biophysical framework
modeling the complex anatomical, hemodynamical, and neuromuscular mechanics governing penile physiology.
Engineered for educational, scientific, and diagnostic demonstration, this application models key
physiological states including baseline flaccidity, parasympathetically driven tumescence and rigidity,
micturition (urination), and sympathetic ejaculatory emissions.
Penile erection is a coordinated neuro-vascular phenomenon dependent upon the relaxation of cavernosal
smooth muscle and helicine arteries. In response to sexual stimulation, parasympathetic non-adrenergic
non-cholinergic (NANC) nerves release nitric oxide ($NO$), which stimulates guanylyl cyclase to produce
cyclic guanosine monophosphate ($cGMP$). This signaling cascade triggers intracavernosal smooth muscle
relaxation, causing arterial inflow ($\Delta Q_{in}$) to surge dramatically. As the paired corpora
cavernosa fill with blood, the expansive tissue compresses the subtunical venular plexus against the
rigid outer fibrous tunica albuginea. This veno-occlusive mechanism restricts venous outflow
($Q_{out} \rightarrow 0$), elevating intracavernosal pressure ($P_{ic}$) from a baseline flaccid value
of approximately $10\text{ mmHg}$ to suprasystolic pressures reaching $100\text{ mmHg}$ or greater during
full rigidity.
This visualizer models clinical pathologies such as Arterial Insufficiency,
Venous Leakage (Veno-Occlusive Dysfunction), and Peyronie's Disease.
When Peyronie's plaque is enabled, a localized dorsal fibrous plaque impairs tunica albuginea compliance,
causing dynamic dorsal bending during erection. The visualizer also renders a real-time Color Doppler
Ultrasound Spectral Graph measuring Peak Systolic Velocity ($PSV$) and the Resistive Index ($RI$).
How to Use
The interactive simulator workspace allows real-time manipulation of physiological states, systemic parameters,
and diagnostic modifiers. The control panel on the right contains all primary operational triggers:
- Start Demo: Initiates an automated diagnostic cycle demonstrating flaccid micturition,
parasympathetic arousal, peak arterial velocity, ejaculatory pulses, Peyronie's plaque curvature, and the hemodynamic impact of severe venous leakage. Any manual user click or slider touch instantly interrupts the demo and restores your original setup.
- Reset Baseline: Instantly resets all physiological states, clearing active fluid particles, returning arousal to zero ($A=0$), and restoring default baseline parameters.
- Sound Toggle (🔇/🔊): Enables or silences synthesized Web Audio API feedback, providing acoustic cues for cavernosal arterial flow pulses, urinary jet dispersion, and ejaculatory bursts.
- Arousal / Erection: Triggers parasympathetic vasodilation, increasing the arousal parameter $A(t)$ smoothly towards 1.0. This models arterial inflow, cavernosa tissue expansion, tunica albuginea tensioning, and upward spatial angular deflection.
- Ejaculation: Becomes active when full arousal is established. Clicking triggers rhythmic sympathetic contractions, emitting high-velocity seminal fluid particle pulses.
- Urination: Initiates bladder evacuation under flaccid or partial arousal states. Urine particles emerge from the urethral orifice with gravity-driven parabolic arcs.
- ED Subtype Mode & Severity Slider: Toggles between Arterial Insufficiency (capped $PSV$), Venous Leakage (persistent venous outflow preventing $RI \ge 0.85$), and Mixed ED.
- Peyronie's Plaque Toggle: Renders a fibrous plaque along the dorsal tunica sheath. As intracavernosal pressure rises, the shaft dynamic bends dorsally toward the plaque.
- Canvas Inspection: Hover or touch across the visualizer canvas to inspect anatomical boundaries including the Corpora Cavernosa, Corpus Spongiosum, Tunica Albuginea, Urethra, Glans Penis, Bladder, and Testicles.
Technical Details
The simulation visualizer operates on an optimized HTML5 2D Canvas engine utilizing high-density Screen
Buffer Normalization ($DPR = \text{window.devicePixelRatio}$) to prevent pixelation.
Anatomical boundaries are synthesized dynamically via parametric Quadratic Bézier Curves and Lofting Splines:
$$\mathbf{B}(t) = (1-t)^2 \mathbf{P}_0 + 2(1-t)t \mathbf{P}_1 + t^2 \mathbf{P}_2, \quad t \in [0, 1]$$
Intracavernosal pressure ($P_{ic}$) is computed in real time using a simplified hemodynamic balance equation:
$$P_{ic}(A, \delta_{ED}, \text{Mode}) = P_{\text{base}} + \left( \Delta P_{\text{max}} \cdot A \cdot f_{\text{leak}}(\delta_{ED}) \right)$$
Color Doppler clinical diagnostic metrics are synthesized continuously:
$$PSV = 15 + 35 \cdot A \cdot (1 - \delta_{\text{arterial}}), \quad EDV = 5 \cdot (1 - A) + 12 \cdot \delta_{\text{venous}} \cdot A$$
$$RI = \frac{PSV - EDV}{PSV}$$
where normal erections maintain $PSV > 35\text{ cm/s}$ and $RI \ge 0.85$. Fluid particles are governed by differential Newtonian gravity ($\mathbf{g} = 900\text{ px/s}^2$) and inelastic floor collision damping.