Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Photonic System Laboratory | Seoul National University

Practice 6: Finite Element Method (FEM)

November 17, 2023

Kyoungsub Yoon
Strong form (2nd order differential equation)

Strong form is an original 2nd order differential equation to be solved; for example, assume the following
Poisson’s equation:

𝛻 ∙ −𝜖 𝐫 𝛻𝑉 𝐫 =𝜌 𝐫 , 𝐫∈Ω
Boundary
where 𝑉 is electric potential, 𝐃 = −𝜖 𝐫 𝛻𝑉 𝐫 is electric flux density, and 𝜌 is source. 𝜕Ω

Boundary conditions at 𝜕Ω are given as


Domain
𝑉 = 𝑉0 𝑫𝒊𝒓𝒊𝒄𝒉𝒍𝒆𝒕 𝑩𝑪
Ω
𝐃 ∙ 𝐧 = 𝐷0 𝑵𝒆𝒖𝒎𝒂𝒏𝒏 𝑩𝑪

For the unique solution, BC should be given as

𝑫𝒊𝒓𝒊𝒄𝒉𝒍𝒆𝒕 𝑩𝑪 𝒐𝒓 𝑴𝒊𝒙𝒆𝒅 𝑩𝑪 𝑫𝒊𝒓𝒊𝒄𝒉𝒍𝒆𝒕 𝑩𝑪 + 𝑵𝒆𝒖𝒎𝒂𝒏𝒏 𝑩𝑪


Weak form (1st order differential equation)

Weak form is the integral equation with a test function 𝑈 𝐫 . For an arbitrary function 𝑉 defined in Ω.

𝑈 𝐫 𝛻 ∙ −𝜖 𝐫 𝛻𝑉 𝐫 =𝑈 𝐫 𝜌 𝐫 , 𝐫∈Ω

Boundary
→ න 𝑈𝛻 ∙ −𝜖𝛻𝑉 = න 𝑈𝜌 𝜕Ω
Ω Ω

Using the product rule:


𝑈𝛻 ∙ −𝜖𝛻𝑉 = 𝜖𝛻𝑈 ∙ 𝛻𝑉 + 𝛻 ∙ −𝑈𝜖𝛻𝑉 Domain
Ω
and by the divergence theorem,

න 𝜖𝛻𝑈 ∙ 𝛻𝑉 + ර −𝑈𝜖𝛻𝑉 ∙ 𝐧 = න 𝑈𝜌
Ω 𝜕Ω Ω

Then, the boundary conditions are involved in this step. For example, if the domain is electrically insulated
from the environment, normal electric flux at the boundary should be zero: −𝑈𝜖𝛻𝑉 ∙ 𝐧 = 0,

∴ න 𝜖𝛻𝑈 ∙ 𝛻𝑉 = න 𝑈𝜌
Ω Ω
Weak form (1st order differential equation)

Summary:

from stric constraints 𝑠𝑡𝑟𝑜𝑛𝑔 𝑓𝑜𝑟𝑚, 𝑠𝑒𝑐𝑜𝑛𝑑 𝑜𝑟𝑑𝑒𝑟 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑡𝑖𝑎𝑡𝑖𝑜𝑛

to weak constraints 𝑤𝑒𝑎𝑘 𝑓𝑜𝑟𝑚, 𝑓𝑖𝑟𝑠𝑡 𝑜𝑟𝑑𝑒𝑟 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑡𝑖𝑎𝑡𝑖𝑜𝑛


FEM example (1) problem
Let’s consider an example of 1D Laplace’s equation without electric source. Specifically, we are interested in the
potential, 𝑉, as a function of the position 𝑥 in the domain defined by the interval 1 ≤ 𝑥 ≤ 4. For simplicity, we assume
the electric permittivity is unity. Then,
Boundary
2
𝑺𝒕𝒓𝒐𝒏 𝒇𝒐𝒓𝒎 ∶ 𝜕𝑥 𝑉 𝑥 = 0, 1≤𝑥≤4 𝜕Ω
4
𝑰𝒏𝒕𝒆𝒈𝒓𝒂𝒍 𝒇𝒐𝒓𝒎 ∶ න 𝜕𝑥2 𝑉𝑑𝑥 = 0
1

