Skip to content

matteo-cadoni/PoissonFEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finite Element Method for Poisson Problems

A Python implementation of the Finite Element Method (FEM) to solve the 2D Poisson equation, based on the Bachelor Thesis.


📌 Overview

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.


🧠 Problem

Solve the Poisson equation:

-Δu = f  in Ω

with mixed boundary conditions:

  • Dirichlet: u = g_D
  • Neumann: ∇u · n = g_N

⚙️ Installation (Poetry)

poetry install
poetry shell

▶️ Usage

Run an example:

poetry run python room_temperature.py

or

poetry run python electric_field_ion_channels.py

🧩 Project Structure

  • assemble_system.py — global FEM assembly
  • auxiliary_assemblage_functions.py — element matrices & integration
  • cg.py — Conjugate Gradient solver
  • cholprec.py — incomplete Cholesky preconditioner
  • preprocessing.py — mesh handling
  • postprocessing.py — visualization

🌡 Example: Room Temperature Simulation

Room temperature FEM Domain

Room temperature FEM result

Simulates heat diffusion with:

  • internal heat source
  • fixed boundary temperature
  • realistic domain geometry

🔧 Features

  • Multiple element orders (P1, P2, P3)
  • Sparse matrix assembly
  • Krylov solver (CG)
  • Preconditioning support
  • Gaussian quadrature integration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages