{
  "format": "mathssim",
  "version": 1,
  "title": "22 - Worked Examples: Interfaces, Lines, Waveguides and Numerical EM",
  "computeMode": "standard",
  "functions": [],
  "notation": {
    "c22": "c",
    "eta022": "\\eta_0",
    "eta2_22": "\\eta_2",
    "Gamma22_1": "\\Gamma",
    "tau22_1": "\\tau",
    "Gmag22": "\\left|\\Gamma\\right|",
    "VSWR22": "\\mathrm{VSWR}",
    "RL22": "RL",
    "Pref22": "P_r/P_i",
    "z22sw": "z",
    "env22": "\\left|V(z)\\right|",
    "Zt22": "Z_t",
    "lambda22_3": "\\lambda",
    "ell22_3": "\\ell",
    "a22": "a",
    "b22": "b",
    "fc22": "f_c",
    "f22_5": "f",
    "lam0_22": "\\lambda_0",
    "lamg22": "\\lambda_g",
    "vp22": "v_p",
    "vg22": "v_g",
    "fcav22": "f_{\\mathrm{cav}}",
    "FEM_sparse22": "\\mathbf{K}_{\\mathrm{FEM}}",
    "MoM_dense22": "\\mathbf{Z}_{\\mathrm{MoM}}",
    "h22": "h",
    "fr22": "f_r",
    "change22": "\\Delta f_r(\\%)",
    "a1_22": "a_1",
    "b1_22": "b_1",
    "S11_22": "S_{11}"
  },
  "regions": [
    {
      "id": "ch22-head-001",
      "type": "text",
      "x": 65,
      "y": 35,
      "w": 990,
      "content": "22 - Worked Examples: Interfaces, Lines, Waveguides and Numerical EM",
      "heading": true
    },
    {
      "id": "ch22-note-002",
      "type": "text",
      "x": 65,
      "y": 140,
      "w": 990,
      "content": "Interactive M²S companion to EM Course Document 22.\nTen course worked examples covering boundaries, TL quantities, waveguide/cavity dispersion and numerical-EM interpretation.\nEdit the input Math regions, then Calculate. M²S values are unitless, so SI units are stated explicitly in labels and notes.",
      "heading": false
    },
    {
      "id": "ch22-math-003",
      "type": "math",
      "x": 65,
      "y": 291,
      "w": 990,
      "target": "c22",
      "expr": "299792458"
    },
    {
      "id": "ch22-math-004",
      "type": "math",
      "x": 65,
      "y": 456,
      "w": 990,
      "target": "eta022",
      "expr": "376.73"
    },
    {
      "id": "ch22-head-005",
      "type": "text",
      "x": 65,
      "y": 621,
      "w": 990,
      "content": "Worked Example 1 - Dielectric-boundary reflection",
      "heading": true
    },
    {
      "id": "ch22-math-006",
      "type": "math",
      "x": 65,
      "y": 726,
      "w": 990,
      "target": "eta2_22",
      "expr": "eta022/sqrt(4)"
    },
    {
      "id": "ch22-math-007",
      "type": "math",
      "x": 65,
      "y": 891,
      "w": 990,
      "target": "Gamma22_1",
      "expr": "(eta2_22-eta022)/(eta2_22+eta022)"
    },
    {
      "id": "ch22-math-008",
      "type": "math",
      "x": 65,
      "y": 1056,
      "w": 990,
      "target": "tau22_1",
      "expr": "1+Gamma22_1"
    },
    {
      "id": "ch22-table-009",
      "type": "table",
      "x": 65,
      "y": 1221,
      "w": 990,
      "h": 280,
      "title": "Example 1",
      "headersText": "Value",
      "rowLabels": "η1 (ohm)\nη2 (ohm)\nΓ\nτ",
      "expr": "cols([eta022,eta2_22,Gamma22_1,tau22_1])",
      "precision": "12"
    },
    {
      "id": "ch22-head-010",
      "type": "text",
      "x": 65,
      "y": 1591,
      "w": 990,
      "content": "Worked Example 2 - Standing wave and VSWR",
      "heading": true
    },
    {
      "id": "ch22-math-011",
      "type": "math",
      "x": 65,
      "y": 1696,
      "w": 990,
      "target": "Gmag22",
      "expr": "0.5"
    },
    {
      "id": "ch22-math-012",
      "type": "math",
      "x": 65,
      "y": 1861,
      "w": 990,
      "target": "VSWR22",
      "expr": "(1+Gmag22)/(1-Gmag22)"
    },
    {
      "id": "ch22-math-013",
      "type": "math",
      "x": 65,
      "y": 2026,
      "w": 990,
      "target": "RL22",
      "expr": "-20*log10(Gmag22)"
    },
    {
      "id": "ch22-math-014",
      "type": "math",
      "x": 65,
      "y": 2191,
      "w": 990,
      "target": "Pref22",
      "expr": "Gmag22^2"
    },
    {
      "id": "ch22-table-015",
      "type": "table",
      "x": 65,
      "y": 2356,
      "w": 990,
      "h": 280,
      "title": "Example 2",
      "headersText": "Value",
      "rowLabels": "VSWR\nReturn loss (dB)\nReflected-power fraction",
      "expr": "cols([VSWR22,RL22,Pref22])",
      "precision": "12"
    },
    {
      "id": "ch22-math-016",
      "type": "math",
      "x": 65,
      "y": 2726,
      "w": 990,
      "target": "z22sw",
      "expr": "linspace(0,1,401)"
    },
    {
      "id": "ch22-math-017",
      "type": "math",
      "x": 65,
      "y": 2891,
      "w": 990,
      "target": "env22",
      "expr": "abs(exp(-i*2*pi*z22sw)+Gmag22*exp(i*2*pi*z22sw))"
    },
    {
      "id": "ch22-plot-018",
      "type": "plot",
      "kind": "line",
      "title": "Example 2: standing-wave magnitude",
      "xexpr": "z22sw",
      "yexpr": "|V| := env22",
      "zexpr": "",
      "x": 65,
      "y": 3056,
      "w": 990,
      "h": 400,
      "xlabel": "Electrical distance (wavelengths)",
      "ylabel": "|V|/|V+|",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch22-head-019",
      "type": "text",
      "x": 65,
      "y": 3561,
      "w": 990,
      "content": "Worked Example 3 - Quarter-wave transformer",
      "heading": true
    },
    {
      "id": "ch22-math-020",
      "type": "math",
      "x": 65,
      "y": 3666,
      "w": 990,
      "target": "Zt22",
      "expr": "sqrt(50*200)"
    },
    {
      "id": "ch22-math-021",
      "type": "math",
      "x": 65,
      "y": 3831,
      "w": 990,
      "target": "lambda22_3",
      "expr": "0.70*3e8/1e9"
    },
    {
      "id": "ch22-math-022",
      "type": "math",
      "x": 65,
      "y": 3996,
      "w": 990,
      "target": "ell22_3",
      "expr": "lambda22_3/4"
    },
    {
      "id": "ch22-table-023",
      "type": "table",
      "x": 65,
      "y": 4161,
      "w": 990,
      "h": 280,
      "title": "Example 3",
      "headersText": "Value",
      "rowLabels": "Transformer impedance (ohm)\nWavelength (m)\nLength (mm)",
      "expr": "cols([Zt22,lambda22_3,ell22_3*1e3])",
      "precision": "12"
    },
    {
      "id": "ch22-head-024",
      "type": "text",
      "x": 65,
      "y": 4531,
      "w": 990,
      "content": "Worked Example 4 - WR-90 TE10 cutoff and field",
      "heading": true
    },
    {
      "id": "ch22-math-025",
      "type": "math",
      "x": 65,
      "y": 4636,
      "w": 990,
      "target": "a22",
      "expr": "22.86e-3"
    },
    {
      "id": "ch22-math-026",
      "type": "math",
      "x": 65,
      "y": 4801,
      "w": 990,
      "target": "b22",
      "expr": "10.16e-3"
    },
    {
      "id": "ch22-math-027",
      "type": "math",
      "x": 65,
      "y": 4966,
      "w": 990,
      "target": "fc22",
      "expr": "c22/(2*a22)"
    },
    {
      "id": "ch22-table-028",
      "type": "table",
      "x": 65,
      "y": 5131,
      "w": 990,
      "h": 280,
      "title": "Example 4",
      "headersText": "Value",
      "rowLabels": "TE10 cutoff (Hz)\nTE10 cutoff (GHz)",
      "expr": "cols([fc22,fc22/1e9])",
      "precision": "12"
    },
    {
      "id": "ch22-plot-029",
      "type": "plot",
      "kind": "quiver2d",
      "title": "Example 4: TE10 transverse E samples",
      "xexpr": "linspace(0,a22,13)",
      "yexpr": "linspace(0,b22,7)",
      "zexpr": "",
      "x": 65,
      "y": 5501,
      "w": 990,
      "h": 470,
      "xlabel": "x (m)",
      "ylabel": "y (m)",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false,
      "uexpr": "0",
      "vexpr": "sin(pi*x/a22)",
      "wexpr": "",
      "vectorAutoScale": true,
      "vectorScale": 0.85,
      "vectorNormalize": false,
      "vectorHeadSize": 0.42,
      "vectorWidth": 2.0,
      "vectorOpacity": 0.92,
      "vectorDensity": 1,
      "vectorAnchor": "tail",
      "vectorColorMode": "magnitude",
      "vectorColor": "#2175b5",
      "vectorPalette": "Viridis",
      "showColorbar": true,
      "animate": false,
      "animVar": "t",
      "animStart": "0",
      "animStop": "2*pi",
      "animFrames": 36,
      "animFps": 16,
      "animLoop": true
    },
    {
      "id": "ch22-head-030",
      "type": "text",
      "x": 65,
      "y": 6076,
      "w": 990,
      "content": "Worked Example 5 - Guide wavelength and velocities",
      "heading": true
    },
    {
      "id": "ch22-math-031",
      "type": "math",
      "x": 65,
      "y": 6181,
      "w": 990,
      "target": "f22_5",
      "expr": "10e9"
    },
    {
      "id": "ch22-math-032",
      "type": "math",
      "x": 65,
      "y": 6346,
      "w": 990,
      "target": "lam0_22",
      "expr": "c22/f22_5"
    },
    {
      "id": "ch22-math-033",
      "type": "math",
      "x": 65,
      "y": 6511,
      "w": 990,
      "target": "lamg22",
      "expr": "lam0_22/sqrt(1-(fc22/f22_5)^2)"
    },
    {
      "id": "ch22-math-034",
      "type": "math",
      "x": 65,
      "y": 6676,
      "w": 990,
      "target": "vp22",
      "expr": "c22/sqrt(1-(fc22/f22_5)^2)"
    },
    {
      "id": "ch22-math-035",
      "type": "math",
      "x": 65,
      "y": 6841,
      "w": 990,
      "target": "vg22",
      "expr": "c22*sqrt(1-(fc22/f22_5)^2)"
    },
    {
      "id": "ch22-table-036",
      "type": "table",
      "x": 65,
      "y": 7006,
      "w": 990,
      "h": 330,
      "title": "Example 5",
      "headersText": "Value",
      "rowLabels": "λ0 (mm)\nλg (mm)\nvp/c\nvg/c\nvp·vg/c²",
      "expr": "cols([lam0_22*1e3,lamg22*1e3,vp22/c22,vg22/c22,vp22*vg22/c22^2])",
      "precision": "12"
    },
    {
      "id": "ch22-head-037",
      "type": "text",
      "x": 65,
      "y": 7426,
      "w": 990,
      "content": "Worked Example 6 - Rectangular-cavity resonance",
      "heading": true
    },
    {
      "id": "ch22-math-038",
      "type": "math",
      "x": 65,
      "y": 7531,
      "w": 990,
      "target": "fcav22",
      "expr": "c22/2*sqrt((1/0.05)^2+(1/0.08)^2)"
    },
    {
      "id": "ch22-table-039",
      "type": "table",
      "x": 65,
      "y": 7696,
      "w": 990,
      "h": 280,
      "title": "Example 6",
      "headersText": "Value",
      "rowLabels": "(1,0,1)-type resonance (Hz)\nResonance (GHz)",
      "expr": "cols([fcav22,fcav22/1e9])",
      "precision": "12"
    },
    {
      "id": "ch22-plot-040",
      "type": "plot",
      "kind": "surface",
      "title": "Example 6: representative standing cavity field",
      "xexpr": "linspace(0,0.05,50)",
      "yexpr": "linspace(0,0.08,60)",
      "zexpr": "sin(pi*x/0.05)*sin(pi*y/0.08)",
      "x": 65,
      "y": 8066,
      "w": 990,
      "h": 450,
      "xlabel": "x (m)",
      "ylabel": "z (m)",
      "y2label": "",
      "zlabel": "Normalized field",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch22-head-041",
      "type": "text",
      "x": 65,
      "y": 8621,
      "w": 990,
      "content": "Worked Example 7 - Sparse versus dense matrices",
      "heading": true
    },
    {
      "id": "ch22-note-042",
      "type": "text",
      "x": 65,
      "y": 8726,
      "w": 990,
      "content": "The course contrast is structural: local FEM basis functions create sparse coupling, while free-space MoM Green-function coupling is generally dense. The matrices below are schematic 6×6 examples, not a solver benchmark.",
      "heading": false
    },
    {
      "id": "ch22-math-043",
      "type": "math",
      "x": 65,
      "y": 8841,
      "w": 990,
      "target": "FEM_sparse22",
      "expr": "[4,-1,0,0,0,0;-1,4,-1,0,0,0;0,-1,4,-1,0,0;0,0,-1,4,-1,0;0,0,0,-1,4,-1;0,0,0,0,-1,4]"
    },
    {
      "id": "ch22-math-044",
      "type": "math",
      "x": 65,
      "y": 9006,
      "w": 990,
      "target": "MoM_dense22",
      "expr": "[4,1,0.7,0.5,0.4,0.3;1,4,1,0.7,0.5,0.4;0.7,1,4,1,0.7,0.5;0.5,0.7,1,4,1,0.7;0.4,0.5,0.7,1,4,1;0.3,0.4,0.5,0.7,1,4]"
    },
    {
      "id": "ch22-plot-045",
      "type": "plot",
      "kind": "heatmap",
      "title": "Example 7: schematic sparse FEM matrix",
      "xexpr": "range(0,1,5)",
      "yexpr": "range(0,1,5)",
      "zexpr": "FEM_sparse22",
      "x": 65,
      "y": 9171,
      "w": 990,
      "h": 420,
      "xlabel": "Column",
      "ylabel": "Row",
      "y2label": "",
      "zlabel": "Value",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch22-plot-046",
      "type": "plot",
      "kind": "heatmap",
      "title": "Example 7: schematic dense MoM matrix",
      "xexpr": "range(0,1,5)",
      "yexpr": "range(0,1,5)",
      "zexpr": "MoM_dense22",
      "x": 65,
      "y": 9696,
      "w": 990,
      "h": 420,
      "xlabel": "Column",
      "ylabel": "Row",
      "y2label": "",
      "zlabel": "Value",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch22-head-047",
      "type": "text",
      "x": 65,
      "y": 10221,
      "w": 990,
      "content": "Worked Example 8 - Convergence study",
      "heading": true
    },
    {
      "id": "ch22-math-048",
      "type": "math",
      "x": 65,
      "y": 10326,
      "w": 990,
      "target": "h22",
      "expr": "[1,0.70,0.50,0.35,0.25,0.18]"
    },
    {
      "id": "ch22-math-049",
      "type": "math",
      "x": 65,
      "y": 10491,
      "w": 990,
      "target": "fr22",
      "expr": "[2.450,2.221,2.113,2.055,2.028,2.015]"
    },
    {
      "id": "ch22-math-050",
      "type": "math",
      "x": 65,
      "y": 10656,
      "w": 990,
      "target": "change22",
      "expr": "(2.028-2.015)/2.015*100"
    },
    {
      "id": "ch22-plot-051",
      "type": "plot",
      "kind": "line",
      "title": "Example 8: mesh convergence",
      "xexpr": "h22",
      "yexpr": "Resonance (GHz) := fr22",
      "zexpr": "",
      "x": 65,
      "y": 10821,
      "w": 990,
      "h": 410,
      "xlabel": "Mesh size h",
      "ylabel": "Result (GHz)",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch22-table-052",
      "type": "table",
      "x": 65,
      "y": 11336,
      "w": 990,
      "h": 210,
      "title": "Example 8",
      "headersText": "Value",
      "rowLabels": "Last-step relative change (%)",
      "expr": "cols([change22])",
      "precision": "12"
    },
    {
      "id": "ch22-head-053",
      "type": "text",
      "x": 65,
      "y": 11636,
      "w": 990,
      "content": "Worked Example 9 - Port mode then driven 3D solve",
      "heading": true
    },
    {
      "id": "ch22-note-054",
      "type": "text",
      "x": 65,
      "y": 11741,
      "w": 990,
      "content": "The course workflow is: solve a 2D port eigenproblem A e_n = β_n² B e_n; use the dominant TE10-like mode as excitation for K(ω)E=b; decompose the solved port field into forward/backward modal amplitudes to obtain S11=b1/a1. M²S does not provide a general eigensolver, so this example visualises the TE10-like port field and the amplitude-ratio step.",
      "heading": false
    },
    {
      "id": "ch22-math-055",
      "type": "math",
      "x": 65,
      "y": 11856,
      "w": 990,
      "target": "a1_22",
      "expr": "1"
    },
    {
      "id": "ch22-math-056",
      "type": "math",
      "x": 65,
      "y": 12021,
      "w": 990,
      "target": "b1_22",
      "expr": "0.18*exp(i*35*pi/180)"
    },
    {
      "id": "ch22-math-057",
      "type": "math",
      "x": 65,
      "y": 12186,
      "w": 990,
      "target": "S11_22",
      "expr": "b1_22/a1_22"
    },
    {
      "id": "ch22-plot-058",
      "type": "plot",
      "kind": "quiver2d",
      "title": "Example 9: TE10-like port electric field",
      "xexpr": "linspace(0,a22,13)",
      "yexpr": "linspace(0,b22,7)",
      "zexpr": "",
      "x": 65,
      "y": 12351,
      "w": 990,
      "h": 470,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false,
      "uexpr": "0",
      "vexpr": "sin(pi*x/a22)",
      "wexpr": "",
      "vectorAutoScale": true,
      "vectorScale": 0.85,
      "vectorNormalize": false,
      "vectorHeadSize": 0.42,
      "vectorWidth": 2.0,
      "vectorOpacity": 0.92,
      "vectorDensity": 1,
      "vectorAnchor": "tail",
      "vectorColorMode": "magnitude",
      "vectorColor": "#2175b5",
      "vectorPalette": "Viridis",
      "showColorbar": true,
      "animate": false,
      "animVar": "t",
      "animStart": "0",
      "animStop": "2*pi",
      "animFrames": 36,
      "animFps": 16,
      "animLoop": true
    },
    {
      "id": "ch22-table-059",
      "type": "table",
      "x": 65,
      "y": 12926,
      "w": 990,
      "h": 280,
      "title": "Example 9",
      "headersText": "Value",
      "rowLabels": "|S11|\nPhase S11 (deg)",
      "expr": "cols([abs(S11_22),arg(S11_22)*180/pi])",
      "precision": "12"
    },
    {
      "id": "ch22-head-060",
      "type": "text",
      "x": 65,
      "y": 13296,
      "w": 990,
      "content": "Worked Example 10 - Numerical-method selection",
      "heading": true
    },
    {
      "id": "ch22-note-061",
      "type": "text",
      "x": 65,
      "y": 13401,
      "w": 990,
      "content": "Course first-choice mapping: thin-wire antenna in open space → MoM; irregular dielectric-loaded 3D waveguide filter → FEM; broadband transient coupling in a large enclosure → FDTD. These are defensible starting points, not absolute rules. Ask what domain is discretised, what boundaries/materials exist, what bandwidth is required and what output quantity is needed.",
      "heading": false
    },
    {
      "id": "ch22-head-062",
      "type": "text",
      "x": 65,
      "y": 13516,
      "w": 990,
      "content": "Checkpoint / exploration",
      "heading": true
    },
    {
      "id": "ch22-note-063",
      "type": "text",
      "x": 65,
      "y": 13621,
      "w": 990,
      "content": "The later examples are intentionally interpretive as well as numerical. Numerical EM is judged by formulation, convergence and physically meaningful outputs, not by smooth plots alone.",
      "heading": false
    }
  ]
}
