When I make a compile. the output shows me the following error:
-REAL cannot be declared inside labelled DO block (perhaps missing CONTAINS or END statement?)
Can any one help me with this problem?
Thank you!
Below is my code:
program researchwork
implicit none
integer, parameter :: ikind=selected_real_kind(p=15)
REAL (kind=ikind) :: nI,f10,f20,f30,f1,previousf1,f2,f3,phi1,previousphi1,phi2,phi10,phi20,n,H,smallnumber,error1,error2,Pr
REAL (kind=ikind) :: df1(1:4),df2(1:4),df3(1:4),dphi1(1:4),dphi2(1:4)
f10=0
f20=0
f30=2.0
phi10=1.0
phi20=1.0
nI=0
Pr=10.0
H=0.1
f1=f10
previousf1=0.0
f2=f20
f3=f30
phi1=phi10
previousphi1=0.0
phi2=phi20
smallnumber = 10.0_ikind**(-15.0)
do 10 n=nI,100,H
WRITE (2,*) n,f1,f2,f3,phi1,phi2,M1(f1,f2,f3,phi1,n),M2(f1,phi2,n)
df1(1)=H*f2
df2(1)=H*f3
df3(1)=H*M1(f1,f2,f3,phi1,n)
dphi1(1)=H*phi2
dphi2(1)=H*M2(f1,phi2,n)
df1(2)=H*(f2+df2(1)/2)
df2(2)=H*(f3+df3(1)/2)
df3(2)=H*M1(n + H/2,f1+df1(1)/2,f2+df2(1)/2,f3+df3(1)/2,phi1+dphi1(1)/2)
dphi1(2)=H*(phi2+dphi2(1)/2)
dphi2(2)=H*M2(n+H/2,f1+df1(1)/2,phi2+dphi2(1)/2)
df1(3)=H*(f2+df2(2)/2)
df2(3)=H*(f3+df3(2)/2)
df3(3)=H*M1(n + H/2,f1+df1(2)/2,f2+df2(2)/2,f3+df3(2)/2,phi1+dphi1(2)/2)
dphi1(3)=H*(phi2+dphi2(2)/2)
dphi2(3)=H*M2(n+H/2,f1+df1(2)/2,phi2+dphi2(2)/2)
df1(4)=H*(f2+df2(3))
df2(4)=H*(f3+df3(3))
df3(4)=H*M1(n + H,f1+df1(3),f2+df2(3),f3+df3(3),phi1+dphi1(3))
dphi1(4)=H*(phi2+dphi2(3))
dphi2(4)=H*M2(n+H,f1+df1(3),phi2+dphi2(3))
f1=f1+(df1(1)+2.0*df1(2)+2.0*df1(3)+df1(4))/6.0
f2=f2+(df2(1)+2.0*df2(2)+2.0*df2(3)+df2(4))/6.0
f3=f3+(df3(1)+2.0*df3(2)+2.0*df3(3)+df3(4))/6.0
phi1=phi1+(dphi1(1)+2.0*dphi1(2)+2.0*dphi1(3)+dphi1(4))/6.0
phi2=phi2+(dphi2(1)+2.0*dphi2(2)+2.0*dphi2(3)+dphi2(4))/6.0
error1=abs(f1-previousf1)
error2=abs(phi1-previousphi1)
if (error1<smallnumber .and. error2<smallnumber) then
print*,'f1 ',f1,'phi1 ',phi1
exit
end if
previousf1=f1
previousphi1=phi1
CONTINUE
REAL FUNCTION M1(n,f1,f2,f3,phi1)
REAL n,f1,f2,f3,phi1
M1=-3*f1*f3+2*f2*f2-phi1
end
REAL FUNCTION M2(n,f1,phi2)
REAL n,f1,phi2
M2=-3*Pr*f1*phi2
end
end program researchwork
-REAL cannot be declared inside labelled DO block (perhaps missing CONTAINS or END statement?)
Can any one help me with this problem?
Thank you!
Below is my code:
program researchwork
implicit none
integer, parameter :: ikind=selected_real_kind(p=15)
REAL (kind=ikind) :: nI,f10,f20,f30,f1,previousf1,f2,f3,phi1,previousphi1,phi2,phi10,phi20,n,H,smallnumber,error1,error2,Pr
REAL (kind=ikind) :: df1(1:4),df2(1:4),df3(1:4),dphi1(1:4),dphi2(1:4)
f10=0
f20=0
f30=2.0
phi10=1.0
phi20=1.0
nI=0
Pr=10.0
H=0.1
f1=f10
previousf1=0.0
f2=f20
f3=f30
phi1=phi10
previousphi1=0.0
phi2=phi20
smallnumber = 10.0_ikind**(-15.0)
do 10 n=nI,100,H
WRITE (2,*) n,f1,f2,f3,phi1,phi2,M1(f1,f2,f3,phi1,n),M2(f1,phi2,n)
df1(1)=H*f2
df2(1)=H*f3
df3(1)=H*M1(f1,f2,f3,phi1,n)
dphi1(1)=H*phi2
dphi2(1)=H*M2(f1,phi2,n)
df1(2)=H*(f2+df2(1)/2)
df2(2)=H*(f3+df3(1)/2)
df3(2)=H*M1(n + H/2,f1+df1(1)/2,f2+df2(1)/2,f3+df3(1)/2,phi1+dphi1(1)/2)
dphi1(2)=H*(phi2+dphi2(1)/2)
dphi2(2)=H*M2(n+H/2,f1+df1(1)/2,phi2+dphi2(1)/2)
df1(3)=H*(f2+df2(2)/2)
df2(3)=H*(f3+df3(2)/2)
df3(3)=H*M1(n + H/2,f1+df1(2)/2,f2+df2(2)/2,f3+df3(2)/2,phi1+dphi1(2)/2)
dphi1(3)=H*(phi2+dphi2(2)/2)
dphi2(3)=H*M2(n+H/2,f1+df1(2)/2,phi2+dphi2(2)/2)
df1(4)=H*(f2+df2(3))
df2(4)=H*(f3+df3(3))
df3(4)=H*M1(n + H,f1+df1(3),f2+df2(3),f3+df3(3),phi1+dphi1(3))
dphi1(4)=H*(phi2+dphi2(3))
dphi2(4)=H*M2(n+H,f1+df1(3),phi2+dphi2(3))
f1=f1+(df1(1)+2.0*df1(2)+2.0*df1(3)+df1(4))/6.0
f2=f2+(df2(1)+2.0*df2(2)+2.0*df2(3)+df2(4))/6.0
f3=f3+(df3(1)+2.0*df3(2)+2.0*df3(3)+df3(4))/6.0
phi1=phi1+(dphi1(1)+2.0*dphi1(2)+2.0*dphi1(3)+dphi1(4))/6.0
phi2=phi2+(dphi2(1)+2.0*dphi2(2)+2.0*dphi2(3)+dphi2(4))/6.0
error1=abs(f1-previousf1)
error2=abs(phi1-previousphi1)
if (error1<smallnumber .and. error2<smallnumber) then
print*,'f1 ',f1,'phi1 ',phi1
exit
end if
previousf1=f1
previousphi1=phi1
CONTINUE
REAL FUNCTION M1(n,f1,f2,f3,phi1)
REAL n,f1,f2,f3,phi1
M1=-3*f1*f3+2*f2*f2-phi1
end
REAL FUNCTION M2(n,f1,phi2)
REAL n,f1,phi2
M2=-3*Pr*f1*phi2
end
end program researchwork