jeudi 17 juin 2021

Using a simple code in Fortran structure ( DO & IF)

I want to use the if (....) then and elseif (....) then in a Do loop. However, I am not sure about the structure and its possibilities. Could anyone please help me with this simple code?

      Do i=0,1000,1
          T(i)=t-(i*TI)
          if (z(i) .EQ. 0.00) then
              z(i+1)=v*T(i)
          elseif (z(i) .EQ. A) then
              z(i+1)=A-v*T(i)
          endif   
          r1=sqrt(x**2+(z-z(i))**2)
          flux(1)=((alpha*p)/(d*pi*r0**2))*exp(-(r1**2/r0**2))
          flux(2)=0 
      end do

Aucun commentaire:

Enregistrer un commentaire