Programming electrostatic and magnetostatic

2 downloads 0 Views 824KB Size Report
The main task of the project is to examine the Maxwell equations, considering a magnetostatic and an electrostatic case. The maxwell equations have to be ...
Programming electrostatic and magnetostatic properties in Finite Element Method using MATLAB

by R´emi Kahwaji Universit¨at Kassel Fachgebiet Baumechanik/Baudynamik Supervisors: Prof. Dr.-Ing. habil. Detlef Kuhl, Dipl.-Ing. Tobias Gleim M.Sc, Dipl.-Ing. Bettina Schr¨oder 2012

TABLE OF CONTENTS

CHAPTER I. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 1.2

1

Problem statement . . . . . . . . . . . . . . . . . . . . . . . . Notations and conventions . . . . . . . . . . . . . . . . . . . .

1 2

II. Numerical modeling of the problem . . . . . . . . . . . . . . . .

3

2.1 2.2 2.3

Setting up the shape functions . . . . . . . . . . . . . . . . . Gaussian integration, a short definition . . . . . . . . . . . . Computing the gradient of N for a general node . . . . . . .

3 4 5

III. Electrostatic equations . . . . . . . . . . . . . . . . . . . . . . . .

9

3.1 3.2

Differential and weak form . . . . . . . . . . . . . . . . . . . Numerical approximation of the electrostatic equation . . . .

9 11

IV. Magnetostatic equations . . . . . . . . . . . . . . . . . . . . . . .

15

4.1 4.2

Differential and weak form . . . . . . . . . . . . . . . . . . . Numerical approximation of the magnetostatic equation . . .

15 17

V. Results and conclusion . . . . . . . . . . . . . . . . . . . . . . . .

21

2

CHAPTER I

Introduction

1.1

Problem statement

The main task of the project is to examine the Maxwell equations, considering a magnetostatic and an electrostatic case. The maxwell equations have to be reduced properly in order to obtain the weak form as well as a spatial discretization using the finite element method. The three dimensional problem for the electrostatic and the magnetostatic case will then be programmed in MATLAB, for 27 cubic elements accounting for a computation in 64 nodes: see figure 1.1.

Figure 1.1: Sketch of the 27 cubic elements and 64 nodes considered

1

1.2

Notations and conventions

We start by grouping the physical terms in the table below. Some of theses terms will appear in the Maxwell equations in chapters 2 and 4:

Symbol

Bezeichnung

µ

permeability of material

σ

electrical conductivity (inverse of resistivity)



permittivity of the material

a

magnetic vector potential

j

total current density

jL

free current density

jV

bound current density

b

magnetic vector field

d

electric flux density

e

electric field intensity

q

free charge density

h

magnetic field intensity Here are the conventions followed for vectors and matrices:

Lower case letters are used for scalars: a Bold lower case letters are used for vectors: a Bold upper case letters are used for matrices: A In this report, single characters in between square brackets represent ”‘sub-matrices”’ inside a larger matrix: [N ] Scalar components of vectors are represented in lower case letters with an index: ai Scalar components of matrices are represented in upper case letters with an index: Aij .

2

CHAPTER II

Numerical modeling of the problem

2.1

Setting up the shape functions

The essence of the finite element method is to approximate the unknown by an expression given as: u'

n X

N i ui

(2.1)

i=1

where Ni are the interpolating shape functions prescribed in terms of linear independent functions. We start by setting the 3D shape functions used in our matlab code: N 1 (ξ) = (1/8)(1 − ξ1 )(1 − ξ2 )(1 − ξ3 ) N 2 (ξ) = (1/8)(1 + ξ1 )(1 − ξ2 )(1 − ξ3 ) N 3 (ξ) = (1/8)(1 + ξ1 )(1 + ξ2 )(1 − ξ3 ) N 4 (ξ) = (1/8)(1 − ξ1 )(1 + ξ2 )(1 − ξ3 ) N 5 (ξ) = (1/8)(1 − ξ1 )(1 − ξ2 )(1 + ξ3 ) N 6 (ξ) = (1/8)(1 + ξ1 )(1 − ξ2 )(1 + ξ3 ) N 7 (ξ) = (1/8)(1 + ξ1 )(1 + ξ2 )(1 + ξ3 ) N 8 (ξ) = (1/8)(1 − ξ1 )(1 + ξ2 )(1 + ξ3 )

