A Python implementation of the Finite Element Method (FEM) to solve the 2D Poisson equation, based on the Bachelor Thesis.
This project provides a full FEM pipeline:
- Triangular mesh generation
- Assembly of stiffness matrix & load vector
- Dirichlet and Neumann boundary conditions
- Solution via Conjugate Gradient (CG)
- Optional Incomplete Cholesky preconditioning
- Visualization of the solution
Supports linear, quadratic, and cubic elements.
Solve the Poisson equation:
-Δu = f in Ω
with mixed boundary conditions:
- Dirichlet:
u = g_D - Neumann:
∇u · n = g_N
poetry install
poetry shellRun an example:
poetry run python room_temperature.pyor
poetry run python electric_field_ion_channels.pyassemble_system.py— global FEM assemblyauxiliary_assemblage_functions.py— element matrices & integrationcg.py— Conjugate Gradient solvercholprec.py— incomplete Cholesky preconditionerpreprocessing.py— mesh handlingpostprocessing.py— visualization
Simulates heat diffusion with:
- internal heat source
- fixed boundary temperature
- realistic domain geometry
- Multiple element orders (P1, P2, P3)
- Sparse matrix assembly
- Krylov solver (CG)
- Preconditioning support
- Gaussian quadrature integration

