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
|
Loading…
Add table
Add a link
Reference in a new issue