It is clear that a constant value of ui specified at all nodes must result in a constant

3

Table 2.1: low-order rules for solving the integration problem Number of points, n Points xi Weights wi 1 0√ 2 2 ±1/ 3 1 3 8/9 p0 ± 3/5 5/9 √ q p 18 + 30 4 ± (3 − 2 6/5)/7 36√ q p 18 − 30 ± (3 + 2 6/5)/7 36 5 0 128/225 √ q p 1 322 + 13 70 ± 5 − 2 10/7 3q 900 √ p 322 − 13 70 1 ± 5 + 2 10/7 3 900 value of u which immediately implies that: n X

Ni = 1

(2.2)

i=1

Let us then define Gaussian integration.

2.2

Gaussian integration, a short definition

In numerical analysis,we can approximate the definite integral of a function, as the weighted sum of function values at specified points within the domain of integration: Z1

Z1 W (x) g(x) dx '

f (x) dx = −1

n X

wi f (xi )

(2.3)

i=1

−1

where f (xi ) is the polynomial approximation of f at point xi and wi the weight of f at this point. Some low-order rules for solving the integration problem are listed in table 2.1.

4

2.3

Computing the gradient of N for a general node

Let N be the shape function for any node. We need to compute:     ∇N =   

∂N ∂X1 ∂N ∂X2 ∂N ∂X3

      

(2.4)

Knowing the values of N i in terms of ξ1 , ξ2 , ξ3 and the gradient in terms of those same coordinates, we have to find a way to compute the gradient of N i with respect to X1 , X2 and X3 . We start by applying the chain rule: ∂ ∂ξ1 ∂ ∂ξ2 ∂ ∂ξ3 ∂ = + + ∂X ∂X ∂ξ1 ∂X ∂ξ2 ∂X ∂ξ3 to the above gradient:     ∇N =        =  

 ∂N ∂X1   ∂N   ∂X2  ∂N  ∂X2 ∂N ∂ξ1 ∂N ∂ξ2 ∂N ∂ξ3 + + ∂ξ1 ∂X1 ∂ξ2 ∂X1 ∂ξ3 ∂X1 ∂N ∂ξ1 ∂N ∂ξ2 ∂N ∂ξ3 + + ∂ξ1 ∂X2 ∂ξ2 ∂X2 ∂ξ3 ∂X2 ∂N ∂ξ2 ∂N ∂ξ3 ∂N ∂ξ1 + + ∂ξ1 ∂X3 ∂ξ2 ∂X3 ∂ξ3 ∂X3

We have yet to compute all terms involving matrix J(X)

5

(2.5)

      

(2.6)

∂ξα . This is nothing but the Jacobian ∂Xβ

We start by writing:

∇ξ =J(ξ)∇X

(2.7)

∇X =J−1 (ξ)∇ξ

(2.8)

∇X =J(X)∇ξ

(2.9)

∇ξ =J−1 (X)∇X

(2.10)

In the above equations, ∂X1  ∂ξ1  ∂X  1 J(ξ) =   ∂ξ2  ∂X1 ∂ξ3

∂X2 ∂ξ1 ∂X2 ∂ξ2 ∂X2 ∂ξ3

 ∂X3 ∂ξ1  ∂X3    ∂ξ2  ∂X3  ∂ξ3

(2.11)

∂ξ1  ∂X1   ∂ξ J(X) =  1  ∂X2  ∂ξ1 ∂X3

∂ξ2 ∂X1 ∂ξ2 ∂X2 ∂ξ2 ∂X3

 ∂ξ3 ∂X1   ∂ξ3   ∂X2  ∂ξ3  ∂X3

(2.12)



