Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28757 Discussions

Error #6274 while running fortran code

andreanto__prima
Beginner
911 Views

Hi, iam newbie in programming especially in fortran. i have a code from my lecturer like this :

program Source1
	implicit none
c	include 'head.h'
	integer lx,ly
	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l

 	integer t_max,time,k
! This array defines which lattice positions are occupied by fluid
! nodes (obst=0)
! or solid nodes (obst=1)
	integer obst(lx,ly)
! Velocity components
	real*8 u_x(lx,ly),u_y(lx,ly)
! Pressure and density
	real*8 p(lx,ly),rho(lx,ly)
! The real fluid density
! which may differ from the velocity components in the above; refer
! toSCmodel
	real*8 upx(lx,ly),upy(lx,ly)
! The force components: Fx, Fy for the interaction between
! fluid nodes.
! Sx, Sy are the interaction (components) between the fluid nodes
! and solid nodes
! ff is the distribution function
	real*8 ff(0:8,lx,ly),Fx(lx,ly),Fy(lx,ly),Sx(lx,ly),Sy(lx,ly)
! TT0W is the value of T/T0; RHW and RLW are the coexisting
! densities
! in the specified T/T0.
! For initialization, \rho_l (lower density)
! and \rho_h (higher density) are supposed to be known.
	real*8 TT0W(12), RHW(12), RLW(12)
!-------------------------------------------! Author: Haibo Huang, Huanghb@ustc.edu.cn
!-------------------------------------------! The below data define the D2Q9 velocity model, xc(ex), yc(ey),
! 
! are the components of e_{ix}, e_{iy},, respectively.
	data xc/0.d0, 1.d0, -1.d0, 0.d0, 0.d0, 1.d0, -1.d0, -1.d0, 1.d0 / 
	data yc/0.d0, 0.d0, 0.d0, 1.d0, -1.0d0, 1.d0, 1.d0, -1.d0, -1.d0 /
	data ex/0, 1, -1, 0, 0, 1, -1, -1, 1 / 
      data ey/0, 0, 0, 1, -1, 1, 1, -1, -1 /
	
! This array gives the opposite direction for e_1, e_2, e_3,
! .....e_18
! It implements the simple bounce-back rule we use in the collision
! step
! for solid nodes (obst=1)
	data opp/2,1,4,3,7,8,5,6/
!C-SEOS
! RHW and RLW are the coexisting densities in the corresponding
! specified T/T0.
	data TT0W/0.975d0, 0.95d0, 0.925d0, 0.9d0, 0.875d0, 0.85d0,
     &0.825d0, 0.8d0, 0.775d0, 0.75d0, 0.7d0, 0.65d0/
	data RHW/0.16d0, 0.196084839d0, 0.23d0,0.228020456692401d0,
     &0.265d0,0.279d0,0.29d0, 0.314d0, 0.30d0, 0.33d0, 0.36d0, 0.38d0/
	data RLW/0.08d0,0.066227359d0,0.05d0, 0.0449597449711991d0,
     &0.038d0, 0.032d0,0.025d0, 0.0245d0, 0.02d0, 0.015d0, 0.009d0,
     &0.006d0/
! Speeds and weighting factors
	cc=1.d0
	c_squ=cc*cc/3.d0
	t_0 = 4.d0 / 9.d0
	t_1 = 1.d0 / 9.d0
	t_2 = 1.d0 / 36.d0
! Weighting coefficient in the equilibrium distribution function
	t_k(0) = t_0
	do 1 k =1,4
	t_k(k) = t_1
1	continue
	do 2 k =5,8
	t_k(k) = t_2
2	continue
! Please specify which temperature
! and corresponding \rho_h, \rho_l in above ’data’ are chosen.
! Initial T/T0, rho_h, and rho_l for the C-S EOS are listed in above
! ’data’ section
	k = 4 ! important
	TT0 = TT0W(k)
	rho_h = RHW(k)
	rho_l = RLW(k)
c=====================================================================
c Initialisation
c=====================================================================
	write (6,*) '@@@??2D LBM for single component multiphase @@@'
	write (6,*) '@@@ lattice size lx = ',lx
	write (6,*) '@@@ ly = ',ly
	call rparam(t_max)
	call robst(obst)
	call indens(obst,u_x,u_y,rho,ff)
	open(40,file='d:\TM\Kuliah\8\SKRIPSI\LBM\D2Q9\joh.txt')
