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.
- Full electromagnetic field simulation using FEM
- Support for complex geometries and material properties
- Built-in mesh generation and handling
- Visualization tools for field distributions
- Comprehensive validation and verification framework
- Easy-to-use interface for defining simulation parameters
- Extensive documentation and tutorials
- Linux Operating System
- Python 3.7 or higher
- FEniCS 2019.1.0
- Additional Python packages:
matplotlib numpy scipy pytest (for running tests)
-
Clone the repository:
git clone https://github.com/yourusername/SPDFEM.git cd SPDFEM
-
Install required dependencies:
pip install -r requirements.txt
-
Navigate to the
src
directory:cd src
-
Run the main simulation:
python main.py
-
Follow the interactive prompts to:
- Specify input file path (e.g.,
Input/Input_t1.txt
) - Provide mesh file path (e.g.,
Mesh/G_fill_t1.xml
) - Define physical regions file (e.g.,
Mesh/G_fill_pr_t1.xml
) - Set facet regions file (e.g.,
Mesh/G_fill_fc_t1.xml
)
- Specify input file path (e.g.,
-
Results will be saved in the
FEM Output
directory as.pvd
and.vtk
files.
- Problem Statement - Detailed explanation of the physical problem
- System Requirements Specification - Technical requirements and theoretical background
- Validation & Verification Plan - Testing methodology
- V&V Report - Validation results and analysis
- Design Documentation - Software architecture and modular design
- Tutorial Notebook - Step-by-step guide for beginners
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 handling
SPDFEM/
├── 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! 🌟