Fortran program compiling error
I have tried everything to remove the error, but it still doesnt go. The error comes in the last do loop.
program main implicit none integer::i,nnodes,time,tmax,iter,iconv,ib real::satk,alpha,en,em,thetas,thetar,slength,delt, psiini,psitop,psibot,delz,epsilon,ndays,n2days,z(5 00),psinew(500),psiold(500),psiass(500),A(500),B(5 00)C(500),D(500),psifinal(500),thetaavail(500),the tazero(500),esatavail(500),thetares(500),esatzero( 500),kodeday(500),psires(500) open(1,file='main.dat',status='new') print *, "Enter the values of satk,alpha,en,thetas,thetar" read *, satk,alpha,en,thetas,thetar write(1,*) "Saturated conductivity=",satk,"Alpha=",alpha,"n=",en,"Satura ted MC =",thetas,"Residual MC =",thetar em=(1-(1/en)) write(1,*) "Van genuchten m =",em print *, "Enter the values of soil length, nnodes, delta T, Maximum time" read *, slength,nnodes,delt,tmax write(1,*) "Soil length=",slength,"Number of nodes=",nnodes,"Time interval=",delt,"Maximum time =",tmax delz=(slength)/(nnodes-1) write(1,*) "Node spacing is =",delz print *, "Enter the values of initial, bottom, top pressure heads" read *, psiini,psibot,psitop write(1,*) "Initial pressure head=",psiini,"Bottom pressure head=",psibot,"Top pressure head=",psitop print *, "Enter the values epsilon,ndays,n2days" read *, eepsilon,ndays,n2days write(1,*) "Prestipulated convergence factor=",eepsilon,"Number days simulation runs=",ndays,"hours of ndays=",n2days do i=1,nnodes z(i)=(nnodes-(i))*delz write(1,*) "Node spacing at node number",(nnodes+1)-i, "is=",z(i) enddo print *, "Which boundary condition you want to apply?" print *, "Enter 1 for Dirichlet boundary condition at top and bottom" print *, "Enter 2 for flux at top and gravity drainage at bottom" print *, "Enter 3 for Dirichlet at top and gravity drainage bottom" print *, "Enter 4 for flux at top and Dirichlet at bottom" read *, ib if(ib.eq.1)then do i=1,nnodes if(i.eq.1)then psiold(i)=psibot elseif(i.eq.nnodes)then psiold(i)=psitop else psiold(i)=psiini endif enddo else do i=1,nnodes if(i.eq.1)then psiold(i)=psibot else psiold(i)=psitop endif write(1,*) "Initial value of pressure head at",(nnodes+1)-i,"is",psiold(i) enddo endif do i=1,nnodes esatzero(i)=(1/(1+abs((psiold(i)*alpha))**en)**em) thetazero(i)=(((esatzero(i))*(thetas-thetar))+thetar) write(1,*) "thetazero=",thetazero(i),"esatzero=",esatzero (i) enddo close(1) end program main |
please, write the compiler error you get
|
At first:
print *, "Enter the values epsilon,ndays,n2days" read *, eepsilon,ndays,n2days But you defined epsilon, not eepsilon. Secondly the problem might be the exponential operation in the last do-loop. FORTRAN is not able to raise a negative number to a fractional power. |
All times are GMT -4. The time now is 17:12. |