Add scripts and inp files.

This commit is contained in:
James Grogan 2024-05-13 20:50:21 +01:00
parent ad937f2602
commit e19f869a1e
390 changed files with 6580687 additions and 10 deletions

View file

@ -0,0 +1,316 @@
c These subroutines control the velocity of exterior nodes in the
c ALE adaptive mesh domain for 3D uniform corrosion analysis.
c Author: J. Grogan - BMEC, NUI Galway. Created: 19/09/2012
c ------------------------------------------------------------------
c SUB UEXTERNALDB: This is used only at the begining of an analysis.
c It populates the 'facet' and 'nbr' common block arrays.
subroutine uexternaldb(lop,lrestart,time,dtime,kstep,kinc)
include 'aba_param.inc'
c Common Block Declarations
parameter (maxNodes=700000,maxFacets=700000)
integer nbr(maxNodes,5),facet(maxFacets,12)
real crd(maxNodes,3)
common nbr,facet,crd
c Other Declarations
integer n(8)
character*256 outdir
c
if(lop==0.or.lop==4)then
call getoutdir(outdir,lenoutdir)
nbr=0
open(unit=101,file=outdir(1:lenoutdir)//'/NodeData.inc',
1 status='old')
read(101,*)numfaces
do i=1,4*numfaces,4
read(101,*)nfix,n(1),n(2),n(3),n(4),n(5),n(6),n(7),n(8)
c facet(*,12)=fized face flag, facet(*,4-11)=element nodes
do j=1,4
ind=i+j-1
facet(ind,12)=nfix
do k=1,8
facet(ind,3+k)=n(k)
enddo
enddo
do j=1,4
ind=i+j-1
c facet(*,1-3)=nodes in facet
read(101,*)facet(ind,1),facet(ind,2),facet(ind,3)
node=facet(ind,1)
c nbr(node,1)=counter for facets per node
if(nbr(node,1)==0)nbr(node,1)=1
nbr(node,1)=nbr(node,1)+1
c nbr(node,>1)=facet number
nbr(node,nbr(node,1))=ind
enddo
enddo
close(unit=101)
endif
return
end
c ------------------------------------------------------------------
c SUB UFIELD: This is used at the start of each analysis increment.
c It populates the 'crd' common block array.
subroutine ufield(field,kfield,nsecpt,kstep,kinc,time,node,
1 coords,temp,dtemp,nfield)
include 'aba_param.inc'
dimension coords(3)
c Common Block Declarations
parameter (maxNodes=700000,maxFacets=700000)
integer nbr(maxNodes,5),facet(maxFacets,12)
real crd(maxNodes,3)
common nbr,facet,crd
c
crd(node,1)=coords(1)
crd(node,2)=coords(2)
crd(node,3)=coords(3)
return
end
c ------------------------------------------------------------------
c SUB UMESHMOTION: This is used at the start of each mesh sweep.
c It calculates the velocity of each node in the local coord system.
subroutine umeshmotion(uref,ulocal,node,nndof,lnodetype,alocal,
$ ndim,time,dtime,pnewdt,kstep,kinc,kmeshsweep,jmatyp,jgvblock,
$ lsmooth)
include 'aba_param.inc'
c user defined dimension statements
dimension ulocal(*),uglobal(ndim),tlocal(ndim)
dimension alocal(ndim,*),time(2)
c Common Block Declarations
parameter (maxNodes=700000,maxFacets=700000)
integer nbr(maxNodes,5),facet(maxFacets,12)
real crd(maxNodes,3)
common nbr,facet,crd
c Other Declarations
integer np(3)
real fp(6,9),fc(6,3),fe(6,3),fn(6,3),a(3),b(3),c(3),d(3),q(3)
real qnew(3),cp1(3),cp2(3),cp3(3)
if(lnodetype>=3.and.lnodetype<=5)then
C PRINT *,NODE,'IN'
c Analysis Parameters
velocity=0.02d0
tol=1.d-5
c
numFacets=nbr(node,1)-1
c get facet point coords (fp).
do i=1,numFacets
nFacet=nbr(node,i+1)
do j=1,3
nNode=facet(nFacet,j)
if (j==1)nnode=node
do k=1,3
fp(i,3*(j-1)+k)=crd(nNode,k)
enddo
c print *,node,nNode
c print *,crd(nNode,1),crd(nNode,2),crd(nNode,3)
enddo
enddo
c get facet element centroid(fe)
fe=0.
do i=1,numFacets
nFacet=nbr(node,i+1)
do j=1,8
nNode=facet(nFacet,j+3)
do k=1,3
fe(i,k)=fe(i,k)+crd(nNode,k)/8.
enddo
enddo
enddo
c get facet centroids (fc)
do i=1,numFacets
do j=1,3
fc(i,j)=(fp(i,j)+fp(i,j+3)+fp(i,j+6))/3.
enddo
enddo
c get facet normals (fn)
do i=1,numFacets
do j=1,3
a(j)=fp(i,j+3)-fp(i,j)
b(j)=fp(i,j+6)-fp(i,j)
enddo
call crossprod(a,b,c)
rlen=sqrt(c(1)*c(1)+c(2)*c(2)+c(3)*c(3))
c get inward pointing unit normal
dp=0.
do j=1,3
dp=dp+c(j)*(fe(i,j)-fc(i,j))
enddo
rsign=1
if(dp<0.)rsign=-1
do j=1,3
fn(i,j)=rsign*c(j)/rlen
enddo
enddo
c move non-fixed facets along unit normals - update fp
dist=velocity*dtime
do i=1,numFacets
nFacet=nbr(node,i+1)
if(facet(nFacet,12)/=1)then
do j=1,3
fp(i,j)=fp(i,j)+fn(i,j)*dist
fp(i,j+3)=fp(i,j+3)+fn(i,j)*dist
fp(i,j+6)=fp(i,j+6)+fn(i,j)*dist
enddo
endif
enddo
c get old node position (q)
do i=1,3
q(i)=crd(node,i)
enddo
c determine method to get qnew and relevant planes
c method depends on # of unique normal directions
numpairs=0
if(numfacets==1)then
method=1
else
numdir=0
do i=1,numfacets-1
do j=i+1,numfacets
dp=0.
do k=1,3
dp=dp+fn(i,k)*fn(j,k)
enddo
if(abs(dp)<1.-tol.or.abs(dp)>1.+tol)then
np(1)=i
np(2)=j
numdir=2
endif
if (numdir==2)continue
enddo
if(numdir==2)continue
enddo
if(numdir==2)then
method=3
do i=1,numfacets
if(i/=np(1).and.i/=np(2))then
dp1=0.
dp2=0.
do j=1,3
dp1=dp1+fn(np(1),j)*fn(i,j)
dp2=dp2+fn(np(2),j)*fn(i,j)
enddo
if(abs(dp1)<1.-tol.or.abs(dp1)>1.+tol)then
if(abs(dp2)<1.-tol.or.
$ abs(dp2)>1.+tol)then
np(3)=i
numdir=3
method=2
endif
endif
endif
enddo
else
method=1
endif
endif
c Get new node position
if(method==1)then
c get projection of old point q onto any plane
c qnew = q - ((q - p1).n)*n
dp=0.
do i=1,3
dp=dp+(q(i)-fp(1,i))*fn(1,i)
enddo
do i=1,3
qnew(i)=q(i)-dp*fn(1,i)
enddo
elseif(method==2)then
c get distances d from each plane to origin
do i=1,3
d(i)=0.
do j=1,3
d(i)=d(i)-fn(np(i),j)*fp(np(i),j)
enddo
enddo
c get n1 x n2
do i=1,3
a(i)=fn(np(1),i)
b(i)=fn(np(2),i)
enddo
call crossprod(a,b,cp1)
c get n2 x n3
do i=1,3
a(i)=fn(np(2),i)
b(i)=fn(np(3),i)
enddo
call crossprod(a,b,cp2)
c get n3 x n1
do i=1,3
a(i)=fn(np(3),i)
b(i)=fn(np(1),i)
enddo
call crossprod(a,b,cp3)
c get intersection of 3 planes
c qnew = (-d1(n2 x n3)-d2(n3 x n1)-d3(n1 x n2))/(n1.(n2 x n3))
denom=fn(np(1),1)*cp2(1)+fn(np(1),2)*cp2(2)
$ +fn(np(1),3)*cp2(3)
do i=1,3
qnew(i)=-(d(1)*cp2(i)+d(2)*cp3(i)+d(3)*cp1(i))
$ /denom
enddo
else
c find line of intersection of planes given by a point
c and vector
do i=1,2
d(i)=0.
do j=1,3
d(i)=d(i)-fn(np(i),j)*fp(np(i),j)
enddo
enddo
c get n1 x n2
do i=1,3
a(i)=fn(np(1),i)
b(i)=fn(np(2),i)
enddo
call crossprod(a,b,cp1)
rlen=sqrt(cp1(1)*cp1(1)+cp1(2)*cp1(2)+cp1(3)*cp1(3))
do i=1,3
a(i)=d(2)*fn(np(1),i)-d(1)*fn(np(2),i)
enddo
c get (d2n1 - d1n2) x (n1 x n2)
call crossprod(a,cp1,cp2)
c a = unit vector along line
c b = point on line
do i=1,3
a(i)=cp1(i)/rlen
b(i)=cp2(i)/(rlen*rlen)
enddo
c get projection of node onto line
c bq'=((bq).a)*a
dp=0.
do i=1,3
dp=dp+(q(i)-b(i))*a(i)
enddo
do i=1,3
qnew(i)=b(i)+dp*a(i)
enddo
endif
do i=1,3
a(i)=(qnew(i)-q(i))/dtime
enddo
c print *,node,a(1),a(2),a(3)
do i=1,3
uglobal(i) = a(i)
enddo
do i=1,ndim
tlocal(i)=0.
do j=1,ndim
tlocal(i)=tlocal(i)+uglobal(j)*alocal(j,i)
enddo
enddo
do i=1,ndim
ulocal(i)=tlocal(i)
enddo
endif
lsmooth=1
return
end
c Return cross product(c) for input vectors (a, b)
subroutine crossprod(a,b,c)
include 'aba_param.inc'
real a(3),b(3),c(3)
c(1)=a(2)*b(3)-a(3)*b(2)
c(2)=a(3)*b(1)-a(1)*b(3)
c(3)=a(1)*b(2)-a(2)*b(1)
return
end

View file

@ -0,0 +1,31 @@
# Python Preprocessor Script for Abaqus Corrosion Model
# J. Grogan, D. Gastaldi - Created. 19-07-11
# Import abaqus modules
from abaqusConstants import *
from abaqus import *
import random
# Create Model, Assembly and Instance objects
modelNames=mdb.models.keys()
corModel=mdb.models[modelNames[0]]
corAssembly=corModel.rootAssembly
corInst=corAssembly.instances['Corrode']
# Create list to store labels of surface elements
numElems=len(corInst.elements)
elemList=[0]*numElems*2
randList=[0]*numElems*2
corSurf=corAssembly.surfaces['CorSurf']
random.seed()
for eachElem in corSurf.elements:
elemList[eachElem.label]=1
randList[eachElem.label]=random.weibullvariate(1.,0.14)
# For each element write surface flag and random number to INC file
incFile=open(modelNames[0]+'.inc','w')
incFile.write("*Initial Conditions,type=solution \n")
j=0
for eachElem in corInst.elements:
label=eachElem.label
incFile.write ("Assembly.Corrode.%i,%i,%f,%i,%i\n"%(label,
elemList[label],randList[label],0,0))
j=j+1
print (float(j)/float(len(corInst.elements)))*100.
incFile.close()

View file

@ -0,0 +1,181 @@
c J. Grogan, 2012
c -------------------------------------------------------------------
subroutine vusdfld(
* nblock,nstatev,nfieldv,nprops,ndir,nshr,jElem,kIntPt,
* kLayer,kSecPt,stepTime,totalTime,dt,cmname,coordMp,
* direct,T,charLength,props,stateOld,stateNew,field)
c
include 'vaba_param.inc'
c
dimension jElem(nblock),stateNew(nblock,nstatev),
* field(nblock,nfieldv),stateOld(nblock,nstatev),
* charLength(nblock),rPEEQ(maxblk,1),
* Stress(nblock*6),jData(nblock*6),
* eigVal(nblock,3),coordMp(nblock,3)
c -------------------------------------------------------------------
c Common blocks store element status and random number assigment.
common active(600000)
common rnum(600000)
integer active
integer rnum
c
do k=1,nblock
c -------------------------------------------------------------------
c Update SDVs
do i=1,7
stateNew(k,i)=stateOld(k,i)
enddo
stateNew(k,11)=stateOld(k,11)
c -------------------------------------------------------------------
c Determine Characteristic Element Length
damage=stateOld(k,8)
randE=stateOld(k,9)
activeE=stateOld(k,10)
c -------------------------------------------------------------------
c Check if element is on exposed surface.
do i=2,7
nNum=stateNew(k,i)
if(nNum==0.)cycle
if(active(nNum)==1)then
activeE=1.
if(rnum(nNum)*0.9547>randE)randE=rnum(nNum)*0.9547
endif
enddo
c -------------------------------------------------------------------
c Recover Corrosion Parameters
ukinetic=0.05d0
randE=1.d0
if(activeE>0.99d0)then
if(totaltime>1.5d0)then
dam_inc=(ukinetic/charlength(k))*randE*dt
damage=damage+dam_inc
endif
endif
c -------------------------------------------------------------------
c Remove Fully Damaged Elements
if(damage>=0.999)then
damage=1.d0
stateNew(k,11)=0.d0
active(statenew(k,1))=1.d0
rnum(statenew(k,1))=randE
endif
c -------------------------------------------------------------------
stateNew(k,8)=damage
field(k,1)=damage
stateNew(k,9)=randE
stateNew(k,10)=activeE
c -------------------------------------------------------------------
end do
return
end subroutine vusdfld
subroutine vuanisohyper_inv(nblock,nFiber,nInv,jElem,kIntPt,
* kLayer,kSecPt,cmname,nstatev, nfieldv, nprops,props,tempOld,
* tempNew,fieldOld,fieldNew,stateOld,sInvariant,zeta,uDev,duDi,
* d2uDiDi,stateNew)
c
include 'vaba_param.inc'
c
dimension props(nprops),tempOld(nblock),
* fieldOld(nblock,nfieldv),stateOld(nblock,nstatev),
* tempNew(nblock), fieldNew(nblock,nfieldv),
* stateNew(nblock,nstatev),sInvariant(nblock,nInv),
* zeta(nblock,nFiber*(nFiber-1)/2),uDev(nblock),
* duDi(nblock,nInv),d2uDiDi(nblock,nInv*(nInv+1)/2)
c
parameter(zero = 0.d0, one = 1.d0, two = 2.d0, three = 3.d0)
common active(600000)
common rnum(600000)
integer active
integer rnum
c Material Properties
u = props(1)
rkap = props(2)
rk1 = props(3)
rk2 = props(4)
rp = props(5)
c
c Loop Over Each Element
do k = 1,nblock
c Index Each Invariant according to Abaqus Convention
i1 = 1
i1i1 = 1
i3 = 3
i3i3 = 6
i4 = 4
i1i4 = 7
i4i4 = 10
i6 = 8
i1i6 = 29
i6i6 = 36
c Get Values of each Invariant
ri1 = sinvariant(k,i1)
ri4 = sinvariant(k,i4)
ri6 = sinvariant(k,i6)
c Get Fibre Contributions to UDEV
t = (one - rp) * (ri1 - three) * (ri1 - three)
if(ri4>1.)then
t1 = rk2 * (t + rp * (ri4 - one) * (ri4 - one))
else
t1=0.
endif
if(ri6>1.)then
t2 = rk2 * (t + rp * (ri6 - one) * (ri6 - one))
else
t2=0.
endif
et1 = exp(t1)
et2 = exp(t2)
term1 = rk1 / (two * rk2)
ufibres = term1 * (et1 + et2 - two)
c Get UDEV
udev(k) = u * (ri1 - three) + ufibres
c Get dUdI1
dt1di1 = rk2 * two * (one - rp) * (ri1 - three)
dudi(k,i1) = term1 * dt1di1 * (et1 + et2) + u
c Get dUdI4 and dUdI6
if(ri4>1.)then
dt1di4 = rk2 * two * rp * (ri4 - one)
else
dt1di4 = 0.
endif
if(ri6>1.)then
dt2di6 = rk2 * two * rp * (ri6 - one)
else
dt2di6 = 0.
endif
dudi(k,i4) = term1 * dt1di4 * et1
dudi(k,i6) = term1 * dt2di6 * et2
c Get d2UdI1dI1
d2t1di1di1 = rk2 * two * (one - rp)
d2udidi(k,i1i1) = term1 * (d2t1di1di1 + dt1di1 * dt1di1)
d2udidi(k,i1i1) = d2udidi(k,i1i1) * (et1 + et2)
c Get d2UdI1dI4 and d2UdI4dI4
d2udidi(k,i1i4) = term1 * dt1di4 * dt1di1 * et1
d2t1di4di4 = rk2 * two * rp
d2udidi(k,i4i4) = term1 * (dt1di4 * dt1di4 + d2t1di4di4)
d2udidi(k,i4i4) = d2udidi(k,i4i4) * et1
c Get d2UdI1dI6 and d2UdI6dI6
d2udidi(k,i1i6) = term1 * dt2di6 * dt1di1 * et2
d2t2di6di6 = rk2 * two * rp
d2udidi(k,i6i6) = term1 * (dt2di6 * dt2di6 + d2t2di6di6)
d2udidi(k,i6i6) = d2udidi(k,i6i6) * et2
end do
c For the compressible case
if(rkap > zero) then
do k = 1,nblock
rj = sInvariant(k,i3)
dudi(k,i3) = rkap * (rj-one)
c duDi(k,i3) = (rkap/two) * (rj - one/rj)
d2udidi(k,i3i3) = rkap
c d2uDiDi(k,i3i3)= (rkap/two) * (one + one/ rj / rj)
end do
end if
return
end

View file

@ -0,0 +1,201 @@
c J. Grogan, 2012
c -------------------------------------------------------------------
subroutine vusdfld(
* nblock,nstatev,nfieldv,nprops,ndir,nshr,jElem,kIntPt,
* kLayer,kSecPt,stepTime,totalTime,dt,cmname,coordMp,
* direct,T,charLength,props,stateOld,stateNew,field)
c
include 'vaba_param.inc'
c
dimension jElem(nblock),stateNew(nblock,nstatev),
* field(nblock,nfieldv),stateOld(nblock,nstatev),
* charLength(nblock),rPEEQ(maxblk,1),
* Stress(nblock*6),jData(nblock*6),
* eigVal(nblock,3),coordMp(nblock,3)
c -------------------------------------------------------------------
c Common blocks store element status and random number assigment.
common active(600000)
common rnum(600000)
common ibcheck
integer active
integer rnum
integer ibcheck
character*256 outdir
c
if (ibcheck/=5)then
call vgetoutdir(outdir,lenoutdir)
open(unit=105,file=outdir(1:lenoutdir)//'/NBOPTP.inc',
* status='old')
do while (ioe==0)
read(105,*,iostat=ioe)ielnum,frnum
if(ioe==0)rnum(ielnum)=frnum
enddo
close(unit=105)
ibcheck=5
endif
do k=1,nblock
c -------------------------------------------------------------------
c Update SDVs
do i=1,7
stateNew(k,i)=stateOld(k,i)
enddo
stateNew(k,11)=stateOld(k,11)
c -------------------------------------------------------------------
c Determine Characteristic Element Length
damage=stateOld(k,8)
if(steptime<2.*dt)then
randE=rnum(statenew(k,1))
else
randE=stateOld(k,9)
endif
activeE=stateOld(k,10)
c -------------------------------------------------------------------
c Check if element is on exposed surface.
do i=2,7
nNum=stateNew(k,i)
if(nNum==0.)cycle
if(active(nNum)==1)then
activeE=1.
if(rnum(nNum)*0.94>randE)randE=rnum(nNum)*0.94
endif
enddo
c -------------------------------------------------------------------
c Recover Corrosion Parameters
ukinetic=0.000025d0
c randE=1.d0
if(activeE>0.99d0)then
if(totaltime>1.5d0)then
dam_inc=(ukinetic/charlength(k))*randE*dt
damage=damage+dam_inc
endif
endif
c -------------------------------------------------------------------
c Remove Fully Damaged Elements
if(damage>=0.999)then
damage=1.d0
stateNew(k,11)=0.d0
active(statenew(k,1))=1.d0
rnum(statenew(k,1))=randE
endif
c -------------------------------------------------------------------
stateNew(k,8)=damage
field(k,1)=damage
stateNew(k,9)=randE
stateNew(k,10)=activeE
c -------------------------------------------------------------------
end do
return
end subroutine vusdfld
subroutine vuanisohyper_inv(nblock,nFiber,nInv,jElem,kIntPt,
* kLayer,kSecPt,cmname,nstatev, nfieldv, nprops,props,tempOld,
* tempNew,fieldOld,fieldNew,stateOld,sInvariant,zeta,uDev,duDi,
* d2uDiDi,stateNew)
c
include 'vaba_param.inc'
c
dimension props(nprops),tempOld(nblock),
* fieldOld(nblock,nfieldv),stateOld(nblock,nstatev),
* tempNew(nblock), fieldNew(nblock,nfieldv),
* stateNew(nblock,nstatev),sInvariant(nblock,nInv),
* zeta(nblock,nFiber*(nFiber-1)/2),uDev(nblock),
* duDi(nblock,nInv),d2uDiDi(nblock,nInv*(nInv+1)/2)
c
parameter(zero = 0.d0, one = 1.d0, two = 2.d0, three = 3.d0)
common active(600000)
common rnum(600000)
common ibcheck
integer active
integer rnum
integer ibcheck
c Material Properties
u = props(1)
rkap = props(2)
rk1 = props(3)
rk2 = props(4)
rp = props(5)
c
c Loop Over Each Element
do k = 1,nblock
c Index Each Invariant according to Abaqus Convention
i1 = 1
i1i1 = 1
i3 = 3
i3i3 = 6
i4 = 4
i1i4 = 7
i4i4 = 10
i6 = 8
i1i6 = 29
i6i6 = 36
c Get Values of each Invariant
ri1 = sinvariant(k,i1)
ri4 = sinvariant(k,i4)
ri6 = sinvariant(k,i6)
c Get Fibre Contributions to UDEV
t = (one - rp) * (ri1 - three) * (ri1 - three)
if(ri4>1.)then
t1 = rk2 * (t + rp * (ri4 - one) * (ri4 - one))
else
t1=0.
endif
if(ri6>1.)then
t2 = rk2 * (t + rp * (ri6 - one) * (ri6 - one))
else
t2=0.
endif
et1 = exp(t1)
et2 = exp(t2)
term1 = rk1 / (two * rk2)
ufibres = term1 * (et1 + et2 - two)
c Get UDEV
udev(k) = u * (ri1 - three) + ufibres
c Get dUdI1
dt1di1 = rk2 * two * (one - rp) * (ri1 - three)
dudi(k,i1) = term1 * dt1di1 * (et1 + et2) + u
c Get dUdI4 and dUdI6
if(ri4>1.)then
dt1di4 = rk2 * two * rp * (ri4 - one)
else
dt1di4 = 0.
endif
if(ri6>1.)then
dt2di6 = rk2 * two * rp * (ri6 - one)
else
dt2di6 = 0.
endif
dudi(k,i4) = term1 * dt1di4 * et1
dudi(k,i6) = term1 * dt2di6 * et2
c Get d2UdI1dI1
d2t1di1di1 = rk2 * two * (one - rp)
d2udidi(k,i1i1) = term1 * (d2t1di1di1 + dt1di1 * dt1di1)
d2udidi(k,i1i1) = d2udidi(k,i1i1) * (et1 + et2)
c Get d2UdI1dI4 and d2UdI4dI4
d2udidi(k,i1i4) = term1 * dt1di4 * dt1di1 * et1
d2t1di4di4 = rk2 * two * rp
d2udidi(k,i4i4) = term1 * (dt1di4 * dt1di4 + d2t1di4di4)
d2udidi(k,i4i4) = d2udidi(k,i4i4) * et1
c Get d2UdI1dI6 and d2UdI6dI6
d2udidi(k,i1i6) = term1 * dt2di6 * dt1di1 * et2
d2t2di6di6 = rk2 * two * rp
d2udidi(k,i6i6) = term1 * (dt2di6 * dt2di6 + d2t2di6di6)
d2udidi(k,i6i6) = d2udidi(k,i6i6) * et2
end do
c For the compressible case
if(rkap > zero) then
do k = 1,nblock
rj = sInvariant(k,i3)
dudi(k,i3) = rkap * (rj-one)
c duDi(k,i3) = (rkap/two) * (rj - one/rj)
d2udidi(k,i3i3) = rkap
c d2uDiDi(k,i3i3)= (rkap/two) * (one + one/ rj / rj)
end do
end if
return
end

View file

@ -0,0 +1,100 @@
subroutine vuanisohyper_inv(nblock,nFiber,nInv,jElem,kIntPt,
* kLayer,kSecPt,cmname,nstatev, nfieldv, nprops,props,tempOld,
* tempNew,fieldOld,fieldNew,stateOld,sInvariant,zeta,uDev,duDi,
* d2uDiDi,stateNew)
c
include 'vaba_param.inc'
c
dimension props(nprops),tempOld(nblock),
* fieldOld(nblock,nfieldv),stateOld(nblock,nstatev),
* tempNew(nblock), fieldNew(nblock,nfieldv),
* stateNew(nblock,nstatev),sInvariant(nblock,nInv),
* zeta(nblock,nFiber*(nFiber-1)/2),uDev(nblock),
* duDi(nblock,nInv),d2uDiDi(nblock,nInv*(nInv+1)/2)
c
parameter(zero = 0.d0, one = 1.d0, two = 2.d0, three = 3.d0)
c Material Properties
u = props(1)
rkap = props(2)
rk1 = props(3)
rk2 = props(4)
rp = props(5)
c
c Loop Over Each Element
do k = 1,nblock
c Index Each Invariant according to Abaqus Convention
i1 = 1
i1i1 = 1
i3 = 3
i3i3 = 6
i4 = 4
i1i4 = 7
i4i4 = 10
i6 = 8
i1i6 = 29
i6i6 = 36
c Get Values of each Invariant
ri1 = sinvariant(k,i1)
ri4 = sinvariant(k,i4)
ri6 = sinvariant(k,i6)
c Get Fibre Contributions to UDEV
t = (one - rp) * (ri1 - three) * (ri1 - three)
if(ri4>1.)then
t1 = rk2 * (t + rp * (ri4 - one) * (ri4 - one))
else
t1=0.
endif
if(ri6>1.)then
t2 = rk2 * (t + rp * (ri6 - one) * (ri6 - one))
else
t2=0.
endif
et1 = exp(t1)
et2 = exp(t2)
term1 = rk1 / (two * rk2)
ufibres = term1 * (et1 + et2 - two)
c Get UDEV
udev(k) = u * (ri1 - three) + ufibres
c Get dUdI1
dt1di1 = rk2 * two * (one - rp) * (ri1 - three)
dudi(k,i1) = term1 * dt1di1 * (et1 + et2) + u
c Get dUdI4 and dUdI6
if(ri4>1.)then
dt1di4 = rk2 * two * rp * (ri4 - one)
else
dt1di4 = 0.
endif
if(ri6>1.)then
dt2di6 = rk2 * two * rp * (ri6 - one)
else
dt2di6 = 0.
endif
dudi(k,i4) = term1 * dt1di4 * et1
dudi(k,i6) = term1 * dt2di6 * et2
c Get d2UdI1dI1
d2t1di1di1 = rk2 * two * (one - rp)
d2udidi(k,i1i1) = term1 * (d2t1di1di1 + dt1di1 * dt1di1)
d2udidi(k,i1i1) = d2udidi(k,i1i1) * (et1 + et2)
c Get d2UdI1dI4 and d2UdI4dI4
d2udidi(k,i1i4) = term1 * dt1di4 * dt1di1 * et1
d2t1di4di4 = rk2 * two * rp
d2udidi(k,i4i4) = term1 * (dt1di4 * dt1di4 + d2t1di4di4)
d2udidi(k,i4i4) = d2udidi(k,i4i4) * et1
c Get d2UdI1dI6 and d2UdI6dI6
d2udidi(k,i1i6) = term1 * dt2di6 * dt1di1 * et2
d2t2di6di6 = rk2 * two * rp
d2udidi(k,i6i6) = term1 * (dt2di6 * dt2di6 + d2t2di6di6)
d2udidi(k,i6i6) = d2udidi(k,i6i6) * et2
end do
c For the compressible case
if(rkap > zero) then
do k = 1,nblock
rj = sInvariant(k,i3)
dudi(k,i3) = rkap * (rj-one)
c duDi(k,i3) = (rkap/two) * (rj - one/rj)
d2udidi(k,i3i3) = rkap
c d2uDiDi(k,i3i3)= (rkap/two) * (one + one/ rj / rj)
end do
end if
return
end

View file

@ -0,0 +1,48 @@
# Import Neccesary Abaqus Modules
from abaqusConstants import *
from abaqus import *
# Define Part
aModel=mdb.models['Straight']
aAss=aModel.rootAssembly
bPart=aModel.parts['p3']
tb=0.24
A=2.4
ecen=0.
ellip=0.
bean_m=0.
bean_exp=1.5
t1=5.
t2=5.
xp1=0.5
xp2=0.5
rL1=11.
rL2=10.1787602
radius=rL2/(2.*pi)
r2=15.
# Map Part
nodelist=[]
coordlist=[]
for eachnode in bPart.nodes:
x_cor=eachnode.coordinates[0]
y_cor=eachnode.coordinates[1]
z_cor=eachnode.coordinates[2]
rFraction=z_cor/tb
rindex1=(y_cor/rL1)**(-log(2.)/log(xp1))
rbracket1=(sin(pi*rindex1))**t1
rad_plaque=1.+A*rbracket1
rheight1=tb+(A-tb)*rbracket1
theta=x_cor/radius
x_cor=(radius-rad_plaque*z_cor)*cos(theta)
y_cor=y_cor
z_cor=(radius-rad_plaque*z_cor)*sin(theta)-ecen*rbracket1*rFraction
if x_cor>0.:
x_cor=x_cor+ellip*abs(x_cor)*rFraction*rbracket1
else:
x_cor=x_cor-ellip*abs(x_cor)*rFraction*rbracket1
z_cor=z_cor+bean_m*(abs(x_cor)**bean_exp)*rFraction*rbracket1
# theta=y_cor/r2
# y_cor=(r2-z_cor)*cos(theta)
# z_cor=(r2-z_cor)*sin(theta)
nodelist.append(eachnode)
coordlist.append((x_cor,y_cor,z_cor))
bPart.editNode(nodes=nodelist,coordinates=coordlist)

View file

@ -0,0 +1,45 @@
# This is a pre-processor script for 3D ALE corrosion analysis.
# Author: J. Grogan - BMEC, NUI Galway. Created: 19/09/2012
from abaqusConstants import *
from abaqus import *
#
aModel=mdb.models['Dream6']
aPart=aModel.parts['AMesh']
incFile=open('NodeData.inc','w')
#
numFaces=0
pstring=''
# Cycle through all element faces
for eachFace in aPart.elementFaces:
# Check if Face is on external Surface
if len(eachFace.getElements())==1:
numFaces=numFaces+1
faceNodes=eachFace.getNodes()
# Identify 'Fixed' Faces
fixed=1
try:
fSet=aPart.sets['Fixed']
for eachNode in faceNodes:
if eachNode not in fSet.nodes:
fixed=0
break
except:
fixed=0
pstring=pstring+str(fixed)+' '
# Write Element Nodes
eNodes=[]
for eachNode in eachFace.getElements()[0].getNodes():
pstring=pstring+str(eachNode.label)+' '
pstring=pstring+'\n'
# Write Each Face Nodes and Corresponding Connected Nodes
for eachNode in faceNodes:
pstring=pstring+str(eachNode.label)+' '
for eachEdge in eachNode.getElemEdges():
for eachENode in eachEdge.getNodes():
if eachENode.label != eachNode.label and eachENode in faceNodes:
pstring=pstring+str(eachENode.label)+' '
pstring=pstring+'\n'
#
incFile.write(str(numFaces)+'\n')
incFile.write(pstring)
incFile.close()

View file

@ -0,0 +1,33 @@
from abaqusConstants import *
from odbAccess import *
odbfilename='tpit3.odb'
resFile='Diams20.dat'
outFile = open(resFile,"w")
odb=openOdb(path=odbfilename)
# create sets
addNodes=[]
tol1=0.005
tol2=0.005
minval=-5.0
# Find Inner Nodes
for eachNode in odb.rootAssembly.instances['PLAQUE-1'].nodes:
x=eachNode.coordinates[0]
y=eachNode.coordinates[1]
dist=sqrt(x*x+y*y)
if dist<0.82:
addNodes.append(eachNode.label)
odb.rootAssembly.NodeSetFromNodeLabels(name='Min13', nodeLabels=(('PLAQUE-1',addNodes),))
aSet=odb.rootAssembly.nodeSets['Min13']
print aSet
# Find Min Radius
for eachFrame in odb.steps['Step-3'].frames:
if eachFrame.frameValue>.5:
dist=0.
for eachValue in eachFrame.fieldOutputs["U"].getSubset(region=aSet).values:
x=eachValue.data[0]
y=eachValue.data[1]
dist=dist+sqrt(x*x+y*y)
dist=dist/(len(eachFrame.fieldOutputs["U"].getSubset(region=aSet).values))
print dist,eachFrame.frameValue
outFile.write('%f %f \n'%(dist,eachFrame.frameValue))
outFile.close()

View file