!c=====================================================================
! Begin iterations
	do 100 time = 1, t_max
	if ( mod(time,Nwri) .eq. 0 .or. time .eq. 1) then
	write(*,*) time
	call resul2(obst,rho,p,upx,upy,time)
	end if
	call stream(obst,ff ) ! streaming (propagation) step
! Obtain the macro variables
	call getuv(obst,u_x ,u_y, rho, ff )
! Calculate the actual velocity
	call calcup(obst,u_x,u_y,Fx,Fy,Sx,Sy,rho, upx,upy)
! Calculate the interaction force between fluid nodes,
! and the interaction force between solid and fluid nodes.
	call calFxy(obst,rho,Fx,Fy,Sx,Sy,p)
! BGK model (a single relaxation parameter) is used
	call collis(tau,obst,u_x,u_y,rho ,ff ,Fx ,Fy ,Sx,Sy ) ! collision step ,
100	continue
!c=====End of the main loop
	close(40)
	write (6,*) '@@@@** end **@@@@'
	end



!c-------------------------------------
	subroutine rparam(t_max)
	implicit none
c	include "head.inc"

	integer lx,ly
 	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l


	integer t_max					 
	real*8 visc
	open(1,file='d:\TM\Kuliah\8\SKRIPSI\LBM\D2Q9\params1.in')
! Initial radius of the droplet.
	read(1,*) RR
! \rho_w in calculation of fluid-wall interaction
	read(1,*) rho_w
! Relaxation parameter, which is related to viscosity
	read(1,*) tau
! Maximum iteration specified
	read(1,*) t_max
! Output data frequency (can be viewed with TECPLOT)
	read(1,*) Nwri
	close(1)
	visc =c_squ*(tau-0.5)
	write (*,'("kinematic viscosity=",f12.5, "lu^2/ts",2X, "tau=", 
     &f12.7)') visc, tau
	end
!---------------------------------------------------! Initialize which nodes are wall node (obst=1) and
! which are fluid nodes (obst=0)
	subroutine robst(obst)
	implicit none
c	include "head.inc"

	integer lx,ly
 	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l




	integer x,y,z,obst(lx,ly)
	do 10 y = 1, ly
	do 40 x = 1,lx
	obst(x,y) = 0
	if(y .eq. 1) obst(x,1) = 1
40	continue
10	continue
	end
!--------------------------------------------------
	subroutine indens(obst,u_x,u_y,rho,ff)
	implicit none
c	include "head.inc"

	integer lx,ly
 	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l



	integer i,j,x,y,k,n,obst(lx,ly)
	real*8 u_squ,u_n(0:8),fequi(0:8),u_x(lx,ly),u_y(lx,ly),rho(lx,ly),
     &ff(0:8,lx,ly)
	do 11 y = 1, ly
	do 10 x = 1,lx
	u_x(x,y) = 0.d0
	u_y(x,y) = 0.d0
	rho(x,y) = rho_l
	if(real(x-lx/2)**2+real(y-5)**2< RR**2) then
	rho(x,y) = rho_h
	endif
10	continue
11	continue
	
      
	do 81 y = 1,ly
	do 80 x = 1,lx
	u_squ = u_x(x,y)*u_x(x,y) + u_y(x,y)*u_y(x,y)
	
	do 60 k = 0,8
	u_n(k) = xc(k)*u_x(x,y) + yc(k)*u_y(x,y)
	
	fequi(k) = t_k(k)* rho(x,y) * ( cc*u_n(k) / c_squ
     & + (u_n(k)*cc) *(u_n(k)*cc) / (2.d0 * c_squ *c_squ)
     & - u_squ / (2.d0 * c_squ)) + t_k(k) * rho(x,y)
	ff(k,x,y)= fequi(k)
60	continue
80	continue
81	continue

	end
!---------------------------------------------------streamcollision.for
!c===========================================================
	subroutine stream(obst,ff)
	implicit none
c	include "head.inc"

	integer lx,ly
      PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l


	integer k,obst(lx,ly)
	real*8 ff(0:8,lx,ly),f_hlp(0:8,lx,ly)
	integer x,y,x_e,x_w,y_n,y_s

	do 11 y = 1,ly
	do 10 x = 1,lx