Whereas



We notice then that J(X) = J−1 (ξ). This is an important equality since we can compute J−1 (ξ) easily using matlab provided we know the values of J(ξ). These values, in turn, can be calculated with the following approximations:

6

J(ξ)11 = J(ξ)12

NN X ∂N i

∂X1 = ∂ξ1

i=1 N N X

∂X2 = = ∂ξ1

i=1

X1i

(2.13)

∂N i i X ∂ξ1 2

(2.14)

∂ξ1

.. . J(ξ)33

(2.15) NN X ∂N i

∂X3 = = ∂ξ3

i=1

∂ξ3

X3i

(2.16) (2.17)

Proceeding with the above calculations we finally find the values of J−1 (ξ) which will be called J for simplicity. The values of J are finally plugged in equation (2.6) to give a fully computable gradient of N for one node in the coordinates X1 , X2 ,X3 .

    ∇N =        =  

 ∂N ∂X1   ∂N   ∂X2  ∂N  ∂X2 ∂N J11 + ∂ξ1 ∂N J21 + ∂ξ1 ∂N J31 + ∂ξ1

(2.18)

∂N ∂N J12 + J13 ∂ξ2 ∂ξ3 ∂N ∂N J22 + J23 ∂ξ2 ∂ξ3 ∂N ∂N J32 + J33 ∂ξ2 ∂ξ3

      

(2.19)

Moreover, in the matlab program, the values of ∇N are stored in a function for all 8 nodes of one element in the following array:

7



1



[∇N ]      [∇N 2 ]      3  ∇N =   [∇N ]    ..   .     8 [∇N ]

(2.20)

Where each [∇N α ] represents a 1×3 matrix of the derivative of N α in 3 directions.

8

CHAPTER III

Electrostatic equations

3.1

Differential and weak form

We start with the general Maxwell equations:

∇ · d =q ∇ × e = − b˙ ∇ · b =0 ∇ × h =d˙ + jL

(3.1) (3.2) (3.3) (3.4)

Since we are in a static case, b˙ = d˙ = 0. Since electric charges are not moving, 1 there is no magnetic field and b = 0 and h = b = 0. Also, by Ampere’s circuital µ Law we have j = ∇ × h = 0 We obtain:

∇ · d =q

(3.5)

∇ × e =0

(3.6) (3.7)

9

Knowing that d =  e and e = −∇φ,plugging into equation (3.6) we get Poisson’s equation: q 

(3.8)

n · d = q∗

(3.9)

∆φ = − Assuming a Neumann B.C:

Since d =  e and e = −∇φ, equation (3.9) becomes:

−∇φ · n = q ∗

(3.10)

From equations (3.9) and (3.8) we therefore obtain:

∇φ · n + q ∗ = 0

(3.11)

∆φ + q = 0

(3.12)

Multiplying by a test function, integrating over the volume for equation (3.12) and integrating over the surface for equation at the boundary (3.11), then subtracting equation (3.11) from equation (3.12), while considering ∆φ = ∇ · ∇φ, we obtain: Z

Z δφ  ∇ · ∇φ dV +



Z δφ q dV −



δφ[ ∇φ · n + q ∗ ] dA = 0

(3.13)

Γ

We can apply the following calculus rule to the example above: ∇ · (δφ ∇φ) = δφ ∇ · ∇φ + ∇δφ · ∇φ Replacing the above equality accordingly in the first term of equation (3.13), we

10

obtain:

Z

δφ q ∗ dA = 0 (3.14)

Γ

Γ





δφ  ∇φ·n dA−

δφ q dV −

[∇·(δφ ∇φ)−∇δφ·∇φ] dV +

Z

Z

Z

Z

By the divergence theorem: Z  ∇ · (δφ ∇φ) dV =  δφ ∇φ · n dA Γ



Therefore, this term cancels out in equation (3.14). Moreover, taking the case where there is no free charge at the boundary, we have n · d = q ∗ = 0 which leaves us with the weak form of the electrostatic equation: Z

