module defpi implicit none real(8),parameter::pi=3.14159265358979323846D0 end module defpi module cdraw_data implicit none integer::ind,ibc,ifc,isc real(4)::baselength,grdspc real(4)::xmin,xmax,ymin,ymax real(4)::bav,bfv real(4)::conint,annint character::strx*100,stry*100 integer::ncut,numcut(10) real(4)::fmax,fact0=1.0E-10 end module cdraw_data program f90_GMTplnt !Drawing by GMT for 2D Stress Analysis use defpi use cdraw_data implicit none integer::i,j,k,l,kk,ne,n,ia,ja,k1,k2,n1,n2,n3 character::strcom*50 !Comment integer::NSTRES !Stress state (0: plane strain, 1: plane stress) integer::NODT !Number of nodes integer::NELT !Number of elements integer::MATEL !Number of material sets integer::KOX !Number of restricted nodes in x-direction integer::KOY !Number of restricted nodes in y-direction integer::KXY !Number of restricted nodes in x and y-directions integer::NF !Number of loaded nodes integer,allocatable::kakom(:,:) !Element connectivity integer,allocatable::matno(:) !Material set number real(4),allocatable::x(:) !x-coordinate of node real(4),allocatable::y(:) !y-coordinate of node real(4),allocatable::grdspcT(:) !Temperature change of node (positive: temperature rise) integer,allocatable::nokx(:) !Restricted node number in x-direction integer,allocatable::noky(:) !Restricted node number in y-direction integer,allocatable::noxy(:) !Restricted node number in x and y-directions real(4),allocatable::f(:) !External load vector real(4),allocatable::dis(:) !Displacement vector real(4),allocatable::strsave(:,:,:) !Stresses of element integer,allocatable::noten(:,:) !Stress state (notension or not) integer::nt !Total degree of freedom (NODT x nhen) integer::nod !Number of nodes per element integer::nhen=2 !Number of degree of freedom per node integer::kkmax !Number of integration point real(4),allocatable::xg(:,:) !x-coordinate of centroid of element real(4),allocatable::yg(:,:) !y-coordinate of centroid of element real(4)::rw integer::iw integer::IPR character::linebuf*1000 character::fnameR*50 call getarg(1,fnameR) !Input file name !*************************** !data input !*************************** open(11,file=fnameR,status='old') read(11,'(a)') strcom read(11,'()') read(11,*) nod,NODT,NELT,MATEL,KOX,KOY,NF,NSTRES,IPR if(nod==3)IPR=0 nt=NODT*nhen if(nod==3)kkmax=1 if(nod==4)kkmax=4 allocate(kakom(1:NELT,1:nod)) allocate(matno(1:NELT)) allocate(x(1:NODT)) allocate(y(1:NODT)) allocate(grdspcT(1:NODT)) allocate(nokx(1:KOX)) allocate(noky(1:KOY)) allocate(noxy(1:KOX)) allocate(f(1:nt)) allocate(dis(1:nt)) allocate(strsave(1:NELT,1:kkmax,1:3)) allocate(noten(1:NELT,1:kkmax)) allocate(xg(1:NELT,1:kkmax)) allocate(yg(1:NELT,1:kkmax)) read(11,'()') read(11,'()') n1=0 n2=0 n3=0 do i=1,NODT read(11,*) iw,rw,rw,f(2*i-1),f(2*i),k1,k2,rw,rw,grdspcT(i) if(0' write(12,*) (x(i)),' ',(y(i)) write(12,*) (x(j)),' ',(y(j)) write(12,*) (x(k)),' ',(y(k)) end if end do case(4) do ne=1,NELT if(matno(ne)==ma)then i=kakom(ne,1) j=kakom(ne,2) k=kakom(ne,3) l=kakom(ne,4) write(12,*) '>' write(12,*) (x(i)),' ',(y(i)) write(12,*) (x(j)),' ',(y(j)) write(12,*) (x(k)),' ',(y(k)) write(12,*) (x(l)),' ',(y(l)) end if end do end select close (12) end do if(0' write(12,*) (x(i)),' ',(y(i)) write(12,*) (x(j)),' ',(y(j)) write(12,*) (x(k)),' ',(y(k)) end if end do end do case(4) do ne=1,NELT do nc=1,ncut if(matno(ne)==numcut(nc))then i=kakom(ne,1) j=kakom(ne,2) k=kakom(ne,3) l=kakom(ne,4) write(12,*) '>' write(12,*) (x(i)),' ',(y(i)) write(12,*) (x(j)),' ',(y(j)) write(12,*) (x(k)),' ',(y(k)) write(12,*) (x(l)),' ',(y(l)) end if end do end do end select close (12) end if end subroutine DAT_PS subroutine MAKE_BAT(MATEL,KOX,KOY,KXY) integer::MATEL,KOX,KOY,KXY integer::ma character::srange*100,sscale*100,sba*100,sgrdspc*100,ssradi*100,filename*100 character::ssx*100,ssy*100,scc*50,sca*50,sscld*100,scol*50,snum*50,spsize*50,scsize*50 character::strw1*50,strw2*50,strw3*50,strw4*50 real(4)::psize,ds real(4)::work character(len=3)::col_r(1:MATEL),col_g(1:MATEL),col_b(1:MATEL) character(len=11)::col_mesh(1:MATEL) psize=0.015*baselength ds=bav open (11, file='_col_mesh.txt', status='old') do i=1,MATEL read(11,*) col_r(i),col_g(i),col_b(i) col_mesh(i)=trim(adjustl(col_r(i)))//'/'//trim(adjustl(col_g(i)))//'/'//trim(adjustl(col_b(i))) end do close(11) write(strw1,'(f10.3)') xmin-ds; write(strw2,'(f10.3)') xmax; write(strw3,'(f10.3)') ymin-ds; write(strw4,'(f10.3)') ymax; srange='set range='//trim(adjustl(strw1))//'/'//trim(adjustl(strw2))//'/'//trim(adjustl(strw3))//'/'//trim(adjustl(strw4)) if(ymax-ymin<=xmax-xmin)then write(strw1,'(f10.3)') baselength; write(strw2,'(f10.3)') baselength/(xmax-xmin+ds)*(ymax-ymin+ds) else write(strw1,'(f10.3)') baselength/(ymax-ymin+ds)*(xmax-xmin+ds); write(strw2,'(f10.3)') baselength; end if sscale='set scale='//trim(adjustl(strw1))//'/'//trim(adjustl(strw2)) write(strw1,'(f10.3)') bav write(strw2,'(f10.3)') bfv sba='set ba=a'//trim(adjustl(strw1))//'f'//trim(adjustl(strw2)) write(strw1,'(f10.3)') grdspc sgrdspc='set grdspc='//trim(adjustl(strw1)) write(strw1,'(f11.4)') grdspc/sqrt(2.0) ssradi='set sradi='//trim(adjustl(strw1)) write(strw1,'(f10.3)') conint scc='set conint='//trim(adjustl(strw1)) write(strw1,'(f10.3)') annint sca='set annint='//trim(adjustl(strw1)) ssx='set strx="'//trim(adjustl(strx))//'"' ssy='set stry="'//trim(adjustl(stry))//'"' if(ymax-ymin<=xmax-xmin)then work=baselength/(xmax-xmin)*(ymax-ymin) write(strw1,'(f10.3)') baselength+0.5 write(strw2,'(f10.3)') work-work*0.5/2.0-0.3 write(strw3,'(f10.3)') work*0.5 if(4.0 %fig%' do ma=1,MATEL write (strw1,'(i2.2)') ma snum='set num='//trim(adjustl(strw1)) scol='set col='//col_mesh(ma) write(12,'(a)') trim(adjustl(snum)) write(12,'(a)') trim(adjustl(scol)) write(12,'(a)') 'psxy _mesh%num%.txt -R -J -W0.5/black -G%col% -K -O >> %fig%' end do if(0> %fig%' write(12,'(a)') 'pstext _text_ne.txt -R -J -N -K -O >> %fig%' write(12,'(a)') 'pstext _text_nd.txt -R -J -N -K -O >> %fig%' end if if(0> %fig%' if(0> %fig%' if(0> %fig%' end if if(0> %fig%' write(12,'(a)') 'echo 0 0 | psxy -R -J -Sp -O >> %fig%' write(12,'()') !drawing of contour of ps1 write(12,'(a)') 'rem *** Drawing of contour of ps1 ***' write(12,'(a)') 'set fig=fig_gmt_ps1.eps' write(12,'(a)') 'grdmask _mask_data.txt -G_mask.grd -I%grdspc% -R%range% -S%sradi% -NNan/0/0' write(12,'(a)') 'surface _ps1.txt -G_ps1.grd -I%grdspc% -R -T0.0' write(12,'(a)') 'grdmath _ps1.grd _mask.grd OR = _ps1m.grd' write(12,'(a)') 'psbasemap -R%range% -JX%scale% -B%ba%:%strx%:/%ba%:%stry%:WS -P -K > %fig%' write(12,'(a)') 'grdimage _ps1m.grd -J -C0_cpt.cpt -K -O >> %fig%' if(0> %fig%' ! write(12,'(a)') 'grdcontour _ps1m.grd -C%conint% -A%annint% -J -K -O >> %fig%' if(0> %fig%' write(12,'(a)') 'echo 0 0 | psxy -R -J -Sp -O >> %fig%' write(12,'()') !drawing of contour of ps2 write(12,'(a)') 'rem *** Drawing of contour of ps1 ***' write(12,'(a)') 'set fig=fig_gmt_ps2.eps' write(12,'(a)') 'surface _ps2.txt -G_ps2.grd -I%grdspc% -R -T0.0' write(12,'(a)') 'grdmath _ps2.grd _mask.grd OR = _ps2m.grd' write(12,'(a)') 'psbasemap -R%range% -JX%scale% -B%ba%:%strx%:/%ba%:%stry%:WS -P -K > %fig%' write(12,'(a)') 'grdimage _ps2m.grd -J -C0_cpt.cpt -K -O >> %fig%' if(0> %fig%' ! write(12,'(a)') 'grdcontour _ps2m.grd -C%conint% -A%annint% -J -K -O >> %fig%' if(0> %fig%' write(12,'(a)') 'echo 0 0 | psxy -R -J -Sp -O >> %fig%' write(12,'()') !reset of variables write(12,'(a)') 'set fig=' write(12,'(a)') 'set range=' write(12,'(a)') 'set scale=' write(12,'(a)') 'set ba=' write(12,'(a)') 'set grdspc=' write(12,'(a)') 'set sradi=' write(12,'(a)') 'set conint=' write(12,'(a)') 'set annint=' write(12,'(a)') 'set strx=' write(12,'(a)') 'set strz=' write(12,'(a)') 'set scld=' write(12,'(a)') 'set psize=' write(12,'(a)') 'set csize=' write(12,'(a)') 'del .gmt*' close(12) end subroutine MAKE_BAT subroutine PST_PL(sigx,sigy,tauxy,ps1,ps2,ang) !主応力計算 real(4),intent(in)::sigx,sigy,tauxy real(4),intent(out)::ps1,ps2,ang ps1=0.5*(sigx+sigy)+sqrt(0.25*(sigx-sigy)*(sigx-sigy)+tauxy*tauxy) ps2=0.5*(sigx+sigy)-sqrt(0.25*(sigx-sigy)*(sigx-sigy)+tauxy*tauxy) if(sigx==sigy)then if(tauxy>0.0)ang=45.0 if(tauxy<0.0)ang=135.0 if(tauxy==0.0)ang=0.0 else ang=0.5*atan(2.0*tauxy/(sigx-sigy)) ang=180.0/pi*ang if(sigx>sigy.and.tauxy>=0.0)ang=ang if(sigx>sigy.and.tauxy<0.0)ang=ang+180.0 if(sigx