FENicSEigenProblem
is a Python class that solves eigenvalue problems for electromagnetic systems using the finite element method (FEM) with the FEniCS library. It is designed for solving problems such as the Maxwell equations:
with Dirichlet boundary conditions:
Currently this code only runs for a cube and dirichlet BCs but can be extended.
Note you should install Docker Destop and in VSCODE install the docker extension
To run this code use the main.py file and change the parameters are your leisure. The eigenvalues are saved in a pickle file in the folder 'data' locally.
Alternatively, use the following:
./run.sh build
If you want to then run it only in the terminal use
./run.sh run
If you are using VS Code, you could alternatively open the devcontainer.json
by using Remote: Reopen in Container
.
- Finite Element Mesh Generation: Supports different domain types, such as
cube
andrectangle
. - Eigenvalue Problem Solver: Uses SLEPc (a suite for solving eigenvalue problems) to compute eigenvalues of the system.
- Boundary Conditions: Implements Dirichlet boundary conditions.
- Test Problem Mode: Supports predefined test problems for debugging and testing purposes.
- Flexible Mesh Resolution: Allows users to specify the number of nodes in the mesh and domain size.
These are provided in the requirements.txt (except for fenicsx) on the linux subsystem. (mamba create -n <env_name> --file requirements.txt)
- Python 3.9 (testing 3.12)
- FEniCS: For the finite element method (FEM) solver. See here for installation instructions (recommend using mamba for speed).
- SLEPc: For solving eigenvalue problems.
- PETSc: A toolkit for efficient numerical computation, used by FEniCS for matrix operations.
- pyvista (Optional): For visualizing the solution.
- mpi4py: For parallel computing support.
We can introduce new domains, and boundary conditions.
https://docs.fenicsproject.org/dolfinx/main/python/demos/demo_half_loaded_waveguide.html
https://bleyerj.github.io/comet-fenicsx/intro/hyperelasticity/hyperelasticity.html
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
You are free to share and adapt the material, provided you give appropriate credit and do not use it for commercial purposes.