|
[Fortran] 纯文本查看 复制代码 04 | integer , parameter :: nvar = 2 , nstep = 500 |
05 | real ( kind = 8 ) , dimension ( nvar ) :: ystart = [ 0.0d0 , 0.0d0 ] |
06 | real ( kind = 8 ) , dimension ( nstep ) :: xx |
07 | real ( kind = 8 ) , dimension ( nvar , nstep ) :: y , ytrue |
09 | real ( kind = 8 ) :: x 1 = 0.0d0 , x 2 = 10.0d0 |
12 | call rkdub ( Qa , xx , y , ystart , nvar , x 1 , x 2 , nstep , diff ) |
19 | integer , parameter :: n = 2 |
21 | real ( kind = 8 ) :: y ( n ) , dydx ( n ) |
22 | real ( kind = 8 ) :: Kr = 1.4 |
23 | real ( kind = 8 ) :: Pg = 5000000 |
24 | real ( kind = 8 ) :: Vg = 0.04 |
26 | real ( kind = 8 ) :: Dm = 0.00025 |
28 | real ( kind = 8 ) :: Ro = 850 |
29 | real ( kind = 8 ) :: Cd = 0.61 |
30 | real ( kind = 8 ) :: Af = 0.0005 |
37 | dydx ( 2 ) = ( Dm * ( Vg * * Kr * Pg / ( ( Vg - y ( 1 ) ) * * 1.4 ) ) - ( y ( 2 ) * y ( 2 ) * Ro * Dm * Dm * Dm ) / ( 2 * ( Cd * Af ) * ( Cd * Af ) ) - Bg * y ( 2 ) ) / Jm |
41 | subroutine ODE_RK 4 ( Qa , t , y , n , h , yout , diff ) |
45 | real ( kind = 8 ) :: Qa , t , h |
47 | real ( kind = 8 ) :: yout ( n ) |
48 | real ( kind = 8 ) :: k 1 ( n ) , k 2 ( n ) , k 3 ( n ) , k 4 ( n ) |
50 | call diff ( Qa , t , y , dydx ) !这一行出现:error #6404: This name does not have a type, and must have an explicit type. [QA] |
52 | call diff ( Qa , t +0.5d0 * h , y +0.5 * k 1 , dydx ) |
54 | call diff ( Qa , t +0.5d0 * h , y +0.5 * k 2 , dydx ) |
56 | call diff ( Qa , t + h , y + k 3 , dydx ) |
59 | yout = y + k 1 / 6.0d0 + k 2 / 3.0d0 + k 3 / 3.0d0 + k 4 / 6.0d0 |
62 | subroutine rkdub ( Qa , xx , y , ystart , nvar , x 1 , x 2 , nstep , diff ) |
64 | integer , intent ( in ) :: nvar , nstep , Qa |
65 | real ( kind = 8 ) , intent ( in ) :: x 1 , x 2 |
66 | real ( kind = 8 ) , dimension ( nvar ) , intent ( in ) :: ystart |
67 | real ( kind = 8 ) , dimension ( nstep ) , intent ( out ) :: xx |
68 | real ( kind = 8 ) , dimension ( nvar , nstep ) , intent ( out ) :: y |
79 | call ODE_RK 4 ( Qa , x , y ( : , i -1 ) , nvar , h , y ( : , i ) , diff ) |
81 | write ( * , * ) 'stepsize not significant in rkdub' |
在第12 和51行出现 error #6404: This name does not have a type, and must have an explicit type. [QA],请大神指点一下如何修改
|
|