Z  ∇δφ · ∇φ dV =

(3.15)





3.2

δφ q dV

Numerical approximation of the electrostatic equation

We now proceed with the numerical approximation of equation (3.15): Starting with the term on the left, we write: NN X φ= N i (ξ)φi , from which we conclude: i=1 NN X

∂φ ∂N i = φi (ξ) ∂X ∂X i=1 Therefore, we obtain:

      ∇φ =     

NN X

 i ∂N φi (ξ)  ∂X1  i=1  N N  X ∂N i  φi (ξ)  =  ∂X2 i=1  NN  i X ∂N  (ξ) φi ∂X3 i=1

∂N i [  ∂X1 (ξ)]   ∂N i  [ (ξ)]  ∂X2  ∂N i [ (ξ)] ∂X3 

    i  [φ ]  

(3.16)

In the above equation, it is important to understand the notations underlying the

11

∂N i ∂N i ∂N i (ξ)], [ (ξ)], [ (ξ)] ∂X1 ∂X2 ∂X3 are 1 × 8 matrices corresponding to the 8 nodes of a single cubic element considered linear algebra computations done by the Matlab code. [

whereas [φi ] is an 8 × 1 Matrix representing the 8 φ values at the 8 nodes of a single cubic element. In the rest of the analysis, all equations which include sums will be replaced by the equivalent linear algebra system, in order to simplify the construction of the Matlab code. Similarly for ∇δφ we get:       

∂N i (ξ)] [ ∂X1 ∂N i [ (ξ)] ∂X2 ∂N i [ (ξ)] ∂X3

    i  [δφ ]  

(3.17)

As mentionned before, it is important to note here that [q i ] refers to an 8 × 1 matrix and that [δφi ] refers to a 1 × 8 matrix, which form a linear algebra system equivalent to the sum brought by the numerical approximation. Going back to equation (3.15), we have a dot product to compute, which can be written as ∇δφ · ∇φ = (∇δφ)T ∇φ (notice that we have omitted the dot product in the new form, using the equivalent matrix multiplication instead) We mention here as a reminder an important rule in Matrix computations, valid for any matrix size (including vectors):

(AB)T = BT AT

(3.18)

Therefore, after introducing the numerical approximations, our equation (∇δφ)T ∇φ takes the form:

12

    [δφi ]T   

∂N i [ (ξ)] ∂X1 ∂N i [ (ξ)] ∂X2 i ∂N [ (ξ)] ∂X3

T       

     

∂N i (ξ)] [ ∂X1 ∂N i [ (ξ)] ∂X2 i ∂N [ (ξ)] ∂X3

    i  [φ ]  

(3.19)

∂N i ∂N i ∂N i (ξ)], [ (ξ)], [ (ξ)] as 1 × 8 matrices as well ∂X1 ∂X2 ∂X3 as [φi ] and [δφi ] as 8 × 1 matrices.

note here that we still have [

The above equation becomes:  [δφi ]



∂N i ∂N i ∂N i (ξ)] [ (ξ)] [ (ξ)] [ ∂X1 ∂X2 ∂X3

     

∂N i [ (ξ)] ∂X1 i ∂N [ (ξ)] ∂X2 i ∂N [ (ξ)] ∂X3

    i  [φ ]  

(3.20)

∂N i ∂N i ∂N i (ξ)], [ (ξ)] and [ (ξ)] are now Introducing the transposed matrices: [ ∂X1 ∂X2 ∂X3 8 × 1 matrices. [δφi ] has also switched to become a 8 × 1 matrix. We can now eliminate [δφi ] to the left of both sides of our equation, which leaves us with:

∂N i [ (ξ)] ∂X1 ∂N i [ (ξ)] ∂X2 ∂N i [ (ξ)] ∂X3



∂N i ∂N i ∂N i ∂N i ∂N i ∂N i (ξ)] [ (ξ)] + [ (ξ)] [ (ξ)] + [ (ξ)] [ (ξ)] ∂X1 ∂X1 ∂X2 ∂X2 ∂X3 ∂X3



 

