Hi all, I have problem reading the data from a the software nastran. I wrote a fortran function that read an output file from the software nastran , it reads all the keys correctly but when it comes to reading the main data which a matrix 441*9, the compiler said :
Segmentation fault
this is the output of the compilation key= 3 M_D_Y 1 20 13 key= 7 NASTRAN key= 2 Label=XXXXXXXX key= -1 EOR key= 0 EOF key= 2 B_N BGPDTS key= -1 EOR key= 7 101 441 0 2646 2 0 441 key= -2 key= 1 Lgcrec= 0 key= 2 B_N BGPDT key= -3 key= 1 type= 0 key= 5292 Segmentation fault
and this is my subroutine:
subroutine readtableBGPDT(Fileunit,Filename,Nnodes,dcoor) implicit none integer,parameter::iwp = selected_real_kind(8) type xyzcoord integer,dimension(6)::wert real(iwp),dimension(3)xyzcoord end type xyzcoord integerkey,M,D,Y,i,Logirecord,tyype integer,intent(in)::Nnodes,Fileunit character,dimension(25)::T character,dimension(8)::L,BlckName,BlckName2 character(len=),intent(in)::Filename integer,dimension(7)::Trailor,Ta type(xyzcoord),dimension(Nnodes,9)::dcoor ! open(unit=Fileunit,file=Filename,status='old',form='unformatted',action='read') ! rewind(Fileunit) read(Fileunit) key write(,)'key=',key read(Fileunit) M,D,Y write(,)'M_D_Y',M,D,Y read(Fileunit)key write(,)'key=',key read(Fileunit)(T(i),i=1,7) write(,)(T(i),i=1,7) read(Fileunit)key write(,)'key=',key read(Fileunit)L write(,)'Label=',L read(Fileunit)key write(,)'key=',key write(,)'EOR' read(Fileunit)key write(,)'key=',key write(,)'EOF' ! read(Fileunit)key write(,)'key=',key read(Fileunit)BlckName write(,)'B_N ',BlckName read(Fileunit)key write(,)'key=',key write(,)'EOR' read(Fileunit)key write(,)'key=',key read(Fileunit)(Ta(i),i=1,7) write(,)(Ta(i),i=1,7) read(Fileunit)key write(,)'key=',key read(Fileunit)key write(,)'key=',key read(Fileunit)Logirecord write(,)'Lgcrec=',Logirecord read(Fileunit)key write(,)'key=',key read(Fileunit)BlckName2 write(,)'B_N ',BlckName2 read(Fileunit)key write(,)'key=',key ! read(Fileunit)key write(,)'key=',key read(Fileunit)tyype write(,)'type=',tyype read(Fileunit)key write(,)'key=',key read(Fileunit)dcoor write(,'(I8,I8,I8,I8,I8,I8,F12.4,F12.4,F12.4)')dcoor read(Fileunit)key write(,)'key=',key close(Fileunit) end subroutine readtableBGPDT
and this the program that tests the above subroutine:
program ttz
implicit none
integer:: Fileunit=18 ,Nnodes=441
real,dimension(441,9)::dcoor
character(len=9)::Filename
parameter(Filename='bgpdt.op2')
call readtableBGPDT(Fileunit,Filename,Nnodes,dcoor)
write(,) '--------------------------'
write(,'(9F10.4)') dcoor(1,1:9)
write(,) '--------------------------'
write(,'(9F10.4)') dcoor(2,1:9)
write(,) '--------------------------'
write(,'(9F10.4)') dcoor(3,1:9)
write(,) '--------------------------'
write(,'(9F10.4)') dcoor(4,1:9)
write(,) '--------------------------'
end program ttz