tutorials:basics

2. The Basics#

We learn the basic concepts to program in NGSolve, we start with an easy example and we explore the single steps to solve a PDE problem. Then we apply the same steps and concepts to a more complex problem.

basic topics

2.1. Finite Element Method in a Nutshell#

Problem: (Strong)
Let Ω be a domain in Rn .

Find u such that

Δu=fin Ω,u=uDon ΓD,nu=gon ΓN,

With ΓDΓN=Ω

Multiply the equation by a test function v and integrate by parts we get the weak formulation:

Problem: (Weak)
Find uH1(Ω) such that u=uD on ΓD and

Ωuvdx=ΩfvdxΓNgvdsvHΓD1(Ω),

Let T ba a triangulation of the space Ω the discrete weak formulation is given by:

Problem: (Discrete-Weak)
Find uhVh such that uh=uD on ΓD and

Ωuhvhdx=ΩfvhdxΓNgvhdsvhVh,ΓD(T),

Applying the Galerkin method: Suppose that on the triangulation T we the finite dimensional function space Vh(T) has a basis {ϕi}i=1N, and let

vh=i=1Nviϕianduh=j=1Nujϕj

Then, by substituting vh and uh in the discrete weak formulation we obtain the following linear system:

i,jviujΩϕjϕidxAij=ivi(ΩfϕidxΓNgϕids)fi

Then the problem reduces to solve the linear system Au=f.