Add scripts and inp files.
This commit is contained in:
parent
ad937f2602
commit
e19f869a1e
390 changed files with 6580687 additions and 10 deletions
BIN
Biomaterials13/Sample_ParamSweep/._Launch.pbs
Normal file
BIN
Biomaterials13/Sample_ParamSweep/._Launch.pbs
Normal file
Binary file not shown.
BIN
Biomaterials13/Sample_ParamSweep/._OptB.in
Normal file
BIN
Biomaterials13/Sample_ParamSweep/._OptB.in
Normal file
Binary file not shown.
BIN
Biomaterials13/Sample_ParamSweep/._OptB.py
Normal file
BIN
Biomaterials13/Sample_ParamSweep/._OptB.py
Normal file
Binary file not shown.
BIN
Biomaterials13/Sample_ParamSweep/._PyWrapperB.py
Normal file
BIN
Biomaterials13/Sample_ParamSweep/._PyWrapperB.py
Normal file
Binary file not shown.
BIN
Biomaterials13/Sample_ParamSweep/._readme.txt
Normal file
BIN
Biomaterials13/Sample_ParamSweep/._readme.txt
Normal file
Binary file not shown.
BIN
Biomaterials13/Sample_ParamSweep/._tasks.inp
Normal file
BIN
Biomaterials13/Sample_ParamSweep/._tasks.inp
Normal file
Binary file not shown.
316
Biomaterials13/Sample_ParamSweep/ALE20.f
Normal file
316
Biomaterials13/Sample_ParamSweep/ALE20.f
Normal 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.01d0
|
||||
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
|
||||
|
27
Biomaterials13/Sample_ParamSweep/Launch.pbs
Normal file
27
Biomaterials13/Sample_ParamSweep/Launch.pbs
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
#PBS -l nodes=2:ppn=12
|
||||
#PBS -l walltime=9:00:00
|
||||
#PBS -N Opt_Stiffness_P3
|
||||
#PBS -A ngeng036b
|
||||
#PBS -r n
|
||||
#PBS -j oe
|
||||
#PBS -m bea
|
||||
#PBS -M lumpwood@gmail.com
|
||||
#PBS -V
|
||||
cd $PBS_O_WORKDIR
|
||||
module load taskfarm2
|
||||
module load intel-cc
|
||||
module load intel-fc
|
||||
module load intel-mkl
|
||||
module load boost-intel
|
||||
module load intel-mpi
|
||||
module load abaqus
|
||||
taskfarm tasks.inp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
Biomaterials13/Sample_ParamSweep/OptB.cae
Normal file
BIN
Biomaterials13/Sample_ParamSweep/OptB.cae
Normal file
Binary file not shown.
30
Biomaterials13/Sample_ParamSweep/OptB.in
Normal file
30
Biomaterials13/Sample_ParamSweep/OptB.in
Normal file
|
@ -0,0 +1,30 @@
|
|||
strategy,
|
||||
single
|
||||
#pareto_set
|
||||
#graphics
|
||||
#opt_method_pointer = "NLP"
|
||||
#multi_objective_weight_sets =
|
||||
#1. 0.
|
||||
#0. 1.
|
||||
#.5 .5
|
||||
tabular_graphics_data
|
||||
method,
|
||||
id_method = "NLP"
|
||||
efficient_global
|
||||
seed = 79877
|
||||
variables,
|
||||
continuous_design = 6
|
||||
lower_bounds 0.11 0.11 0.6 1.0 0.1 0.001
|
||||
upper_bounds 0.16 0.14 1.0 1.2 0.5 0.04
|
||||
descriptors "x1" "x2" "x3" "x4" "x5" "x6"
|
||||
interface,
|
||||
fork asynchronous evaluation_concurrency = 1
|
||||
analysis_drivers = 'abaqus python PyWrapperB.py --'
|
||||
parameters_file = 'Bparams.in'
|
||||
results_file = 'Bresults.out'
|
||||
file_tag
|
||||
file_save
|
||||
responses,
|
||||
objective_functions = 1
|
||||
no_gradients
|
||||
no_hessians
|
14
Biomaterials13/Sample_ParamSweep/OptB.jnl
Normal file
14
Biomaterials13/Sample_ParamSweep/OptB.jnl
Normal file
|
@ -0,0 +1,14 @@
|
|||
from part import *
|
||||
from material import *
|
||||
from section import *
|
||||
from assembly import *
|
||||
from step import *
|
||||
from interaction import *
|
||||
from load import *
|
||||
from mesh import *
|
||||
from job import *
|
||||
from sketch import *
|
||||
from visualization import *
|
||||
from connectorBehavior import *
|
||||
mdb.models['Dream6'].boundaryConditions['BC-2'].setValues(u1=-0.7)
|
||||
# Save by 05365350 on Fri Oct 19 21:01:57 2012
|
126
Biomaterials13/Sample_ParamSweep/OptB.py
Normal file
126
Biomaterials13/Sample_ParamSweep/OptB.py
Normal file
|
@ -0,0 +1,126 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from abaqus import *
|
||||
from odbAccess import *
|
||||
import regionToolset
|
||||
import sys
|
||||
import os
|
||||
import interaction
|
||||
import mesh
|
||||
#Read in Model Parameters
|
||||
paramFile=sys.argv[-1]
|
||||
jobName=paramFile.encode("hex")
|
||||
os.system ("cp %s %s" % ('OptB.cae', jobName+'.cae'))
|
||||
mdb=openMdb(jobName+'.cae')
|
||||
inFile = open(paramFile,"r")
|
||||
inFile.readline()
|
||||
x1,name1=inFile.readline().split()
|
||||
x2,name2=inFile.readline().split()
|
||||
x3,name3=inFile.readline().split()
|
||||
x4,name4=inFile.readline().split()
|
||||
x5,name5=inFile.readline().split()
|
||||
x6,name6=inFile.readline().split()
|
||||
mname='Dream6'
|
||||
#Generate New Model
|
||||
aModel=mdb.models[mname]
|
||||
aAss=aModel.rootAssembly
|
||||
tol=0.0001
|
||||
radius=0.75
|
||||
numCrowns=6.
|
||||
W=float(x1)
|
||||
T=float(x2)
|
||||
L1=float(x3)
|
||||
L2=float(x4)*L1
|
||||
L3=float(x5)
|
||||
H2=float(x6)
|
||||
H1=(pi*radius)/(2.*numCrowns)
|
||||
# Modify Part
|
||||
aPart=aModel.parts['Geom']
|
||||
aSketch=aPart.features['Solid extrude-1'].sketch
|
||||
aModel.ConstrainedSketch(name='__edit__', objectToCopy=aSketch)
|
||||
bSketch=aModel.sketches['__edit__']
|
||||
bSketch.parameters['w'].setValues(expression=str(W/2.))
|
||||
bSketch.parameters['h1'].setValues(expression=str(H1))
|
||||
bSketch.parameters['h2'].setValues(expression=str(H2))
|
||||
bSketch.parameters['l1'].setValues(expression=str(L1))
|
||||
bSketch.parameters['l2'].setValues(expression=str(L2))
|
||||
bSketch.parameters['l3'].setValues(expression=str(L3))
|
||||
aPart.features['Solid extrude-1'].setValues(sketch=bSketch)
|
||||
del aModel.sketches['__edit__']
|
||||
aPart.features['Solid extrude-1'].setValues(depth=T)
|
||||
aPart.regenerate()
|
||||
# Mesh Part
|
||||
aPart.seedPart(size=W/6., deviationFactor=0.1)
|
||||
aPart.generateMesh()
|
||||
# Create Orphan Mesh
|
||||
aPart.PartFromMesh(name='AMesh')
|
||||
bPart=aModel.parts['AMesh']
|
||||
# Create Sets,Sections,Surfaces
|
||||
for nameSet,eachSet in aPart.sets.items():
|
||||
bPart.Set(name=nameSet, nodes=eachSet.nodes)
|
||||
bPart.Set(name='AllE', elements=aPart.sets['All'].elements)
|
||||
bPart.Set(name='InnerE', elements=aPart.sets['Inner'].elements)
|
||||
bPart.Set(name='OuterE', elements=aPart.sets['Outer'].elements)
|
||||
region = regionToolset.Region(elements=bPart.elements)
|
||||
bPart.SectionAssignment(region=region, sectionName='Magnesium')
|
||||
aPart=aModel.parts['AMesh']
|
||||
elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD,
|
||||
kinematicSplit=AVERAGE_STRAIN, secondOrderAccuracy=OFF,
|
||||
hourglassControl=ENHANCED, distortionControl=DEFAULT)
|
||||
pickedRegions =(aPart.elements, )
|
||||
aPart.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
|
||||
# Wrap Part
|
||||
nlist=[]
|
||||
clist=[]
|
||||
for eachnode in aPart.nodes:
|
||||
theta=eachnode.coordinates[1]/radius
|
||||
newcoord1=eachnode.coordinates[0]
|
||||
newcoord2=(radius-eachnode.coordinates[2])*cos(theta)
|
||||
newcoord3=(radius-eachnode.coordinates[2])*sin(theta)
|
||||
nlist.append(eachnode)
|
||||
clist.append((newcoord1,newcoord2,newcoord3))
|
||||
aPart.editNode(nodes=nlist,coordinates=clist)
|
||||
aPart.regenerate()
|
||||
aAss.regenerate()
|
||||
aInst=aAss.instances['AMesh-1']
|
||||
aModel.rootAssembly.Set(name='Set-1',nodes=aInst.nodes)
|
||||
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()
|
||||
mdb.Job(name=jobName, model=mname)
|
||||
mdb.jobs[jobName].writeInput(consistencyChecking=OFF)
|
||||
mdb.close()
|
||||
|
34
Biomaterials13/Sample_ParamSweep/OptPostB1.py
Normal file
34
Biomaterials13/Sample_ParamSweep/OptPostB1.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from odbAccess import *
|
||||
import sys
|
||||
import os
|
||||
jobName=sys.argv[-2]
|
||||
resFile=sys.argv[-1]
|
||||
resFile2=resFile+'.b'
|
||||
odbfilename=jobName+'.odb'
|
||||
odb=openOdb(path=odbfilename)
|
||||
aFrame=odb.steps["Step-1"].frames[-1]
|
||||
maxStrain=0.
|
||||
for currentStrain in aFrame.fieldOutputs["LE"].values:
|
||||
if currentStrain.instance.name=='AMESH-1':
|
||||
if currentStrain.maxPrincipal>maxStrain:
|
||||
maxStrain=currentStrain.maxPrincipal
|
||||
outFile = open(resFile,"w")
|
||||
if maxStrain>0.1256:
|
||||
outFile = open(resFile,"w")
|
||||
outFile2 = open(resFile2,"w")
|
||||
objFn=1.+maxStrain
|
||||
outFile.write("%12.6f \n " % (objFn))
|
||||
outFile2.write("%12.6f \n " % (maxStrain))
|
||||
outFile.close()
|
||||
outFile2.close()
|
||||
odb.close()
|
||||
else:
|
||||
outFile2 = open(resFile2,"w")
|
||||
outFile2.write("%12.6f \n " % (maxStrain))
|
||||
outFile2.close()
|
||||
odb.close()
|
||||
os.system('abaqus j=R1'+jobName+' oldjob='+jobName+' inp=Restart1 cpus=6 inter user=ALE20')
|
||||
os.system('abaqus j=R2'+jobName+' oldjob=R1'+jobName+' inp=Restart2 cpus=6 inter user=ALE20')
|
||||
os.system('abaqus python OptPostB2.py -- R2'+jobName+' '+resFile)
|
46
Biomaterials13/Sample_ParamSweep/OptPostB2.py
Normal file
46
Biomaterials13/Sample_ParamSweep/OptPostB2.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from odbAccess import *
|
||||
import sys
|
||||
import os
|
||||
jobName=sys.argv[-2]
|
||||
resFile=sys.argv[-1]
|
||||
odbfilename=jobName+'.odb'
|
||||
try:
|
||||
odb=openOdb(path=odbfilename)
|
||||
aNod=odb.rootAssembly.instances['AMESH-1'].nodeSets['E1'].nodes[0].coordinates[0]
|
||||
bNod=odb.rootAssembly.instances['AMESH-1'].nodeSets['E2'].nodes[0].coordinates[0]
|
||||
rlen=abs(aNod-bNod)
|
||||
check=0.
|
||||
try:
|
||||
for eachFrame in odb.steps["Step-5"].frames:
|
||||
tforce=0.
|
||||
for currentForce in eachFrame.fieldOutputs["CNORMF ASSEMBLY_AOUTER/ASSEMBLY_SURF-1"].values:
|
||||
fx=currentForce.data[0]
|
||||
fy=currentForce.data[1]
|
||||
fz=currentForce.data[2]
|
||||
tforce=tforce+sqrt(fx*fx+fy*fy+fz*fz)
|
||||
aSet=odb.rootAssembly.instances['OUTER-1']
|
||||
uy=eachFrame.fieldOutputs["U"].getSubset(region=aSet).values[0].data[1]
|
||||
uz=eachFrame.fieldOutputs["U"].getSubset(region=aSet).values[0].data[2]
|
||||
rad=sqrt(uy*uy+uz*uz)
|
||||
if tforce>0.:
|
||||
check=check+1
|
||||
if check==2:
|
||||
f1=tforce
|
||||
r1=rad
|
||||
if check==5:
|
||||
f2=tforce
|
||||
r2=rad
|
||||
break
|
||||
stiff=abs(f2-f1)/abs(r2-r1)
|
||||
except:
|
||||
stiff=0.
|
||||
stiff=stiff/rlen
|
||||
except:
|
||||
stiff=0.
|
||||
outFile = open(resFile,"w")
|
||||
objFn=1.-(0.15*abs(stiff))
|
||||
outFile.write("%12.6f \n " % (objFn))
|
||||
outFile.close()
|
||||
odb.close()
|
15
Biomaterials13/Sample_ParamSweep/PyWrapperB.py
Normal file
15
Biomaterials13/Sample_ParamSweep/PyWrapperB.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
#
|
||||
resFile=sys.argv[-1]
|
||||
paramFile=sys.argv[-2]
|
||||
jobName=paramFile.encode("hex")
|
||||
# Run Preprocessor
|
||||
os.system("abaqus cae noGUI=OptB.py -- "+paramFile)
|
||||
# Run Job
|
||||
os.system('abaqus j='+jobName+' cpus=6 inter user=ALE20 mp_mode=mpi')
|
||||
# Run Postprocessor
|
||||
os.system('abaqus python OptPostB1.py -- '+jobName+' '+resFile)
|
69
Biomaterials13/Sample_ParamSweep/Restart1.inp
Normal file
69
Biomaterials13/Sample_ParamSweep/Restart1.inp
Normal file
|
@ -0,0 +1,69 @@
|
|||
*Heading
|
||||
** Job name: Restart Model name: Dream6R
|
||||
** Generated by: Abaqus/CAE 6.10-1
|
||||
*Preprint, echo=NO, model=NO, history=NO, contact=NO
|
||||
*Restart, read, step=2
|
||||
**
|
||||
** STEP: Step-3
|
||||
**
|
||||
*Step, name=Step-3, nlgeom=YES
|
||||
*Static
|
||||
0.05, 1., 1e-05, 0.05
|
||||
*Adaptive Mesh, elset=AMesh-1.AllE, frequency=1, mesh sweeps=10, op=NEW
|
||||
**
|
||||
** ADAPTIVE MESH CONSTRAINTS
|
||||
**
|
||||
** Name: Ada-Cons-1 Type: Velocity/Angular velocity
|
||||
*Adaptive Mesh Constraint, user, type=VELOCITY
|
||||
AMesh-1.Const
|
||||
**
|
||||
** OUTPUT REQUESTS
|
||||
**
|
||||
**
|
||||
*field,user
|
||||
set-1
|
||||
** FIELD OUTPUT: F-Output-1
|
||||
**
|
||||
*Output, field
|
||||
*Node Output
|
||||
CF, RF, U
|
||||
*Element Output, directions=YES
|
||||
LE, PE, PEEQ, PEMAG, S
|
||||
*Contact Output
|
||||
CDISP, CFORCE, CSTRESS
|
||||
**
|
||||
** HISTORY OUTPUT: H-Output-1
|
||||
**
|
||||
*Output, history, variable=PRESELECT
|
||||
*End Step
|
||||
** ----------------------------------------------------------------
|
||||
** STEP: Step-4
|
||||
**
|
||||
*Step, name=Step-4, nlgeom=YES
|
||||
*Static
|
||||
0.05, 0.05, 5e-07, 0.05
|
||||
*Adaptive Mesh, op=NEW
|
||||
**
|
||||
** ADAPTIVE MESH CONSTRAINTS
|
||||
**
|
||||
** Name: Ada-Cons-1 Type: Velocity/Angular velocity
|
||||
*Adaptive Mesh Constraint, op=NEW
|
||||
**
|
||||
** OUTPUT REQUESTS
|
||||
**
|
||||
*Restart, write, number interval=1, time marks=NO
|
||||
**
|
||||
** FIELD OUTPUT: F-Output-1
|
||||
**
|
||||
*Output, field
|
||||
*Node Output
|
||||
CF, RF, U
|
||||
*Element Output, directions=YES
|
||||
LE, PE, PEEQ, PEMAG, S
|
||||
*Contact Output
|
||||
CDISP, CFORCE, CSTRESS
|
||||
**
|
||||
** HISTORY OUTPUT: H-Output-1
|
||||
**
|
||||
*Output, history, variable=PRESELECT
|
||||
*End Step
|
28
Biomaterials13/Sample_ParamSweep/Restart2.inp
Normal file
28
Biomaterials13/Sample_ParamSweep/Restart2.inp
Normal file
|
@ -0,0 +1,28 @@
|
|||
*Heading
|
||||
** Job name: Restart Model name: Dream6R
|
||||
** Generated by: Abaqus/CAE 6.10-1
|
||||
*Preprint, echo=NO, model=NO, history=NO, contact=NO
|
||||
*Restart, read, step=4
|
||||
** ----------------------------------------------------------------
|
||||
** STEP: Step-5
|
||||
**
|
||||
*Step, name=Step-5, nlgeom=YES
|
||||
*Static
|
||||
0.02, 1., 1e-05, 0.02
|
||||
**
|
||||
** OUTPUT REQUESTS
|
||||
**
|
||||
*Restart, write, frequency=0
|
||||
**
|
||||
** FIELD OUTPUT: F-Output-1
|
||||
**
|
||||
*Output, field
|
||||
*Node Output
|
||||
CF, RF, U
|
||||
*Contact Output
|
||||
CDISP, CFORCE, CSTRESS
|
||||
**
|
||||
** HISTORY OUTPUT: H-Output-1
|
||||
**
|
||||
*Output, history, variable=PRESELECT
|
||||
*End Step
|
36
Biomaterials13/Sample_ParamSweep/readme.txt
Normal file
36
Biomaterials13/Sample_ParamSweep/readme.txt
Normal file
|
@ -0,0 +1,36 @@
|
|||
Using the optimization scripts. Contact james.grogan@universityofgalway.ie for further details.
|
||||
--------------------------------------------------------------
|
||||
These scripts were developed to perform optmizations with Abaqus and DAKOTA on the ICHEC
|
||||
system. With small modifications they can also be used to perform optimizations on
|
||||
windows systems.
|
||||
|
||||
Prerequisites:
|
||||
Abaqus (tested in v6.10)
|
||||
DAKOTA (tested in v5.2) - needs to be built from source on ICHEC.
|
||||
|
||||
Sequence:
|
||||
1. Launch.pbs
|
||||
Sends optimization job to ICHEC queue. Loads modules neccessary for DAKOTA and runs the optimization job as
|
||||
a taskfarm.
|
||||
|
||||
2. tasks.inp
|
||||
Input file for the taskfarm program. Changes to a unique directory for each task an runs DAKOTA with the input file
|
||||
OptB.in.
|
||||
|
||||
3. OptB.in
|
||||
DAKOTA input file. Tells DAKOTA what sort of optimization to perform. How many parameters to use and what ranges the
|
||||
parameters fall in. Launchs the preprocessing wrapper script 'PyWrapperB.py' and designates 'Bparams.in' and 'Bparams.out' as the optimization input and output files.
|
||||
|
||||
4. PyWrapperB.py
|
||||
Python wrapper script. Launchs the Abaqus geometry kernel file 'OptB.py'. Launches each abaqus job. Launches the
|
||||
postprocessor python file 'OptPostB1.py'.
|
||||
|
||||
5. OptB.py
|
||||
Abaqus kernel script. Creates the FE model. Model parameters are read in from DAKOTA through the Bparams.in file.
|
||||
|
||||
6. OptPostB1.py
|
||||
Post-processes the initial simulation. If a design looks promising it launches a corrosion simulation and a second postprocessor OptPostB2.py.
|
||||
|
||||
7. OptPostB2.py
|
||||
Post-processes the corrosion simulation. Returns the objective function value to DAKOTA through the Bparams.out text file.
|
||||
|
4
Biomaterials13/Sample_ParamSweep/tasks.inp
Normal file
4
Biomaterials13/Sample_ParamSweep/tasks.inp
Normal file
|
@ -0,0 +1,4 @@
|
|||
cd $PBS_O_WORKDIR/N1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/N2/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/N3/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/N4/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
4
Biomaterials13/Sample_ParamSweep/tasksb.inp
Normal file
4
Biomaterials13/Sample_ParamSweep/tasksb.inp
Normal file
|
@ -0,0 +1,4 @@
|
|||
cd $PBS_O_WORKDIR/P1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/P2/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/P3/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/P4/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
4
Biomaterials13/Sample_ParamSweep/tasksc.inp
Normal file
4
Biomaterials13/Sample_ParamSweep/tasksc.inp
Normal file
|
@ -0,0 +1,4 @@
|
|||
cd $PBS_O_WORKDIR/P1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 114 -w dakota3.rst
|
||||
cd $PBS_O_WORKDIR/P2/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 116 -w dakota3.rst
|
||||
cd $PBS_O_WORKDIR/P3/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 125 -w dakota3.rst
|
||||
cd $PBS_O_WORKDIR/P4/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 138 -w dakota3.rst
|
1
Biomaterials13/Sample_ParamSweep/tasksd.inp
Normal file
1
Biomaterials13/Sample_ParamSweep/tasksd.inp
Normal file
|
@ -0,0 +1 @@
|
|||
cd $PBS_O_WORKDIR/N1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 124 -w dakota3.rst
|
316
Biomaterials13/Scripts/ALE20.f
Normal file
316
Biomaterials13/Scripts/ALE20.f
Normal 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
|
||||
|
31
Biomaterials13/Scripts/CDAM_PRE.py
Normal file
31
Biomaterials13/Scripts/CDAM_PRE.py
Normal 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()
|
181
Biomaterials13/Scripts/Cor.f
Normal file
181
Biomaterials13/Scripts/Cor.f
Normal 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
201
Biomaterials13/Scripts/CorP.f
Normal file
201
Biomaterials13/Scripts/CorP.f
Normal 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
100
Biomaterials13/Scripts/holz.for
Normal file
100
Biomaterials13/Scripts/holz.for
Normal 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
|
48
Biomaterials13/Scripts/map_plaque.py
Normal file
48
Biomaterials13/Scripts/map_plaque.py
Normal 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)
|
45
Biomaterials13/Scripts/nodeCon3DF.py
Normal file
45
Biomaterials13/Scripts/nodeCon3DF.py
Normal 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()
|
33
Biomaterials13/Scripts/pdiam.py
Normal file
33
Biomaterials13/Scripts/pdiam.py
Normal 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()
|
40
Biomaterials13/Scripts/plaque.f95
Normal file
40
Biomaterials13/Scripts/plaque.f95
Normal 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
|
40
Biomaterials13/Scripts/quickcorrosion.py
Normal file
40
Biomaterials13/Scripts/quickcorrosion.py
Normal 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()
|
||||
|
12
Biomaterials13/Scripts/wrap.py
Normal file
12
Biomaterials13/Scripts/wrap.py
Normal 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)
|
55
Biomaterials13/Scripts/wrap_balloon.f95
Normal file
55
Biomaterials13/Scripts/wrap_balloon.f95
Normal 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
|
BIN
Biomaterials13/StudyO1/._OptB.in
Normal file
BIN
Biomaterials13/StudyO1/._OptB.in
Normal file
Binary file not shown.
BIN
Biomaterials13/StudyO1/._OptB.py
Normal file
BIN
Biomaterials13/StudyO1/._OptB.py
Normal file
Binary file not shown.
BIN
Biomaterials13/StudyO1/._readme.txt
Normal file
BIN
Biomaterials13/StudyO1/._readme.txt
Normal file
Binary file not shown.
BIN
Biomaterials13/StudyO1/._tasks.inp
Normal file
BIN
Biomaterials13/StudyO1/._tasks.inp
Normal file
Binary file not shown.
BIN
Biomaterials13/StudyO1/._tasksb.inp
Normal file
BIN
Biomaterials13/StudyO1/._tasksb.inp
Normal file
Binary file not shown.
316
Biomaterials13/StudyO1/ALE20.f
Normal file
316
Biomaterials13/StudyO1/ALE20.f
Normal 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.01d0
|
||||
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
|
||||
|
27
Biomaterials13/StudyO1/Launch.pbs
Normal file
27
Biomaterials13/StudyO1/Launch.pbs
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
#PBS -l nodes=2:ppn=12
|
||||
#PBS -l walltime=9:00:00
|
||||
#PBS -N Opt_Stiffness_P3
|
||||
#PBS -A ngeng036b
|
||||
#PBS -r n
|
||||
#PBS -j oe
|
||||
#PBS -m bea
|
||||
#PBS -M lumpwood@gmail.com
|
||||
#PBS -V
|
||||
cd $PBS_O_WORKDIR
|
||||
module load taskfarm2
|
||||
module load intel-cc
|
||||
module load intel-fc
|
||||
module load intel-mkl
|
||||
module load boost-intel
|
||||
module load intel-mpi
|
||||
module load abaqus
|
||||
taskfarm tasks.inp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
Biomaterials13/StudyO1/OptB.cae
Normal file
BIN
Biomaterials13/StudyO1/OptB.cae
Normal file
Binary file not shown.
30
Biomaterials13/StudyO1/OptB.in
Normal file
30
Biomaterials13/StudyO1/OptB.in
Normal file
|
@ -0,0 +1,30 @@
|
|||
strategy,
|
||||
single
|
||||
#pareto_set
|
||||
#graphics
|
||||
#opt_method_pointer = "NLP"
|
||||
#multi_objective_weight_sets =
|
||||
#1. 0.
|
||||
#0. 1.
|
||||
#.5 .5
|
||||
tabular_graphics_data
|
||||
method,
|
||||
id_method = "NLP"
|
||||
efficient_global
|
||||
seed = 79877
|
||||
variables,
|
||||
continuous_design = 6
|
||||
lower_bounds 0.11 0.11 0.6 1.0 0.1 0.001
|
||||
upper_bounds 0.16 0.14 1.0 1.2 0.5 0.04
|
||||
descriptors "x1" "x2" "x3" "x4" "x5" "x6"
|
||||
interface,
|
||||
fork asynchronous evaluation_concurrency = 1
|
||||
analysis_drivers = 'abaqus python PyWrapperB.py --'
|
||||
parameters_file = 'Bparams.in'
|
||||
results_file = 'Bresults.out'
|
||||
file_tag
|
||||
file_save
|
||||
responses,
|
||||
objective_functions = 1
|
||||
no_gradients
|
||||
no_hessians
|
14
Biomaterials13/StudyO1/OptB.jnl
Normal file
14
Biomaterials13/StudyO1/OptB.jnl
Normal file
|
@ -0,0 +1,14 @@
|
|||
from part import *
|
||||
from material import *
|
||||
from section import *
|
||||
from assembly import *
|
||||
from step import *
|
||||
from interaction import *
|
||||
from load import *
|
||||
from mesh import *
|
||||
from job import *
|
||||
from sketch import *
|
||||
from visualization import *
|
||||
from connectorBehavior import *
|
||||
mdb.models['Dream6'].boundaryConditions['BC-2'].setValues(u1=-0.7)
|
||||
# Save by 05365350 on Fri Oct 19 21:01:57 2012
|
126
Biomaterials13/StudyO1/OptB.py
Normal file
126
Biomaterials13/StudyO1/OptB.py
Normal file
|
@ -0,0 +1,126 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from abaqus import *
|
||||
from odbAccess import *
|
||||
import regionToolset
|
||||
import sys
|
||||
import os
|
||||
import interaction
|
||||
import mesh
|
||||
#Read in Model Parameters
|
||||
paramFile=sys.argv[-1]
|
||||
jobName=paramFile.encode("hex")
|
||||
os.system ("cp %s %s" % ('OptB.cae', jobName+'.cae'))
|
||||
mdb=openMdb(jobName+'.cae')
|
||||
inFile = open(paramFile,"r")
|
||||
inFile.readline()
|
||||
x1,name1=inFile.readline().split()
|
||||
x2,name2=inFile.readline().split()
|
||||
x3,name3=inFile.readline().split()
|
||||
x4,name4=inFile.readline().split()
|
||||
x5,name5=inFile.readline().split()
|
||||
x6,name6=inFile.readline().split()
|
||||
mname='Dream6'
|
||||
#Generate New Model
|
||||
aModel=mdb.models[mname]
|
||||
aAss=aModel.rootAssembly
|
||||
tol=0.0001
|
||||
radius=0.75
|
||||
numCrowns=6.
|
||||
W=float(x1)
|
||||
T=float(x2)
|
||||
L1=float(x3)
|
||||
L2=float(x4)*L1
|
||||
L3=float(x5)
|
||||
H2=float(x6)
|
||||
H1=(pi*radius)/(2.*numCrowns)
|
||||
# Modify Part
|
||||
aPart=aModel.parts['Geom']
|
||||
aSketch=aPart.features['Solid extrude-1'].sketch
|
||||
aModel.ConstrainedSketch(name='__edit__', objectToCopy=aSketch)
|
||||
bSketch=aModel.sketches['__edit__']
|
||||
bSketch.parameters['w'].setValues(expression=str(W/2.))
|
||||
bSketch.parameters['h1'].setValues(expression=str(H1))
|
||||
bSketch.parameters['h2'].setValues(expression=str(H2))
|
||||
bSketch.parameters['l1'].setValues(expression=str(L1))
|
||||
bSketch.parameters['l2'].setValues(expression=str(L2))
|
||||
bSketch.parameters['l3'].setValues(expression=str(L3))
|
||||
aPart.features['Solid extrude-1'].setValues(sketch=bSketch)
|
||||
del aModel.sketches['__edit__']
|
||||
aPart.features['Solid extrude-1'].setValues(depth=T)
|
||||
aPart.regenerate()
|
||||
# Mesh Part
|
||||
aPart.seedPart(size=W/6., deviationFactor=0.1)
|
||||
aPart.generateMesh()
|
||||
# Create Orphan Mesh
|
||||
aPart.PartFromMesh(name='AMesh')
|
||||
bPart=aModel.parts['AMesh']
|
||||
# Create Sets,Sections,Surfaces
|
||||
for nameSet,eachSet in aPart.sets.items():
|
||||
bPart.Set(name=nameSet, nodes=eachSet.nodes)
|
||||
bPart.Set(name='AllE', elements=aPart.sets['All'].elements)
|
||||
bPart.Set(name='InnerE', elements=aPart.sets['Inner'].elements)
|
||||
bPart.Set(name='OuterE', elements=aPart.sets['Outer'].elements)
|
||||
region = regionToolset.Region(elements=bPart.elements)
|
||||
bPart.SectionAssignment(region=region, sectionName='Magnesium')
|
||||
aPart=aModel.parts['AMesh']
|
||||
elemType1 = mesh.ElemType(elemCode=C3D8R, elemLibrary=STANDARD,
|
||||
kinematicSplit=AVERAGE_STRAIN, secondOrderAccuracy=OFF,
|
||||
hourglassControl=ENHANCED, distortionControl=DEFAULT)
|
||||
pickedRegions =(aPart.elements, )
|
||||
aPart.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
|
||||
# Wrap Part
|
||||
nlist=[]
|
||||
clist=[]
|
||||
for eachnode in aPart.nodes:
|
||||
theta=eachnode.coordinates[1]/radius
|
||||
newcoord1=eachnode.coordinates[0]
|
||||
newcoord2=(radius-eachnode.coordinates[2])*cos(theta)
|
||||
newcoord3=(radius-eachnode.coordinates[2])*sin(theta)
|
||||
nlist.append(eachnode)
|
||||
clist.append((newcoord1,newcoord2,newcoord3))
|
||||
aPart.editNode(nodes=nlist,coordinates=clist)
|
||||
aPart.regenerate()
|
||||
aAss.regenerate()
|
||||
aInst=aAss.instances['AMesh-1']
|
||||
aModel.rootAssembly.Set(name='Set-1',nodes=aInst.nodes)
|
||||
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()
|
||||
mdb.Job(name=jobName, model=mname)
|
||||
mdb.jobs[jobName].writeInput(consistencyChecking=OFF)
|
||||
mdb.close()
|
||||
|
34
Biomaterials13/StudyO1/OptPostB1.py
Normal file
34
Biomaterials13/StudyO1/OptPostB1.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from odbAccess import *
|
||||
import sys
|
||||
import os
|
||||
jobName=sys.argv[-2]
|
||||
resFile=sys.argv[-1]
|
||||
resFile2=resFile+'.b'
|
||||
odbfilename=jobName+'.odb'
|
||||
odb=openOdb(path=odbfilename)
|
||||
aFrame=odb.steps["Step-1"].frames[-1]
|
||||
maxStrain=0.
|
||||
for currentStrain in aFrame.fieldOutputs["LE"].values:
|
||||
if currentStrain.instance.name=='AMESH-1':
|
||||
if currentStrain.maxPrincipal>maxStrain:
|
||||
maxStrain=currentStrain.maxPrincipal
|
||||
outFile = open(resFile,"w")
|
||||
if maxStrain>0.1256:
|
||||
outFile = open(resFile,"w")
|
||||
outFile2 = open(resFile2,"w")
|
||||
objFn=1.+maxStrain
|
||||
outFile.write("%12.6f \n " % (objFn))
|
||||
outFile2.write("%12.6f \n " % (maxStrain))
|
||||
outFile.close()
|
||||
outFile2.close()
|
||||
odb.close()
|
||||
else:
|
||||
outFile2 = open(resFile2,"w")
|
||||
outFile2.write("%12.6f \n " % (maxStrain))
|
||||
outFile2.close()
|
||||
odb.close()
|
||||
os.system('abaqus j=R1'+jobName+' oldjob='+jobName+' inp=Restart1 cpus=6 inter user=ALE20')
|
||||
os.system('abaqus j=R2'+jobName+' oldjob=R1'+jobName+' inp=Restart2 cpus=6 inter user=ALE20')
|
||||
os.system('abaqus python OptPostB2.py -- R2'+jobName+' '+resFile)
|
46
Biomaterials13/StudyO1/OptPostB2.py
Normal file
46
Biomaterials13/StudyO1/OptPostB2.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from odbAccess import *
|
||||
import sys
|
||||
import os
|
||||
jobName=sys.argv[-2]
|
||||
resFile=sys.argv[-1]
|
||||
odbfilename=jobName+'.odb'
|
||||
try:
|
||||
odb=openOdb(path=odbfilename)
|
||||
aNod=odb.rootAssembly.instances['AMESH-1'].nodeSets['E1'].nodes[0].coordinates[0]
|
||||
bNod=odb.rootAssembly.instances['AMESH-1'].nodeSets['E2'].nodes[0].coordinates[0]
|
||||
rlen=abs(aNod-bNod)
|
||||
check=0.
|
||||
try:
|
||||
for eachFrame in odb.steps["Step-5"].frames:
|
||||
tforce=0.
|
||||
for currentForce in eachFrame.fieldOutputs["CNORMF ASSEMBLY_AOUTER/ASSEMBLY_SURF-1"].values:
|
||||
fx=currentForce.data[0]
|
||||
fy=currentForce.data[1]
|
||||
fz=currentForce.data[2]
|
||||
tforce=tforce+sqrt(fx*fx+fy*fy+fz*fz)
|
||||
aSet=odb.rootAssembly.instances['OUTER-1']
|
||||
uy=eachFrame.fieldOutputs["U"].getSubset(region=aSet).values[0].data[1]
|
||||
uz=eachFrame.fieldOutputs["U"].getSubset(region=aSet).values[0].data[2]
|
||||
rad=sqrt(uy*uy+uz*uz)
|
||||
if tforce>0.:
|
||||
check=check+1
|
||||
if check==2:
|
||||
f1=tforce
|
||||
r1=rad
|
||||
if check==5:
|
||||
f2=tforce
|
||||
r2=rad
|
||||
break
|
||||
stiff=abs(f2-f1)/abs(r2-r1)
|
||||
except:
|
||||
stiff=0.
|
||||
stiff=stiff/rlen
|
||||
except:
|
||||
stiff=0.
|
||||
outFile = open(resFile,"w")
|
||||
objFn=1.-(0.15*abs(stiff))
|
||||
outFile.write("%12.6f \n " % (objFn))
|
||||
outFile.close()
|
||||
odb.close()
|
15
Biomaterials13/StudyO1/PyWrapperB.py
Normal file
15
Biomaterials13/StudyO1/PyWrapperB.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
#
|
||||
resFile=sys.argv[-1]
|
||||
paramFile=sys.argv[-2]
|
||||
jobName=paramFile.encode("hex")
|
||||
# Run Preprocessor
|
||||
os.system("abaqus cae noGUI=OptB.py -- "+paramFile)
|
||||
# Run Job
|
||||
os.system('abaqus j='+jobName+' cpus=6 inter user=ALE20 mp_mode=mpi')
|
||||
# Run Postprocessor
|
||||
os.system('abaqus python OptPostB1.py -- '+jobName+' '+resFile)
|
69
Biomaterials13/StudyO1/Restart1.inp
Normal file
69
Biomaterials13/StudyO1/Restart1.inp
Normal file
|
@ -0,0 +1,69 @@
|
|||
*Heading
|
||||
** Job name: Restart Model name: Dream6R
|
||||
** Generated by: Abaqus/CAE 6.10-1
|
||||
*Preprint, echo=NO, model=NO, history=NO, contact=NO
|
||||
*Restart, read, step=2
|
||||
**
|
||||
** STEP: Step-3
|
||||
**
|
||||
*Step, name=Step-3, nlgeom=YES
|
||||
*Static
|
||||
0.05, 1., 1e-05, 0.05
|
||||
*Adaptive Mesh, elset=AMesh-1.AllE, frequency=1, mesh sweeps=10, op=NEW
|
||||
**
|
||||
** ADAPTIVE MESH CONSTRAINTS
|
||||
**
|
||||
** Name: Ada-Cons-1 Type: Velocity/Angular velocity
|
||||
*Adaptive Mesh Constraint, user, type=VELOCITY
|
||||
AMesh-1.Const
|
||||
**
|
||||
** OUTPUT REQUESTS
|
||||
**
|
||||
**
|
||||
*field,user
|
||||
set-1
|
||||
** FIELD OUTPUT: F-Output-1
|
||||
**
|
||||
*Output, field
|
||||
*Node Output
|
||||
CF, RF, U
|
||||
*Element Output, directions=YES
|
||||
LE, PE, PEEQ, PEMAG, S
|
||||
*Contact Output
|
||||
CDISP, CFORCE, CSTRESS
|
||||
**
|
||||
** HISTORY OUTPUT: H-Output-1
|
||||
**
|
||||
*Output, history, variable=PRESELECT
|
||||
*End Step
|
||||
** ----------------------------------------------------------------
|
||||
** STEP: Step-4
|
||||
**
|
||||
*Step, name=Step-4, nlgeom=YES
|
||||
*Static
|
||||
0.05, 0.05, 5e-07, 0.05
|
||||
*Adaptive Mesh, op=NEW
|
||||
**
|
||||
** ADAPTIVE MESH CONSTRAINTS
|
||||
**
|
||||
** Name: Ada-Cons-1 Type: Velocity/Angular velocity
|
||||
*Adaptive Mesh Constraint, op=NEW
|
||||
**
|
||||
** OUTPUT REQUESTS
|
||||
**
|
||||
*Restart, write, number interval=1, time marks=NO
|
||||
**
|
||||
** FIELD OUTPUT: F-Output-1
|
||||
**
|
||||
*Output, field
|
||||
*Node Output
|
||||
CF, RF, U
|
||||
*Element Output, directions=YES
|
||||
LE, PE, PEEQ, PEMAG, S
|
||||
*Contact Output
|
||||
CDISP, CFORCE, CSTRESS
|
||||
**
|
||||
** HISTORY OUTPUT: H-Output-1
|
||||
**
|
||||
*Output, history, variable=PRESELECT
|
||||
*End Step
|
28
Biomaterials13/StudyO1/Restart2.inp
Normal file
28
Biomaterials13/StudyO1/Restart2.inp
Normal file
|
@ -0,0 +1,28 @@
|
|||
*Heading
|
||||
** Job name: Restart Model name: Dream6R
|
||||
** Generated by: Abaqus/CAE 6.10-1
|
||||
*Preprint, echo=NO, model=NO, history=NO, contact=NO
|
||||
*Restart, read, step=4
|
||||
** ----------------------------------------------------------------
|
||||
** STEP: Step-5
|
||||
**
|
||||
*Step, name=Step-5, nlgeom=YES
|
||||
*Static
|
||||
0.02, 1., 1e-05, 0.02
|
||||
**
|
||||
** OUTPUT REQUESTS
|
||||
**
|
||||
*Restart, write, frequency=0
|
||||
**
|
||||
** FIELD OUTPUT: F-Output-1
|
||||
**
|
||||
*Output, field
|
||||
*Node Output
|
||||
CF, RF, U
|
||||
*Contact Output
|
||||
CDISP, CFORCE, CSTRESS
|
||||
**
|
||||
** HISTORY OUTPUT: H-Output-1
|
||||
**
|
||||
*Output, history, variable=PRESELECT
|
||||
*End Step
|
36
Biomaterials13/StudyO1/readme.txt
Normal file
36
Biomaterials13/StudyO1/readme.txt
Normal file
|
@ -0,0 +1,36 @@
|
|||
Using the optimization scripts. Contact james.grogan@universityofgalway.ie for further details.
|
||||
--------------------------------------------------------------
|
||||
These scripts were developed to perform optmizations with Abaqus and DAKOTA on the ICHEC
|
||||
system. With small modifications they can also be used to perform optimizations on
|
||||
windows systems.
|
||||
|
||||
Prerequisites:
|
||||
Abaqus (tested in v6.10)
|
||||
DAKOTA (tested in v5.2) - needs to be built from source on ICHEC.
|
||||
|
||||
Sequence:
|
||||
1. Launch.pbs
|
||||
Sends optimization job to ICHEC queue. Loads modules neccessary for DAKOTA and runs the optimization job as
|
||||
a taskfarm.
|
||||
|
||||
2. tasks.inp
|
||||
Input file for the taskfarm program. Changes to a unique directory for each task an runs DAKOTA with the input file
|
||||
OptB.in.
|
||||
|
||||
3. OptB.in
|
||||
DAKOTA input file. Tells DAKOTA what sort of optimization to perform. How many parameters to use and what ranges the
|
||||
parameters fall in. Launchs the preprocessing wrapper script 'PyWrapperB.py' and designates 'Bparams.in' and 'Bparams.out' as the optimization input and output files.
|
||||
|
||||
4. PyWrapperB.py
|
||||
Python wrapper script. Launchs the Abaqus geometry kernel file 'OptB.py'. Launches each abaqus job. Launches the
|
||||
postprocessor python file 'OptPostB1.py'.
|
||||
|
||||
5. OptB.py
|
||||
Abaqus kernel script. Creates the FE model. Model parameters are read in from DAKOTA through the Bparams.in file.
|
||||
|
||||
6. OptPostB1.py
|
||||
Post-processes the initial simulation. If a design looks promising it launches a corrosion simulation and a second postprocessor OptPostB2.py.
|
||||
|
||||
7. OptPostB2.py
|
||||
Post-processes the corrosion simulation. Returns the objective function value to DAKOTA through the Bparams.out text file.
|
||||
|
4
Biomaterials13/StudyO1/tasks.inp
Normal file
4
Biomaterials13/StudyO1/tasks.inp
Normal file
|
@ -0,0 +1,4 @@
|
|||
cd $PBS_O_WORKDIR/N1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/N2/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/N3/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/N4/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
4
Biomaterials13/StudyO1/tasksb.inp
Normal file
4
Biomaterials13/StudyO1/tasksb.inp
Normal file
|
@ -0,0 +1,4 @@
|
|||
cd $PBS_O_WORKDIR/P1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/P2/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/P3/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
||||
cd $PBS_O_WORKDIR/P4/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in
|
4
Biomaterials13/StudyO1/tasksc.inp
Normal file
4
Biomaterials13/StudyO1/tasksc.inp
Normal file
|
@ -0,0 +1,4 @@
|
|||
cd $PBS_O_WORKDIR/P1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 114 -w dakota3.rst
|
||||
cd $PBS_O_WORKDIR/P2/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 116 -w dakota3.rst
|
||||
cd $PBS_O_WORKDIR/P3/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 125 -w dakota3.rst
|
||||
cd $PBS_O_WORKDIR/P4/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 138 -w dakota3.rst
|
1
Biomaterials13/StudyO1/tasksd.inp
Normal file
1
Biomaterials13/StudyO1/tasksd.inp
Normal file
|
@ -0,0 +1 @@
|
|||
cd $PBS_O_WORKDIR/N1/;$PBS_O_WORKDIR/DBUILD/src/dakota -i OptB.in -r dakota.rst -s 124 -w dakota3.rst
|
316
Biomaterials13/StudyP1/ALE0.for
Normal file
316
Biomaterials13/StudyP1/ALE0.for
Normal 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.0d0
|
||||
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
|
||||
|
316
Biomaterials13/StudyP1/ALE05.for
Normal file
316
Biomaterials13/StudyP1/ALE05.for
Normal 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.005d0
|
||||
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
|
||||
|
316
Biomaterials13/StudyP1/ALE10.for
Normal file
316
Biomaterials13/StudyP1/ALE10.for
Normal 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.01d0
|
||||
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
|
||||
|
316
Biomaterials13/StudyP1/ALE20.for
Normal file
316
Biomaterials13/StudyP1/ALE20.for
Normal 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
|
||||
|
316
Biomaterials13/StudyP1/ALE25.for
Normal file
316
Biomaterials13/StudyP1/ALE25.for
Normal 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.025d0
|
||||
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
|
||||
|
6936
Biomaterials13/StudyP1/C6.inp
Normal file
6936
Biomaterials13/StudyP1/C6.inp
Normal file
File diff suppressed because it is too large
Load diff
6530
Biomaterials13/StudyP1/E6.inp
Normal file
6530
Biomaterials13/StudyP1/E6.inp
Normal file
File diff suppressed because it is too large
Load diff
8151
Biomaterials13/StudyP1/NodeData.inc
Normal file
8151
Biomaterials13/StudyP1/NodeData.inc
Normal file
File diff suppressed because it is too large
Load diff
BIN
Biomaterials13/StudyP1/Param.cae
Normal file
BIN
Biomaterials13/StudyP1/Param.cae
Normal file
Binary file not shown.
BIN
Biomaterials13/StudyP1/ParameterModels.cae
Normal file
BIN
Biomaterials13/StudyP1/ParameterModels.cae
Normal file
Binary file not shown.
BIN
Biomaterials13/StudyP1/ParampPICS.cae
Normal file
BIN
Biomaterials13/StudyP1/ParampPICS.cae
Normal file
Binary file not shown.
8808
Biomaterials13/StudyP1/R4.inp
Normal file
8808
Biomaterials13/StudyP1/R4.inp
Normal file
File diff suppressed because it is too large
Load diff
6733
Biomaterials13/StudyP1/R6.inp
Normal file
6733
Biomaterials13/StudyP1/R6.inp
Normal file
File diff suppressed because it is too large
Load diff
7772
Biomaterials13/StudyP1/S4.inp
Normal file
7772
Biomaterials13/StudyP1/S4.inp
Normal file
File diff suppressed because it is too large
Load diff
6032
Biomaterials13/StudyP1/S6.inp
Normal file
6032
Biomaterials13/StudyP1/S6.inp
Normal file
File diff suppressed because it is too large
Load diff
1147
Biomaterials13/StudyP1/crush.inp
Normal file
1147
Biomaterials13/StudyP1/crush.inp
Normal file
File diff suppressed because it is too large
Load diff
45
Biomaterials13/StudyP1/nodeCon3DF.py
Normal file
45
Biomaterials13/StudyP1/nodeCon3DF.py
Normal 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['Square6']
|
||||
aPart=aModel.parts['Geom']
|
||||
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()
|
31
Biomaterials13/StudyP1/post.py
Normal file
31
Biomaterials13/StudyP1/post.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Import Neccesary Abaqus Modules
|
||||
from abaqusConstants import *
|
||||
from odbAccess import *
|
||||
import sys
|
||||
import os
|
||||
resFile='E6R.dat'
|
||||
outFile = open(resFile,"w")
|
||||
for i in range(1,6):
|
||||
jobName='E6R'+str(i)
|
||||
odbfilename=jobName+'.odb'
|
||||
odb=openOdb(path=odbfilename)
|
||||
j=0.
|
||||
for eachFrame in odb.steps["Step-5"].frames:
|
||||
j=j+1
|
||||
aSet=odb.rootAssembly.instances['GEOM-1'].nodeSets['BCT']
|
||||
cforce=0.
|
||||
for currentForce in eachFrame.fieldOutputs["RF"].getSubset(region=aSet).values:
|
||||
cforce=cforce+currentForce.data[1]
|
||||
bSet=odb.rootAssembly.instances['GEOM-1'].nodeSets['BC4']
|
||||
disp=eachFrame.fieldOutputs["U"].getSubset(region=bSet).values[0].data[1]
|
||||
if j==2:
|
||||
cf2=cforce
|
||||
d2=disp
|
||||
elif j==4:
|
||||
cf4=cforce
|
||||
d4=disp
|
||||
stiff=abs(cf4-cf2)/abs(d4-d2)
|
||||
outFile.write("%12.6f \n " % (stiff))
|
||||
break
|
||||
odb.close()
|
||||
outFile.close()
|
7
Biomaterials13/StudyP1/run.bat
Executable file
7
Biomaterials13/StudyP1/run.bat
Executable file
|
@ -0,0 +1,7 @@
|
|||
(
|
||||
abq6101 j=C6R1 inp=C6 user=ALE0 inter
|
||||
abq6101 j=C6R2 inp=C6 user=ALE05 inter
|
||||
abq6101 j=C6R3 inp=C6 user=ALE10 inter
|
||||
abq6101 j=C6R4 inp=C6 user=ALE20 inter
|
||||
abq6101 j=C6R5 inp=C6 user=ALE25 inter
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue