# Phase 8: Bayesian Model Calibration — Experimental Measurement & Parameter Fitting **Date started:** 2026-02-10 **Status:** Planning (hardware not yet built) **Method:** Build QCW Tesla coil, collect systematic measurements, fit dynamic threshold model via Bayesian inference **Purpose:** Empirically constrain the dynamic threshold parameters (delta_T, tau_buildup, epsilon, E_prop_floor) that currently have no measured values — transitioning the framework's T3/T4 claims toward T1/T2 --- ## Motivation The spark physics framework is now theoretically mature: 17 context files, ~8,000 lines of interlinked physics, covering circuit topology through plasma dynamics. But several critical parameters remain unconstrained: | Parameter | Current knowledge | Tier | What measurement would give us | |---|---|---|---| | E_prop_effective at QCW leader tip | "much lower than 0.5 MV/m" | T3 | Actual value (or range) with uncertainty | | delta_T (thermal pre-conditioning) | "elevated, maybe 600-2000 K" | T3/T4 | Fitted value from spark length data | | tau_buildup (threshold ramp-up time) | "~ms scale, order of tau_thermal" | T3 | Fitted value constraining when threshold saturates | | epsilon during QCW ramp | 5-15 J/m (community estimates) | T2 | Time-resolved epsilon(t) with proper threshold model | | Power coupling to spark | Via Thevenin model | T3 | Validated against measured frequency/impedance shifts | The Bayesian approach is ideal here because: 1. We have **strong physics-informed priors** from 8 months of framework development 2. The model structure is known (forward simulation exists in `examples/spark-growth-timeline.md`) 3. The measurements are accessible (primary current, frequency, spark length) 4. Even a small dataset (10-20 operating points) dramatically constrains the posteriors when priors are informative --- ## The Forward Model ### State Variables (per time step dt) ``` t — time into QCW ramp [s] L(t) — spark length [m] V_top(t) — topload voltage [V] V_tip(t) — spark tip voltage [V] E_tip(t) — electric field at spark tip [V/m] E_prop(t) — effective propagation threshold [V/m] P(t) — power delivered to spark [W] T_eff(t) — effective gas temperature ahead of tip [K] ``` ### Equations **1. Topload voltage** (from ramp profile + circuit model): ``` V_top(t) = V_max * envelope(t) For linear ramp: envelope(t) = t / T_ramp For Bresenham: envelope(t) = pulse-density modulated approximation ``` **2. Capacitive divider** (voltage at spark tip): ``` C_sh(t) = C_sh_per_meter * L(t) V_tip(t) = V_top(t) * C_mut / (C_mut + C_sh(t)) ``` In the open-circuit limit. For finite R, use full complex impedance division (see `context/capacitive-divider.md`). **3. Tip electric field** (from FEMM lookup or approximate formula): ``` E_tip(t) = FEMM_lookup(V_tip(t), L(t), geometry) ``` The FEMM lookup is a precomputed table: E_tip as a function of V_tip and L for the specific coil geometry. This must be generated once per coil design. Alternatively, for initial work: ``` E_tip(t) ~ kappa * V_tip(t) / effective_gap(L(t)) ``` where effective_gap and kappa are geometry-dependent. This approximation is known to be inaccurate (Section 3.4 of field-thresholds.md) but may suffice for initial fitting if kappa is treated as a free parameter. **4. Dynamic propagation threshold** (THE NEW PART): ``` T_eff(t) = T_0 + delta_T * (1 - exp(-t_active / tau_buildup)) E_prop(t) = max(E_prop_floor, E_prop_cold * T_0 / T_eff(t)) ``` where: - `T_0` = 300 K (ambient) - `delta_T` = temperature elevation at saturation [K] — **FIT PARAMETER** - `tau_buildup` = time constant for threshold development [s] — **FIT PARAMETER** - `E_prop_cold` = cold-air propagation threshold [V/m] — **FIT PARAMETER** (prior: 0.5 MV/m) - `E_prop_floor` = minimum achievable threshold [V/m] — **FIT PARAMETER** (prior: weakly constrained, >0) - `t_active` = time since leader formation at the tip (resets if spark stalls and re-ignites) NOTE: This single-exponential "effective temperature" model is a deliberate simplification. It collapses all four physical mechanisms (UV, thermal, residual ionization, expansion) into one proxy variable. This is appropriate for initial fitting. If the data demand it, the model can be expanded later (see Section "Model Extensions" below). **5. Growth condition and rate:** ``` if E_tip(t) > E_prop(t): dL/dt = P(t) / epsilon else: dL/dt = 0 (stalled) ``` **6. Power delivered to spark** (Thevenin model): ``` P(t) = 0.5 * |V_th|^2 * R / |Z_th + Z_spark|^2 ``` where Z_spark depends on R, C_mut, C_sh (all functions of L). For initial work, can approximate P from measured input power * efficiency factor. **7. Epsilon:** ``` epsilon(t) = epsilon_0 / (1 + alpha_accum * integral_0^t P(t') dt') ``` Or simpler: `epsilon = epsilon_0` (constant). Start with constant, add accumulation if data require it. **8. Update:** ``` L(t + dt) = L(t) + dL/dt * dt ``` ### Parameter Vector ``` theta = { E_prop_cold, — cold-air propagation threshold [V/m] delta_T, — thermal pre-conditioning saturation [K] tau_buildup, — threshold development time constant [s] E_prop_floor, — minimum propagation threshold [V/m] epsilon_0, — energy per meter [J/m] kappa_eff, — effective tip enhancement (if not using FEMM) sigma_L — measurement noise on spark length [m] } ``` 7 parameters. With 20+ data points and informative priors, this is well-determined. --- ## Priors | Parameter | Prior Distribution | Physical Justification | |---|---|---| | E_prop_cold | Normal(0.5 MV/m, 0.15 MV/m) | Bazelyan & Raizer streamer propagation field [T1] | | delta_T | LogNormal(ln(700), 0.8) | Must be >0; 600-2000 K range from Paschen scaling argument [T3] | | tau_buildup | LogNormal(ln(2 ms), 0.7) | Should be ~tau_thermal scale for thin leader (~ms) [T3] | | E_prop_floor | Uniform(0.01, 0.3 MV/m) | Must be >0 and < E_prop_cold; weakly constrained [T4] | | epsilon_0 | LogNormal(ln(10), 0.5) | Community QCW data: 5-15 J/m [T2] | | kappa_eff | LogNormal(ln(3), 0.4) | 2-5 from FEMM studies [T1]; broader if no FEMM available | | sigma_L | HalfNormal(0.1 m) | Measurement precision of spark length | The priors encode everything the framework has established. The posterior will show how much the data pull the parameters away from the physics predictions. --- ## Experimental Design ### The Coil Build a QCW-capable DRSSTC with the following features: **Required capabilities:** - QCW ramp with adjustable duration (2-30 ms range) - Adjustable power level (bus voltage or duty cycle control) - Repeatable operation (same conditions, multiple shots) - Frequency: 200-500 kHz range (higher is better for sword formation) **Required instrumentation:** - Primary current transformer (Pearson or Rogowski) → oscilloscope - Bus voltage measurement - Spark length measurement (ruler/scale + camera, or laser reference) - High-speed camera if available (but not required for initial fitting) **Nice to have (future phases):** - Antenna/capacitive probe for secondary voltage estimation - Spectrometer for channel temperature measurement - Multiple secondaries for frequency comparison ### Measurement Protocol #### Experiment 1: Ramp Duration Sweep (highest priority) **What:** Fix power level (constant bus voltage), vary ramp duration from 3 ms to 25 ms in ~8 steps. **Measurements per point:** Repeat each condition 5-10 times. Record: - Ramp duration T_ramp (control variable, exact) - Spark length L_final (from photo/video, +/- 5 cm) - Primary current waveform (oscilloscope capture → infer V_topload, frequency shift) - Qualitative morphology (photo: sword vs branchy) **Why this is the highest-priority experiment:** The L_final vs T_ramp curve directly constrains delta_T and tau_buildup nearly independently of other parameters. At short ramps, E_prop_eff is near the cold-air value and L is short. At long ramps, E_prop_eff saturates and L plateaus. The transition region pins tau_buildup. Expected data shape: ``` L_final | ___________ | / \ (lateral breakouts begin here) | / | / | / | / |_____/ | +-----|---|---|---|----> T_ramp 3 8 15 20 25 ms ``` #### Experiment 2: Power Level Sweep **What:** Fix ramp duration at the optimal value found in Experiment 1, vary bus voltage (power) in ~5 steps. **Measurements:** Same as Experiment 1. **What it constrains:** The power dependence of the dynamic threshold. If L_final increases with power at fixed ramp time (beyond what the simple Thevenin model predicts from higher V_topload), this is direct evidence for the coupled voltage-power limit. #### Experiment 3: Frequency Comparison (if feasible) **What:** Build or borrow a second secondary with significantly different resonant frequency. Run both at the same power and ramp time. **What it constrains:** Frequency dependence of tau_buildup and thermal ratchet. Higher frequency should produce longer swords at the same power (more RF cycles per tau_g). This is the least practical experiment but the most diagnostic. ### Data Format Store measurements in a structured file (CSV or YAML): ```yaml # measurements/run-001.yaml coil_id: "qcw-v1" date: "2026-XX-XX" conditions: bus_voltage_V: 340 ramp_duration_ms: 12 frequency_kHz: 380 repetition_rate_Hz: 5 ambient_temp_C: 22 humidity_pct: 45 measurements: - trial: 1 spark_length_m: 1.45 morphology: "sword" notes: "clean single channel" scope_file: "scope_001.csv" - trial: 2 spark_length_m: 1.52 morphology: "sword" notes: "slight fork at tip" scope_file: "scope_002.csv" ``` --- ## Fitting Pipeline ### Software Stack - **Python 3.10+** with NumPy, SciPy - **emcee** or **PyMC** for MCMC sampling - **corner** for posterior visualization - **matplotlib** for diagnostic plots - Forward model implemented as a standalone Python function ### Pipeline Steps ``` 1. Load coil geometry → precompute FEMM lookup table (or set kappa_eff) 2. Load measurement data (L_final, T_ramp, V_bus, f_RF for each trial) 3. Define forward model: theta → L_predicted(T_ramp, V_bus, f_RF) 4. Define log-likelihood: sum over trials of Normal(L_measured | L_predicted, sigma_L) 5. Define log-prior: product of prior distributions on theta 6. Run MCMC (emcee: 32 walkers, 5000 steps, 1000 burn-in) 7. Check convergence (Gelman-Rubin, effective sample size, trace plots) 8. Extract posteriors: median + 68% credible intervals for each parameter 9. Posterior predictive check: does the fitted model predict HELD-OUT data? 10. Model comparison: compute Bayes factor vs fixed-threshold model ``` ### Key Diagnostic Checks **Before fitting:** - Does the forward model reproduce `examples/spark-growth-timeline.md` with its stated parameters? - Do the priors span the range of plausible outcomes? **After fitting:** - Are posteriors well-constrained (not just reflecting priors)? - Do trace plots show convergence (no drift, good mixing)? - Does the posterior predictive distribution cover the observed data? - Are there strong parameter correlations? (delta_T vs tau_buildup will likely be correlated) **Validation:** - Hold out 20% of data for prediction testing - Does the model predict spark length for a NEW operating condition? - Does the fixed-threshold model (delta_T = 0) fit significantly worse? --- ## Model Extensions (if data demand them) The single-exponential effective temperature model is the simplest version. If residuals show systematic structure, consider: ### Extension 1: Power-dependent delta_T ``` delta_T(P) = delta_T_0 * (P / P_ref)^gamma ``` Adds one parameter (gamma). Tests whether more power produces more pre-conditioning. ### Extension 2: Two-timescale buildup ``` T_eff(t) = T_0 + delta_T_fast * (1 - exp(-t/tau_fast)) + delta_T_slow * (1 - exp(-t/tau_slow)) ``` Adds two parameters. Captures the possibility that UV/residual ionization (fast, ~100 us) and thermal diffusion (slow, ~ms) have distinct timescales. ### Extension 3: Time-varying epsilon ``` epsilon(t) = epsilon_0 / (1 + alpha * integral P dt) ``` Adds one parameter (alpha). Tests whether epsilon decreases as thermal energy accumulates. ### Extension 4: Stochastic L_final ``` L_final ~ Normal(L_predicted, sigma_L(L)) where sigma_L = sigma_0 + sigma_1 * L ``` Longer sparks have more variability. Adds one parameter (sigma_1). Start with the base model. Only add extensions if the Bayes factor favors the more complex model (Occam's razor built into the framework). --- ## What Success Looks Like ### Minimum viable result: - 10+ data points (ramp sweep at one power level) - Posteriors on delta_T and tau_buildup that are meaningfully tighter than priors - Forward model predicts held-out data to within +/- 15% ### Strong result: - 30+ data points (ramp sweep + power sweep) - delta_T constrained to +/- 30%: first empirical measurement of the dynamic threshold magnitude - tau_buildup constrained to +/- factor of 2: first measurement of how fast the threshold develops - Bayes factor >10 favoring dynamic threshold model over fixed threshold - Posterior predictive check passes for a new operating condition ### Exceptional result: - All of the above plus frequency comparison data - Spectroscopic temperature measurement ahead of leader tip - Extension models tested (power-dependent delta_T, two-timescale) - Published or shared with TC community with enough detail for replication --- ## Connection to Context Files This phase directly addresses open questions in: - **`context/field-thresholds.md`** Section 4.7: "The effective E_propagation at a QCW leader tip should be directly measurable" - **`context/open-questions.md`** Section 1.3: thermal evolution, spectroscopic temperature - **`context/energy-and-growth.md`**: "Can epsilon be predicted from first principles without calibration?" - **`context/qcw-operation.md`**: measurement gaps (arc current, time-resolved impedance) Results will be integrated back into context files as the data come in: - Measured parameter values → equations-and-bounds.md (new entries with T1 tags) - Dynamic threshold validation → field-thresholds.md Section 4.7 (upgrade T3 claims to T1/T2) - Calibrated epsilon → energy-and-growth.md (refine bounds) - Model code → tools/ directory --- ## Timeline This is an ongoing research phase. Approximate milestones: | Milestone | Description | |---|---| | M1: Coil design | Select topology, order components, design secondary for target frequency | | M2: Coil build | Assemble and test at low power, verify basic operation | | M3: Instrumentation | Set up current probe, scope capture, camera, measurement protocol | | M4: FEMM model | Build electrostatic model of the specific coil geometry, generate E_tip lookup table | | M5: Forward model code | Implement the time-stepped growth simulation in Python | | M6: First data | Ramp duration sweep (Experiment 1), ~8 operating points × 5 trials | | M7: First fit | Run Bayesian fitting on Experiment 1 data, check convergence, examine posteriors | | M8: Power sweep | Experiment 2 data collection and fitting | | M9: Validation | Predict spark length for a new operating condition, compare to measurement | | M10: Integration | Update context files with measured values, upgrade tier tags | No time estimates — this depends on hardware availability and build schedule. Each milestone is independently useful: M5 (forward model code) is valuable even without measurement data, and M6-M7 (first fit) answers the core question regardless of whether later experiments are completed. --- ## References - Foreman-Mackey et al. (2013), "emcee: The MCMC Hammer," PASP 125, 306-312 - Gelman et al. (2013), "Bayesian Data Analysis," 3rd edition, CRC Press - Existing framework: `context/field-thresholds.md` Section 4.7 (dynamic threshold theory) - Existing forward model: `examples/spark-growth-timeline.md` (QCW growth simulation) - Phase 6 QCW survey: `phases/phase-6-qcw-community-research.md` (community data and priors)