Z  Ω



Z  Ω

[

∂N i ∂N i ∂N i [ (ξ)] [ (ξ)] [ (ξ)] ∂X1 ∂X2 ∂X3

     

 Z   i  [φ ] dV = [q i ] dV   Ω (3.21) Z i [φ ] dV = [q i ] dV Ω

(3.22) Notice that on the left hand side of the last equation we are summing matrix

13

products of 8 × 1 with 1 × 8 vectors. This explains that the sum gives us the stifness 8 × 8 tensor K, as can be shown from the following calculation done for a general direction X:

         

∂N 1 (ξ) ∂X2 ∂N (ξ) ∂X .. . ∂N 8 (ξ) ∂X

∂N 1 ∂N 1   ∂X ∂X      ∂N 2 ∂N 1 2 8 1   ∂N ∂N ∂N   ∂X ∂X = (ξ) (ξ) . . . (ξ)   .. ∂X ∂X ∂X   .     ∂N 8 ∂N 1 ∂X ∂X 



 ∂N 1 ∂N 2 ∂N 1 ∂N 8 ... ∂X2 ∂X2 ∂X ∂X   ∂N ∂N ∂N 2 ∂N 8  ...  ∂X ∂X ∂X ∂X   .. .. ..  . . .  ∂N 8 ∂N 2 ∂N 8 ∂N 8  ... ∂X ∂X ∂X ∂X (3.23)

∂N i ∂N j = ⊗ for i, j = 1, 2, 3, ..., 8 ∂X ∂X (3.24) Finally, our K becomes:

K=

∂N i ∂N j ∂N i ∂N j ∂N i ∂N j ⊗ + ⊗ + ⊗ ∂X1 ∂X1 ∂X2 ∂X2 ∂X3 ∂X3

14

(3.25)

CHAPTER IV

Magnetostatic equations

4.1

Differential and weak form

Starting with Maxwell equations (refer to equations accordingly), and taking the static case where b˙ = 0 as well as d˙ = jV = 0 We have:

∇ · b =0

(4.1)

∇ × h =jL

(4.2) (4.3)

We have also have, from the equation of magnetic force: b = µh = ∇ × a. Plugging back in (4.2) we get:

1 ∇ × ( ∇ × a) =jL µ

(4.4)

We consider a Neumann Boundary condition:

n × h =κ∗ which gives: 1 n × ∇ × ( ∇ × a) =κ∗ µ 15

(4.5) (4.6)

We now proceed by multiplying by a 1 × 3 vector test function δaT from the left of (4.2) and (4.6). This is equivalent to taking the dot product with δa. Then, integrating over the volume and surface respectively and summing up both equations we obtain:

Z

1 δa · ∇ × ( ∇ × a) dV − µ

Z

Z δa · jL dV +

Γ





1 δa · [n × ( ∇ × a) + κ∗ ] dA = 0 (4.7) µ

We can introduce here a calculus formula that simplifies the first term: ∇ · (a × b) = (∇ × a) · b + a · (∇ × b)

Which in our case is: 1 1 1 ∇ · [δa × ( ∇ × a)] = (∇ × δa) · ( ∇ × a) + δa · ∇ × ( ∇ × a) µ µ µ Replacing the above equality accordingly in the first term of equation (4.7), we obtain: Z Ω

1 ∇·[δa×( ∇×a)] dV − µ

Z

1 ∇×δa· ∇×a dV − µ



Z

T

Z

δa jL dV − Ω

1 δaT [n× ∇×a+κ∗ ] dA = 0 µ

Γ

(4.8) Z Ω

Using the divergence theorem, we compute the first term of the above equation: Z 1 1 ∇ · [δa × ( ∇ × a)] dV = [δa × ( ∇ × a)] · n dA µ µ Γ

but in general, the scalar triple product property states: (a × b) · c = −a · (c × b) this means: 1 1 [δa × ( ∇ × a)] · n = −δa · [n × ( ∇ × a)] µ µ Therefore, these terms cancel out in equation (4.7). Moreover, taking the case where no there is no current on the surface, we have n × h = κ∗ = 0 which leaves us with the weak form of the magnetostatic equation:

16

Z −

1 (∇ × δa) · ( ∇ × a) dV − µ



4.2

Z

δaT jL dV = 0

(4.9)



Numerical approximation of the magnetostatic equation

We now proceed with the numerical approximation of equation (4.7). Starting with the term on the left, we write: NN X a= N i (ξ)ai , from which we conclude: i=1 NN X

∂a = ∂X

i=1

ai

∂N i (ξ) ∂X

Therefore, we obtain:

    ∇ × a =         =    

 ∂a2 ∂a3 − ∂X2 ∂X3   ∂a1 ∂a3  −  ∂X3 ∂X1  ∂a1  ∂a2 − ∂X1 ∂X2 N N NN X ∂N i X i ∂N i ai3 − a2 ∂X ∂X3 2 i=1 i=1 N N N N X ∂N i X ∂N i ai1 − ai3 ∂X3 ∂X1 i=1 i=1 N N N N X ∂N i X ∂N i ai2 − ai1 ∂X ∂X2 1 i=1 i=1

(4.10)

          

(4.11)

As in the electrostatic case all equations which include sums will be replaced by the equivalent linear algebra system, in order to simplify the construction of the Matlab

17

code. In this case we obtain: 

 [0]   ∂N i ∇ × a = [ ]  ∂X3  ∂N i ] [− ∂X2

∂N i [− ] ∂X3 [0] [

∂N i ] ∂X1

  ∂N i [ ] i ∂X2   [a1 ]   ∂N i   i  [− ]  ] [a 2  ∂X1     i [a ] [0] 3

(4.12)

As in the electrostatic case, it is important to understand the notations underlying ∂N i ∂N i the linear algebra computations done by the Matlab code. [ (ξ)], [ (ξ)], ∂X1 ∂X2 ∂N i [ (ξ)], [0] are 1 × 8 matrices corresponding to the 8 nodes of a single cubic element ∂X3 considered whereas [ai1 ], [ai2 ], [ai3 ] are 8 × 1 matrices representing the 8 a values at the 8 nodes of a single cubic element, in directions 1, 2 and 3. Similarly for ∇ × δa we get: 

 [0]   ∂N i ∇ × δa =  [ ]  ∂X3  ∂N i ] [− ∂X2

∂N i [− ] ∂X3 [0] [

∂N i ] ∂X1

  ∂N i [ ] i ∂X2   [δa1 ]   ∂N i   i  [− ]  ] [δa 2  ∂X1     i ] [δa [0] 3

(4.13)

As in the electrostatic part, we replace the dot product in equation (4.9) by the equivalent matrix multiplication form, and transposing ∇ × δa following the rule of equation (3.18); we get:  ∂N i [0] [− ] ∂X2      ∂N i   ∂N i T i i i (∇ × δa) = ] [0] [ ] [δa1 ] [δa2 ] [δa3 ] [−  ∂X3 ∂X1   ∂N i  ∂N i [ ] [− ] [0] ∂X2 ∂X1 

∂N i [ ] ∂X3

(4.14)

∂N i ∂N i ∂N i (ξ)], [ (ξ)], [ (ξ)], [0] are ∂X1 ∂X2 ∂X3 8×1 matrices whereas the [δai1 ], [δai2 ], [δai3 ] are 1×8 matrices. This is a very important Note that because of the transposition the [

detail since it explains the final dimension of the stiffness matrix K, a (3 × 8) × (3 × 8) 18

which will be shown in the following calculation. Omitting

1 for the moment, our µ

dot product becomes:

   ∂N i ∂N i ∂N i [− ] [0] [− ] [ ] [0] i  ∂X2  ∂X3 ∂X2   [a1 ]     i i i  i   ∂N   ∂N ∂N    ∂N ] [0] [ ]  [ ] [0] [− ]  [ai2 ]  [δai1 ] [δai2 ] [δai3 ] [−   ∂X3 ∂X1   ∂X3 ∂X1        ∂N i i i i ∂N ∂N ∂N i [a ] [ ] [− ] [0] [− ] [ ] [0] 3 ∂X2 ∂X1 ∂X2 ∂X1 (4.15) 

∂N i ] [ ∂X3

Our K becomes:   ∂N i ∂N i ∂N i ∂N i ∂N i ∂N i ∂N i ∂N i [ ⊗ + ⊗ ] [− ⊗ ] [− ⊗ ]  ∂X3 ∂X3 ∂X2 ∂X2  ∂X2 ∂X1 ∂X3 ∂X1   i i i i i i i i ∂N ∂N ∂N ∂N ∂N ∂N ∂N ∂N     [− ⊗ ] [ ⊗ + ⊗ ] [− ⊗ ]   ∂X1 ∂X2 ∂X3 ∂X3 ∂X1 ∂X1 ∂X3 ∂X2  ∂N i ∂N i ∂N i ∂N i ∂N i ∂N i ∂N i  ∂N i ⊗ ] [− ⊗ ] [ ⊗ + ⊗ ] [− ∂X1 ∂X3 ∂X2 ∂X3 ∂X2 ∂X2 ∂X1 ∂X1 (4.16) On the right side of equation (4.9) we write the following numerical approximaNN X T tion: (δa) jL = (δai )T jiL N i i=1

This, in turns, using Einstein’s sum convention for repeated indexes, gives:  

i

  [(δjL1 N ) ]  i [δai1 ] [δai2 ] [δai3 ]   [(δjL2 N ) ]  [(δjL3 N )i ]

     

(4.17)

In the equation above, the terms [δai1 ], [δai2 ], [δai3 ] are 1 × 8 matrices whereas [(δjL1 N )i ], [(δjL2 N )i ] and [(δjL3 N )i ] are 8 × 1 matrices. We can now eliminate [(δai )T ] to the left of both sides of equation (4.9). Then,we can then extend the above linear equation to:

19

   i i [0]   [δjL1 ]  [N ] [0]     [0] [N i ] [0]   [δj i ]    L2     i i [0] [0] [N ] [δjL3 ]

(4.18)

i i i where the terms [δjL1 ], [δjL2 ] and [δjL3 ] are 8 × 1 matrices, and the terms [N i ]

and [0] are 8 × 8 matrices. We obtain a new diagonal matrix N for which all terms are 8 × 8 matrices: 



i

[0]  [N ] [0]    i N= [0] [N ] [0]     [0] [0] [N i ]

(4.19)

Equation (4.9) becomes:    Z Z K11 K12 K13    1   K i i i [a1 ] [a2 ] [a3 ] dV = − 21 K22 K23  µ    Ω Ω K31 K32 K33

   i i [0]   [δjL1 ]  [N ] [0]     [0] [N i ] [0]   [δj i ]  dV   L2     i [δjL3 ] [0] [0] [N i ] (4.20)

Our final solution is:

i ai = −K−1 e Ne j L

For a single element with 8 nodes.

20

(4.21)

CHAPTER V

Results and conclusion

In this chapter, the results of the matlab code will be presented in the form of graphs. In the first graph, representing any plane X3 = constant we can see the plotted electric potential lines, with the higher potential in red color and the lower potential in dark blue. We notice that the electric potential is the highest around the nodes verifying X1 = 3 and X2 = 0. Electric potential lines also have a higher gradient close to these nodes. This result is intuitive because we set the electric field boundary conditions on X2 = 0 with an increasing potential at the boundary from X1 = 0 till X1 = 3. In the second graph, representing the full cube divided into 27 elements, (the elements are not visible on the graph) we notice a perfect axisymmetry in the X2 axis, starting from the center of the cube. This result is also intuitive, since equal boundary conditions were set on the nodes of the 3 central elements of the X2 direction.

21

Figure 5.1: Result of the matlab electrostatic code

Figure 5.2: Result of the matlab magnetostatic code

22