回答編集履歴
2
コードの訂正
test
CHANGED
@@ -54,21 +54,21 @@
|
|
54
54
|
|
55
55
|
do current_nstep = 1, total_nstep
|
56
56
|
|
57
|
-
|
57
|
+
if(current_nstep==1)then
|
58
58
|
|
59
59
|
open (17, file='array.csv', status='old')
|
60
60
|
|
61
61
|
read (17, '()') ! ヘッダ行の読み飛ばし
|
62
62
|
|
63
|
-
|
63
|
+
do i = 1, total_nstep
|
64
64
|
|
65
|
-
|
65
|
+
read (17, *) pressure
|
66
66
|
|
67
67
|
n_array(i) = pressure !配列のi番目にcsvファイルのi番目を格納
|
68
68
|
|
69
|
-
|
69
|
+
end do
|
70
70
|
|
71
|
-
|
71
|
+
close (17)
|
72
72
|
|
73
73
|
direchlet_pressure = n_array(1)
|
74
74
|
|
@@ -76,7 +76,7 @@
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
-
|
79
|
+
else
|
80
80
|
|
81
81
|
direchlet_pressure = n_array(current_nstep)
|
82
82
|
|
1
コードの訂正
test
CHANGED
@@ -12,13 +12,13 @@
|
|
12
12
|
|
13
13
|
integer ntcabs
|
14
14
|
|
15
|
-
integer :: nstep = 100
|
15
|
+
integer :: total_nstep = 100
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
do ntcabs = 1, nstep
|
19
|
+
do ntcabs = 1, total_nstep
|
20
20
|
|
21
|
-
call readcsv(ntcabs)
|
21
|
+
call readcsv(ntcabs,total_nstep)
|
22
22
|
|
23
23
|
end do
|
24
24
|
|
@@ -32,53 +32,53 @@
|
|
32
32
|
|
33
33
|
!======================================================================================
|
34
34
|
|
35
|
-
subroutine readcsv(nstep)
|
35
|
+
subroutine readcsv(current_nstep,total_nstep)
|
36
36
|
|
37
37
|
implicit none
|
38
38
|
|
39
|
+
integer i, current_nstep
|
40
|
+
|
41
|
+
integer :: total_nstep
|
39
42
|
|
40
43
|
|
41
|
-
integer nstep
|
42
44
|
|
43
|
-
real pressure
|
45
|
+
real pressure, direchlet_pressure
|
44
|
-
|
45
|
-
integer i
|
46
46
|
|
47
47
|
real, save :: n_array(100)
|
48
48
|
|
49
|
-
real direchlet_pressure
|
50
|
-
|
51
|
-
integer :: n = 100
|
52
49
|
|
53
50
|
|
54
51
|
|
55
|
-
open (17, file='array.csv', status='old')
|
56
|
-
|
57
|
-
read (17, '()') ! ヘッダ行の読み飛ばし
|
58
|
-
|
59
|
-
do i = 1, n
|
60
|
-
|
61
|
-
read (17, *) pressure
|
62
|
-
|
63
|
-
n_array(i) = pressure !配列のi番目にcsvファイルのi番目を格納
|
64
|
-
|
65
|
-
end do
|
66
|
-
|
67
|
-
close (17)
|
68
52
|
|
69
53
|
|
70
54
|
|
71
|
-
do nstep = 1, n
|
55
|
+
do current_nstep = 1, total_nstep
|
72
56
|
|
73
|
-
if(nstep==1)then
|
57
|
+
if(current_nstep==1)then
|
58
|
+
|
59
|
+
open (17, file='array.csv', status='old')
|
60
|
+
|
61
|
+
read (17, '()') ! ヘッダ行の読み飛ばし
|
62
|
+
|
63
|
+
do i = 1, total_nstep
|
64
|
+
|
65
|
+
read (17, *) pressure
|
66
|
+
|
67
|
+
n_array(i) = pressure !配列のi番目にcsvファイルのi番目を格納
|
68
|
+
|
69
|
+
end do
|
70
|
+
|
71
|
+
close (17)
|
74
72
|
|
75
73
|
direchlet_pressure = n_array(1)
|
76
74
|
|
77
75
|
print *,direchlet_pressure !出力したい配列要素
|
78
76
|
|
77
|
+
|
78
|
+
|
79
79
|
else
|
80
80
|
|
81
|
-
direchlet_pressure = n_array(nstep)
|
81
|
+
direchlet_pressure = n_array(current_nstep)
|
82
82
|
|
83
83
|
print *,direchlet_pressure !出力したい配列要素
|
84
84
|
|