SPDFEM is a powerful Python package for simulating and analyzing photonic devices using the Finite Element Method. It provides a robust framework for modeling electromagnetic wave propagation, light-matter interactions, and optical phenomena in complex photonic structures.
matplotlib
numpy
scipy
pytest (for running tests)
git clone https://github.com/yourusername/SPDFEM.git
cd SPDFEM
pip install -r requirements.txt
src
directory:
cd src
python main.py
Input/Input_t1.txt
)Mesh/G_fill_t1.xml
)Mesh/G_fill_pr_t1.xml
)Mesh/G_fill_fc_t1.xml
)FEM Output
directory as .pvd
and .vtk
files.Run the test suite using pytest:
pytest src/test_*.py
Key test files:
test_constparam.py
: Validates constant parameterstest_inputparam.py
: Tests input parameter handlingtest_visual_ls.py
: Verifies visualization functionstest_meshinput.py
: Ensures proper mesh handlingSPDFEM/
โโโ src/ # Source code
โ โโโ main.py # Main simulation entry point
โ โโโ fem_solver.py # FEM implementation
โ โโโ inputparam.py # Parameter handling
โ โโโ ...
โโโ docs/ # Documentation
โโโ Mesh/ # Example mesh files
โโโ Input/ # Input configuration files
โโโ FEM Output/ # Simulation results
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions, issues, or collaboration opportunities, please open an issue or contact the repository maintainers.
Happy simulating with SPDFEM! ๐