1
The Finite Element MethodComputer Program FEM2D
Read: Chapter 13CONTENTS
Logical units of a FEM2D program Flow chart of a typical processor
unit Element calculations Computer program FEM2D Input data to FEM2D Example problem for FEM2D
2
LOGICAL UNITS OF FEM2D
Computer Program FEM2DF15: 3JN Reddy
3JN Reddy
FEM2D Program FLOWCHART
4
FEM2D Program DATA INPUT
(13.4.2)(13.4.3)
5
FEM2D Program DATA INPUT
6
FEM2D Program DATA INPUT
7
FEM2D Program DATA INPUT
8
FEM2D Program DATA INPUTCards 5-7 are read only when you give the mesh information
9
FEM2D Program DATA INPUTCards 8-11 are read only when mesh is generated for complicated domains.
FEM2D Program DATA INPUT
10
FEM2D Program DATA INPUT
11
Cards 12-14 are read only when mesh is generated for rectangular domains.
Cards 15 and 16 are read for all problems
FEM2D Program DATA INPUT
12
Cards 17-20 are NOT read for eigenvalue problems
FEM2D Program DATA INPUT
13
Cards 21-23 are read for all problems
FEM2D Program DATA INPUT
14
INOD(I,J) – Array of the local node numbers of the side
FEM2D Program DATA INPUT
15
Card 28 is only readfor viscous flow problems of Chapter 10
Cards 29 and 30 areread only elasticity problems of Ch. 11
FEM2D Program DATA INPUT
16
Card 31 is read only for plate bending problems of Chapter 12
17
FEM2D Program DATA INPUT
Card 32 is read for all problems EXCEPT for eigenvalue problems
Card 33 is read for time-dependent and eigenvalue problems
FEM2D Program DATA INPUT
18
Cards 34-37 are read for only time-dependent problems
19
FEM2D Program DATA INPUT
20
TO RUN THE EXECUTABLE PROGRAM FEM2D.EXE
Executable Computer Programs from the book, AnIntroduction to the Finite Element Method by J. N. Reddy,3rd ed., McGraw--Hill, 2006.
Notes:Programs FEM1D and FEM2D are a revised versions of theprograms from the second edition of the book. The revisions areminor. Both FEM1D and FEM2D were compiled using theMicrosoft Fortran compiler, with a fixed array dimensions.Hence, only a limited size problem can be analyzed using thecompiled versions of the programs. The programs were compiledwith a maximum number of degrees of freedom of 2,500. If yourcomputer has the storage and you have the source programs, youmay recompile the program after changing the DIMENSIONstatements in the programs.
21
TO RUN THE EXECUTABLE PROGRAM FEM2D.EXE
To run a program on a PC, the files should be downloaded to your PCinto a folder (say, FEM_Reddy). The user is required to prepare a datafile for each problem he or she wants to solve, using the instructions inTable 7.3.2 for FEM1D and Table 13.4.1 for FEM2D. Most errors aremistakes made in the preparation of the data files. Therefore, you mustcheck the data files when you see 'run-time error' message or theprogram is not executed (by returning just the echo of the input datafile). All files should be in the same folder where FEM1D.EXE andFEM2D.EXE are placed.
To run the program: Double click on the executable file (say, FEM2D.EXE).
A window (called Command Prompt window) will pop open (withwhite letter and black background). It will read
File name missing or blank – please enter file nameUNIT 5?
22
TO RUN THE EXECUTABLE PROGRAM FEM2D.EXE
Type the input file name (with its extension) and press Enter. Forexample, if the file name you prepared is labeled as Prob1.inp, youmay type it as prob1.inp (not case sensitive). The Command Promptwindow will now display
File name missing or blank – please enter file nameUNIT 6?
Type the output file name (with its extension) and press Enter. Forexample, if you want the computer to return the output to fileProb1.out, you may type it as prob1.out. Note that you do not preparethis file; it will be created by the computer. The Command Promptwindow will disappear, indicating that it has taken the data file andexecuted the program. You will find the file prob1.out in the samefolder where you are running the program. Depending on the resultsyou see, you may have to correct the data file.
1
1 2 3
6
9
1 1
1
1 2
3 4
x
y
A = 1
A = 1
u = 0
0=∂∂−=
∂∂=
yu
nuqn
4
0nuqx
¶= - =
¶ u = 0
7 8
5
●●
●
● ● ●
● ●
●
2
11 22 00
1 in a square of 2 units( 1, 0, ( ) 1)
ua a a f x
- == = = =
Example 1: Example 8.3.1 of the book
Problem Type, ITYPE = 0; steady-state, ITEM = 0; NEIGN = 0Gradient computation is for heat transfer-like Problems, i.e., compute the x and y-components of the flux vector (IGRAD = 1)
11 22,x yu uq a q ax y
¶ ¶= - = -
¶ ¶
Problem description
FEM Mesh and boundary conditions
2 x 2 mesh of linear rectangular elementsNX = NY = 2; IELTYP = 1; NPE = 4; MESH = 1X0 = Y0 = 0.0; DX(1) = 0.5, DX(2) = 0.5
DY(1) = 0.5, DY(2) = 0.5NSPV = 5, Global nodes 3, 6, 7, 8, and 9 have specified PVs with specified values being zeros; no convection
Quadrant model
24
Ex 8.3.1: Solution of the Poisson equation on a square domain (quadrant)0 1 0 0 ITYPE,IGRAD,ITEM,NEIGN1 4 1 0 IELTYP,NPE,MESH,NPRNT2 2 NX,NY0.0 0.5 0.5 X0,DX(I)0.0 0.5 0.5 Y0,DY(I)5 NSPV3 1 6 1 7 1 8 1 9 1 ISPV(I,J)0.0 0.0 0.0 0.0 0.0 VSPV(I)0 NSSV1.0 0.0 0.0 A10, A1X, A1Y1.0 0.0 0.0 A20, A2X, A2Y0.0 A000 ICONV1.0 0.0 0.0 F0, FX, FY
Example 1: Example 8.3.1 of the bookINPUT DATA to FEM2D
2
11 22 00
0
( 1, 1, 0)
u ut
c a a a
¶- =
¶= = = =
Example 2: Find the eigenvalues of the problem in Example 1
Problem Type, ITYPE = 0; IGRAD = 0 Eigenvalue analysis, ITEM = 1; NEIGN = 1
Problem description
FEM Mesh and boundary conditions
4 x 4 mesh of linear rectangular elementsNX = NY = 4; IELTYP = 1; NPE = 4; MESH = 1X0 = Y0 = 0.0; DX(1) = 0.5, DX(2) = 0.5,DX(3) = 0.5, DX(4) = 0.5, DY(1) = 0.5, DY(2) = 0.5, DY(3) = 0.5, DX(4) = 0.5NSPV = 16, Global nodes on the boundaryhave specified homogeneous PVs.
52
6 10
1 3 4
15
25
1 x
y A = 2
u = 0
16 20
11
21
u = 0
0u =
A = 29
1 2 3 4
8
12
5
1613
13
8
18
0u =
26
Example 2: Eigenvalues of the Poisson equation on a square domain (full)0 1 1 1 ITYPE,IGRAD,ITEM,NEIGN9 1 NVALU, NVCTR1 4 1 0 IELTYP,NPE,MESH,NPRNT4 4 NX,NY0.0 0.5 0.5 0.5 0.5 X0,DX(I)0.0 0.5 0.5 0.5 0.5 Y0,DY(I)
16 NSPV1 1 2 1 2 1 4 1 5 16 1 10 1 11 1 15 1 16 1
20 1 21 1 22 1 23 1 24 1 25 1 ISPV(I,J)1.0 0.0 0.0 A10, A1X, A1Y1.0 0.0 0.0 A20, A2X, A2Y0.0 A000 ICONV1.0 0.0 0.0 C0, CX, CY
Example 2: INPUT DATA to FEM2D
2
11 22 00
0
( 1, 1, 0)
u ut
c a a a
¶- =
¶= = = =
Example 3: Find the transient response of the problem in Example 1
Problem Type, ITYPE = 0; IGRAD = 0 Transient analysis, ITEM = 1; NEIGN = 1
Problem description
FEM Mesh and boundary conditions
4 x 4 mesh of linear rectangular elementsNX = NY = 4; IELTYP = 1; NPE = 4; MESH = 1X0 = Y0 = 0.0; DX(1) = 0.25, DX(2) = 0.25,DX(3) = 0.25, DX(4) = 0.25, DY(1) = 0.25, DY(2) = 0.25, DY(3) = 0.25, DX(4) = 0.25NSPV = 16, Global nodes on the boundaryhave specified homogeneous PVs.
52
6 10
1 3 4
15
25
1 x
y1
u = 0
0=∂∂−=
∂∂=
yu
nuqn
16 20
11
21
u = 0
0=∂∂−
xu
19
1 2 3 4
8
12
5
1613
13
8
18
28
Example 8.6.3: Transient analysis of an parabolic equation (membrane) 0 0 1 0 ITYPE,IGRAD,ITEM,NEIGN 1 4 1 0 IELTYP,NPE,MESH,NPRNT 4 4 NX,NY 0.0 0.25 0.25 0.25 0.25 X0,DX(I) 0.0 0.25 0.25 0.25 0.25 Y0,DY(I) 9 NSPV 5 1 10 1 15 1 20 1 21 1 22 1 23 1 24 1 25 1 ISPV 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 VSPV 0 NSSV 1.0 0.0 0.0 A10, A1X, A1Y 1.0 0.0 0.0 A20, A2X, A2Y 0.0 A00 0 ICONV 0.0 0.0 0.0 F0, FX, FY 1.0 0.0 0.0 C0, CX, CY
Example 3: INPUT DATA to FEM2D
29
100 101 1 1 NTIME,NSTP,INTVL,INTIAL 0.025 0.5 0.5 1.0E-3 DT,ALFA,GAMA,EPSLN
0.400 0.375 0.300 0.175 0.0 0.375 0.35156 0.28125 0.16406 0.0 0.300 0.28125 0.225 0.13125 0.0 0.175 0.16406 0.13125 0.076563 0.0 0.0 0.0 0.0 0.0 0.0 Initial cond., GLU(I)
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 Initial cond., GLV(I)
Example 3: INPUT DATA to FEM2D (continued)
30
Example 8.6.4: Transient analysis of a rectangular membrane (hyperbolic) 0 0 2 0 ITYPE,IGRAD,ITEM,NEIGN 1 4 1 0 IELTYP,NPE,MESH,NPRNT 4 4 NX,NY 0.0 0.5 0.5 0.5 0.5 X0,DX(I) 0.0 0.25 0.25 0.25 0.25 Y0,DY(I) 9 NSPV 5 1 10 1 15 1 20 1 21 1 22 1 23 1 24 1 25 1 ISPV 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 VSPV 0 NSSV 12.5 0.0 0.0 A10, A1X, A1Y 12.5 0.0 0.0 A20, A2X, A2Y 0.0 A00 0 ICONV 0.0 0.0 0.0 F0, FX, FY 2.5 0.0 0.0 C0, CX, CY
Example 4: INPUT DATA to FEM2D
31
100 101 1 1 NTIME,NSTP,INTVL,INTIAL 0.025 0.5 0.5 1.0E-3 DT,ALFA,GAMA,EPSLN
0.400 0.375 0.300 0.175 0.0 0.375 0.35156 0.28125 0.16406 0.0 0.300 0.28125 0.225 0.13125 0.0 0.175 0.16406 0.13125 0.076563 0.0 0.0 0.0 0.0 0.0 0.0 Initial cond., GLU(I)
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 Initial cond., GLV(I)
Example 4: INPUT DATA to FEM2D (continued)