edgefem 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edgefem-1.0.0/.DS_Store +0 -0
- edgefem-1.0.0/.clang-format +2 -0
- edgefem-1.0.0/.clang-tidy +3 -0
- edgefem-1.0.0/.claude/settings.local.json +67 -0
- edgefem-1.0.0/.github/workflows/ci.yml +36 -0
- edgefem-1.0.0/.github/workflows/docs.yml +48 -0
- edgefem-1.0.0/.github/workflows/wheels.yml +84 -0
- edgefem-1.0.0/.gitignore +26 -0
- edgefem-1.0.0/AGENTS.md +140 -0
- edgefem-1.0.0/CLAUDE.md +239 -0
- edgefem-1.0.0/CMakeLists.txt +32 -0
- edgefem-1.0.0/CONTRIBUTING.md +166 -0
- edgefem-1.0.0/LICENSE +21 -0
- edgefem-1.0.0/MANIFEST.in +17 -0
- edgefem-1.0.0/PKG-INFO +332 -0
- edgefem-1.0.0/README.md +296 -0
- edgefem-1.0.0/cmake/FindEigen3.cmake +14 -0
- edgefem-1.0.0/code_samples.md +600 -0
- edgefem-1.0.0/dist/edgefem-1.0.0-cp39-cp39-macosx_26_0_arm64.whl +0 -0
- edgefem-1.0.0/docs/VALIDATION_REPORT.md +103 -0
- edgefem-1.0.0/docs/api/core.md +526 -0
- edgefem-1.0.0/docs/api/designs.md +596 -0
- edgefem-1.0.0/docs/api/plots.md +484 -0
- edgefem-1.0.0/docs/index.md +85 -0
- edgefem-1.0.0/docs/installation.md +159 -0
- edgefem-1.0.0/docs/javascripts/mathjax.js +16 -0
- edgefem-1.0.0/docs/quickstart.md +202 -0
- edgefem-1.0.0/docs/tutorials/patch_antenna.md +436 -0
- edgefem-1.0.0/docs/tutorials/unit_cell.md +502 -0
- edgefem-1.0.0/docs/tutorials/waveguide.md +339 -0
- edgefem-1.0.0/docs/validation.md +178 -0
- edgefem-1.0.0/edgefem_cad/__init__.py +48 -0
- edgefem-1.0.0/edgefem_cad/cli.py +85 -0
- edgefem-1.0.0/edgefem_cad/export/edgefem_case.py +30 -0
- edgefem-1.0.0/edgefem_cad/io/step_iges.py +33 -0
- edgefem-1.0.0/edgefem_cad/io/stl_obj.py +21 -0
- edgefem-1.0.0/edgefem_cad/mesh/generate.py +26 -0
- edgefem-1.0.0/edgefem_cad/ops/repair.py +24 -0
- edgefem-1.0.0/edgefem_cad/ops/tagging.py +23 -0
- edgefem-1.0.0/edgefem_cad/sdk/__init__.py +16 -0
- edgefem-1.0.0/edgefem_cad/sdk/project.py +82 -0
- edgefem-1.0.0/edgefem_cad/viz/preview.py +23 -0
- edgefem-1.0.0/examples/.gitkeep +0 -0
- edgefem-1.0.0/examples/01_waveguide_sparams.py +192 -0
- edgefem-1.0.0/examples/01_waveguide_sparams.s2p +4 -0
- edgefem-1.0.0/examples/02_frequency_sweep.py +218 -0
- edgefem-1.0.0/examples/02_frequency_sweep.s2p +14 -0
- edgefem-1.0.0/examples/03_unit_cell_floquet.py +230 -0
- edgefem-1.0.0/examples/README.md +85 -0
- edgefem-1.0.0/examples/cube_cavity.geo +8 -0
- edgefem-1.0.0/examples/cube_cavity.msh +238 -0
- edgefem-1.0.0/examples/make_mesh.sh +8 -0
- edgefem-1.0.0/examples/make_port_mesh.sh +6 -0
- edgefem-1.0.0/examples/make_waveguide_mesh.sh +3 -0
- edgefem-1.0.0/examples/mixed_cavity.geo +14 -0
- edgefem-1.0.0/examples/mixed_cavity.msh +244 -0
- edgefem-1.0.0/examples/patch_2p45_FR4.s1p +102 -0
- edgefem-1.0.0/examples/patch_antenna.geo +13 -0
- edgefem-1.0.0/examples/patch_antenna.msh +2416 -0
- edgefem-1.0.0/examples/patch_antenna_design.py +201 -0
- edgefem-1.0.0/examples/patch_antenna_design_prompt.md +101 -0
- edgefem-1.0.0/examples/patch_antenna_pattern.csv +38 -0
- edgefem-1.0.0/examples/patch_design.json +12 -0
- edgefem-1.0.0/examples/patch_fullwave_sparams.csv +12 -0
- edgefem-1.0.0/examples/patch_sparams.csv +102 -0
- edgefem-1.0.0/examples/plot_waveguide_sparams.py +34 -0
- edgefem-1.0.0/examples/rect_waveguide.geo +37 -0
- edgefem-1.0.0/examples/rect_waveguide.msh +6309 -0
- edgefem-1.0.0/examples/run_patch_fullwave.py +28 -0
- edgefem-1.0.0/examples/run_scalar_demo.sh +6 -0
- edgefem-1.0.0/examples/run_waveguide_demo.sh +7 -0
- edgefem-1.0.0/examples/sdk_demo.py +29 -0
- edgefem-1.0.0/examples/unit_cell.geo +131 -0
- edgefem-1.0.0/examples/unit_cell_demo.py +210 -0
- edgefem-1.0.0/examples/unit_cell_workflow.md +325 -0
- edgefem-1.0.0/examples/waveguide_sparams.csv +52 -0
- edgefem-1.0.0/examples/waveguide_sparams.s2p +52 -0
- edgefem-1.0.0/examples/waveport_demo.py +197 -0
- edgefem-1.0.0/examples/waveport_demo_sparams.s2p +14 -0
- edgefem-1.0.0/examples/waveport_workflow.md +312 -0
- edgefem-1.0.0/examples/wr90_port.geo +23 -0
- edgefem-1.0.0/examples/wr90_port.msh +312 -0
- edgefem-1.0.0/include/edgefem/array/active_impedance.hpp +66 -0
- edgefem-1.0.0/include/edgefem/array/coupling_extract.hpp +62 -0
- edgefem-1.0.0/include/edgefem/array/embedded_pattern.hpp +73 -0
- edgefem-1.0.0/include/edgefem/bc.hpp +41 -0
- edgefem-1.0.0/include/edgefem/coupling.hpp +61 -0
- edgefem-1.0.0/include/edgefem/edge_basis.hpp +30 -0
- edgefem-1.0.0/include/edgefem/fem.hpp +30 -0
- edgefem-1.0.0/include/edgefem/io/array_export.hpp +54 -0
- edgefem-1.0.0/include/edgefem/io/json_export.hpp +26 -0
- edgefem-1.0.0/include/edgefem/io/touchstone.hpp +47 -0
- edgefem-1.0.0/include/edgefem/io/vtk_export.hpp +50 -0
- edgefem-1.0.0/include/edgefem/materials/dispersive.hpp +282 -0
- edgefem-1.0.0/include/edgefem/maxwell.hpp +205 -0
- edgefem-1.0.0/include/edgefem/mesh.hpp +62 -0
- edgefem-1.0.0/include/edgefem/mesh_quality.hpp +35 -0
- edgefem-1.0.0/include/edgefem/mor/vector_fit.hpp +37 -0
- edgefem-1.0.0/include/edgefem/periodic.hpp +75 -0
- edgefem-1.0.0/include/edgefem/ports/port_eigensolve.hpp +65 -0
- edgefem-1.0.0/include/edgefem/ports/wave_port.hpp +64 -0
- edgefem-1.0.0/include/edgefem/post/ntf.hpp +125 -0
- edgefem-1.0.0/include/edgefem/solver.hpp +47 -0
- edgefem-1.0.0/include/edgefem/sweep.hpp +21 -0
- edgefem-1.0.0/mkdocs.yml +64 -0
- edgefem-1.0.0/project_plan.md +329 -0
- edgefem-1.0.0/project_review.md +30 -0
- edgefem-1.0.0/pyproject.toml +54 -0
- edgefem-1.0.0/python/.gitkeep +0 -0
- edgefem-1.0.0/python/CMakeLists.txt +7 -0
- edgefem-1.0.0/python/edgefem/__init__.py +83 -0
- edgefem-1.0.0/python/edgefem/designs/__init__.py +70 -0
- edgefem-1.0.0/python/edgefem/designs/patch_antenna.py +867 -0
- edgefem-1.0.0/python/edgefem/designs/unit_cell.py +915 -0
- edgefem-1.0.0/python/edgefem/designs/waveguide.py +448 -0
- edgefem-1.0.0/python/edgefem/plots/__init__.py +76 -0
- edgefem-1.0.0/python/edgefem/plots/coupling.py +367 -0
- edgefem-1.0.0/python/edgefem/plots/fields.py +295 -0
- edgefem-1.0.0/python/edgefem/plots/patterns.py +402 -0
- edgefem-1.0.0/python/edgefem/plots/sparams.py +433 -0
- edgefem-1.0.0/python/pyedgefem.cpp +918 -0
- edgefem-1.0.0/requirements.md +153 -0
- edgefem-1.0.0/requirements.txt +2 -0
- edgefem-1.0.0/simulations/test_array/run_simulation.py +94 -0
- edgefem-1.0.0/simulations/test_array/unit_cell.geo +120 -0
- edgefem-1.0.0/simulations/test_array/unit_cell.msh +9313 -0
- edgefem-1.0.0/simulations/test_dipole/dipole.geo +69 -0
- edgefem-1.0.0/simulations/test_dipole/dipole.msh +10577 -0
- edgefem-1.0.0/simulations/test_dipole/run_simulation.py +94 -0
- edgefem-1.0.0/simulations/test_fields.vtk +17891 -0
- edgefem-1.0.0/simulations/test_fields.vtu +18474 -0
- edgefem-1.0.0/simulations/test_wg_sim/run_simulation.py +89 -0
- edgefem-1.0.0/simulations/test_wg_sim/waveguide.geo +32 -0
- edgefem-1.0.0/simulations/test_wg_sim/waveguide.msh +15426 -0
- edgefem-1.0.0/simulations/wr90_highlevel.s2p +4 -0
- edgefem-1.0.0/smoke.s2p +2 -0
- edgefem-1.0.0/src/CMakeLists.txt +44 -0
- edgefem-1.0.0/src/array/active_impedance.cpp +140 -0
- edgefem-1.0.0/src/array/coupling_extract.cpp +217 -0
- edgefem-1.0.0/src/array/embedded_pattern.cpp +146 -0
- edgefem-1.0.0/src/assemble_maxwell.cpp +648 -0
- edgefem-1.0.0/src/bc.cpp +103 -0
- edgefem-1.0.0/src/coupling.cpp +136 -0
- edgefem-1.0.0/src/edge_basis.cpp +116 -0
- edgefem-1.0.0/src/fem_scalar.cpp +37 -0
- edgefem-1.0.0/src/io/array_export.cpp +192 -0
- edgefem-1.0.0/src/io/json_export.cpp +124 -0
- edgefem-1.0.0/src/io/touchstone.cpp +151 -0
- edgefem-1.0.0/src/io/vtk_export.cpp +288 -0
- edgefem-1.0.0/src/main_scalar_demo.cpp +44 -0
- edgefem-1.0.0/src/materials/dispersive.cpp +17 -0
- edgefem-1.0.0/src/mesh_gmsh.cpp +121 -0
- edgefem-1.0.0/src/mesh_quality.cpp +83 -0
- edgefem-1.0.0/src/mor/vector_fit.cpp +88 -0
- edgefem-1.0.0/src/periodic.cpp +230 -0
- edgefem-1.0.0/src/ports/port_eigensolve.cpp +272 -0
- edgefem-1.0.0/src/ports/wave_port.cpp +404 -0
- edgefem-1.0.0/src/post/ntf.cpp +418 -0
- edgefem-1.0.0/src/solver.cpp +85 -0
- edgefem-1.0.0/src/sweep.cpp +72 -0
- edgefem-1.0.0/src/sweep_demo.cpp +34 -0
- edgefem-1.0.0/src/waveguide_demo.cpp +59 -0
- edgefem-1.0.0/system_design_spec.md +241 -0
- edgefem-1.0.0/tests/CMakeLists.txt +179 -0
- edgefem-1.0.0/tests/benchmark_2d_waveguide.cpp +627 -0
- edgefem-1.0.0/tests/benchmark_wr90.cpp +177 -0
- edgefem-1.0.0/tests/debug_3d_mode_structure.cpp +206 -0
- edgefem-1.0.0/tests/debug_3d_vs_2d_pattern.cpp +224 -0
- edgefem-1.0.0/tests/debug_fem_core.cpp +313 -0
- edgefem-1.0.0/tests/debug_matrix_cond.cpp +171 -0
- edgefem-1.0.0/tests/debug_mode_alignment.cpp +298 -0
- edgefem-1.0.0/tests/debug_port_coupling.cpp +212 -0
- edgefem-1.0.0/tests/debug_port_normals.cpp +132 -0
- edgefem-1.0.0/tests/debug_port_weights.cpp +130 -0
- edgefem-1.0.0/tests/debug_solution_structure.cpp +211 -0
- edgefem-1.0.0/tests/debug_waveguide.cpp +483 -0
- edgefem-1.0.0/tests/python_smoke.py +10 -0
- edgefem-1.0.0/tests/test_2d_port_eigensolve.cpp +315 -0
- edgefem-1.0.0/tests/test_3d_eigenvector_excitation.cpp +226 -0
- edgefem-1.0.0/tests/test_abc.cpp +41 -0
- edgefem-1.0.0/tests/test_coupling.cpp +195 -0
- edgefem-1.0.0/tests/test_direct_mode_excitation.cpp +237 -0
- edgefem-1.0.0/tests/test_direct_mode_tuning.cpp +216 -0
- edgefem-1.0.0/tests/test_dispersive_materials.cpp +349 -0
- edgefem-1.0.0/tests/test_edge_indexing.cpp +34 -0
- edgefem-1.0.0/tests/test_eigenmode_sparams.cpp +122 -0
- edgefem-1.0.0/tests/test_eigenvector_waveport.cpp +126 -0
- edgefem-1.0.0/tests/test_flipped_port.cpp +87 -0
- edgefem-1.0.0/tests/test_frequency_sweep.cpp +141 -0
- edgefem-1.0.0/tests/test_maxwell.cpp +112 -0
- edgefem-1.0.0/tests/test_mesh_quality.cpp +119 -0
- edgefem-1.0.0/tests/test_normalized_ports.cpp +114 -0
- edgefem-1.0.0/tests/test_ntf.cpp +52 -0
- edgefem-1.0.0/tests/test_periodic.cpp +171 -0
- edgefem-1.0.0/tests/test_pml.cpp +38 -0
- edgefem-1.0.0/tests/test_ports.cpp +42 -0
- edgefem-1.0.0/tests/test_solver_convergence.cpp +141 -0
- edgefem-1.0.0/tests/test_sparam_accuracy.cpp +341 -0
- edgefem-1.0.0/tests/test_sweep.cpp +23 -0
- edgefem-1.0.0/tests/test_touchstone_nport.cpp +184 -0
- edgefem-1.0.0/tests/test_vector_fit.cpp +27 -0
- edgefem-1.0.0/tests/test_waveguide_modal.cpp +48 -0
- edgefem-1.0.0/tests/test_waveguide_modes.cpp +191 -0
- edgefem-1.0.0/tests/test_waveguide_with_pml.cpp +219 -0
- edgefem-1.0.0/tests/test_waveport_with_abc.cpp +115 -0
- edgefem-1.0.0/tests/test_weight_normalization.cpp +132 -0
- edgefem-1.0.0/tests/verify_mode_normalization.cpp +136 -0
- edgefem-1.0.0/tools/__init__.py +1 -0
- edgefem-1.0.0/tools/agents/mesh_qa.py +23 -0
- edgefem-1.0.0/tools/codex/tasks.md +177 -0
- edgefem-1.0.0/tools/geometry/__init__.py +17 -0
- edgefem-1.0.0/tools/geometry/generators.py +474 -0
- edgefem-1.0.0/tools/lint.sh +16 -0
- edgefem-1.0.0/tools/new_simulation.py +273 -0
- edgefem-1.0.0/tools/plot_pattern.py +32 -0
- edgefem-1.0.0/tools/requirements.txt +2 -0
- edgefem-1.0.0/tutorials/01_rectangular_waveguide.ipynb +376 -0
- edgefem-1.0.0/tutorials/02_patch_antenna.ipynb +450 -0
- edgefem-1.0.0/tutorials/03_unit_cell.ipynb +435 -0
- edgefem-1.0.0/tutorials/04_phased_array.ipynb +488 -0
- edgefem-1.0.0/waveguide.msh +6 -0
- edgefem-1.0.0/waveguide_sparams.png +0 -0
- edgefem-1.0.0/waveguide_sparams.s2p +12 -0
edgefem-1.0.0/.DS_Store
ADDED
|
Binary file
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(find:*)",
|
|
5
|
+
"Bash(wc:*)",
|
|
6
|
+
"Bash(tree:*)",
|
|
7
|
+
"Bash(cmake:*)",
|
|
8
|
+
"Bash(/opt/homebrew/bin/cmake:*)",
|
|
9
|
+
"Bash(grep:*)",
|
|
10
|
+
"Bash(ctest:*)",
|
|
11
|
+
"Bash(git add:*)",
|
|
12
|
+
"Bash(git commit:*)",
|
|
13
|
+
"Bash(PYTHONPATH=build/python python3:*)",
|
|
14
|
+
"Bash(python3:*)",
|
|
15
|
+
"Bash(PYTHONPATH=../../build/python python3:*)",
|
|
16
|
+
"Bash(gmsh:*)",
|
|
17
|
+
"Bash(./build/tests/test_waveguide_modal:*)",
|
|
18
|
+
"Bash(echo:*)",
|
|
19
|
+
"Bash(./build/debug_waveguide:*)",
|
|
20
|
+
"Bash(g++:*)",
|
|
21
|
+
"Bash(./build/tests/debug_waveguide:*)",
|
|
22
|
+
"Bash(/tmp/test_cavity)",
|
|
23
|
+
"Bash(/tmp/test_eigenfreq:*)",
|
|
24
|
+
"Bash(./build/tests/debug_fem_core:*)",
|
|
25
|
+
"Bash(/tmp/verify_mode)",
|
|
26
|
+
"Bash(./build/tests/benchmark_2d_waveguide:*)",
|
|
27
|
+
"Bash(./build/tests/debug_port_weights:*)",
|
|
28
|
+
"Bash(./build/tests/test_frequency_sweep:*)",
|
|
29
|
+
"Bash(./build/tests/test_normalized_ports:*)",
|
|
30
|
+
"Bash(./build/tests/debug_port_normals:*)",
|
|
31
|
+
"Bash(./build/tests/test_flipped_port:*)",
|
|
32
|
+
"Bash(timeout 120 ./build/tests/debug_matrix_cond:*)",
|
|
33
|
+
"Bash(./build/tests/debug_matrix_cond:*)",
|
|
34
|
+
"Bash(./build/tests/test_weight_normalization:*)",
|
|
35
|
+
"Bash(./build/tests/test_waveguide_modes:*)",
|
|
36
|
+
"Bash(./build/tests/debug_port_coupling:*)",
|
|
37
|
+
"Bash(./build/tests/debug_mode_alignment:*)",
|
|
38
|
+
"Bash(./build/tests/debug_3d_mode_structure:*)",
|
|
39
|
+
"Bash(./build/tests/debug_solution_structure:*)",
|
|
40
|
+
"Bash(./build/tests/test_2d_port_eigensolve:*)",
|
|
41
|
+
"Bash(./build/tests/test_waveport_with_abc:*)",
|
|
42
|
+
"Bash(./build/tests/debug_3d_vs_2d_pattern:*)",
|
|
43
|
+
"Bash(./build/tests/test_waveguide_with_pml:*)",
|
|
44
|
+
"Bash(./build/tests/test_3d_eigenvector_excitation:*)",
|
|
45
|
+
"Bash(./build/tests/test_eigenvector_waveport:*)",
|
|
46
|
+
"Bash(ls:*)",
|
|
47
|
+
"Bash(./build/tests/test_sparam_accuracy:*)",
|
|
48
|
+
"Bash(./build/tests/test_direct_mode_excitation:*)",
|
|
49
|
+
"Bash(./build/tests/test_direct_mode_tuning:*)",
|
|
50
|
+
"Bash(./build/tests/test_eigenmode_sparams:*)",
|
|
51
|
+
"Bash(./build/tests/benchmark_wr90:*)",
|
|
52
|
+
"Bash(PYTHONPATH=build/python:. python3:*)",
|
|
53
|
+
"Bash(PYTHONPATH=build/python:python python3:*)",
|
|
54
|
+
"Bash(git -C /Users/johnhodge/Documents/code/VectorEM status)",
|
|
55
|
+
"Bash(git -C /Users/johnhodge/Documents/code/VectorEM diff pyproject.toml)",
|
|
56
|
+
"Bash(git -C /Users/johnhodge/Documents/code/VectorEM log --oneline -5)",
|
|
57
|
+
"Bash(./build/tests/test_dispersive_materials:*)",
|
|
58
|
+
"Bash(pip wheel:*)",
|
|
59
|
+
"Bash(PYTHONPATH=/Users/johnhodge/Documents/code/VectorEM/build/python:/Users/johnhodge/Documents/code/VectorEM/python /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9:*)",
|
|
60
|
+
"Bash(python3.9:*)",
|
|
61
|
+
"WebFetch(domain:pypi.org)",
|
|
62
|
+
"WebSearch",
|
|
63
|
+
"Bash(gh repo view:*)",
|
|
64
|
+
"Bash(gh api:*)"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
build-test:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
steps:
|
|
8
|
+
- uses: actions/checkout@v4
|
|
9
|
+
- uses: actions/setup-python@v5
|
|
10
|
+
with:
|
|
11
|
+
python-version: '3.11'
|
|
12
|
+
- name: Install deps
|
|
13
|
+
run: |
|
|
14
|
+
sudo apt-get update && sudo apt-get install -y cmake ninja-build clang-format clang-tidy libeigen3-dev gmsh
|
|
15
|
+
python -m pip install --upgrade pip
|
|
16
|
+
python -m pip install -r tools/requirements.txt
|
|
17
|
+
python -m pip install pybind11 matplotlib
|
|
18
|
+
- name: Get pybind11 CMake dir
|
|
19
|
+
id: pybind11_dir
|
|
20
|
+
run: echo "dir=$(python3 -c 'import pybind11; print(pybind11.get_cmake_dir())')" >> $GITHUB_ENV
|
|
21
|
+
- name: Configure
|
|
22
|
+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DEDGEFEM_PYTHON=ON -Dpybind11_DIR=${{ env.dir }}
|
|
23
|
+
- name: Build
|
|
24
|
+
run: cmake --build build -j
|
|
25
|
+
- name: Static analysis
|
|
26
|
+
run: bash tools/lint.sh build
|
|
27
|
+
- name: Unit tests
|
|
28
|
+
run: ctest --test-dir build -L smoke -j || (cat build/Testing/Temporary/LastTest.log; exit 1)
|
|
29
|
+
- name: Mesh QA (agents)
|
|
30
|
+
run: python tools/agents/mesh_qa.py --in examples --out artifacts/mesh_qa
|
|
31
|
+
- name: Upload artifacts
|
|
32
|
+
uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: edgefem-artifacts
|
|
35
|
+
path: artifacts
|
|
36
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Deploy Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: "pages"
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: '3.11'
|
|
26
|
+
|
|
27
|
+
- name: Install MkDocs and dependencies
|
|
28
|
+
run: |
|
|
29
|
+
pip install mkdocs mkdocs-material mkdocstrings[python]
|
|
30
|
+
|
|
31
|
+
- name: Build documentation
|
|
32
|
+
run: mkdocs build --strict
|
|
33
|
+
|
|
34
|
+
- name: Upload artifact
|
|
35
|
+
uses: actions/upload-pages-artifact@v3
|
|
36
|
+
with:
|
|
37
|
+
path: site
|
|
38
|
+
|
|
39
|
+
deploy:
|
|
40
|
+
environment:
|
|
41
|
+
name: github-pages
|
|
42
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
needs: build
|
|
45
|
+
steps:
|
|
46
|
+
- name: Deploy to GitHub Pages
|
|
47
|
+
id: deployment
|
|
48
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: Build wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ['v*']
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build_wheels:
|
|
10
|
+
name: Build wheels on ${{ matrix.os }}
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-22.04, macos-13, macos-14]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install Eigen (macOS)
|
|
21
|
+
if: runner.os == 'macOS'
|
|
22
|
+
run: brew install eigen
|
|
23
|
+
|
|
24
|
+
- name: Build wheels
|
|
25
|
+
uses: pypa/cibuildwheel@v2.16
|
|
26
|
+
env:
|
|
27
|
+
# Build for Python 3.9-3.12
|
|
28
|
+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*"
|
|
29
|
+
# Skip musllinux (Alpine) and 32-bit builds
|
|
30
|
+
CIBW_SKIP: "*-musllinux_* *-manylinux_i686 *-win32"
|
|
31
|
+
# Install Eigen on Linux before building
|
|
32
|
+
CIBW_BEFORE_ALL_LINUX: >
|
|
33
|
+
yum install -y eigen3-devel ||
|
|
34
|
+
apt-get update && apt-get install -y libeigen3-dev
|
|
35
|
+
# Test the wheel after building
|
|
36
|
+
CIBW_TEST_COMMAND: >
|
|
37
|
+
python -c "import pyedgefem; print('EdgeFEM imported successfully')"
|
|
38
|
+
|
|
39
|
+
- uses: actions/upload-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: wheels-${{ matrix.os }}
|
|
42
|
+
path: ./wheelhouse/*.whl
|
|
43
|
+
|
|
44
|
+
build_sdist:
|
|
45
|
+
name: Build source distribution
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Build sdist
|
|
51
|
+
run: pipx run build --sdist
|
|
52
|
+
|
|
53
|
+
- uses: actions/upload-artifact@v4
|
|
54
|
+
with:
|
|
55
|
+
name: sdist
|
|
56
|
+
path: dist/*.tar.gz
|
|
57
|
+
|
|
58
|
+
publish:
|
|
59
|
+
name: Publish to PyPI
|
|
60
|
+
needs: [build_wheels, build_sdist]
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
63
|
+
environment:
|
|
64
|
+
name: pypi
|
|
65
|
+
url: https://pypi.org/project/edgefem/
|
|
66
|
+
permissions:
|
|
67
|
+
id-token: write
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
pattern: wheels-*
|
|
73
|
+
merge-multiple: true
|
|
74
|
+
path: dist
|
|
75
|
+
|
|
76
|
+
- uses: actions/download-artifact@v4
|
|
77
|
+
with:
|
|
78
|
+
name: sdist
|
|
79
|
+
path: dist
|
|
80
|
+
|
|
81
|
+
- name: Publish to PyPI
|
|
82
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
83
|
+
with:
|
|
84
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
edgefem-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Build directories
|
|
2
|
+
/build/
|
|
3
|
+
/build-*/
|
|
4
|
+
|
|
5
|
+
# CMake cache
|
|
6
|
+
CMakeCache.txt
|
|
7
|
+
CMakeFiles/
|
|
8
|
+
|
|
9
|
+
# Compiled outputs
|
|
10
|
+
*.o
|
|
11
|
+
*.obj
|
|
12
|
+
*.exe
|
|
13
|
+
*.out
|
|
14
|
+
*.a
|
|
15
|
+
*.so
|
|
16
|
+
*.dll
|
|
17
|
+
|
|
18
|
+
# Python artifacts
|
|
19
|
+
__pycache__/
|
|
20
|
+
*.pyc
|
|
21
|
+
|
|
22
|
+
# Example output images
|
|
23
|
+
examples/*.png
|
|
24
|
+
|
|
25
|
+
# Misc
|
|
26
|
+
*.log
|
edgefem-1.0.0/AGENTS.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# AGENTS.md — Developer Agents & CI Automation
|
|
2
|
+
|
|
3
|
+
This repo uses lightweight agents (scripts + LLM prompts) to automate routine tasks: code review hints, documentation updates, mesh QA, and benchmark triage. Agents run locally via CLI and in CI on pull requests.
|
|
4
|
+
|
|
5
|
+
> These are *assistive* and never auto‑commit to `main` without human review. They operate under strict permission boundaries and produce artifacts for maintainers to inspect.
|
|
6
|
+
|
|
7
|
+
## Agent Catalog
|
|
8
|
+
|
|
9
|
+
### 1) Mesh QA Agent
|
|
10
|
+
**Purpose:** Validate Gmsh meshes (or imported STEP→mesh) for quality: min dihedral angles, aspect ratios, boundary tags, and port cross‑section sanity.
|
|
11
|
+
- **Inputs:** `.msh`/STEP, mesh config, thresholds
|
|
12
|
+
- **Outputs:** HTML/JSON report; annotated screenshots; suggested fixes
|
|
13
|
+
- **Triggers:** `tools/agents/mesh_qa.py --in examples/*.msh`
|
|
14
|
+
|
|
15
|
+
### 2) Numerics QA Agent
|
|
16
|
+
**Purpose:** Spot numerical risks in PRs (ill‑conditioned matrices, missing complex arithmetic, curl‑curl sign conventions, boundary application).
|
|
17
|
+
- **Inputs:** Diff context, unit test logs
|
|
18
|
+
- **Outputs:** Markdown review comments with citations to code lines
|
|
19
|
+
- **Triggers:** CI step on PR; local pre‑commit hook
|
|
20
|
+
|
|
21
|
+
### 3) Docs Agent
|
|
22
|
+
**Purpose:** Keep `README.md`, API docs, and tutorials consistent with code changes.
|
|
23
|
+
- **Inputs:** Public headers, CLI help, example scripts
|
|
24
|
+
- **Outputs:** PR comment with proposed doc patches
|
|
25
|
+
- **Triggers:** `tools/agents/docs_sync.py` or CI job
|
|
26
|
+
|
|
27
|
+
### 4) Benchmark Agent
|
|
28
|
+
**Purpose:** Run validation pack nightly and on PRs touching core; compare against tolerances.
|
|
29
|
+
- **Inputs:** Benchmark YAML, reference results
|
|
30
|
+
- **Outputs:** Trend plots, pass/fail summary; regression artifacts
|
|
31
|
+
- **Triggers:** `tools/bench/run_pack.py --suite golden`
|
|
32
|
+
|
|
33
|
+
### 5) Release Notes Agent
|
|
34
|
+
**Purpose:** Generate `CHANGELOG` candidate from merged PRs and labels.
|
|
35
|
+
- **Inputs:** Git log, PR labels
|
|
36
|
+
- **Outputs:** Markdown section for the upcoming version
|
|
37
|
+
- **Triggers:** `tools/agents/release_notes.py`
|
|
38
|
+
|
|
39
|
+
## Implementation
|
|
40
|
+
Agents are simple Python CLIs. Optionally they can call an LLM via your provider of choice (e.g., Bedrock, OpenAI) or a **local MCP server** for context retrieval.
|
|
41
|
+
|
|
42
|
+
````
|
|
43
|
+
|
|
44
|
+
tools/
|
|
45
|
+
agents/
|
|
46
|
+
mesh\_qa.py
|
|
47
|
+
numerics\_review\.py
|
|
48
|
+
docs\_sync.py
|
|
49
|
+
release\_notes.py
|
|
50
|
+
bench/
|
|
51
|
+
run\_pack.py
|
|
52
|
+
|
|
53
|
+
````
|
|
54
|
+
|
|
55
|
+
## CI Wiring (GitHub Actions)
|
|
56
|
+
Example CI job that runs build, tests, mesh QA, and benchmark smoke:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
name: CI
|
|
60
|
+
on: [push, pull_request]
|
|
61
|
+
jobs:
|
|
62
|
+
build-test:
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
- uses: actions/setup-python@v5
|
|
67
|
+
with: { python-version: '3.11' }
|
|
68
|
+
- name: Install deps
|
|
69
|
+
run: |
|
|
70
|
+
sudo apt-get update && sudo apt-get install -y cmake ninja-build
|
|
71
|
+
python -m pip install -r tools/requirements.txt
|
|
72
|
+
- name: Configure
|
|
73
|
+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
74
|
+
- name: Build
|
|
75
|
+
run: cmake --build build -j
|
|
76
|
+
- name: Unit tests
|
|
77
|
+
run: ctest --test-dir build -j || (cat build/Testing/Temporary/LastTest.log; exit 1)
|
|
78
|
+
- name: Mesh QA (agents)
|
|
79
|
+
run: python tools/agents/mesh_qa.py --in examples --out artifacts/mesh_qa
|
|
80
|
+
- name: Benchmark Smoke
|
|
81
|
+
run: python tools/bench/run_pack.py --suite smoke --out artifacts/bench
|
|
82
|
+
- name: Upload artifacts
|
|
83
|
+
uses: actions/upload-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: edgefem-artifacts
|
|
86
|
+
path: artifacts
|
|
87
|
+
````
|
|
88
|
+
|
|
89
|
+
### Optional macOS local smoke
|
|
90
|
+
|
|
91
|
+
On Apple Silicon (M3 Max):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
tools/scripts/setup_macos.sh
|
|
95
|
+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
96
|
+
cmake --build build -j
|
|
97
|
+
ctest --test-dir build -L smoke -j
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Optional: MCP Server & RAG KB
|
|
101
|
+
|
|
102
|
+
If you use an MCP server for repository context and retrieval:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcp": {
|
|
107
|
+
"servers": {
|
|
108
|
+
"repo-kb": {
|
|
109
|
+
"command": "python",
|
|
110
|
+
"args": ["tools/mcp/repo_kb.py"],
|
|
111
|
+
"env": {"KB_PATH": "./docs"}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Then agents call MCP tools to fetch docs/snippets for grounded suggestions.
|
|
119
|
+
|
|
120
|
+
## Security & Guardrails
|
|
121
|
+
|
|
122
|
+
* Agents run with read‑only tokens; write changes as patches in PR comments
|
|
123
|
+
* Large file access and network calls are restricted in CI
|
|
124
|
+
* Logs and artifacts are retained for audit; secrets are masked by Actions
|
|
125
|
+
|
|
126
|
+
## Local Usage Examples
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python tools/agents/mesh_qa.py --in examples/cube_cavity.msh
|
|
130
|
+
python tools/agents/numerics_review.py --diff HEAD~1..HEAD
|
|
131
|
+
python tools/bench/run_pack.py --suite golden --filter patch_2p45GHz
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Adding a New Agent
|
|
135
|
+
|
|
136
|
+
1. Create `tools/agents/<name>.py` with `--in`, `--out`,args and JSON output
|
|
137
|
+
2. Add a Make/CI step and README snippet
|
|
138
|
+
3. Provide a sample input and expected output in `tools/agents/samples/`
|
|
139
|
+
|
|
140
|
+
```
|
edgefem-1.0.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
EdgeFEM is a 3D finite-element electromagnetics (FEM) simulator specialized for **metasurface, metamaterial, and phased array unit cell RF modeling** (100 kHz–110 GHz). It computes S-parameters, fields, and radiation patterns using Nédélec (edge) elements with periodic boundary conditions, PML for open boundaries, and scales from laptops to HPC clusters.
|
|
8
|
+
|
|
9
|
+
The project is MCP (Model Context Protocol) compatible, enabling LLM-augmented automation agents for mesh QA, numerical validation, and documentation sync.
|
|
10
|
+
|
|
11
|
+
## Ecosystem Role
|
|
12
|
+
|
|
13
|
+
EdgeFEM serves as the **full-wave FEM engine** in a multi-package RF modeling ecosystem:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
17
|
+
│ Application Layer │
|
|
18
|
+
│ ┌─────────────────────┐ ┌─────────────────────────────────┐ │
|
|
19
|
+
│ │ Phased-Array- │ │ RF Metasurface/Metamaterial │ │
|
|
20
|
+
│ │ Antenna-Model │ │ Package (planned) │ │
|
|
21
|
+
│ │ - Array factor │ │ - Unit cell optimization │ │
|
|
22
|
+
│ │ - Beamforming │ │ - Homogenization │ │
|
|
23
|
+
│ │ - Scan analysis │ │ - Surface impedance extraction │ │
|
|
24
|
+
│ └─────────┬───────────┘ └───────────────┬─────────────────┘ │
|
|
25
|
+
│ │ │ │
|
|
26
|
+
│ ▼ ▼ │
|
|
27
|
+
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
28
|
+
│ │ EdgeFEM │ │
|
|
29
|
+
│ │ Full-wave 3D FEM engine providing: │ │
|
|
30
|
+
│ │ - Unit cell S-parameters (Floquet ports) │ │
|
|
31
|
+
│ │ - Embedded element patterns │ │
|
|
32
|
+
│ │ - Mutual coupling coefficients │ │
|
|
33
|
+
│ │ - Near-field distributions │ │
|
|
34
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
35
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Interoperability Interfaces
|
|
39
|
+
|
|
40
|
+
| Interface | Format | Use Case |
|
|
41
|
+
|-----------|--------|----------|
|
|
42
|
+
| Python SDK (`pyedgefem`) | NumPy arrays | Direct integration with array/metasurface packages |
|
|
43
|
+
| Touchstone (.sNp) | IEEE standard | S-parameter exchange with any RF tool |
|
|
44
|
+
| JSON | Structured data | Element patterns, coupling matrices, geometry |
|
|
45
|
+
| Gmsh v2 | Mesh format | Geometry import from CAD pipelines |
|
|
46
|
+
|
|
47
|
+
### Integration with Phased-Array-Antenna-Model
|
|
48
|
+
|
|
49
|
+
EdgeFEM provides element-level data that feeds into [Phased-Array-Antenna-Model](https://github.com/jman4162/Phased-Array-Antenna-Model):
|
|
50
|
+
- **Element patterns**: Far-field radiation from unit cell simulation → array factor weighting
|
|
51
|
+
- **Mutual coupling**: Full-wave S-matrix between adjacent elements → impairment modeling
|
|
52
|
+
- **Scan impedance**: Port impedance vs. scan angle → active VSWR prediction
|
|
53
|
+
|
|
54
|
+
### Integration with Metasurface Package (planned)
|
|
55
|
+
|
|
56
|
+
EdgeFEM will provide unit cell characterization for metasurface/metamaterial design:
|
|
57
|
+
- **Reflection/transmission coefficients**: Floquet-port S-parameters under oblique incidence
|
|
58
|
+
- **Surface impedance**: Extracted Zs for equivalent surface models
|
|
59
|
+
- **Dispersion curves**: Frequency-dependent effective parameters (ε_eff, μ_eff)
|
|
60
|
+
|
|
61
|
+
## Build Commands
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# macOS prerequisites
|
|
65
|
+
brew install cmake ninja eigen
|
|
66
|
+
|
|
67
|
+
# Release build
|
|
68
|
+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
69
|
+
cmake --build build -j
|
|
70
|
+
|
|
71
|
+
# With Python SDK
|
|
72
|
+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DEDGEFEM_PYTHON=ON
|
|
73
|
+
cmake --build build -j
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Test Commands
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Smoke tests (fast)
|
|
80
|
+
ctest --test-dir build -L smoke -j
|
|
81
|
+
|
|
82
|
+
# All tests
|
|
83
|
+
ctest --test-dir build -j
|
|
84
|
+
|
|
85
|
+
# Specific test labels
|
|
86
|
+
ctest --test-dir build -L pml # PML absorption
|
|
87
|
+
ctest --test-dir build -L abc # ABC boundary
|
|
88
|
+
|
|
89
|
+
# Single test binary
|
|
90
|
+
./build/tests/test_maxwell
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Lint Commands
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Format and static analysis
|
|
97
|
+
bash tools/lint.sh build
|
|
98
|
+
|
|
99
|
+
# clang-tidy only
|
|
100
|
+
clang-tidy -p build -warnings-as-errors='*' $(git ls-files 'src/*.cpp')
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Demo Commands
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Scalar Helmholtz cavity
|
|
107
|
+
./build/src/edgefem_scalar_demo examples/cube_cavity.msh 1
|
|
108
|
+
|
|
109
|
+
# Waveguide S-parameters
|
|
110
|
+
./build/src/edgefem_waveguide_demo
|
|
111
|
+
python3 examples/plot_waveguide_sparams.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Architecture
|
|
115
|
+
|
|
116
|
+
### Core Modules (`include/edgefem/`)
|
|
117
|
+
|
|
118
|
+
| Module | Purpose |
|
|
119
|
+
|--------|---------|
|
|
120
|
+
| `mesh.hpp` | Tet4/Tri3 mesh with global edge indexing, loaded from Gmsh v2 |
|
|
121
|
+
| `maxwell.hpp` | Maxwell curl-curl FEM assembly with PML and ABC |
|
|
122
|
+
| `edge_basis.hpp` | Nédélec (Whitney) edge element basis functions |
|
|
123
|
+
| `ports/wave_port.hpp` | Wave port definitions with 2D eigenmode solver |
|
|
124
|
+
| `solver.hpp` | BiCGSTAB + ILUT linear solver interface |
|
|
125
|
+
| `sweep.hpp` | Frequency sweep orchestration |
|
|
126
|
+
| `io/touchstone.hpp` | S-parameter Touchstone export |
|
|
127
|
+
| `post/ntf.hpp` | Near-to-far field via Huygens surface |
|
|
128
|
+
| `mor/vector_fit.hpp` | Rational model fitting for MOR |
|
|
129
|
+
|
|
130
|
+
### Data Flow
|
|
131
|
+
|
|
132
|
+
1. **Mesh** → `load_gmsh_v2()` parses Gmsh file, builds edge connectivity
|
|
133
|
+
2. **BC** → `build_edge_pec()` tags PEC edges from physical groups
|
|
134
|
+
3. **Ports** → `build_wave_port()` extracts surface mesh, solves 2D eigenmode
|
|
135
|
+
4. **Assembly** → `assemble_maxwell()` builds curl-curl + mass matrices with PML/ABC
|
|
136
|
+
5. **Solve** → `solve_linear()` via BiCGSTAB with ILUT preconditioner
|
|
137
|
+
6. **Post** → `calculate_sparams()` extracts S-matrix, exports to Touchstone
|
|
138
|
+
|
|
139
|
+
### Key Types
|
|
140
|
+
|
|
141
|
+
- `VecC = Eigen::VectorXcd` — complex solution vectors
|
|
142
|
+
- `SpMatC = Eigen::SparseMatrix<std::complex<double>>` — sparse system matrices
|
|
143
|
+
- Edge orientation stored per element: `edge_orient[i]` ∈ {+1, −1}
|
|
144
|
+
|
|
145
|
+
## MCP Integration
|
|
146
|
+
|
|
147
|
+
Automation agents in `tools/agents/` follow the MCP server pattern:
|
|
148
|
+
- `mesh_qa.py` — validates mesh quality, outputs JSON diagnostics
|
|
149
|
+
- `release_notes.py` — generates changelog from merged PRs
|
|
150
|
+
- Designed for LLM-augmented workflows with structured output
|
|
151
|
+
|
|
152
|
+
## CMake Options
|
|
153
|
+
|
|
154
|
+
| Option | Default | Description |
|
|
155
|
+
|--------|---------|-------------|
|
|
156
|
+
| `EDGEFEM_BUILD_SCALAR` | ON | Scalar Helmholtz path |
|
|
157
|
+
| `EDGEFEM_BUILD_VECTOR` | ON | Maxwell vector path |
|
|
158
|
+
| `EDGEFEM_PYTHON` | OFF | pybind11 Python bindings |
|
|
159
|
+
|
|
160
|
+
## Code Conventions
|
|
161
|
+
|
|
162
|
+
- All code in `namespace edgefem`
|
|
163
|
+
- Public headers in `include/edgefem/`, implementations in `src/`
|
|
164
|
+
- Tests use simple `assert()` macros (no external framework)
|
|
165
|
+
- Edge canonical form: `(n0 < n1)` stored in `mesh.edges`
|
|
166
|
+
|
|
167
|
+
## Known Issues & Critical Fixes
|
|
168
|
+
|
|
169
|
+
### Wave Port Formulation: 2D vs 3D Mode Coupling (Fixed Feb 2026)
|
|
170
|
+
|
|
171
|
+
**Problem**: S-parameter calculations produced non-physical results (|S11| > 1, |S21| ≈ 0) for simple waveguide structures that should have |S11| ≈ 0, |S21| ≈ 1.
|
|
172
|
+
|
|
173
|
+
**Root Cause**: 2D analytical port weights had only **3% correlation** with the 3D FEM eigenvector at port edges.
|
|
174
|
+
|
|
175
|
+
| Component | Expected | Actual | Issue |
|
|
176
|
+
|-----------|----------|--------|-------|
|
|
177
|
+
| Analytical weights Y/X edge ratio | ~12.7 | 0.95 | Analytical formula distributes weight evenly |
|
|
178
|
+
| 3D FEM eigenvector Y/X edge ratio | 12.7 | 12.7 | Correct (y-edges dominate for TE10) |
|
|
179
|
+
| Weight correlation |<w_ana, v_3D>| | ~1.0 | 0.03 | Fundamental mismatch |
|
|
180
|
+
|
|
181
|
+
**Symptoms indicating this issue**:
|
|
182
|
+
- |S11| > 1 (passivity violation)
|
|
183
|
+
- |S21| ≈ 0 when propagation expected
|
|
184
|
+
- Solution field decays along waveguide instead of propagating
|
|
185
|
+
- Port loading (ww^H/Z0) << 1% of system matrix norm
|
|
186
|
+
|
|
187
|
+
**Implemented Fixes**:
|
|
188
|
+
|
|
189
|
+
1. **Eigenvector-based port weights** (`src/ports/wave_port.cpp`):
|
|
190
|
+
```cpp
|
|
191
|
+
// Use 3D FEM eigenvector instead of analytical formula
|
|
192
|
+
WavePort build_wave_port_from_eigenvector(mesh, surface, eigenvector, mode, pec_edges);
|
|
193
|
+
Eigen::VectorXd compute_te_eigenvector(mesh, pec_edges, target_kc_sq);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
2. **Direct eigenmode S-parameter calculation** (`src/assemble_maxwell.cpp`):
|
|
197
|
+
```cpp
|
|
198
|
+
// Use eigenmode-based S-parameter extraction with optimal ABC scaling
|
|
199
|
+
MaxwellParams p;
|
|
200
|
+
p.omega = 2 * M_PI * freq;
|
|
201
|
+
p.port_abc_scale = 0.5; // Optimal scaling factor
|
|
202
|
+
Eigen::MatrixXcd S = calculate_sparams_eigenmode(mesh, p, bc, ports);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
The key insight: the optimal ABC coefficient is 0.5×jβ (not 1.0×jβ) due to the
|
|
206
|
+
diagonal approximation of the surface mass matrix in the FEM discretization.
|
|
207
|
+
|
|
208
|
+
**Guidelines for future port development**:
|
|
209
|
+
- Use `calculate_sparams_eigenmode()` for accurate S-parameters (>99% transmission accuracy)
|
|
210
|
+
- Set `MaxwellParams::port_abc_scale = 0.5` (optimal value from tuning study)
|
|
211
|
+
- Always verify port weight correlation with 3D FEM eigenvector: |<w, v>| should be > 0.9
|
|
212
|
+
- Check edge direction bias: for TE10, y-directed edges should dominate
|
|
213
|
+
- Test passivity: |S11|² + |S21|² ≤ 1.01
|
|
214
|
+
- Verify S21 phase matches analytical: phase(S21) = -β×L (within ~10° for typical meshes)
|
|
215
|
+
|
|
216
|
+
**Related test files**:
|
|
217
|
+
- `tests/test_eigenvector_waveport.cpp` — validates eigenvector-based approach
|
|
218
|
+
- `tests/debug_mode_alignment.cpp` — diagnoses weight/eigenvector correlation
|
|
219
|
+
- `tests/debug_3d_vs_2d_pattern.cpp` — compares edge direction distributions
|
|
220
|
+
|
|
221
|
+
### Mode Normalization for Unit Power Flow (Fixed Feb 2026)
|
|
222
|
+
|
|
223
|
+
**Problem**: TE10 mode amplitude was 87.5× too small due to missing factor in normalization formula.
|
|
224
|
+
|
|
225
|
+
**Root Cause**: Original formula `A² = 4·kc⁴/(ω·μ·β·π²·b)` was missing factor `a` (waveguide width).
|
|
226
|
+
|
|
227
|
+
**Fix**: Corrected to `A² = 4·kc⁴·a/(ω·μ·β·π²·b)` in `src/ports/wave_port.cpp`.
|
|
228
|
+
|
|
229
|
+
**Derivation**: For TE10 mode with Hz = A·cos(πx/a), unit power flow requires:
|
|
230
|
+
```
|
|
231
|
+
P = (1/2)·Re∫∫ E×H* · dS = 1
|
|
232
|
+
→ A² = 4·kc⁴·a / (ω·μ·β·π²·b)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Reference Documents
|
|
236
|
+
|
|
237
|
+
- `system_design_spec.md` — numerical methods, architecture decisions
|
|
238
|
+
- `project_plan.md` — sprint breakdown, acceptance criteria
|
|
239
|
+
- `AGENTS.md` — automation agent design, MCP wiring
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.20)
|
|
2
|
+
project(EdgeFEM VERSION 1.0.0 LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
7
|
+
|
|
8
|
+
enable_testing()
|
|
9
|
+
|
|
10
|
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
11
|
+
|
|
12
|
+
find_package(Eigen3 3.4 REQUIRED)
|
|
13
|
+
|
|
14
|
+
option(EDGEFEM_BUILD_SCALAR "Build scalar prototype" ON)
|
|
15
|
+
option(EDGEFEM_BUILD_VECTOR "Build vector Maxwell path" ON)
|
|
16
|
+
option(EDGEFEM_PYTHON "Build Python bindings" OFF)
|
|
17
|
+
|
|
18
|
+
# When building via scikit-build-core, SKBUILD is defined
|
|
19
|
+
if(SKBUILD)
|
|
20
|
+
set(EDGEFEM_PYTHON ON CACHE BOOL "" FORCE)
|
|
21
|
+
endif()
|
|
22
|
+
|
|
23
|
+
add_subdirectory(src)
|
|
24
|
+
add_subdirectory(tests)
|
|
25
|
+
if (EDGEFEM_PYTHON)
|
|
26
|
+
add_subdirectory(python)
|
|
27
|
+
endif()
|
|
28
|
+
|
|
29
|
+
if (EDGEFEM_BUILD_SCALAR)
|
|
30
|
+
add_test(NAME smoke_scalar_demo COMMAND edgefem_scalar_demo ${PROJECT_SOURCE_DIR}/examples/cube_cavity.msh 1)
|
|
31
|
+
set_tests_properties(smoke_scalar_demo PROPERTIES LABELS smoke)
|
|
32
|
+
endif()
|