-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo2.f90
56 lines (42 loc) · 1.15 KB
/
demo2.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
! This demo program reads the naca6403_Re20k.csv and writes it to
! an output file naca6403_Re20k.C81. Both files are in the Samples/ directory.
program demo2
use libC81
implicit none
integer, parameter :: rows = 19
integer, parameter :: cols = 4
integer, parameter :: nMach = cols-1
integer :: i,j
type(C81_class) :: C81
real, dimension(rows,cols) :: A
! Read airfoil data from CSV file
A=getTable('Samples/NACA6409.csv',rows,cols)
! Allocate arrays
allocate(C81%MaL(nMach))
allocate(C81%MaD(nMach))
allocate(C81%MaM(nMach))
allocate(C81%AL(rows-1))
allocate(C81%AD(rows-1))
allocate(C81%AM(rows-1))
allocate(C81%CL(rows-1,nMach))
allocate(C81%CD(rows-1,nMach))
allocate(C81%CM(rows-1,nMach))
! Specify airfoil name
C81%airfoilName = 'NACA6409'
! Copy values from read array to variables
C81%MaL = A(1,2:)
C81%MaD = C81%MaL
C81%MaM = C81%MaL
C81%AL = A(2:,1)
C81%AD = C81%AL
C81%AM = C81%AL
do j=2,cols
do i=2,rows
C81%CL(i-1,j-1) = A(i,j)
enddo
enddo
C81%CD = C81%CL
C81%CM = C81%CL
! Write airfoil data to C81 file
call c81%writefile('Samples/NACA6409.C81')
end program demo2