--- id: model-02 title: "FEMM Extraction for Lumped Models" section: "Advanced Modeling" difficulty: "advanced" estimated_time: 45 prerequisites: ["model-01", "phys-08"] objectives: - Master FEMM setup for two-body electrostatic problems (topload + spark) - Extract and interpret Maxwell capacitance matrices - Apply correct sign conventions for mutual and shunt capacitances - Validate extracted capacitances against empirical rules tags: ["FEMM", "electrostatics", "capacitance-matrix", "extraction", "validation"] --- # FEMM Extraction for Lumped Models This lesson covers the detailed procedure for using FEMM (Finite Element Method Magnetics) to extract capacitances for lumped spark models. We'll focus on the two-body problem: topload and spark channel. ## The Maxwell Capacitance Matrix ### Mathematical Definition FEMM outputs the **Maxwell capacitance matrix** [C] which relates charges to voltages: ``` [Q] = [C] × [V] Where: Q_i = charge on conductor i (coulombs) V_i = potential of conductor i (volts) [C] = capacitance matrix (farads) ``` ### Matrix Properties The Maxwell matrix has specific mathematical properties: **1. Symmetry:** ``` C_ij = C_ji Physical basis: Maxwell's equations are symmetric Numerical check: |C_ij - C_ji| / |C_ij| < 0.01 ``` **2. Diagonal elements positive:** ``` C_ii > 0 (self-capacitance) Physical meaning: Charge required to raise conductor i to 1V ``` **3. Off-diagonal elements negative:** ``` C_ij < 0 for i ≠ j IMPORTANT: This is the Maxwell convention! Physical meaning: Negative charge induced on conductor j when conductor i is at +1V (field lines terminate) ``` **4. Row sum equals zero:** ``` Σ_j C_ij = 0 for each row i Conservation: Total charge to ground = 0 when far-field grounded ``` ### Two-Body System For topload (conductor 1) and spark (conductor 2), with ground implicit: ``` [1] [2] [1] [ C₁₁ C₁₂ ] [2] [ C₂₁ C₂₂ ] Example values: [Top] [Spark] [Top] [ 30 -8 ] pF [Spark][ -8 14 ] pF ``` **Interpretation:** - **C₁₁ = 30 pF:** Topload self-capacitance (to infinity/ground at ∞) - **C₂₂ = 14 pF:** Spark self-capacitance (to infinity) - **C₁₂ = C₂₁ = -8 pF:** Mutual capacitance (negative per convention) **Note:** These are NOT the circuit elements we need directly. Extraction required! ## FEMM Setup for Lumped Model ### Problem Type and Geometry **Problem configuration:** ``` Type: Electrostatic, axisymmetric Coordinates: r-z (cylindrical) Frequency: 0 Hz (pure electrostatic) Precision: 1e-8 (default) ``` **Geometry components:** **1. Topload (Conductor 1):** ``` Typical: Toroid - Major diameter: 20-50 cm - Minor diameter: 5-15 cm - Or sphere: radius 10-25 cm Position: Origin at center Material: Perfect conductor (grouped as Conductor 1) ``` **2. Spark channel (Conductor 2):** ``` Shape: Vertical cylinder - Length: Target spark length (e.g., 1.5 m) - Diameter: 1-3 mm (typical plasma channel) - Position: Base at topload bottom, extending downward Material: Perfect conductor (grouped as Conductor 2) Note: Small gap (0.1 mm) between topload and spark base This is numerical convenience; results insensitive ``` **3. Ground plane:** ``` Position: Below spark tip Distance: 10-20 cm below tip (or room floor distance) Extent: Large radius (3-5× max dimension) Boundary: V = 0 (Dirichlet condition) ``` **4. Outer boundary:** ``` Shape: Large cylindrical volume Radius: 3-5× maximum geometry dimension Height: Extends above and below structure Boundary condition: V = 0 (or mixed, grounded at ∞) ``` **5. Medium:** ``` All regions: Air ε_r = 1 (vacuum permittivity) ``` ### Step-by-Step FEMM Procedure **Step 1: Create geometry** ``` 1. Draw toroid in r-z plane (right half only, axisymmetric) - Use arc and line segments - Close contour 2. Draw spark cylinder - Rectangle in r-z coordinates - r: [0, radius], z: [z_base, z_tip] 3. Draw ground plane - Horizontal line at z = z_ground - r: [0, r_max] 4. Draw outer boundary box - Enclose all geometry - Large enough to avoid boundary effects ``` **Step 2: Define materials** ``` Create air material block: - Name: "Air" - Relative permittivity: ε_r = 1 - Apply to all regions ``` **Step 3: Define conductors** ``` Property → Conductors → Add Conductors: Conductor 1 (Topload): - Select all topload surface nodes/segments - Group: "1" - Voltage: 1V (test voltage) Conductor 2 (Spark): - Select all spark cylinder surfaces - Group: "2" - Voltage: (floating potential) Ground plane: - Boundary condition: V = 0 (not a separate conductor) ``` **Step 4: Mesh generation** ``` Mesh → Create Mesh Automatic meshing with refinement near conductors: - Typical element size: 1-5 mm near spark - 10-50 mm in far field - Total elements: 5,000-20,000 for lumped model Check mesh quality visually (no overly elongated triangles) ``` **Step 5: Solve** ``` Analysis → Solve Solver runs (typically <10 seconds for lumped model) Check for convergence: - Should converge in <100 iterations - Final residual < 1e-8 - No warnings about poor mesh quality ``` **Step 6: Extract capacitance matrix** ``` View → Circuit Props Output shows: - Conductor properties (V, Q for each) - Capacitance matrix [C] Copy matrix values to spreadsheet or script ``` ### Example FEMM Output **Conductor properties:** ``` Conductor 1 (Topload): Voltage: 1.0000 V (fixed) Charge: 3.52e-11 C = 35.2 pC Conductor 2 (Spark): Voltage: 0.2982 V (computed, floating) Charge: 1.68e-11 C = 16.8 pC ``` **Capacitance matrix [C]:** ``` [1] [2] [1] [ 35.2 -10.5 ] pF [2] [-10.5 16.8 ] pF ``` **Verify properties:** ``` ✓ Symmetric: C₁₂ = C₂₁ = -10.5 pF ✓ Diagonal positive: C₁₁, C₂₂ > 0 ✓ Off-diagonal negative: C₁₂, C₂₁ < 0 ✓ Row sum: 35.2 + (-10.5) = 24.7 ≈ 0? NO - ground implicit! Row sum ≠ 0 is OK: ground is not in matrix (infinite conductor) ``` ## Extracting Circuit Elements ### Formula Derivation **Goal:** Extract C_mut and C_sh for this circuit: ``` Topload ---[C_mut]--- Spark ---[C_sh]--- Ground ``` **C_mut (Mutual Capacitance):** Mutual capacitance is the capacitance *between* topload and spark. ``` C_mut = |C₁₂| = |C₂₁| Take absolute value of off-diagonal element Why absolute? - Circuit element capacitances are positive - Maxwell convention uses negative for mutual coupling - |C₁₂| converts to standard circuit convention ``` **Example:** ``` C₁₂ = -10.5 pF C_mut = |-10.5| = 10.5 pF ✓ ``` **C_sh (Shunt Capacitance to Ground):** Shunt capacitance is spark-to-ground with topload present. **Method 1: From row sum** The charge on spark (row 2) with V₁=V_topload, V₂=V_spark is: ``` Q₂ = C₂₁ × V₁ + C₂₂ × V₂ Charge to ground = -(Q₂) assuming no other charges But this includes charge from topload coupling! Actual spark-to-ground capacitance: C_sh = C₂₂ + C₂₁ = C₂₂ - |C₁₂| (since C₂₁ = C₁₂ < 0) ``` **Derivation:** ``` Consider: Topload grounded (V₁ = 0), spark at V₂ = 1V Charge on spark: Q₂ = C₂₁ × 0 + C₂₂ × 1 = C₂₂ But part of this is coupled to topload! Spark-to-actual-ground capacitance: Total capacitance to ∞ = C₂₂ Minus coupling through topload = -C₂₁ = |C₁₂| Net shunt: C_sh = C₂₂ - |C₁₂| ``` **Example:** ``` C₂₂ = 16.8 pF C₁₂ = -10.5 pF C_sh = 16.8 - 10.5 = 6.3 pF ✓ ``` **Method 2: Direct measurement** (verification) Run second FEMM simulation: ``` - Topload: V = 0 (grounded) - Spark: V = 1V - Ground: V = 0 Measure charge on spark → this is C_sh directly Should match Method 1 result ``` ### Sign Convention Summary **CRITICAL: Understand the sign conventions!** ``` Maxwell Matrix: C_ij < 0 for i ≠ j (negative mutual elements) Circuit Elements: All capacitances > 0 (positive values) Conversion: C_mut = |C₁₂| (absolute value) C_sh = C₂₂ - |C₁₂| (subtract absolute value) ``` **Common error:** Using C₁₂ directly as C_mut without absolute value **Result:** Negative capacitance in SPICE → error or nonsensical results ## Validation Checks ### 1. Matrix Symmetry ``` Check: |C₁₂ - C₂₁| / |C₁₂| < 0.01 If not symmetric: - Mesh too coarse → refine near conductors - Convergence issue → lower tolerance - Geometry problem → check closed contours ``` ### 2. Physical Value Ranges **C_mut (Mutual):** ``` Expected: 5-20 pF for typical Tesla coil toploads Too high (>30 pF): Check geometry (topload too large?) Too low (<2 pF): Check geometry (spark too short/far?) ``` **C_sh (Shunt):** ``` Empirical rule: C_sh ≈ 2 pF/foot × L_spark Example: L = 1.8 m = 5.9 ft Expected: C_sh ≈ 2 × 5.9 = 11.8 pF Acceptable range: 0.5× to 2.5× empirical prediction ``` **Why deviations occur:** ``` Higher than expected: - Nearby ground objects (walls, floor close) - Wide spark base (cone shape) - Ground plane too close in simulation Lower than expected: - Elevated spark (no ground plane modeled) - Thin diameter (<1 mm) - Topload shielding effect strong - Empirical rule may include mutual capacitance ``` **Important note for distributed models:** When using distributed models (Part 4, Lesson 4), the total C_sh from summing all segments may differ from the 2 pF/foot rule by a larger factor. This is because: - Matrix extraction method sums individual contributions - Mutual couplings between segments affect total - Distributed geometry changes field distribution - Factor of 2-3 deviation is normal and acceptable - Use FEMM value (more accurate for specific geometry) ### 3. Energy Conservation Check ``` Total energy stored should be conserved: W = 0.5 × V^T × C × V For V = [1, V₂]: W = 0.5 × (C₁₁ + 2×C₁₂×V₂ + C₂₂×V₂²) Check: Should be positive, finite ``` ### 4. Ground Distance Sensitivity **Test:** Vary ground plane distance, check C_sh ``` Ground at z = -2.0 m: C_sh = 6.8 pF Ground at z = -3.0 m: C_sh = 6.2 pF Ground at z = -5.0 m: C_sh = 6.0 pF Expect: C_sh decreases as ground moves away Convergence: <5% change when distance > 2× spark length ``` If C_sh changes significantly (>20%) with ground distance: - Ground plane too close - Move ground further away - Or accept measured geometry (e.g., actual room) ## Worked Example: Complete Extraction **Given:** - Spark length: 1.8 m = 5.9 feet - FEMM simulation output (see above) - Operating frequency: 200 kHz **FEMM capacitance matrix:** ``` [1] [2] [1] [ 35.2 -10.5 ] pF [2] [-10.5 16.8 ] pF ``` **Step 1: Extract C_mut** ``` C_mut = |C₁₂| = |-10.5| = 10.5 pF ✓ ``` **Step 2: Extract C_sh** ``` C_sh = C₂₂ + C₂₁ = C₂₂ - |C₁₂| = 16.8 - 10.5 = 6.3 pF ✓ ``` **Step 3: Validate C_sh** ``` Empirical prediction: C_sh_predicted = 2 pF/ft × 5.9 ft = 11.8 pF FEMM result: C_sh_FEMM = 6.3 pF Ratio: 6.3 / 11.8 = 0.53 This is LOWER than expected by factor ~2 ``` **Analysis of discrepancy:** **Possible explanations:** ``` 1. Empirical rule assumes straight vertical spark - If spark is angled or curved: less capacitance - FEMM models idealized vertical cylinder 2. Empirical rule from community measurements - May include some C_mut in "measured" value - Difficult to separate mutual from shunt experimentally - Pure C_sh might be lower 3. Ground plane distance matters - FEMM: specific ground geometry (15 cm below tip) - Empirical rule: "typical" room (floor 1-2 m away) - Closer ground in measurements → higher C_sh 4. Diameter assumption - Thinner diameter → lower C_sh (logarithmic dependence) - C ∝ 1/ln(h/d), so d = 1 mm vs 3 mm changes C by ~30% ``` **Decision: Use FEMM value** ``` For modeling: Use C_sh = 6.3 pF (FEMM result) Reason: More accurate for specific geometry Empirical rule: Rough check only Within factor of 2-3: Acceptable agreement ``` **Step 4: Calculate total capacitance** ``` C_total = C_mut + C_sh = 10.5 + 6.3 = 16.8 pF ``` **Step 5: Calculate R_opt** ``` f = 200 kHz ω = 2π × 200×10³ = 1.257×10⁶ rad/s R_opt = 1/(ω × C_total) = 1/(1.257×10⁶ × 16.8×10⁻¹²) = 47.3 kΩ ✓ Within physical bounds (5-500 kΩ) ``` **Step 6: Build circuit** ``` SPICE netlist: C_mut topload spark_n 10.5p R_spark spark_n spark_r 47.3k C_sh spark_r 0 6.3p ``` Ready for simulation! ## Common FEMM Errors and Troubleshooting ### Problem: Matrix not symmetric **Symptoms:** ``` |C₁₂ - C₂₁| / |C₁₂| > 0.05 ``` **Causes and fixes:** ``` 1. Mesh too coarse → Refine mesh near conductors → Increase total element count 2. Poor convergence → Lower precision requirement (1e-9 or 1e-10) → Check mesh quality 3. Geometry errors → Verify all contours closed → Check no overlapping regions ``` ### Problem: Negative C_sh **Symptoms:** ``` C_sh = C₂₂ - |C₁₂| < 0 ``` **Causes:** ``` This should NEVER happen physically! 1. Wrong extraction formula used → Double-check: C_sh = C₂₂ - |C₁₂|, not C₂₂ + C₁₂ 2. FEMM simulation error → Check conductor assignments → Verify boundary conditions → Remake geometry from scratch 3. Conductors not properly grouped → Each conductor must be single contiguous group ``` ### Problem: C_sh >> empirical rule (factor >5) **Symptoms:** ``` C_sh = 50 pF for 1 m spark (expected: 6 pF) ``` **Causes:** ``` 1. Ground plane too close → Move ground plane further away → Check z-coordinate 2. Spark diameter too large → Should be 1-3 mm, not 1-3 cm! → Check units 3. Multiple ground connections → Check only one ground boundary condition ``` ### Problem: C_mut unreasonably large **Symptoms:** ``` C_mut > 50 pF for medium toroid ``` **Causes:** ``` 1. Topload size too large → Check diameter in correct units 2. Spark embedded in topload → Should have small gap (0.1-1 mm) 3. Scale error → Check all dimensions (cm? m? mm?) ``` ## Best Practices **1. Consistent units:** ``` Recommended: Centimeters throughout FEMM - Easy to work with Tesla coil scales - Avoid mixing mm/cm/m - Output still in standard SI units ``` **2. Mesh refinement:** ``` Start coarse → check matrix → refine if needed Adequate: Symmetry <1% error Overkill: >50,000 elements for lumped model (slow, no benefit) ``` **3. Parametric studies:** ``` Vary one parameter at a time: - Spark length: C_sh should scale linearly - Ground distance: C_sh should saturate at large distance - Diameter: C_sh logarithmic dependence (weak) Check trends make physical sense ``` **4. Documentation:** ``` Save for each simulation: - Geometry parameters (toroid size, spark length, ground position) - Mesh statistics (elements, convergence) - Raw matrix output - Extracted C_mut, C_sh - Validation checks Build database for future reference ``` ## Key Takeaways - **Maxwell matrix** uses negative off-diagonals for mutual capacitance (standard convention) - **Extraction formulas:** C_mut = |C₁₂|, C_sh = C₂₂ - |C₁₂| (absolute value critical!) - **FEMM setup:** Axisymmetric, two conductors (topload at 1V, spark floating), ground boundary - **Validation:** Check symmetry, C_sh ≈ 2 pF/ft ± factor 2, physical value ranges - **Discrepancies:** FEMM more accurate than empirical rules for specific geometry - **Common errors:** Wrong sign conversion, mesh too coarse, units mismatch, ground too close - **Use FEMM values** in circuit model, not empirical estimates ## Practice {exercise:model-ex-02} --- **Next Lesson:** [Distributed Model Theory](03-distributed-model.md)