module defpi implicit none real(8),parameter::pi=3.14159265358979323846D0 end module defpi program f90_FEM_ASNT !**************************************************************** !Axisymmetric Analysis with function of no-tension analysis !**************************************************************** use defpi implicit none integer::i,j,k,l,kk,ne,n,ia,ja character::strcom*50 !Comment integer::NODT !Number of nodes integer::NELT !Number of elements integer::MATEL !Number of material sets integer::KOZ !Number of restricted nodes in z-direction (axial direction) integer::KOR !Number of restricted nodes in r-direction (radius direction) integer::NF !Number of loaded nodes integer,allocatable::kakom(:,:) !Element connectivity integer,allocatable::matno(:) !Material set number real(8),allocatable::wm(:,:) !work for material properties real(8),allocatable::Em(:) !Elastic modulus of element real(8),allocatable::po(:) !Poisson's ratio of element real(8),allocatable::gamma(:) !Unit weight of element real(8),allocatable::gkz(:) !Coefficient of inertia force (ratio to gravity acceleration) real(8),allocatable::alpha(:) !Coefficient of thermal expansion of element real(8),allocatable::ts(:) !Tensile strength of element real(8),allocatable::z(:) !z-coordinate of node real(8),allocatable::r(:) !r-coordinate of node real(8),allocatable::deltaT(:) !Temperature change of node (+: temperature rise) integer,allocatable::nokz(:) !Restricted node number in z-direction integer,allocatable::nokr(:) !Restricted node number in r-direction real(8),allocatable::f(:) !External force vector real(8),allocatable::fmass(:) !Inertia force vector integer,allocatable::mindex(:) !Index for treatment of restricted nodes real(8),allocatable::ftvec(:) !Nodal force vector real(8),allocatable::tsm(:,:) !Stiffness matrix real(8),allocatable::dis(:) !Increment of nodal displacement real(8),allocatable::rdis(:) !Displacement of restricted node real(8),allocatable::wdis(:) !work for displacement real(8),allocatable::dist(:) !Cumulative displacement of node real(8),allocatable::reac(:) !Internal force vector real(8),allocatable::strsave(:,:,:) !Memory of stresses integer,allocatable::noten(:,:) !Memory of stress state real(8),allocatable::sm(:,:) !Stiffness matrix of element real(8),allocatable::fevec(:) !Nodal force vector of element integer::nt !Number of degrees of freedom of all nodes (NODT x nhen) integer::nod=4 !Number of nodes per element integer::nhen=2 !Number of degrees of freedom per node integer::mm !Number of degrees of freedom of reduced FE equation integer::ib !Band width of redused matrix real(8)::elarea1 !Half area of element real(8)::elarea2 !Half area of element real(8)::fact0=1.0D-30 !zero judgement real(8):: sigz,sigr,sigt,tauzr,ps1,ps2,ang !Stresses integer:: nnn !Increment for iterative calculation integer:: maxita=2000 !Limit value of iterative calculation integer:: ntsum !Number of no-tension state gauss points integer:: icount !Number of converged degrees of freedom real(8):: dtest,ftest !Sum total of increment of nodal displacement, um total of unbalanced force integer:: IPR !Output format of stresses (0: all Gauss points, 1: average of element) character::fnameR*50,fnameW*50 !Input file name, output file name character :: linebuf*1000 character :: fmt1*200,fmt2*200,fmt3*200,fmt4*200 real(4) :: t1,t2 fmt1="(i5,2(',',e15.7),2(',',e15.7),2(',',i2),2(',',e15.7),',',e15.7)" !Node fmt2="(i5,4(',',i5),6(',',e15.7),',',i5)" !Element fmt3="(i5,2(',',e15.7),2(',',e15.7),2(',',e15.7),2(',',e15.7))" !Disp. & reaction fmt4="(i5,',',i5,4(',',e15.7),3(',',e15.7),2(',',i5))" !Stress !To input file names call getarg(1,fnameR) !Input file name call getarg(2,fnameW) !Output file name !To start the measurement of calculation time t1=DIFT() !*************************** !data input !*************************** open(11,file=fnameR,status='old') !!-------------------------------------------------------------------------------------- !!Comment !!-------------------------------------------------------------------------------------- read(11,'(a)') strcom !------------------------------------------------------------------------------------------ !Basic values for analysis !------------------------------------------------------------------------------------------ read(11,*) NODT,NELT,MATEL,KOZ,KOR,NF,IPR !------------------------------------------------------------------------------------------ !To Declare array size !------------------------------------------------------------------------------------------ nt=NODT*nhen allocate(kakom(1:NELT,1:nod)) allocate(matno(1:NELT)) allocate(wm(1:NELT,1:6)) allocate(Em(1:NELT)) allocate(po(1:NELT)) allocate(gamma(1:NELT)) allocate(gkz(1:NELT)) allocate(alpha(1:NELT)) allocate(ts(1:NELT)) allocate(z(1:NODT)) allocate(r(1:NODT)) allocate(deltaT(1:NODT)) allocate(nokz(1:KOZ)) allocate(nokr(1:KOR)) allocate(f(1:nt)) allocate(fmass(1:nt)) allocate(mindex(1:nt)) allocate(ftvec(1:nt)) allocate(tsm(1:nt,1:nt)) allocate(dis(1:nt)) allocate(rdis(1:nt)) allocate(wdis(1:nt)) allocate(dist(1:nt)) allocate(reac(1:nt)) allocate(strsave(1:NELT,1:4,1:4)) allocate(noten(1:NELT,1:4)) allocate(sm(1:nod*nhen,1:nod*nhen)) allocate(fevec(1:nod*nhen)) !------------------------------------------------------------------------------------------ !Material properties (Em,po,gamma,gkz,alpha,ts) !------------------------------------------------------------------------------------------ do i=1,MATEL read(11,*) wm(i,1),wm(i,2),wm(i,3),wm(i,4),wm(i,5),wm(i,6) end do !------------------------------------------------------------------------------------------ !Element-nodes relationship, material set No. !------------------------------------------------------------------------------------------ do ne=1,NELT read(11,*) kakom(ne,1),kakom(ne,2),kakom(ne,3),kakom(ne,4),matno(ne) do i=1,MATEL if(i==matno(ne))then Em(ne) =wm(i,1) po(ne) =wm(i,2) gamma(ne)=wm(i,3) gkz(ne) =wm(i,4) alpha(ne)=wm(i,5) ts(ne) =wm(i,6) end if end do end do deallocate(wm) !------------------------------------------------------------------------------------------ !Coordinate (z,r), temperature change of node !------------------------------------------------------------------------------------------ do i=1,NODT read(11,*) z(i),r(i),deltaT(i) end do !------------------------------------------------------------------------------------------ !Restricted node No., displacement of restricted node !------------------------------------------------------------------------------------------ do i=1,nt rdis(i)=0.0D0 end do if(00)then mm=mm+1 mindex(mm)=i end if end do do i=1,mm ia=mindex(i) ftvec(i)=ftvec(ia) do j=1,mm ja=mindex(j) tsm(i,j)=tsm(ia,ja) end do end do !----------------------------------------------------- !Calculation of band width & memory of band matrix !----------------------------------------------------- ib=IBAND(mm,tsm,fact0,nt) call BAND(mm,ib,tsm,nt) !----------------------------------------------------- !Checking of diagonal element of band matrix !----------------------------------------------------- do i=1,mm if(abs(tsm(i,1)) 0.0D0)ang= 45.0D0 if(tauzr< 0.0D0)ang=135.0D0 if(tauzr==0.0D0)ang= 0.0D0 else ang=0.5D0*atan(2.0D0*tauzr/(sigz-sigr)) ang=180.0D0/pi*ang if((sigz>sigr).and.(tauzr>=0.0D0))ang=ang if((sigz>sigr).and.(tauzr< 0.0D0))ang=ang+180.0D0 if(sigzm1)then mm=m1 else mm=n1-i+1 end if do j=1,mm z=array(i,j) if(j/=m1)then if(m1-j+11)then array(i,j)=z/array(i,1) else array(i,1)=sqrt(z) end if else array(i,j)=z/array(i,1) end if end do end do end subroutine CHBAND10 subroutine CHBAND11(n1,m1,array,vector,nt) !*************************************************** !Cholesky method (2) !Forward elimination & backward substitution !*************************************************** integer,intent(in)::n1,m1,nt real(8),intent(in)::array(1:nt,1:nt) real(8),intent(out)::vector(nt) integer :: i,j,mm real(8) :: z vector(1)=vector(1)/array(1,1) do i=2,n1 z=vector(i) if(i>m1)then mm=m1 else mm=i end if do j=2,mm z=z-array(i-j+1,j)*vector(i-j+1) end do vector(i)=z/array(i,1) end do vector(n1)=vector(n1)/array(n1,1) do i=n1-1,1,-1 z=vector(i) do j=2,m1 if(i+j-1>n1)exit z=z-array(i,j)*vector(i+j-1) end do vector(i)=z/array(i,1) end do end subroutine CHBAND11 integer function IBAND(mm,array,fact0,nt) !*************************************************** !Calculation of band width !*************************************************** integer,intent(in)::mm,nt real(8),intent(in)::array(1:nt,1:nt),fact0 integer :: i,j IBAND=1 do i=1,mm-1 do j=mm,i+1,-1 if(fact0<=abs(array(i,j)))exit end do if(IBAND<=j-i+1)IBAND=j-i+1 end do if(mm