       program inputdeck
       implicit real*8(a-h,o-z)
       dimension nofe(8)
c
c
       write(*,*)'x軸方向の要素数を入れて下さい'
       read(*,*) nx
       write(*,*)'y軸方向の要素数を入れて下さい'
       read(*,*) ny
       write(*,*)'z軸方向の要素数を入れて下さい'
       read(*,*) nz
c       write(*,*)どの方向を拘束しますか
c
       nzen=nx*ny*nz
c
       open(7,file='beam.inp')
cccccccccc
c座標出力c
cccccccccc
       write(7,*)'*NODE,NSET=Nall'
       nnofe=0
       do k=1,nz+1
       do j=1,ny+1
       do i=1,nx+1
        nnofe=nnofe+1
        zax=(i-1)*2.5d-1
        zay=(ny+1-j)*2.5d-1
        zaz=(k-1)*0.5d0
       write(7,100)nnofe,',',zax,',',zay,',',zaz
       end do
       end do
       end do
100    format(i5,a,F6.3,a,F6.3,a,F6.3)
cccccccccccccc
c要素番号出力c
cccccccccccccc
       do k=1,nz
       do j=1,ny
       do i=1,nx
        node=(k-1)*nx*ny+nx*(j-1)+i
        nofe(1)=(nx+1)*(ny+1)*(k-1)+(nx+1)*(j-1)+i
        nofe(2)=nofe(1)+1
        nofe(3)=nofe(1)+(nx+1)
        nofe(4)=nofe(3)+1
        nofe(5)=nofe(1)+(nx+1)*(ny+1)
        nofe(6)=nofe(2)+(nx+1)*(ny+1)
        nofe(7)=nofe(3)+(nx+1)*(ny+1)
        nofe(8)=nofe(4)+(nx+1)*(ny+1)
        write(7,*)'*ELEMENT,TYPE=C3D8,ELSET=Eall'
        write(7,*)node,',',nofe(1),',',nofe(2),',',nofe(3),
     & ',',nofe(4),',',nofe(5),',',nofe(6),',',nofe(7),',',nofe(8)
       end do
       end do
       end do
c
cccccccccccccc
c固定端の座標c
cccccccccccccc
       write(7,*)'*NSET,NSET=FIX'
       do i=1,(nx+1)*(ny+1)
       write(7,*)i,','
       end do
c
cccccccccc
c境界条件c
cccccccccc
       write(7,*)'*BOUNDARY'
       write(7,*)'FIX,1,3'
c
cccccc
c材料c
cccccc
       write(7,*)'*MATERIAL,NAME=EL'
cccccccccc
c弾性特性c
cccccccccc
       write(7,*)'*ELASTIC'
cデフォールトは等方性異方性ならTYPE=ANISOをつける
       write(7,*)'210000.,.3'
cヤング率、ポワソン比の順
c
cccccccccccccccccc
c材料特性の3D化？c
cccccccccccccccccc
       write(7,*)'*SOLID SECTION,ELSET=Eall,MATERIAL=EL'
cccccccccccccc
c自由端の座標c
cccccccccccccc
       write(7,*)'*NSET,NSET=LAST'
       nnofe=(nx+1)*(ny+1)*(nz+1)-(nx+1)*(ny+1)
       do i=1,(nx+1)*(ny+1)
       nnofe=nnofe+1
       write(7,*)nnofe,','
       end do
c
c
c
c
       write(7,*)'*STEP'
       write(7,*)'*STATIC,SOLVER=SPOOLES'
       write(7,*)'*CLOAD'
       write(7,*)'LAST,2,0.36'
       write(7,*)'*NODE PRINT,NSET=Nall'
       write(7,*)'U'
       write(7,*)'*EL PRINT,ELSET=Eall'
       write(7,*)'S'
       write(7,*)'*NODE FILE'
       write(7,*)'U'
       write(7,*)'*EL FILE,POSITION=AVERAGED AT NODES'
       write(7,*)'S'
       write(7,*)'*END STEP'
c
       close(7)
       end

