Skip to content

SPDFEM (Simulation of Photonic Devices using Finite Element Method) is a Python-based framework for simulating electromagnetic wave propagation in photonic devices. Built on FEniCS, it offers finite element analysis capabilities, support for complex geometries, and visualization tools.

Notifications You must be signed in to change notification settings

shmouses/SPDFEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  • 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

📋 Prerequisites

  • Linux Operating System
  • Python 3.7 or higher
  • FEniCS 2019.1.0
  • Additional Python packages:
    matplotlib
    numpy
    scipy
    pytest (for running tests)
    

🔧 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:

  • test_constparam.py: Validates constant parameters
  • test_inputparam.py: Tests input parameter handling
  • test_visual_ls.py: Verifies visualization functions
  • test_meshinput.py: Ensures proper mesh handling

📁 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! 🌟

About

SPDFEM (Simulation of Photonic Devices using Finite Element Method) is a Python-based framework for simulating electromagnetic wave propagation in photonic devices. Built on FEniCS, it offers finite element analysis capabilities, support for complex geometries, and visualization tools.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •