         SUBROUTINE FORCDT (X1,X2,X3,F,T,TIME,DTIME,NDEG,NODE,X4,XORD
	1	,NCRD,IACFLG,INC,IPASS)
		 IMPLICIT REAL *8 (A-H, O-Z)
		include '../common/creeps'
		DIMENSION F(NDEG),T(NDEG),XORD(NCRD)
		COMMON StoredINC, Tbound, DTmax,amin,Zeroflag,writeflag,tcure,Temp,TIME
                T1=180
                T2=180
                Dt=7200
                r=1
                r=r/60
		if (TIME<=(T1-120)/r) then
			T=120+r*TIME
		end if
		if (TIME>(T1-120)/r.AND.TIME<=Dt+(T1-120)/r) then
 			T=T1
		end if
		if (TIME>Dt+(T1-120)/r.AND.TIME<=(T2-T1)/r+Dt+(T1-120)/r) then
 			T=T1+r*(TIME-(Dt+(T1-120)/r))
		end if
		if (TIME>(T2-T1)/r+Dt+(T1-120)/r) then
 			T=T2
		end if
		Tbound=T(1)
        RETURN
       END
	 SUBROUTINE UFILM (UHFILM,UTSINK,UHNATUR,UEXPNAT,
     1	  UEFFVIEW,UEMISS,UQFLUX,TS,N,TIME,INC)
		IMPLICIT REAL*8 (A-H,O-Z)
		DIMENSION TS(*),N(*)
		UHFILM=50
                T1=180
                T2=180
                Dt=7200
                r=1
                r=r/60
		if (TIME<=(T1-120)/r) then
			UTSINK=120+r*TIME
		end if
		if (TIME>(T1-120)/r.AND.TIME<=Dt+(T1-120)/r) then
 			UTSINK=T1
		end if
		if (TIME>Dt+(T1-120)/r.AND.TIME<=(T2-T1)/r+Dt+(T1-120)/r) then
 			UTSINK=T1+r*(TIME-(Dt+(T1-120)/r))
		end if
		if (TIME>(T2-T1)/r+Dt+(T1-120)/r) then
 			UTSINK=T2
		end if
c		print*,TIME
c		pause
	 RETURN
	 END
         subroutine ucure(m,n,nn,kc,matus,dt,ak,density,volumi,curedat,
     1   tempbeg,tempend,deltime,time,curerate)
        include '../common/implicit'
	include '../common/concom'
        include '../common/mrcparm'
	dimension curedat(*),matus(2)
        real K1
        real K2
        real K1c
        real K2c
        real Kd
        real A1
        real A2
        real Ad
        real ni
        real nl
        real mi
        real E1
        real E2
        real Ed
        real H
        real R
        real vf
        real l
        real b
        real Tginf
        real Tg0
        real f
        A1=1.7580E4
        A2=2.1525E4  
        Ad=6.48E18
	  E1=70.5E3
	  E2=59.05E3
	  Ed=136.8E3
	  ni=1.8
	  nl=1.32
        mi=1.16
        l=0.435
	  b=0.467
        Tginf=206+273.15
        Tg0=-11+273.15
        H=465000.0
	  R=8.3144
	  vf=0.6
	f=4.8e-4*((tempbeg+273.15)-Tg0-(Tginf-Tg0)*l*dt/(1-(1-l)*dt))+0.025
        K1c=A1*exp(-E1/R/(tempbeg+273.15))
        K2c=A2*exp(-E2/R/(tempbeg+273.15))
	Kd=Ad*exp(-Ed/R/(tempbeg+273.15))*exp(-b/f)
        K1=1/(1/Kd+1/K1c)
        K2=1/(1/Kd+1/K2c)
        curerate=K1*(1-dt)**ni+K2*dt**mi*(1-dt)**nl
	curedat(9)=H*(1-vf)
	volumi=1.0
	ak=dt+deltime*curerate
	if (ak>0.999) then
		curerate=0.0
		ak=1.0
	end if
      end
      SUBROUTINE PLOTV (V,S,SP,ETOT,EPLAS,ECREEP,T,M,NN,KCUS,NDI,
     + NSHEAR,JPLTCD)
	IMPLICIT REAL *8 (A-H, O-Z)
	DIMENSION S(*),SP(*),ETOT(*),EPLAS(*),ECREEP(*),T(*),
     + M(2),KCUS(2)
	COMMON StoredINC, Tbound, DTmax,amin,Zeroflag,writeflag,tcure,Temp,TIME
	include '../common/concom'
	include '../common/creeps'
	if (INC==0.AND.Zeroflag==0) then
		DTmax=-8065014
		amin=8065014
		Zeroflag=1
	end if
	if (INC>StoredInc) then
		amin=8065014
		StoredInc=INC
	end if
	call elmvar(285,M,NN,KCUS,conv)
	if (conv<amin) then
		amin=conv
	end if
	RETURN
       END
        SUBROUTINE UPSTNO (NQCODE,NODEID,VALNO,NQNCOMP,NQTYPE,
     	1	NQAVER,NQCOMPTYPE,NQDATATYPE,NQCOMPNAME)
		IMPLICIT REAL*8 (A-H,O-Z)
		COMMON StoredINC, Tbound, DTmax,amin,Zeroflag,writeflag,tcure,Temp,
	1	TIME,Tempstore
		include '../common/concom'
		include '../common/creeps'
		include '../common/blnk'
		include '../common/lass'
		DIMENSION VALNO(*)
     		CHARACTER*24 NQCOMPNAME(*)
		call nodvar(14,NODEID,Temp,NQNCOMP,NQDATATYPE)
c		Temp=VALNO(1)
		VALNO(1)=Temp
		if (Temp-Tbound>DTmax .AND.amin<0.88) then
			DTmax=Temp-Tbound
			open (unit=1,file="DTmax_2dwells.txt",form="formatted"
	1		,status="replace",action="write")
			write (unit=1,fmt=*),DTmax 
			close (unit=1)
c			print*, DTmax, Temp,Tbound
c			pause
		endif
		if (Temp-Tbound>DTmax .AND.amin>=0.88) then
			DTmax=Temp-Tbound
			open (unit=1,file="DTmax_2dwells.txt",form="formatted"
	1		,status="replace",action="write")
			write (unit=1,fmt=*),DTmax 
			close (unit=1)
c			print*, DTmax, Temp,Tbound
c			pause
		end if
c		print*, Temp
c		pause
	RETURN
       END
       SUBROUTINE UEDINC (INC1,INCSUB1)
       	IMPLICIT REAL *8 (A-H, O-Z)
	COMMON StoredINC, Tbound, DTmax,amin,Zeroflag,writeflag,tcure,Temp,TIME,
	1	Tempstore
	include '../common/concom'
	include '../common/creeps'
	if (amin>0.88.AND.writeflag==0.0) then
			tcure=CPTIM
			open (unit=2,file="tcure_2dwells.txt",form="formatted"
	1		,status="replace",action="write")
			write (unit=2,fmt=*),tcure 
			close (unit=2)
			writeflag=1.0
c			print*,'tcure', tcure,DTmax
c			pause
	end if
	if (amin<0.88) then
			tcure=80000
			open (unit=2,file="tcure_2dwells.txt",form="formatted"
	1		,status="replace",action="write")
			write (unit=2,fmt=*),tcure 
			close (unit=2)
c			print*,CPTIM
c			pause
	endif
         RETURN
       END
