program solard
implicit none
REAL TMAX, TMIN, E, TTHIRTY
INTEGER I, YEAR, DOY ,a
INTEGER ,parameter:: ndays=730
REAL B,delta,sita,R,womiga0,womiga1,womiga2,womiga3
REAL tuo0,alfa,C,b0,PAI,FAI,PZ,P0,Tfmax,q1
real b1,b2,I0,D
real, allocatable::Q0(:)
real, allocatable::Qh(:)
real, allocatable::TTMAX(:)
! NDAYS=730
tuo0=0.87
alfa=-0.000061
C=1.5
b0=0.031
b1=0.201
b2=0.185
I0=1367.0
D=86400
PAI=3.14159
FAI=38.33/(180*PAI)
PZ=90810
P0=101325
DO I=1,NDAYS
OPEN (UNIT = 9, FILE = '\B90V3\DAT\SOLARDFILE.DAT')
rewind(9)
READ (9, *) YEAR, DOY, TMAX, TMIN, E, TTHIRTY
enddo
Allocate( Q0( ndays ) )
Allocate( Qh( ndays ) )
Allocate( TTMAX( ndays ) )
DO I=1,NDAYS
!TTHIRTY 30日平均温差
delta=23.45*PAI/(180*sin(2*PAI*(284+i)/365))
sita=2*PAI*i/365
R=1.000109+0.033494*cos(sita)+0.001472*sin(sita)
R=R+0.000768*cos(2*sita)+0.000079*sin(2*sita)
womiga0=ABS(acos(-tan(delta)*tan(fai)))
q1=womiga0*sin(fai)*sin(delta)+cos(fai)*cos(delta)*sin(womiga0)
q0=q1*I0*D/(PAI*R*R)
womiga3=0
DO A=1,100
womiga1=-womiga0+womiga0/100+womiga0*a/50
womiga2=sin(fai)*sin(delta)+cos(fai)*cos(delta)*cos(womiga1)
womiga3=womiga3+(womiga2*tuo0**(PZ/(P0*womiga2)))*womiga0/50
ENDDO
Ttmax=womiga3/(q0*2*PAI*R*R/I0/D)+alfa*e*1000;
B=b0+b1*exp(-b2* TTHIRTY);
Tfmax=1.0-0.9*exp(-B*(Tmax-Tmin)**(C));
Qh=q0*Ttmax*Tfmax/1000000;
ENDDO
open(2,file='QH.dat')
do I=1,ndays-1
write(2,'(i4,2x,f15.1,f6.1,f15.1)') I,Q0(I),TTMAX(I),QH(I)
enddo
CLOSE(2)
END
DO I=1,NDAYS
OPEN (UNIT = 9, FILE = '\B90V3\DAT\SOLARDFILE.DAT')
rewind(9)
READ (9, *) YEAR, DOY, TMAX, TMIN, E, TTHIRTY
enddo
OPEN (UNIT = 9, FILE = '\B90V3\DAT\SOLARDFILE.DAT')
DO I=1,NDAYS
!TTHIRTY 30日平均温差
READ (9, *) YEAR, DOY, TMAX, TMIN, E, TTHIRTY
! 计算
END DO
Close( 9 )
vvt 发表于 2015-8-20 16:04
DO I=1,NDAYS
OPEN (UNIT = 9, FILE = '\B90V3\DAT\SOLARDFILE.DAT')
...
program solard
implicit none
REAL TMAX, TMIN, E, TTHIRTY
INTEGER I, YEAR, DOY ,a
INTEGER ,parameter:: ndays=730
REAL B,delta,sita,R,womiga0,womiga1,womiga2,womiga3
REAL tuo0,alfa,C,b0,PAI,FAI,PZ,P0,Tfmax,q1
real b1,b2,I0,D
real, allocatable::Q0(:)
real, allocatable::Qh(:)
real, allocatable::TTMAX(:)
! NDAYS=730
tuo0=0.87
alfa=-0.000061
C=1.5
b0=0.031
b1=0.201
b2=0.185
I0=1367.0
D=86400
PAI=3.14159
FAI=38.33/(180*PAI)
PZ=90810
P0=101325
!38.33是样地纬度
OPEN (UNIT = 9, FILE = '\B90V3\DAT\SOLARDFILE.DAT')
DO I=1,NDAYS
rewind(9)
READ (9, *) YEAR, DOY, TMAX, TMIN, E, TTHIRTY
enddo
close(9)
Allocate( Q0( ndays ) )
Allocate( Qh( ndays ) )
Allocate( TTMAX( ndays ) )
DO I=1,NDAYS
!TTHIRTY 30日平均温差
delta=23.45*PAI/(180*sin(2*PAI*(284+i)/365))
sita=2*PAI*i/365
R=1.000109+0.033494*cos(sita)+0.001472*sin(sita)
R=R+0.000768*cos(2*sita)+0.000079*sin(2*sita)
womiga0=ABS(acos(-tan(delta)*tan(fai)))
q1=womiga0*sin(fai)*sin(delta)+cos(fai)*cos(delta)*sin(womiga0)
q0=q1*I0*D/(PAI*R*R)
womiga3=0
DO A=1,100
womiga1=-womiga0+womiga0/100+womiga0*a/50
womiga2=sin(fai)*sin(delta)+cos(fai)*cos(delta)*cos(womiga1)
womiga3=womiga3+(womiga2*tuo0**(PZ/(P0*womiga2)))*womiga0/50
ENDDO
Ttmax=womiga3/(q0*2*PAI*R*R/I0/D)+alfa*e*1000;
B=b0+b1*exp(-b2* TTHIRTY);
Tfmax=1.0-0.9*exp(-B*(Tmax-Tmin)**(C));
Qh=q0*Ttmax*Tfmax/1000000;
ENDDO
open(2,file='QH.dat')
do I=1,ndays-1
write(2,'(i4,2x,f15.1,f6.1,f15.1)') I,Q0(I),TTMAX(I),QH(I)
enddo
CLOSE(2)
END
program solard
implicit none
REAL TMAX, TMIN, E, TTHIRTY
INTEGER I, YEAR, DOY ,a
INTEGER ,parameter:: ndays=730
REAL B,delta,sita,R,womiga0,womiga1,womiga2,womiga3
REAL tuo0,alfa,C,b0,PAI,FAI,PZ,P0,Tfmax,q1
real b1,b2,I0,D
real, allocatable::Q0(:)
real, allocatable::Qh(:)
real, allocatable::TTMAX(:)
! NDAYS=730
tuo0=0.87
alfa=-0.000061
C=1.5
b0=0.031
b1=0.201
b2=0.185
I0=1367.0
D=86400
PAI=3.14159
FAI=38.33/(180*PAI)
PZ=90810
P0=101325
!!!DO I=1,NDAYS
OPEN (UNIT = 9, FILE = '\B90V3\DAT\SOLARDFILE.DAT')
!! rewind(9)
!! READ (9, *) YEAR, DOY, TMAX, TMIN, E, TTHIRTY
!! enddo
Allocate( Q0( ndays ) )
Allocate( Qh( ndays ) )
Allocate( TTMAX( ndays ) )
DO I=1,NDAYS
!TTHIRTY 30日平均温差
READ (9, *) YEAR, DOY, TMAX, TMIN, E, TTHIRTY !////// 加到这里
delta=23.45*PAI/(180*sin(2*PAI*(284+i)/365))
sita=2*PAI*i/365
R=1.000109+0.033494*cos(sita)+0.001472*sin(sita)
R=R+0.000768*cos(2*sita)+0.000079*sin(2*sita)
womiga0=ABS(acos(-tan(delta)*tan(fai)))
q1=womiga0*sin(fai)*sin(delta)+cos(fai)*cos(delta)*sin(womiga0)
q0(i)=q1*I0*D/(PAI*R*R)
womiga3=0
DO A=1,100
womiga1=-womiga0+womiga0/100+womiga0*a/50
womiga2=sin(fai)*sin(delta)+cos(fai)*cos(delta)*cos(womiga1)
womiga3=womiga3+(womiga2*tuo0**(PZ/(P0*womiga2)))*womiga0/50
ENDDO
Ttmax(i)=womiga3/(q0(i)*2*PAI*R*R/I0/D)+alfa*e*1000;
B=b0+b1*exp(-b2* TTHIRTY);
Tfmax=1.0-0.9*exp(-B*(Tmax-Tmin)**(C));
Qh(i)=q0(i)*Ttmax(i)*Tfmax/1000000;
ENDDO
open(2,file='QH.dat')
do I=1,ndays-1
write(2,'(i4,2x,f15.1,f6.1,f15.1)') I,Q0(I),TTMAX(I),QH(I)
enddo
CLOSE(2)
END
微信截图_20150821095334.png (49.17 KB, 下载次数: 1)
vvt 发表于 2015-8-20 16:39
你改得不对
[mw_shl_code=fortran,true]
22.45 KB, 下载次数: 2
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |