# NGS-Py Finite Element Tool¶

Netgen/NGSolve 6 contains a rich Python interface. Program flow as well as geometry description and equation setup can be controlled from Python. You should be familiar with weak formulations of partial differential equations and the finite element method (NGSolve-oriented lecture notes are here: Scientific Computing) and the Python programming language. The interface to Python is inspired by the FEniCS project.

We acknowledge support from the TU Wien and by the Austrian Science Foundation FWF within project grant SFB65 Taming Complexity in Partial Differential Systems.

Tutorial on Using NGSpy by Jay Gopalakrishnan

- Interactive NGSolve Tutorial
- Whetting the Appetite
- 1. Getting started
- 2. Advanced Topics
- 2.1.1 Preconditioners in NGSolve
- 2.1.2 Building blocks for programming preconditioners
- 2.1.3 Multigrid and Multilevel Methods
- 2.1.4 Element-wise BDDC Preconditioner
- 2.2 Programming an eigenvalue solver
- 2.3
*H(curl)*and*H(div)*function spaces - 2.4 Maxwell’s Equations
- 2.4.1 Maxwell eigenvalue problem
- 2.5 Mixed formulation for second order equations
- 2.6 Stokes equation
- 2.7 Facet spaces and hybrid methods
- 2.8 Discontinuous Galerkin Methods
- 2.9 Fourth order equations
- 2.10 Dual basis functions
- 2.11 Matrix free operator application
- 2.12 Periodic Spaces
- Eigenvalue problem for phase shift
- 2.13 Interface resisitivity
- 2.14 Coupling of FEM with plane waves

- 3. Time-dependent and non-linear problems
- 3.1 Parabolic model problem
- 3.2 Incompressible Navier-Stokes equations
- 3.3 Nonlinear problems
- 3.4 Nonlinear minimization problems
- 3.5.1 Operator applications for Discontinuous Galerkin discretizations - linear transport
- 3.5.2 DG for the acoustic wave equation
- 3.6 Scalar PDE on surfaces (with HDG)
- 3.7 DG/HDG splitting
- 3.8 A Nonlinear conservation law: shallow water equation in 2D

- 4. Geometric modeling and mesh generation
- 5. MPI - Parallelization and CUDA Support
- 5.1 Poisson Equation in Parallel
- 5.2 Parallel dofs and Vector-types
- 5.3.1 Using PETSc
- 5.3.2 NGSolve - PETSc interface
- 5.5.1 Solving the Poisson Equation on devices
- 5.5.2 Discontinuous Galerkin for the Wave Equation
- 5.5.3 Euler equations
- 5.5.1 MPI-Parallelization with NGSolve
- 5.5.2 Basics of MPI-parallel NGSolve
- 5.6.1 FETI-DP in NGSolve I: Working with Point-Constraints
- 5.6.2 FETI-DP in NGSolve II: Point-Constraints in 3D
- 5.6.3 FETI-DP in NGSolve III: Using Non-Point Constraints

- 6. Various Topics
- 7. Shape- and Topology Optimization
- 7.1 Shape optimization via the shape derivative
- 7.2 PDE-Constrained Shape Optimization
- 7.3 PDE-Constrained Shape Optimization (semi-automated)
- 7.5 PDE-Constrained Shape Optimization (fully automated)
- 7.6 Topology Optimization based on the Topological Derivative
- 7.7 PDE-Constrained Topology Optimization

- 8. Unfitted Finite Elements
- 8.1 Fundamental concepts of
`ngsxfem`

- 8.2 Integration on level set domains
- 8.3 Unfitted FEM discretizations
- 8.4 Space-time discretizations on fitted geometry
- 8.5 Space-time discretizations on unfitted geometries
- 8.6 Integration over domains described by multiple level sets
- 8.7 Unfitted FEM for domains described by multiple level sets
- 8.8 Cell and basis aggregation in
`ngsxfem`

- 8.9 Unfitted Mixed FEM (using
`HDiv`

FE spaces)

- 8.1 Fundamental concepts of
- 9. Extending by C++ programming
- 10. NGSolve and ...
- Appendix

- Working with CoefficientFunctions
- Setting inhomogeneous Dirichlet boundary conditions
- Define and update preconditioners
- The Trace() operator
- Vectors and matrices
- Static condensation of internal bubbles
- Discontinuous Galerkin methods
- Parallel computing with NGS-Py
- Interfacing to numpy/scipy
- Periodicity
- Symbolic Integrators
- Spaces and forms on sub-domains
- Perfectly Matched Layers

# MyLittleNGSolve - An Introduction into C++ Programming with NGSolve¶

This project is divided into 3 sections:

The basic section should provide you with knowledge about NGSolve's classes and how to overload them or provide C++ utility functions, as well as export all that to python.

The advanced section gives some more useful examples to browse through.

The legacy section contains old code, it may be useful mainly for people working already for some time with NGSolve and looking something up. Please keep in mind, that these things are not maintained and may contain code that does not work (efficiently) any more.