The weak form equation asks that the average value of 𝜕𝑥2 𝑉 in the entire domain is zero. 1≤𝑥≤4
It seems too “weak” as compared to the original differential equation, strong form, which Domain
asks that 𝜕𝑥2 𝑉 should be zero everywhere in the defined domain. Ω

To improve upon it, we can ask instead that the average value of 𝜕𝑥2 𝑉 in a very narrow domain is zero, say,

1.01 1.02
න 𝜕𝑥2 𝑉𝑑𝑥 = 0, න 𝜕𝑥2 𝑉𝑑𝑥 = 0, …
1 1.01

Of course, the higher the number of integral equations in the set, the better the approximation. (fine discretization)
FEM example (2) convert to weak form with boundary condition
4 1.01 1.02
𝑰𝒏𝒕𝒆𝒈𝒓𝒂𝒍 𝒇𝒐𝒓𝒎 ∶ න 𝜕𝑥2 𝑉𝑑𝑥 = 0 → න 𝜕𝑥2 𝑉𝑑𝑥 = 0, න 𝜕𝑥2 𝑉𝑑𝑥 = 0, …
1 1 1.01

The main idea is to sample the value of 𝑉 in a narrow range.


4
𝑾𝒆𝒂𝒌 𝒇𝒐𝒓𝒎 ∶ න 𝑈𝜕𝑥2 𝑉𝑑𝑥 = 0, 𝑈: 𝑡𝑒𝑠𝑡 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛
1
4 4 4
→ 𝑈𝜕𝑥 𝑉 ቚ − න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 = 𝑈4 𝑉4′ − 𝑈1 𝑉1′ − න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 = 0
1 1 1

Compare

4
න 𝜖𝛻𝑈 ∙ 𝛻𝑉 = ර 𝑈𝜖𝛻𝑉 ∙ 𝐧 න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 = 𝑈4 𝑉4′ − 𝑈1 𝑉1′
Ω 𝜕Ω 1

Suppose the boundary conditions are given as

𝑉 = 2 𝑎𝑡 𝑥 = 1
ቊ 𝐷𝑖𝑟𝑖𝑐ℎ𝑙𝑒𝑡 𝑏𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝑐𝑜𝑛𝑑𝑡𝑖𝑜𝑛
𝑉 = 8 𝑎𝑡 𝑥 = 4
FEM example (3) basis function
4
න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 = 𝑈4 𝑉4′ − 𝑈1 𝑉1′
1

To solve the above equation numerically, we first divide the domain 1 ≤ 𝑥 ≤ 4 into three evenly spaced sub-intervals,
or discretized elements, bound by four nodal points 𝑥 = 1,2,3,4.
Then, we can define a set of basis functions, or shape functions, 𝜓1 , 𝜓2 , 𝜓3 , 𝜓4, as shown in the graph below.

2 − 𝑥 𝑓𝑜𝑟 1 ≤ 𝑥 ≤ 2,
𝜓1 = ቊ
𝜓1 𝜓2 𝜓3 𝜓4 0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
1
𝑥 − 1 𝑓𝑜𝑟 1 ≤ 𝑥 ≤ 2,
𝜓2 = ቐ3 − 𝑥 𝑓𝑜𝑟 2 < 𝑥 ≤ 3,
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
0 𝑥
1 2 3 4 …
FEM example (3) basis function
4
න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 = 𝑈4 𝑉4′ − 𝑈1 𝑉1′
1

𝑉 = 2 𝑎𝑡 𝑥 = 1
ቊ 𝐷𝑖𝑟𝑖𝑐ℎ𝑙𝑒𝑡 𝑏𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝑐𝑜𝑛𝑑𝑡𝑖𝑜𝑛
𝑉 = 8 𝑎𝑡 𝑥 = 4

Now, with this set of basis functions, potential 𝑉 is approximated to

𝑉 𝑥 ≈ σ 𝑐𝑖 𝜓𝑖 𝑥
Then,
4 4 4 4 4
න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 ≈ 𝑐1 න 𝜕𝑥 𝑈𝜕𝑥 𝜓1 𝑑𝑥 + 𝑐2 න 𝜕𝑥 𝑈𝜕𝑥 𝜓2 𝑑𝑥 + 𝑐3 න 𝜕𝑥 𝑈𝜕𝑥 𝜓3 𝑑𝑥 + 𝑐4 න 𝜕𝑥 𝑈𝜕𝑥 𝜓4 𝑑𝑥
1 1 1 1 1

