Fortran Coder

查看: 5238|回复: 2
打印 上一主题 下一主题

[求助] 书上代码 Error in opening the compiled module file. [MAIN]

[复制链接]

7

帖子

3

主题

0

精华

入门

F 币
38 元
贡献
23 点
跳转到指定楼层
楼主
发表于 2021-11-16 23:29:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
最近在学Fortran语言,然后安装了Intel visual Fortran
然后在一本书上看到一个程序,请看附件。(附件是.txt文件或者下看下面,面第一次发帖还不会如何把代码弄上去,见谅)
[Fortran] 纯文本查看 复制代码
PROGRAM p41
!---------------------------------------------
!program 4.1 one dimensional analysis of axially loaded elastic rods
!   using 2-node rod elements
!---------------------------------------------   
use main; use geom; 
implicit none
integer,parameter::iwp=selected_real_kind(15)
integer::fixed_freedoms,i,iel,k,loaded_nodes,ndof=2,nels,neq,nlen,nod=2,&
    nodof=1,nn,nprops=1,np_types,nr
real(iwp)::penalty=1.0e20_iwp,zero=0.0iwp;character(len=15)::argv
!----------------dynamic arrays---------------
integer,allocatable::etype(:),g(:),g_g(:,:),kdiag(:),nf(:,:),no(:),    &
    node(:),num(:)
real(iwp),allocatable::action(:),eld(:),ell(:),km(:,:),kv(:),loads(:),  &
    prop(:,:),value(:)
!----------------input and initialisation---------------
call getname(argv,nlen)
open(10,file=argv(1:nlen)//'.dat'); open(11,file=argv(1:nlen)//'.res')
read(10,*)nels,np_types;nn=nels+1
allocate(g(ndof),num(nod),nf(nodof,nn),etype(nels),ell(nels),eld(ndof),  &
    km(ndof,ndof),action(ndof),g_g(ndof,nels),prop(nprops,np_types))
read(10,*)prop; etype=1;if(np_types>1)read(10,*)etype; read(10,*)ell
nf=1; read(10,*)nr,(k,nf(:,k),i=1,nr); call formnf(nf); neq=maxval(nf)
allocate(kdiag(neq),loads(0:neq)); kdiag=0
!----------------loop the elements to find global arrays sizes---------------
elements_1: do iel=1,nels
    num=(/iel,iel+1/); call num_to_g(num,nf,g);g_g(:,iel)=g
    call fkdiag(kdiag,g)
end do elements_1
do i=2,neq; kdiag(i)=kdiag(i)+kdiag(i-1); end do; allocate(kv(kdiag(neq)))
    write(11,'(2(a,i5))')
    "There are" ,neq," equations and the skyline storage is",kdiag(neq)
!----------------global stiffness matrix assembly---------------
kv=zero
elements_2:do iel=1,nels
    call rod_km(km,prop(1,etype(iel)),ell(iel); g=g_g(:,iel)
    call fsparv(kv,km,g,kdiag)
end do elements_2
!----------------read loads and/or displacements---------------
loads=zero; read(10,*) loaded_nodes,(k,loads(nf(:,k)),i=1,loads_nodes)
read(10,*)fixed_freedoms
if(fixed_freedoms/=0)then
    allocate(node(fixed_freedoms),no(fixed_freedoms),value(fixed_freedoms))
    read(10,*)(node(i),value(i),i=1,fixed_freedoms)
    do i=1,fixed_freedoms; no(i)=nf(1,node(i));end do
    kv(kdiag(no))=kv(kdiag(no))+penalty; loads(no)=kv(kdiag(no))*value
    end if
!----------------equation solution---------------
call sparin(kv,kdiag);call spabac(kv,loads,kdiag);loads(0)=zero
write(11,'(/a)')" node disp"
do k=1,nn; write(11,'(i5,2e12.4)')k,loads(nf(:,k));end do
!----------------retrieve elements end actions---------------
write(11,'(/a)')"element actions "
elements_3: do iel=1,nels
    call rod_km(km,prop(1,etype(iel)),ell(iel));g=g_g(:,iel)
    eld=loads(g); action=matmul(km,eld);write(11,'(i5,2e12.4)')iel,action
end do elements_3

    stop
end program p41

然后出现了如下问题:
(1)出现在第六行  error #7002: Error in opening the compiled module file.  Check INCLUDE paths.    [MAIN]        
(2)出现在第六行   error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [GEOM]        
(3)出现在第32 行          error #6899: First non-blank character in a character type format specifier must be a left parenthesis.   ['There are']
(4)出现在40行     error #6404: This name does not have a type, and must have an explicit type.   [LOADS_NODES]                        
(5)出现在10行     error #6355: This binary operation is invalid for this data type.   [0.0]               
(6)出现在 40 行   error #6059: A REAL or INTEGER or LOGICAL data type is required in this context.   [LOADS_NODES]        
(7)出现在 10  行          error #5082: Syntax error, found IDENTIFIER 'IWP' when expecting one of: .EQV. .NEQV. .XOR. .OR. .AND. .LT. < .LE. <= .EQ. == .NE. /= .GT. > ...
(8)出现在36 行     error #5082: Syntax error, found ';' when expecting one of: , :: : )               
(10)出现在 32 行  error #5082: Syntax error, found ',' when expecting one of: (               
(11)出现在 1 行  Compilation Aborted (code 1)                        1        


最后,由于我在这方面所知甚浅,不应该一开始就用这么长的程序,额 ,其实我本意是想了解一下不同编译器在语法上的差异以及把在A编译器上的程序弄到B编译器上如何修改(因为上面那个程序不是Intelvisual Fortran编的,而我是用的IVF)
还有就是子程序的问题,我按上Intel visualFortran后,其中会包含有什么子程序,如何添加呢?
感谢解答!!!

程序4.1.txt

2.75 KB, 下载次数: 1

分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

1958

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1339 元
贡献
565 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

沙发
发表于 2021-11-17 08:19:29 | 只看该作者
这个程序不完整,需要找到 main 和 geom 这两个模块。
注意看 use main; use geom; 这俩语句。

7

帖子

3

主题

0

精华

入门

F 币
38 元
贡献
23 点
板凳
 楼主| 发表于 2021-11-17 14:20:42 | 只看该作者
fcode 发表于 2021-11-17 08:19
这个程序不完整,需要找到 main 和 geom 这两个模块。
注意看 use main; use geom; 这俩语句。 ...

嗯嗯,懂了,我看的这本书后面有提供main库子程序以及几何库子程序,但是他给的网址打不开,似乎要翻墙
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

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

GMT+8, 2024-4-20 12:38

Powered by Tencent X3.4

© 2013-2024 Tencent

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