phd-scripts/Unpublished/XFEM/AbaqusUEL/2D_XCorS.for

113 lines
3.5 KiB
Text
Raw Normal View History

2024-05-13 19:50:21 +00:00
c 2D XFEM Corrosion Element
subroutine uel(rhs,amatrx,svars,energy,ndofel,nrhs,nsvars,props,
1 nprops,coords,mcrd,nnode,u,du,v,a,jtype,time,dtime,kstep,kinc,
2 jelem,params,ndload,jdltyp,adlmag,predef,npredf,lflags,
3 mlvarx,ddlmag,mdload,pnewdt,jprops,njprop,period)
c
include 'aba_param.inc'
c
dimension rhs(mlvarx,*),amatrx(ndofel,ndofel),svars(nsvars),
1 energy(8),props(*),coords(mcrd,nnode),
2 u(ndofel),du(mlvarx,*),v(ndofel),a(ndofel),time(2),
3 params(3),jdltyp(mdload,*),adlmag(mdload,*),
4 ddlmag(mdload,*),predef(2,npredf,nnode),lflags(*),jprops(*)
c
dimension phig(8),phih(8),phi(8),phix(8),phiy(8)
dimension crdnx(4),crdny(4),dndg(4),dndh(4)
dimension theta(4),rjac(2,2),rjaci(2,2)
dimension gx(100,4),hx(100,4),xi(2),yi(2),gi(2),hi(2)
dimension c(2),gp(2,8),gm2(8,8)
c
parameter(zero=0.d0,one=1.d0)
c material property definition
thick = 1.
rho = 1.
c initialization (nrhs=1)
do k1=1,ndofel
rhs(k1,nrhs)=zero
do k2=1,ndofel
amatrx(k2,k1)=zero
enddo
enddo
if (lflags(1).eq.33) then
do icrd=1,4
crdnx(icrd)=coords(1,icrd)
crdny(icrd)=coords(2,icrd)
enddo
c Normal Shp Funs
ienr=1
gpos=1/sqrt(3.)
gx(1,1)=-gpos
gx(1,2)=gpos
gx(1,3)=gpos
gx(1,4)=-gpos
hx(1,1)=-gpos
hx(1,2)=-gpos
hx(1,3)=gpos
hx(1,4)=gpos
c assemble amatrx and rhs
do i=1,ienr
do j=1,4
g=gx(i,j)
h=hx(i,j)
phi(1)=0.25*(1.-g)*(1.-h)
phi(2)=0.25*(1.+g)*(1.-h)
phi(3)=0.25*(1.+g)*(1.+h)
phi(4)=0.25*(1.-g)*(1.+h)
cond=1.
spec=1.
phig(1)=0.25*-(1.-h)
phig(2)=0.25*(1.-h)
phig(3)=0.25*(1.+h)
phig(4)=0.25*-(1.+h)
phih(1)=0.25*-(1.-g)
phih(2)=0.25*-(1.+g)
phih(3)=0.25*(1.+g)
phih(4)=0.25*(1.-g)
rjac=zero
do iter=1,4
rjac(1,1)=rjac(1,1)+phig(iter)*crdnx(iter)
rjac(1,2)=rjac(1,2)+phig(iter)*crdny(iter)
rjac(2,1)=rjac(2,1)+phih(iter)*crdnx(iter)
rjac(2,2)=rjac(2,2)+phih(iter)*crdny(iter)
enddo
djac=rjac(1,1)*rjac(2,2)-rjac(1,2)*rjac(2,1)
rjaci(1,1)= rjac(2,2)/djac
rjaci(2,2)= rjac(1,1)/djac
rjaci(1,2)=-rjac(1,2)/djac
rjaci(2,1)=-rjac(2,1)/djac
do iter=1,4
phix(iter)=rjaci(1,1)*phig(iter)+
1 rjaci(1,2)*phih(iter)
phiy(iter)=rjaci(2,1)*phig(iter)+
1 rjaci(2,2)*phih(iter)
enddo
dtdx=zero
dtdy=zero
t =zero
told=zero
do iter=1,4
dtdx=u(iter)*phix(iter)+dtdx
dtdy=u(iter)*phiy(iter)+dtdy
t=u(iter)*phi(iter)+t
told=(u(iter)-du(iter,nrhs))*phi(iter)+told
end do
dtdt=(t-told)/dtime
we=djac
do ki=1,4
c loop over nodes
rhs(ki,nrhs) = rhs(ki,nrhs) -
1 (we/float(ienr))*(phi(ki)*rho*spec*dtdt+
2 cond*(phix(ki)*dtdx + phiy(ki)*dtdy))
do kj=1,4
amatrx(ki,kj)=amatrx(ki,kj)+(we/float(ienr))
1 *(phi(ki)*phi(kj)*rho*spec/dtime+cond
2 *(phix(ki)*phix(kj)+phiy(ki)*phiy(kj)))
end do
end do
enddo
enddo
end if
return
end