with four unknowns, 𝑐1 ~𝑐4 . 𝜓1 𝜓2 𝜓3 𝜓4


1

0 𝑥
1 2 3 4
FEM example (4) role of test function : Galerkin method
4 4 4 4 4
න 𝜕𝑥 𝑈𝜕𝑥 𝑉𝑑𝑥 ≈ 𝑐1 න 𝜕𝑥 𝑈𝜕𝑥 𝜓1 𝑑𝑥 + 𝑐2 න 𝜕𝑥 𝑈𝜕𝑥 𝜓2 𝑑𝑥 + 𝑐3 න 𝜕𝑥 𝑈𝜕𝑥 𝜓3 𝑑𝑥 + 𝑐4 න 𝜕𝑥 𝑈𝜕𝑥 𝜓4 𝑑𝑥
1 1 1 1 1

To solve for the four unknowns 𝑐𝑖 , we need four equations.


Just substitute basis functions into the test function 𝑈 to obtain the four equations we need.
4 4 4 4 4
න 𝜕𝑥 𝜓1 𝜕𝑥 𝑉𝑑𝑥 ≈ 𝑐1 න 𝜕𝑥 𝜓1 𝜕𝑥 𝜓1 𝑑𝑥 + 𝑐2 න 𝜕𝑥 𝜓1 𝜕𝑥 𝜓2 𝑑𝑥 + 𝑐3 න 𝜕𝑥 𝜓1 𝜕𝑥 𝜓3 𝑑𝑥 + 𝑐4 න 𝜕𝑥 𝜓1 𝜕𝑥 𝜓4 𝑑𝑥 = 𝜓1 𝑥 = 4 𝑉4′ − 𝜓1 𝑥 = 1 𝑉1′
1 1 1 1 1
→ 𝑐1 − 𝑐2 + 0𝑐3 + 0𝑐4 = −𝑉1′
4 4 4 4 4
න 𝜕𝑥 𝜓2 𝜕𝑥 𝑉𝑑𝑥 ≈ 𝑐1 න 𝜕𝑥 𝜓2 𝜕𝑥 𝜓1 𝑑𝑥 + 𝑐2 න 𝜕𝑥 𝜓2 𝜕𝑥 𝜓2 𝑑𝑥 + 𝑐3 න 𝜕𝑥 𝜓2 𝜕𝑥 𝜓3 𝑑𝑥 + 𝑐4 න 𝜕𝑥 𝜓2 𝜕𝑥 𝜓4 𝑑𝑥 = 𝜓2 𝑥 = 4 𝑉4′ − 𝜓2 𝑥 = 1 𝑉1′
1 1 1 1 1
→ −𝑐1 + 2𝑐2 − 𝑐3 + 0𝑐4 = 0
FEM example (4) role of test function : Galerkin method

𝑐1 − 𝑐2 = −𝑉1′
−𝑐1 + 2𝑐2 − 𝑐3 = 0 𝑐1 = 2
, ቊ 𝐷𝑖𝑟𝑖𝑐ℎ𝑙𝑒𝑡 𝐵𝐶
−𝑐2 + 2𝑐3 − 𝑐4 = 0 𝑐4 = 8
−𝑐3 + 𝑐4 = 𝑉4′

𝑐1
−𝑐 + 2𝑐2 − 𝑐3 = 0 𝑐2 −2 1 𝑐2 −𝑐1
→ቊ 1 → −1 2 −1 𝑐3 =0→ 𝑐3 = −𝑐4
−𝑐2 + 2𝑐3 − 𝑐4 = 0 −1 2 −1 1 −2
𝑐4

6
𝜓1 𝜓2 𝜓3 𝜓4
1
𝑉 𝑥 ≈ ෍ 𝑐𝑖 𝜓𝑖 𝑥 4

