SPDFEM

View the Project on GitHub shmouses/SPDFEM

SPDFEM: Simulation of Photonic Devices using Finite Element Method

License: MIT Python 3.7+ FEniCS

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.

๐Ÿš€ Features

๐Ÿ“‹ Prerequisites

๐Ÿ”ง Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/SPDFEM.git
    cd SPDFEM
    
  2. Install required dependencies:
    pip install -r requirements.txt
    

๐ŸŽฏ Quick Start

  1. Navigate to the src directory:
    cd src
    
  2. Run the main simulation:
    python main.py
    
  3. 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)
  4. Results will be saved in the FEM Output directory as .pvd and .vtk files.

๐Ÿ“š Documentation

๐Ÿงช Testing

Run the test suite using pytest:

pytest src/test_*.py

Key test files:

๐Ÿ“ Project Structure

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

๐Ÿค Contributing

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.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ง Contact

For questions, issues, or collaboration opportunities, please open an issue or contact the repository maintainers.


Happy simulating with SPDFEM! ๐ŸŒŸ