- 积分
- 18
- 注册时间
- 2002-6-7
- 仿真币
-
- 最后登录
- 1970-1-1
|
- subroutine sdcdx(f,x,N,dfdx,fx,ndord,iv,m)
- implicit real*8 (a-h,o-z)
- dimension x(N),y(3),fx(27),dfdx( * )
- external f
- h =0.02
- h2 = h*2
- c write(*,*) 'h =',h,' x =',x
- m = 0
- c do 300 i=-1,1
- c y(3) = x(3)+h*i
- do 200 j=-1,1
- y(2) = x(2)+h*j
- do 100 k=-1,1
- y(1) = x(1)+h*k
- m = m+1
- [b] [color=red]if (( n .eq.1) .and. (i * j.ne.0)) goto 100
- if (( n .eq.2) .and. (i.ne.0)) goto 100
- if (ndord.eq.1) then
- kk = k*k+j*j+i*i
- if (kk.gt.1) goto 100
- endif[/color][/b] fx( m ) = f(y,iv)
- c write( * ,'(1x,i3,4f10.4)') m,y,fx( m )
- 100 continue
- 200 continue
- c300 continue
- 400 continue
- c write( * , * ) 'iv,n,m =',iv,n,m,' fx ='
- c write( * ,'(9f8.3)') (fx( i ),i=1, m )
- mm = m/2+1
- dfdx(1) = fx(mm)
- m = n+1
- do 500 i=1,n
- j = 3 ** (i-1)
- dfdx(i+1) = (fx(mm+j)-fx(mm-j))/h2
- 500 continue
- if (ndord.eq.1) goto 1000
- do 900 i=1,n
- do 800 j=i,n
- i1 = 3**(i-1)
- j1 = 3**(j-1)
- m = m+1
- if (i.eq.j) then
- dfdx ( m ) = (fx(mm+i1)+fx(mm-i1)-fx(mm)*2)/h/h
- else
- dfdx ( m ) = (fx(mm+j1+i1)+fx(mm-j1-i1)
- & -fx(mm+j1-1)-fx(mm-i1-1))/h2/h2
- endif
- c write( * , * ) 'i,j,i1,j1,m,dfdx =',i,j,i1,j1,m,dfdx ( M )
- 800 continue
- 900 continue
- 1000 continue
- c write(*,*) 'n,m =',n,m,' dfdx ='
- c write(*,*) (dfdx ( i ),i=1,m )
- return
- end
复制代码 该子程序是有限元法中求解Jacobi矩阵的一段程序。
该子程序中传入参数的说明:f是用来坐标变换的函数,分别实现对各坐标的变换,x为局部坐标,n为问题的维数,dfdx为原坐标对当地坐标的导数,ndord为最高导数的阶数,iv为对维数的循环数。我看了好久,也没有弄清楚程序中红色部分的判断是起什么作用的?请大侠指点,非常感谢! |
|