2
0 𝑥
1 2 3 4
1 2 3 4
FEM example (5) Jacobi method
review (Practice #2) :
𝐴𝐱 = 𝐷𝐱 + 𝑅𝐱 = 𝐛
→ 𝐷𝐱 = 𝐛 − 𝑅𝐱
→ 𝐱 = 𝐷−1 𝐛 − 𝑅𝐱 = −𝐷 −1 𝑅𝐱 + 𝐷−1 𝐛 = 𝐻𝐱 + 𝐝
→ 𝐱 = 𝐻𝐱 + 𝐝

4
න 𝜕𝑥2 𝑉𝑑𝑥 = 0
1

𝑉 = 2 𝑎𝑡 𝑥 = 1
ቊ 𝐷𝑖𝑟𝑖𝑐ℎ𝑙𝑒𝑡 𝑏𝑜𝑢𝑛𝑑𝑎𝑟𝑦 𝑐𝑜𝑛𝑑𝑡𝑖𝑜𝑛
𝑉 = 8 𝑎𝑡 𝑥 = 4

𝑐1
−1 2 −1 𝑐2 −2 1 𝑐2 −𝑐1
𝑐3 =0→ 𝑐3 = −𝑐4
−1 2 −1 1 −2
𝑐4
FEM example (6) basis functions

𝐿𝑖𝑛𝑒𝑎𝑟 𝑏𝑎𝑠𝑖𝑠 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛𝑠 𝑄𝑢𝑎𝑑𝑟𝑢𝑡𝑖𝑐 𝑏𝑎𝑠𝑖𝑠 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛𝑠

1. Linear basis functions can be utilized due to the conversion from second order derivative to weak form of first
derivative.

2. cost : 𝐿𝑖𝑛𝑒𝑎𝑟 > 𝑄𝑢𝑎𝑑𝑟𝑢𝑡𝑖𝑐


FEM example (7) mesh

2𝐷: 𝑡𝑟𝑖𝑎𝑛𝑔𝑢𝑙𝑎𝑟 3𝐷: 𝑡𝑒𝑡𝑟𝑎ℎ𝑒𝑑𝑟𝑎𝑙


FEMM, magnetostatic simulation

1. Download free software FEMM


https://www.femm.info/wiki/Download

2. Install FEMM

3. Start FEMM

4. File-New (Ctrl+N) and select Magnetics Problem


FEMM Window

Modeling Solving

Scaling
(Zoom in/out)

Moving

Dot on a grid
Modeling (1)
1 2 3 4

1. Dot a point

Left click to dot on a screen, or press Tab key to enter coordinates.

2. Draw a line

Left click starting and ending point in order.

3. Draw an arc

Same as 2 except a process to determine an angle

4. Draw a material point

Same as 1 but by using this point, you can define material property of the inner closed region in
which material point is included.
Modeling (2)
1 2 3 4

For all these operations:

- if you want to select what you drew, click proper menu and right click the object (e.g. choose
menu 3 and right click on the arc). It is possible to select multiple element.

- if you want to delete what you drew, right click and press delete key

- if you want to modify what you drew, right click and press space key
Modeling (3)

Step 1 : Dot four points (3,3) (3,4) (5,3) and (5,4) using tab key
Step 2 : Draw line segments

Step 3 : Draw material points by clicking any points inside and outside of the
rectangle
Select material (1)
Add materials to the geometry:

1. Properties – Materials Library

2. Drag and drop below materials from Library Materials to Model Materials

Path
- Air
- Steel: Soft magnetic materials/Silicon Iron/M-19
- Magnet: Hard MAGNETIC MATERIALS/Bonded
NdFeB magnets/Legacy Bonded NdFeB/NdFeB 10
MGOe (Bonded)
Select material (2)

Step 1 : Right click the material points and press space key
Step 2 : Assign the proper materials as the figure

red arrow : S → N
Boundary condition

Set radius and center point


this boundary condition assumes that the unbounded
space is grounded at infinity(zero value at infinity)
Solve the equation
1. File-Save

2. Click 1, 2, 3
1 23
3. See result
Practice
1. Contour plot: shows flux line
1 23
2. Density plot: shows flux density

3. Vector plot: shows vector field


Assignment
1. Derive the weak form of magnetostatic equation for magnetic vector potential 𝐀, given permeability 𝜇 𝐫 and current
density source 𝐉 𝐫 .
𝛻×𝐀
𝛻× =𝐉
𝜇
Use ‘vector’ test function, 𝑼, during the process.

2. Plot the magnetic flux line of the following geometry

You might also like