Fortran Coder

查看: 1400|回复: 5
打印 上一主题 下一主题

[数学库] IMSL编译问题

[复制链接]

252

帖子

0

主题

0

精华

版主

World Analyser

F 币
689 元
贡献
497 点

新人勋章美女勋章元老勋章热心勋章规矩勋章管理勋章

QQ
楼主
发表于 2023-8-14 17:08:57 | 显示全部楼层
本帖最后由 kyra 于 2023-8-14 17:11 编辑

error1:Compilation Aborted (code1)
不是一个编译器抛出的错误。而是编译环境抛出的错误。意思是:由于一个(或一些)编译器抛出的错误,而编译中止
(题外话,为什么是中止呢?因为编译环境设计时认为有多个源代码文件需要编译,当前面的遇到了编译错误,那么后面的就没必要编译了,就中止了)

具体编译器抛出的错误,应该在前面显示。如果你从“错误列表”中无法看到前面有编译器抛出的错误,尝试在“输出”窗口查看。(题外话,错误列表是对输出窗口的美化,但Visual Studio经常会美化错误,所以需要看原始的“输出”窗口)

IMSL有若干版本,要根据你安装的版本来决定该如何使用IMSl函数库。

252

帖子

0

主题

0

精华

版主

World Analyser

F 币
689 元
贡献
497 点

新人勋章美女勋章元老勋章热心勋章规矩勋章管理勋章

QQ
沙发
发表于 2023-8-15 11:28:19 | 显示全部楼层
那应该是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
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-5-15 20:14

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表