@ -0,0 +1,40 @@
Program Balloon_Wrap
!
! Program to map plaque from flat to cylindrical shape.
!
real pi,x_cor,y_cor,z_cor,theta,radius,theta_hat,rad_hat,alpha,beta,phi
real inner_radius,outer_radius,num_folds,multiplier
integer node_num
!
open(unit=10,file='in.dat',status='old')
open(unit=11,file='out.dat',status='unknown')
!
tb=0.2
A=0.5
ecen=0.2
t1=5.
t2=5.
xp1=0.5
xp2=0.5
rL1=11.
rL2=8.6708
radius=1.38
!
do i=1, 69264
read(10,*)node_num,x_cor,y_cor,z_cor
rFraction=z_cor/tb
rindex1=(y_cor/rL1)**(-log(2.)/log(xp1))
rbracket1=(sin(3.1415*rindex1))**t1
rad_plaque=1.+A*rbracket1
rheight1=tb+(A-tb)*rbracket1
!
z_cor=rheight1*rFraction
!
xfrac=x_cor/rL2
theta=x_cor/radius
x_cor=(radius-rad_plaque*z_cor)*cos(theta)
y_cor=y_cor
z_cor=(radius-rad_plaque*z_cor)*sin(theta)+ecen*rbracket1*rFraction
write(11,*)node_num,',',x_cor,',',y_cor,',',z_cor
enddo
end program

View file

@ -0,0 +1,40 @@
# Import Neccesary Abaqus Modules
from abaqusConstants import *
from abaqus import *
from odbAccess import *
import regionToolset
import sys
import os
import interaction
import random
mname='StraightMagic2'
mtype=1
jobName=mname
aModel=mdb.models[mname]
aAss=aModel.rootAssembly
bPart=aModel.parts['Stent1']
random.seed(2344564)
incFile=open('NBR.inc','w')
onSurf=[]
for i in range(0,300000):
onSurf.append(0)
incFile.write("*INITIAL CONDITIONS,TYPE=SOLUTION \n")
if mtype==1:
for eachSN in bPart.sets['Set-1'].elements:
onSurf[eachSN.label]=1
for eachElement in bPart.elements:
label=eachElement.label
nbrs=[]
for eachNbr in eachElement.getAdjacentElements():
nbrs.append(eachNbr.label)
for i in range(0,6-len(eachElement.getAdjacentElements())):
nbrs.append(0)
if onSurf[label]==1:
rnum=random.weibullvariate(1.,0.2)
else:
rnum=0.
incFile.write("Assembly.Stent1-1.%i, %i, %i, %i, %i, %i, %i, %i, \n"%(label,label,
nbrs[0],nbrs[1],nbrs[2],nbrs[3],nbrs[4],nbrs[5]))
incFile.write("%i, %f, %i, %i, \n"%(0,rnum,onSurf[label],0))
incFile.close()

View file

@ -0,0 +1,12 @@
from abaqusConstants import *
from abaqus import *
aModel=mdb.models['Straight']
aPart=aModel.parts['PLAQUE1']
Radius=15.
for eachnode in aPart.nodes:
theta=eachnode.coordinates[1]/Radius
newcoord1=(Radius-eachnode.coordinates[0])*sin(theta)
newcoord2=(Radius-eachnode.coordinates[0])*cos(theta)
newcoord3=eachnode.coordinates[2]
aPart.editNode(nodes=eachnode,coordinate1=newcoord1,coordinate2=newcoord2,
coordinate3=newcoord3)

View file

@ -0,0 +1,55 @@
Program Balloon_Wrap
!
! Program to map an unfolded ballon geometry onto a folded configuration (Based on Laroche Paper)
! Input: File containing nodal coords of ballon geometry (Abaqus INP Format)
! Output: File containing nodal coords of mapped ballon geometry (Abaqus INP Format)
! Rev. 1 - J. Grogan - 07/07/10
!
real pi,x_cor,y_cor,z_cor,theta,radius,theta_hat,rad_hat,alpha,beta,phi
real inner_radius,outer_radius,num_folds,multiplier
integer node_num
logical outer_flap
!
open(unit=10,file='in.dat',status='old')
open(unit=11,file='out.dat',status='unknown')
!
pi=acos(-1.)
inner_radius=0.25
outer_radius=0.43
num_folds=3.
phi=(2*pi)/num_folds
outer_flap=.false.
!
do i=1, 9821
read(10,*)node_num,x_cor,y_cor,z_cor
theta=(atan2(z_cor,x_cor))
radius=sqrt(z_cor*z_cor+x_cor*x_cor)
!
if(theta<0.)then
theta=theta+2*pi
endif
!
beta=(phi/2.)*(1.+(2*radius)/(inner_radius+outer_radius))
alpha=((outer_radius+inner_radius)/(2*radius))*beta
!
do j=1,num_folds
if((theta>=(j-1)*phi).and.(theta<=(alpha+(j-1)*phi)))then
multiplier=j-1
outer_flap=.true.
elseif((theta>=(alpha+(j-1)*phi)).and.(theta<=(j*phi)))then
multiplier=j
outer_flap=.false.
endif
enddo
!
if(outer_flap)then
theta_hat=(beta/alpha)*(theta-multiplier*phi)+multiplier*phi
rad_hat=inner_radius+((outer_radius-inner_radius)/beta)*(theta_hat-multiplier*phi)
else
theta_hat=((beta-phi)/(phi-alpha))*(multiplier*phi-theta)+multiplier*phi
rad_hat=inner_radius+((outer_radius-inner_radius)/(beta-phi))*(theta_hat-multiplier*phi)
endif
!
write(11,*)node_num,',',rad_hat*cos(theta_hat),',',y_cor,',',rad_hat*sin(theta_hat)
enddo
end program