!
	
	y_n = mod(y,ly) + 1
	x_e = mod(x,lx) + 1
	
	y_s = ly - mod(ly + 1 - y, ly)
	x_w = lx - mod(lx + 1 - x, lx)
c......... Propagation
	f_hlp(1 ,x_e,y ) = ff(1,x,y)
	f_hlp(2 ,x_w,y ) = ff(2,x,y)
	f_hlp(3 ,x ,y_n ) = ff(3,x,y)
	f_hlp(4 ,x ,y_s ) = ff(4,x,y)
	f_hlp(5 ,x_e ,y_n) = ff(5,x,y)
	f_hlp(6 ,x_w ,y_n) = ff(6,x,y)
	f_hlp(7 ,x_w,y_s) = ff(7,x,y)
	f_hlp(8 ,x_e,y_s ) = ff(8,x,y)
	
10	continue
11	continue

c---------------------Update distribution function
	
	do 21 y = 1, ly
	do 20 x = 1, lx
	do k = 1, 8
	ff(k,x,y) = f_hlp(k,x,y)
	enddo
20	continue
21	continue
	
	return
	end
!c-----------------------------------------
	subroutine getuv(obst,u_x,u_y,rho,ff)
c	include "head.inc"
	integer lx,ly
	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey,ez, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l

	integer x,y,obst(lx,ly)
	real*8 u_x(lx,ly),u_y(lx,ly),rho(lx,ly),
     & ff(0:8,lx,ly)
	
	do 11 y = 1,ly
	do 10 x = 1,lx
	rho(x,y) = 0.d0
	if(obst(x,y) .eq. 0 ) then
	do 5 k=0,8
	rho(x,y) = rho(x,y) + ff(k,x,y)
5	continue
c----------------------
	if(rho(x,y) .ne. 0.d0) then
	u_x(x,y)=(ff(1,x,y)+ ff(5,x,y)+ ff(8,x,y)
     &-(ff(2,x,y) + ff(6,x,y) + ff(7,x,y) ))/rho(x,y)
	u_y(x,y) = (ff(3,x,y) + ff(5,x,y) + ff(6,x,y)
     &-(ff(4,x,y) + ff(8,x,y) + ff(7,x,y) )) /rho(x,y)
	
	endif
	endif
10	continue
11	continue

	end
!c-----------------------------------------
	subroutine calcup(obst,u_x,u_y,Fx,Fy,Sx,Sy,rho,upx,upy)
	implicit none
c	include "head.inc"
	integer lx,ly
 	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l


	integer x,y ,obst(lx,ly)
	real*8 u_x(lx,ly),u_y(lx,ly),rho(lx,ly), upx(lx,ly), upy(lx,ly),
     &Fx(lx,ly), Fy(lx,ly),
     &Sx(lx,ly), Sy(lx,ly)
	
	do 10 y = 1, ly
	do 11 x=1,lx
	if(obst(x,y) .eq. 0) then
	upx(x,y) = u_x(x,y) + (Fx(x,y)+Sx(x,y))/2.d0/ rho(x,y)
	upy(x,y) = u_y(x,y) + (Fy(x,y)+Sy(x,y))/2.d0/ rho(x,y)
	
	else
	upx(x,y) = u_x(x,y)
	upy(x,y) = u_y(x,y)
	
	endif
11	continue
10	continue

	end
!c-----------------------------------------
	subroutine collis(tauc,obst,u_x,u_y,rho,ff,Fx,Fy, Sx, Sy)
!
	implicit none
c	include "head.inc"

	integer lx,ly
 	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l



	integer l,obst(lx,ly)
	real*8 u_x(lx,ly),u_y(lx,ly),ff(0:8,lx,ly),rho(lx,ly)
	real*8 Fx(lx,ly),Fy(lx,ly), Sx(lx,ly), Sy(lx,ly)
	real*8 temp(8)
	integer x,y,k
	real*8 u_n(0:8),fequ(0:8),fequ2(0:8),u_squ,tauc,ux,uy
	
	do 5 y = 1,ly
	do 6 x = 1,lx
	if(obst(x,y) .eq. 1) then
	do k =1, 8
	temp(k) =ff(k,x,y)
	enddo
	do k =1,8
	ff(opp(k),x,y) = temp(k)
	enddo
	endif
	if(obst(x,y) .eq. 0) then
	ux = u_x(x,y) +tauc * ( Fx(x,y)+Sx(x,y) ) / rho(x,y)
	uy = u_y(x,y) +tauc * ( Fy(x,y)+Sy(x,y) ) / rho(x,y)
	
	u_squ=ux*ux+uy*uy
	do 10 k = 0,8
c...........Equillibrium distribution function
	u_n(k) = xc(k)*ux + yc(k)*uy 
	fequ(k) = t_k(k)* rho(x,y) * ( cc*u_n(k) / c_squ
     &+ (u_n(k)*cc) *(u_n(k)*cc) / (2.d0 * c_squ *c_squ)
     & - u_squ / (2.d0 * c_squ)) + t_k(k) * rho(x,y)
c...........Collision step
	ff(k,x,y) = fequ(k) + (1.d0-1.d0/tauc)*(ff(k,x,y) -fequ(k))
10	continue
	endif
6	continue
5	continue

	end
!c-----------------------------------------
	subroutine getf_equ(rh,u,v,f_equ)
c	include ’head.inc’

	integer lx,ly
 	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l


	real*8 rh, u,v,u_squ, f_equ(0:8),u_n(0:8)
	u_squ =u*u +v*v
	do 10 i =0,8
	u_n(i) = u *xc(i) +v *yc(i)
	f_equ(i) = t_k(i) * rh *( u_n(i)/c_squ
     &+ u_n(i) *u_n(i) / (2.d0 * c_squ *c_squ)
     &- u_squ / (2.d0 * c_squ)) + t_k(i) * rh
10    continue
	end
!force.for
!c===========================================================
	  subroutine calFxy(obst,rho,Fx,Fy,Sx,Sy,p)
	  implicit none
c	include "head.inc"

      integer lx,ly
	  PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l

	integer x,y,z,obst(lx,ly),yn,yp,xn,xp, i,j,k
	real*8 Fx(lx,ly),Fy(lx,ly),psx(lx,ly), sum_x, sum_y, psx_w
     & ,rho(lx,ly), Sx(lx,ly), Sy(lx,ly)
     % , Fztemp, R,a,b, Tc, TT, alfa, omega, G1,p(lx,ly)
! Parameters in YUAN C-S EOS
	R =1.0d0
	b=4.d0
	a=1.d0
	Tc = 0.3773d0*a/(b*R)
	TT= TT0 *Tc
	
	do 5 j = 1,ly
	do 6 i = 1,lx
	if (obst(i,j ) .eq. 0 .and. rho(i,j).ne. 0.d0) then
	if( (R*TT*(1.d0+(4.d0* rho(i,j)-2.d0* rho(i,j)* rho(i,j)
     &)/(1.d0- rho(i,j))**3 )
     % -a* rho(i,j) -1.d0/3.d0) .gt. 0.) then
	G1= 1.d0/3.d0
	else
	G1= -1.d0/3.d0
	endif
c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	psx(i,j) = sqrt( 6.d0* rho(i,j) * ( R*TT*
     &(1.d0+ (4.d0* rho(i,j)-2.d0*rho(i,j)*rho(i,j) )
     &/(1.d0-rho(i,j))**3 )
     &-a* rho(i,j) -1.d0/3.d0)
     &/G1)
c Yuan C-S EOS
	p(i,j) = rho(i,j)/3.d0 + G1/6.d0 * psx(i,j) *psx(i,j)
	endif
6	continue
5	continue

	psx_w = sqrt( 6.d0* rho_w * ( R*TT*
     & (1.d0+ (4.d0* rho_w-2.d0*rho_w * rho_w )
     & /(1.d0- rho_w)**3 )
     & -a* rho_w -1.d0/3.d0)
     &/G1)
	
	do 20 y=1,ly
	do 10 x = 1,lx
c.........interaction between neighbouring with periodic boundaries
	Fx(x,y) =0.d0
	Fy(x,y) =0.d0

	if (obst(x,y) .eq. 0) then
	sum_x = 0.d0
	sum_y = 0.d0
	
	do 11 k=1,8
	xp=x+ex(k)
	yp=y+ey(k)
	
	if(xp .lt. 1) xp = lx
	if(xp .gt. lx) xp =1
	if(yp .lt. 1) yp = ly
	if(yp .gt. ly) yp =1
	
	if (obst(xp,yp) .eq. 1) then
