# Finite Element Method - 3D Mesh Generator - Metfem3D

## FEM Approach

### Space-dependent term

After integration NK(Nu) by parts, one obtains a mixed set of linear and nonlinear equations

 ∫ (∇ Nb)T k+ (∑a Nan+,a) ∇ (∑c Ncφc) dΩ + ∫ (∇ Nb)T D+ ∇(∑a Na n+, a)dΩ
 + 1/(Δt) ∫ Nb ∑a Na ( n+, an - n+, an-1) dΩ = 0
 ∫ (∇ Nb)Tk- (∑a Nan-, a) ∇ (∑c Ncφc) dΩ + ∫ (∇ Nb)TD- ∇(∑a Na n-, a)dΩ
 + 1/(Δt) ∫ Nb ∑a Na (n-,an - n-,an-1) dΩ = 0
 - ∫ (∇ Nb)Tε0ε∇(∑a Naφa) dΩ + z+e ∫ Nb (∑a Na n+,a)dΩ + z-e ∫ Nb (∑a Na n-,a)dΩ = 0
 b = 1,…,M

and a corresponding set of boundary terms for φ and ni where i = {+, -}

 - ki ∫ Nb ∂/(∂n) {(∑a Na ni,a)∇(∑c Ncφc)} dΓ - Di ∫ Nb ∂/(∂n){∇(∑a Nani,a)} dΓ + εε0 ∫ Nb ∂/(∂n){∇(∑a Naφa)} dΓ = 0
 b = 1, …, M

where ∂/(∂n) denotes derivative normal to Γ. Presented-above spatially temporal discretization has been done for the case with β = 1 at each node. If the forced boundary conditions are imposed on Γφ and Γn, respectively, then all terms in equation can be neglected by restricting the choice of Nb functions to those which equal 0 on Γ. Let us denote integrals from equation as

 Kacb = ∫ (∇ Nb)T Na∇ Nc dΩ = ∑e ∫ (∇ Nb)T Na∇ Nc dΩe = ∑e Kacb, e
 K*ab = ∫ (∇ Nb)T∇ Na dΩ = ∑e ∫ (∇ Nb)T∇ Na dΩe = ∑e K*ab, e
 Kab = ∫ Na Nb dΩ = ∑e ∫ Na Nb dΩe = ∑e Kab,e.

where ∑e with e = 1, …, E denotes sum over elements. In 3D space tetrahedral elements seem to be a natural choice of finite volume elements. Then indices (a,b,c) take four values each (an element has four nodes) from the set of 1, …, M values.

### References

1. ^ O. C. Zienkiewicz, R. L. Taylor and J. Z. Zhu, The Finite Element Method: Its Basis and Fundamentals, Sixth edition., Elsevier 2005