Skip to content

Add example for mixed Dirichlet–Neumann boundary conditions (2D Poisson equation) #3972

@akarve1507

Description

@akarve1507

Describe new/missing feature

I would like to contribute a tutorial demonstrating mixed boundary conditions (Dirichlet + Neumann) for the 2D Poisson equation in DOLFINx using Python.

The example will show how to:

  • Apply Dirichlet and Neumann boundary conditions on different boundaries of the same domain
  • Formulate the weak form including both terms
  • Visualize the computed solution using PyVista

Mathematical Problem Setup

−∇²u = f in Ω = [0,1] × [0,1]

u = 0 on Γ_D : y = 0 (Dirichlet BC)
∂u/∂n = 1 on Γ_N : y = 1 (Neumann BC)
∂u/∂n = 0 on Γ_nat : x = 0,1 (Natural no-flux BC)

f = 1

Environment
I am working on macOS Sonoma 14.x using Python 3.11 installed through conda-forge.
DOLFINx is installed via the fenics-dolfinx package, along with dependencies including pyvista, mpi4py, and petsc4py.
The environment is set up using a Conda environment on an Apple M-series (ARM64) machine, and visualization is handled locally through PyVista.

I searched existing issues and did not find any example or discussion related to mixed Dirichlet–Neumann boundary condition tutorials in DOLFINx.

Suggested user interface

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions