-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo3.f90
70 lines (52 loc) · 1.5 KB
/
demo3.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
! This demo program reads the lift.csv and drag.csv files and writes it to
! an output file output.C81. Both files are in the Samples/ directory.
program demo3
use libC81
implicit none
integer, parameter :: rowsL = 36
integer, parameter :: colsL = 4
integer, parameter :: nMachL = 3
integer, parameter :: rowsD = 32
integer, parameter :: colsD = 4
integer, parameter :: nMachD = 3
integer :: i,j
type(C81_class) :: C81
real, dimension(rowsL,colsL) :: LMat
real, dimension(rowsD,colsD) :: DMat
! Read airfoil lift data from CSV file
LMat=getTable('Samples/NACA63A012-CL.csv',rowsL,colsL)
! Read airfoil drag data from CSV file
DMat=getTable('Samples/NACA63A012-CD.csv',rowsD,colsD)
! Allocate arrays
allocate(C81%MaL(nMachL))
allocate(C81%MaD(nMachD))
allocate(C81%MaM(nMachL))
allocate(C81%AL(rowsL-1))
allocate(C81%AD(rowsD-1))
allocate(C81%AM(rowsL-1))
allocate(C81%CL(rowsL-1,nMachL))
allocate(C81%CD(rowsD-1,nMachD))
allocate(C81%CM(rowsL-1,nMachL))
! Specify airfoil name
C81%airfoilName = 'GA(W)-2'
! Copy values from read array to variables
C81%MaL = LMat(1,2:)
C81%MaD = DMat(1,2:)
C81%MaM = C81%MaL
C81%AL = LMat(2:,1)
C81%AD = DMat(2:,1)
C81%AM = C81%AL
do j=2,colsL
do i=2,rowsL
C81%CL(i-1,j-1) = LMat(i,j)
enddo
enddo
do j=2,colsD
do i=2,rowsD
C81%CD(i-1,j-1) = DMat(i,j)
enddo
enddo
C81%CM = C81%CL
! Write airfoil data to C81 file
call c81%writefile('Samples/output.C81')
end program demo3