You are on page 1of 3

Nama : Indah Arifka

NIM : 1407045060
Prodi : Fisika

1. Script
program Streamline
real::Koef,V0,L,Pi,temp,x,y,iin,iout,xa,xb
integer::I,J,maxstep,N,H
real,dimension (1000,1000)::V,V_kini

!write(*,*)'Masukkan Jumlah Grid :'


!read(*,*)N

open (1,file=’hasil.dat’,status=’unknown’)

!Parameter
L=1; xa=8;
V0=1; xb=10;
Pi=3.14; iin=1;
H=L/(N-1) iout=1;
Koef=Pi/L

!Kondisi Awal
do I=1,H
do J=1,H
! x=(0:N-1)*H
! y=(0:N-1)*H
V=V0*4/(Pi*sinh(Pi))*sin(Koef*x)*sinh(Koef*y)
V=V0*4/(Pi*sinh(Pi))*sin(Koef*xa)*sinh(Koef*xb)
V=V0*4/(Pi*sinh(Pi))*sin(Koef*iin)*sinh(Koef*iout)
V(I,N)=V0*V(N,1)
end do
end do

!Komputasi
! flops(0)
! V_kini=V
maxstep=N**2
do I=1,maxstep
temp=0.
end do

do I=2,(N-1)
do J=2,(N-1)
V_kini(I,J)=0.25*(V(I+1,J)+V(I-1,J)+V(I,J+1)+V(I,J-1))
temp=temp+abs(1-V(I,J)/V_kini(I,J))
end do
end do
V_kini=V
change=temp/(N-2)**2
if (change .le. -4) then
write(*,*)'Akurasi 0.0001 sudah dicapai'
else
end if

do I=1,N
write(1,*)(V(I,J),J=1,N)
end do

end program Streamline

2. Error

You might also like