TD1
- Open a terminal and go to your homedirectory « perso » === > cd
- Create a new repertory ============================ > mkdir TD_EF
- Go in TD_EF ============================ > cd perso/TD_EF
- Move « codes_matlab.tar » in TD_EF
& extract (uncompress) files ============= > tar xvf codes_matlab.tar
Download: http://dms.mat.mines-paristech.fr/Programme/Module-B2/ codes_matlab.tar
GMSH repertory ==== in ==== > perso/TD_EF/gmsh-1.60.1
Run GMSH: cd /usr/local/gmsh-1.60.1/
./gmsh
Matlab code repertory ==== in ==== > perso/TD_EF/codes_matlab
Run matlab code: cd perso/TD_EF/code_matab
./matlab ./
How to get the files ?
How to run the programs ?
Introduction
- Tutorial code
linel_T.m (« pedagogical » version)
Main programm.
Run the code: linel_T (on the matlab command window)
linel_T_fast.m (« faster » version of linel_T)
- Some examples: Input file (perso/TD_EF/codes_matlab/input) :
Go to matlab codes directory : cd perso/TD_EF/codes_matlab
Run matlab: ./matlab ./
- 3 types of files:
- *.geo: input file gmsh (geometric description)
- *.msh: output file gmsh (Mesh description)
- *.inp: input file matlab_code
wing
Compress
example
Main steps ...
1- Geometric description of the structure: == > intput/file.geo
Users: - geometric definition
- physical line, surface
- mesh refinement parameter
2- Mesh generation: == > input/file.msh
Gmsh: - run gmsh and open file.geo
- Options: mesh, 2D, first order (T3) ou second order (T6)
- save (== > file.msh)
3- Problem definition == > input/file.inp
Users : - define the problem to be solved
(static, dynamic, ..., material properties, boundary conditions ….)
4- Compute the Finite Element approximation
Matlab: - run linel_T or linel_T_fast ….
Airplane wing: a simplify model !
Vertical displacement : ???
Forces on Su: ???
F=.0625
Airplane wing
Su
Input file : input/wing.geo
wing.geo
Physical Line (Boundary conditions)
- Physical Line(1) : (traction force)
Line 2: given traction force
- Physical Line(2) : (displacement)
Line 4: embedding (imposed displacement)
1
2
4
3
Line 1 (1,2)
Line 2 (2,3) Line 3 (3,4)
Line 4 (4,1)
Mesh generation: wing.geo
Line Loop (5) =(1,2,3,4)
Physical
Surface(1)={3}
Physical line(2)
Physical line(1)
Mesh refinement parameter
- Run gmsh : cd perso/TD_EF/gmsh-1.60.1/
./gmsh
- open « wing.geo »
- mesh, 2D (Shortcut: esc F3)
- option: first order (T3) or second order (T6)
- save (== > generation of wing.msh)
- To modify « input file » == > Edit
Mesh generation: wing.geo
1
7
6
2
5
4
3
9
8
5
6
8
3 2
1
7
4
wing.geo
Mesh refinement parameter
TO DO:
- change mesh refinement parameter
- generate the new meshes
wing.inp
Input file : input/wing.inp
Input data: wing.inp
F
Domain:
ELSET=3 (Physical surface (3))
Boundary conditions :
Displacement: DBC
ELSET = 2 (Physical Line(2))
Direction 1 ; Value = 0
Direction 2 ; Value = 0
Traction : TBC
ELSET = 1 (Physical Line(1))
Direction 2 :
Value F=0.0625
Analyse : Static, plane stress
Material caracteristic
Elset 1
Elset 2
Run matlab :
Linel_T.m
But before ….
Input data: wing.inp
… let’s have a look on the
main program
wing.geo
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Tables: Analysis, materials
# nodes
# surface elt
# ‘3’ == >T3 ; ‘6’ == > T6
#
#
# Gauss points
# segment (imposed traction)
# unknown
File : utility/read_input.m
analysis.NN = 9
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Tables: connec, coor
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Tables: dof & TD & displ
DBC (nodes 1, 4 et 8) :
here : nodes 1, 4 et 8
In both directions
(== > values in Displ)
TD (nodes 2 et 3) :
Direction : 2
Value : 0.0625
Displ = 0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
F
Initialisation of the Displacement vector:
- Zero (for unknown dof)
- Value of the imposed displacement for
other nodes
Problem formulation
Problem formlation
1-
2-
3-
Local stiffness matrix: Ke
Directory: ElementName
Program : Stiff_linel_ElementName.m
Local extrenal forces: Fe
Directory: ElementName
Program : nf_traction_ElementName.m
Local stifness matrix Local Stiffness Matrix: Ke Directory: ElementName
Program : Stiff_linel_ElementName.m
Local external forces Local external forces : Fe Directory: ElementName
Program : nf_traction_ElementName.m
Pressure loading : idir=0
Assembly
== >
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
with Usurfvol FFFFFUK
Assembly
1-
2-
Contribution to the global stiffness matrix: [K]
Contribution to the global right hand side (imposed displacement): {Fu}
with
Usurfvol FFFF
FUK
Boundary condition: displacement
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Example : Element 5
)66(
5
)65(
5
)64(
5
)63(
5
)62(
5
)61(
5
)56(
5
)55(
5
)54(
5
)53(
5
)52(
5
)51(
5
)46(
5
)45(
5
)44(
5
)43(
5
)42(
5
)41(
5
)36(
5
)35(
5
)34(
5
)33(
5
)32(
5
)31(
5
)26(
5
)25(
5
)24(
5
)23(
5
)22(
5
)21(
5
)16(
5
)15(
5
)14(
5
)13(
5
)12(
5
)11(
5
eeeeee
eeeeee
eeeeee
eeeeee
eeeeee
eeeeee
KKKKKK
KKKKKK
KKKKKK
KKKKKK
KKKKKK
KKKKKK
)8(
1
)8(
1
)5(
2
)5(
1
)1(
2
)1(
1
U
U
U
U
U
U
0 0 0 0 )5(
2
)5(
1555 wwUKW ee
T
e
D
eeee
eeeeT
ee
eeT
ee
T
e eeeeU
KKKK
KKKKWU
KK
KKWUKW
5555 )46(
5
)45(
5
)42(
5
)41(
5
)36(
5
)35(
5
)32(
5
)31(
500
)44(
5
)43(
5
)34(
5
)33(
50
555
Boundary condition: displacement
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Element 5
)66(
5
)65(
5
)64(
5
)63(
5
)62(
5
)61(
5
)56(
5
)55(
5
)54(
5
)53(
5
)52(
5
)51(
5
)46(
5
)45(
5
)44(
5
)43(
5
)42(
5
)41(
5
)36(
5
)35(
5
)34(
5
)33(
5
)32(
5
)31(
5
)26(
5
)25(
5
)24(
5
)23(
5
)22(
5
)21(
5
)16(
5
)15(
5
)14(
5
)13(
5
)12(
5
)11(
5
eeeeee
eeeeee
eeeeee
eeeeee
eeeeee
eeeeee
KKKKKK
KKKKKK
KKKKKK
KKKKKK
KKKKKK
KKKKKK
)8(
1
)8(
1
)5(
2
)5(
1
)1(
2
)1(
1
U
U
U
U
U
U
555 ee
T
e UKW
T
w
w
0
0
0
0
)5(
2
)5(
1
Co
ntrib
utio
n to
{F}
Co
ntrib
utio
n to
[K]
‘Local’ numbering ‘Global’numbering
Matlab translation ...
Fe=nf_tractions_T3(L,val,idir);
Displacement
boundary condition
Post traitement: Cauchy Stress components Directory : ElementName
Program : StressG_linel_ElementName.m
To be compare with stiff_linel_T3 …
Post traitement: Cauchy Stress components Matlab function: ic = find(dof>0); = > returns the indices of « dof » that satisfy the condition
EX 1: Extract some information Write matlab code lines:
- To display total number of element
- To display total number of nodes
- To find all nodes that belong to the line x=0
• 1 - How is compute the coefficients
K(5,7),K(5,10) and K(12,9) ?
• where does it come from ?
• which elements contribute to its
computation ?
• which coefficients of Ke contribute to
its computation ?
• 2 – What is the contribution of :
K_2(1,2), K_4(4,6) and K_5(1,6)
- Verify with the code
Ex 2: Assembly 1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
EX 3: Potential energy (DM) • 1- Matlab code lines to evaluate the potential energy for the FE solution
• 2- Convergence analysis (Wing case)
Plot the potential energy in function of the number of elements
(mesh refinement) for T3 and T6 elements.
Send by email: ([email protected])
- Your names
- Matlab code lines
- 1 pages (max) of comments and analysis
Compress.inp
wing.inp
• 3- Compute the potential energy for the example
« compress.inp »
Hand in next session
Work in pairs
Correction EX 1: extract some information
Write matlab code lines:
- To display total number of element:
- To display total number of nodes:
- To find all nodes that belong to the line x=0
== > NbNodes = analysis.NN
or == > NbNodes = size(coor,1)
SX0=find(coor(:,1)<(1.d-4));
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
SX0 =
1
4
8
== > SX0 contains the list
(column) of the nodes that
belong to the line x=0
== > NbElement = analysis.NE
or == > NbElement = size(connec,1)
• 1 - How is compute the coefficient K(5,7), K(5,10) and
K(12,9) ?
• where does it come from ?
• which elements contribute to its computation ?
• which coefficients of Ke contribute to its computation ?
• 2 – Same question for K(5,10)
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Correction EX 2 – Assembly (1/2)
• 3 – Same question for K(12,9)
K(5,7)
- Node 5 (direction 1) & Node 6 (direction 1)
- Element 7
- K(1,4) = K_7(5,1)
K(5,10)
- Node 5 (direction 1) & Node 7 (direction 2)
- No common support of shape functions
- K(5,11) = 0
- Node 9 (direction 2) & Node 7 (direction 1)
- Elements 3 & 4
- K(12,9) = K_3(4,5) + K_4(4,1)
1
7
6
2
5
4
3
9
8
5
6
8
3
2
1
7
4
Correction EX 2 – Assembly (2/2)
• 2 – What is the contribution of :
K_2(1,2), K_4(4,6) and [ K_5(2,3) and K_5(3,2)]
K_2(1,2)
- dof_2 = 1 ↔ Node : 2 Dir 1 ↔ dof = 1
- dof_2 = 2 ↔ Node : 2 Dir 2 ↔ dof = 2
- K(1,2) ← K_2(1,2) (but ≠)
K_4(4,6)
- dof_4 = 4 ↔ Node : 9 Dir 2 ↔ dof = 12
- dof_4= 6 ↔ Node : 6 Dir 2 ↔ dof = 8
- K(12,8) ← K_4(4,6) (but ≠)
K_5(3,2) and K_5(2,3)
- dof_5 = 3 ↔ Node : 5 Dir 1 ↔ dof = 5
- dof_5 = 2 ↔ Node : 1 Dir 2 ↔ dof = -10
- F^u(5) ← K_5(3,2) *U^(1)^2 (but ≠)
- K_5(2,3) does not contribute
Hints EX 3: Potential energy • 1- Matlab code lines to evaluate the potential energy for the FE solution
)(2
1
2
1)(
)(D
h
TT
e
ext
e
T
eee
T
eh uPKuP
FUUUFUUKUProve: