[請益]主程式的變數與副程式共用?
program
implicit none
integer::num,i,j
integer,parameter::ROW=100,COL=100 !矩陣大小
real::U(ROW)
real::Matrix_Bij(ROW,COL)
real::T(ROW) !數值解
real::Y(ROW) !理論解
real::b,a,G,E,pr,n,L,f,&
xi,xj,bij,bij1,bij2,bij3,bij4,&
uyi,PI,a1,a2,a3,a4,Tyy
open (9,file='input.txt')
read(9,*) f,b,num,PI,E,Pr,uyi
open(10,file='output.txt')
G=E/(2*(1+pr))
L=b*f
write(10,*)"f=",f
write(10,*)"num=",num
write(10,*)"E=",E
write(10,*)"Pr=",pr
write(10,*)"G=",G
write(10,*)"b=",b
write(10,*)"L=",L*f
write(10,*)"uyi:",uyi
call slove_Bij
(num,i,j,xi,xj,a,bij,bij1,bij2,bij3,bij4,pr,G,Matrix_Bij,U,uyi,L,b,a1,a2,a3,a4)
call gauss(U,Matrix_Bij,T,num,uyi)
stop
end program
!--------------------slove_Bij------------------------
subroutine slove_Bij
(num,i,j,xi,xj,a,bij,bij1,bij2,bij3,bij4,pr,G,Matrix_Bij,U,uyi,L,b,a1,a2,a3,a4)
implicit none
integer,parameter::ROW=100,COL=100 !矩陣大小
integer::num,i,j
real::U(ROW)
real::Matrix_Bij(ROW,COL)
real::T(ROW)
real::a,b,G,xi,xj,pr,n,L,bij,bij1,bij2,bij3,bij4,uyi,PI,E,a1,a2,a3,a4
PI=3.14159
E=5000
pr=0.25
G=E/(2*(1+pr))
uyi=-0.04
上面這些參數已經在主程式的時候開啟了,
如何讓這些參數在副程式的時候直接讀取不用在定義一次
如果要用COMMON這個指令是要在主程式就先宣告嗎?
請版上各位高手指教一下小弟了~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.120.28.103
→
01/09 11:12, , 1F
01/09 11:12, 1F
Fortran 近期熱門文章
PTT數位生活區 即時熱門文章