那应该是IMSL版本和编译器有一些不匹配。
根据我使用IMSL的经验,这不是一个大问题。你可以试试去掉 use numerical_libraries 这个语句。
除此之外,代码中的问题还是挺多的。
首先,implicit none 不能去掉,一定要写!!
然后,aa , bb , inc 这些变量在 subroutine a 和 subroutine b 中定义了,但 subroutine wall_plus 中没有。
你需要理解,不同的子程序之间,变量作用域是独立的。所以 subroutine a 里面的 aa,不能在 wall_plus 中使用。
要使用的话,你可以通过参数传递,或者 common 公共区,或者module。
[Fortran] 纯文本查看 复制代码 module dataMod
implicit none
real :: inc,aa(2,2),bb(2)
contains
!传递函数a
subroutine a(theta0,point0,point2,point3)
real theta0,point0(2),point2(4),point3(4)
real m23
m23 = (point3(4)-point2(4))/(point3(3)-point2(3))
aa(1,1) = 1
aa(1,2) = -m23
aa(2,1) = 1
aa(2,2) = -tan(0.5*(theta0+inc))
end subroutine a
!传递函数b
subroutine b(theta0,point0,point2,point3)
real theta0,point0(2),point2(4),point3(4)
real m23
m23 = (point3(4)-point2(4))/(point3(3)-point2(3))
bb(1) = point3(4)-m23*point3(3)
bb(2) = point0(2)-tan(0.5*(theta0+inc))*point0(1)
end subroutine b
!左行壁面进程
subroutine wall_plus(theta0,point0,point2,point3,theta_new,point_new)
include "link_fnl_shared.h"
use linear_operators
implicit none
real theta0,point0(2),point2(4),point3(4)
real theta_new,point_new(2),old_theta,old_point(2)
real , parameter :: th = 1.0e-7
real tol
tol = 1.0e3
theta_new = theta0
point_new(:) = point0(:)
do while(tol>th)
old_point = point_new
old_theta = theta_new
inc = theta_new
call a(theta0,point0,point2,point3)
call b(theta0,point0,point2,point3)
point_new = aa .ix. bb
theta_new = point2(1)+sqrt(((point_new(1)-point2(3))**2+(point_new(2)-point2(4))**2)/&
((point3(3)-point2(3))**2+(point3(4)-point2(4))**2))*(point3(1)-point2(1))
tol=max(abs(point_new(1)-old_point(1)),abs(point_new(2)-old_point(2)))
tol=max(tol,abs(theta_new-old_theta))
end do
end subroutine wall_plus
end module dataMod |