! Interact with solid nodes (obst=1)
	sum_x = sum_x + t_k(k)*xc(k)
	sum_y = sum_y + t_k(k)*yc(k)

	else
! Interact with fluid nodes (obst=0)
	Fx(x,y)=Fx(x,y) +t_k(k)*xc(k)* psx(xp,yp)
	Fy(x,y)=Fy(x,y) +t_k(k)*yc(k)* psx(xp,yp)
	
	endif
11	continue
! Final wall-fluid interaction
	Sx(x,y) = -G1*sum_x *psx(x,y) *psx_w
	Sy(x,y) = -G1*sum_y *psx(x,y) *psx_w

! Final fluid-fluid interaction
	Fx (x,y)= -G1 *psx (x,y)* Fx(x,y)
	Fy (x,y)= -G1 *psx (x,y)* Fy(x,y)-(0.000020)

	endif
10	continue
20	continue

	end
!  output.for
!c===================================================
	subroutine resul2(obst,rho,p,upx,upy, n)
	implicit none
c	include "head.inc"

	integer lx,ly
	PARAMETER(lx=61,ly=61)
	common/AA/ G,tau,Gads(2),ex(0:8),ey(0:8),opp(8)
	real*8 G,tau,Gads
	integer ex,ey, opp
	common/b/ error,vel,xc(0:8),yc(0:8),t_k(0:8)
	real*8 error,vel,xc,yc,t_k
	common/vel/ c_squ,cc,TT0,rho_w,Ca,RR, Nwri
	real*8 c_squ,cc,TT0, rho_w, Ca,RR
	integer Nwri
	common/app/ t_0,t_1,t_2, rho_h, rho_l
	real*8 t_0,t_1,t_2, rho_h, rho_l


	integer x,y,i,n
	real*8 rho(lx,ly),upx(lx,ly),upy(lx,ly)
	real*8  p(lx,ly)
	integer obst(lx,ly)
	character filename*16, B*6
	write(B,'(i6.6)') n
c	filename='out/2D’//B//'.plt’
	open(41,file='d:\TM\Kuliah\8\SKRIPSI\LBM\D2Q9\Pinned2.txt')
c	write(41,*) 'variables = x, y, rho, upx, upy, p, obst'
c	write(41,*) 'zone i=', lx, ', j= ', ly, ', f=point'
	
	do 10 y = 1, ly
	do 10 x=1,lx
	write(41,9) x, y, rho(x,y),upx(x,y), upy(x,y),p(x,y), obst(x,y)
10	continue
9	format(2i4, 4f15.8, i4)
	close(41)
	end

but the code got error when running and appears error like this :
Severity    Code    Description    Project    File    Line    Suppression State
Error        error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( : % [ . = =>        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #5149: Illegal character in statement label field          C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #5149: Illegal character in statement label field  

        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #5118: First statement in file must not be continued        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #5149: Illegal character in statement label field          C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #5149: Illegal character in statement label field          C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        Compilation Aborted (code 1)        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #5149: Illegal character in statement label field          C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    1    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    68    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    69    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    70    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    71    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    72    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    74    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    75    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    76    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    77    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    78    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    79    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    80    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    85    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    86    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    87    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    88    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    92    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    93    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    94    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    95    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    96    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    97    
Error        error #6274: This statement must not appear in the specification part of a module.        C:\Users\prima andreanto\source\repos\Console2\Console2\Source1.for    98    
 

please help me, iam so confuse to fix this...

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
911 Views

Please look in your textbook for the rules regarding Fortran fixed-form source. They are quite specific that the statement field starts in column 7, and the continuation indicator (your example uses &) must be in column 6. Many of your source lines do not follow those rules.

Please also read about free-form source, which is the ONLY thing you should be using in new development. Admittedly, you are using code you got from someone else, but they should know better. You can make this work with fixed-form if you follow the column rules. (Don't go past column 72 in any line, also.)

One last thing - these errors occurred when you tried to compile (build) the program, not run it.

0 Kudos
Reply