|
本人也在做岩土分析,
用ADD, REMOVE ELEMENT 出了点问题,
REMOVE SOME ELEMENT 后,
计算结果无变化,感觉奇怪:SCRIPT 如下:
"""
This module constructs and analyzes a model.
"""
from abaqus import *
from abaqusConstants import *
#形成岩石区域
session.viewports['Viewport: 1'].setValues(displayedObject=None)
session.viewports['Viewport: 1'].setValues(displayedObject=None)
session.viewports['Viewport: 1'].partDisplay.setValues(mesh=OFF)
session.viewports['Viewport: 1'].partDisplay.meshOptions.setValues(
meshTechnique=OFF)
s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=200.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.rectangle(point1=(-30.0, 30.0), point2=(30.0, -30.0))
#s.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(5.0, 0.0))
#s.RadialDimension(curve=g[6], textPoint=(7.93981409072876, -9.88425731658936),
# radius=5.0)
p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=TWO_D_PLANAR,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Part-1']
p.BaseShell(sketch=s)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['Part-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
#形成衬砌
s1 = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=50.0)
g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints
s1.setPrimaryObject(option=STANDALONE)
s1.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(5.0, 0.0))
s1.RadialDimension(curve=g[2], textPoint=(6.07638835906982, -4.69907331466675),
radius=5.0)
p = mdb.models['Model-1'].Part(name='Part-2', dimensionality=TWO_D_PLANAR,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Part-2']
p.BaseWire(sketch=s1)
s1.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['Part-2']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
#形成材料
#define material and section
session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=ON,
engineeringFeatures=ON)
mdb.models['Model-1'].Material(name='concrate')
mdb.models['Model-1'].materials['concrate'].Density(table=((2600.0, ), ))
mdb.models['Model-1'].materials['concrate'].Elastic(table=((25000000000.0,
0.3), ))
mdb.models['Model-1'].Material(name='rock')
mdb.models['Model-1'].materials['rock'].Density(table=((2300.0, ), ))
mdb.models['Model-1'].materials['rock'].Elastic(table=((14000000000.0, 0.25),
))
#define section
#beam sectionn
mdb.models['Model-1'].RectangularProfile(name='Profile-1', a=1.0, b=0.6)
mdb.models['Model-1'].BeamSection(name='Section-beam', profile='Profile-1',
integration=BEFORE_ANALYSIS, poissonRatio=0.3, density=3900.0,
referenceTemperature=20.0, thermalExpansion=OFF, temperatureDependency=OFF,
dependencies=0, table=((320000000000.0, 270000000000.0), ),
alphaDamping=0.0, betaDamping=0.0, compositeDamping=0.0, centroid=(0.0,
0.0), shearCenter=(0.0, 0.0), outputPts=((4.0, 4.0), ))
# rock section
mdb.models['Model-1'].HomogeneousSolidSection(name='Section-rock',
material='rock', thickness=1.0)
import regionToolset
p = mdb.models['Model-1'].parts['Part-1']
f = p.faces
faces = f.getSequenceFromMask(mask=('[#1 ]', ), )
region = regionToolset.Region(faces=faces)
p = mdb.models['Model-1'].parts['Part-1']
p.SectionAssignment(region=region, sectionName='Section-rock', offset=0.0)
p1 = mdb.models['Model-1'].parts['Part-2']
session.viewports['Viewport: 1'].setValues(displayedObject=p1)
p = mdb.models['Model-1'].parts['Part-2']
e = p.edges
edges = e.getSequenceFromMask(mask=('[#1 ]', ), )
region = regionToolset.Region(edges=edges)
p = mdb.models['Model-1'].parts['Part-2']
p.SectionAssignment(region=region, sectionName='Section-beam', offset=0.0)
#asambly part
a = mdb.models['Model-1'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
p = mdb.models['Model-1'].parts['Part-1']
a.Instance(name='Part-1-rock', part=p, dependent=OFF)
#a = mdb.models['Model-1'].rootAssembly
#p = mdb.models['Model-1'].parts['Part-2']
#a.Instance(name='Part-2-concrete', part=p, dependent=OFF)
p = mdb.models['Model-1'].parts['Part-2']
e = p.edges
edges = e.getSequenceFromMask(mask=('[#1 ]', ), )
region=regionToolset.Region(edges=edges)
p = mdb.models['Model-1'].parts['Part-2']
p.assignBeamSectionOrientation(region=region, method=N1_COSINES, n1=(0.0, 0.0,
-1.0))
#-------------------------------------------------------
import step
# Create a step. The time period of the static step is 1.0,
# and the initial incrementation is 0.1; the step is created
# after the initial step.
#a = mdb.models['Model-1'].rootAssembly
mdb.models['Model-1'].StaticStep(name='Step-grave',previous='Initial',
timePeriod=1.0, initialInc=0.0001,
description='Load the top of the beam.')
mdb.models['Model-1'].steps['Step-grave'].setValues(nlgeom=ON)
mdb.models['Model-1'].StaticStep(name='Step-grave2',previous='Step-grave',
timePeriod=1.0, initialInc=0.0001,
description='Load the top of the beam.')
mdb.models['Model-1'].steps['Step-grave2'].setValues(nlgeom=ON)
#output
#mdb.models['Model-1'].fieldOutputRequests['F-Output-cal'].setValues(variables=(
# 'CDISP', 'CF', 'CSTRESS', 'LE', 'PE', 'PEEQ', 'PEMAG', 'RF', 'S', 'U' ))
mdb.models['Model-1'].FieldOutputRequest(name='F-Output-1',
createStepName='Step-grave', variables=('S', 'MISESMAX', 'TSHR', 'CTSHR',
'ALPHA', 'VS', 'PS'))
#create curve setx
#a = mdb.models['Model-1'].rootAssembly
#e1 = a.instances['Part-1-rock'].edges
#edges1 = e1.getSequenceFromMask(mask=('[#1 ]', ), )
#a.Set(edges=edges1, name='Set-rock-curvx')
#: The set 'Set-rock-curv' has been created (1 edge).
#a = mdb.models['Model-1'].rootAssembly
#e1 = a.instances['Part-2-concrete'].edges
#edges1 = e1.getSequenceFromMask(mask=('[#1 ]', ), )
#a.Set(edges=edges1, name='Set-concrete-curvx')
#: The set 'Set-concrete-curv' has been created (1 edge).
#mdb.models['Model-1'].Equation(name='Constraint-r-cx', terms=((1.0,
# 'Set-rock-curvx', 1), (-1.0, 'Set-concrete-curvx', 1)))
#create curve sety
#a = mdb.models['Model-1'].rootAssembly
#e1 = a.instances['Part-1-rock'].edges
#edges1 = e1.getSequenceFromMask(mask=('[#1 ]', ), )
#a.Set(edges=edges1, name='Set-rock-curvy')
#: The set 'Set-rock-curv' has been created (1 edge).
#a = mdb.models['Model-1'].rootAssembly
#e1 = a.instances['Part-2-concrete'].edges
#edges1 = e1.getSequenceFromMask(mask=('[#1 ]', ), )
#a.Set(edges=edges1, name='Set-concrete-curvy')
#: The set 'Set-concrete-curv' has been created (1 edge).
#mdb.models['Model-1'].Equation(name='Constraint-r-cy', terms=((1.0,
# 'Set-rock-curvy', 2), (-1.0, 'Set-concrete-curvy', 2)))
a = mdb.models['Model-1'].rootAssembly
e1 = a.instances['Part-1-rock'].edges
edges1 = e1.getSequenceFromMask(mask=('[#8 ]', ), )
region = regionToolset.Region(edges=edges1)
mdb.models['Model-1'].EncastreBC(name='BC-fixbot', createStepName='Initial',
region=region)
mdb.saveAs(pathName='C:/Temp/yy.cae')
#: The model database has been saved to "C:\Temp\yy.cae".
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Step-grave')
a = mdb.models['Model-1'].rootAssembly
s1 = a.instances['Part-1-rock'].edges
side1Edges1 = s1.getSequenceFromMask(mask=('[#2 ]', ), )
region = regionToolset.Region(side1Edges=side1Edges1)
mdb.models['Model-1'].Pressure(name='Load-1', createStepName='Step-grave',
region=region, distributionType=UNIFORM, field='', magnitude=1000.0,
amplitude=UNSET)
#session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Step-seismic')
#mdb.models['Model-1'].Gravity(name='Load-2', createStepName='Step-grave',
# comp2=0.8)
#CREATE PARTITION
#session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON)
#session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
# meshTechnique=ON)
#a = mdb.models['Model-1'].rootAssembly
#f1 = a.instances['Part-1-rock'].faces
#pickedFaces = f1.getSequenceFromMask(mask=('[#1 ]', ), )
#e1 = a.instances['Part-1-rock'].edges
#a.PartitionFaceByShortestPath(faces=pickedFaces,
# point1=a.instances['Part-1-rock'].InterestingPoint(edge=e1[1],
# rule=MIDDLE), point2=a.instances['Part-1-rock'].InterestingPoint(
# edge=e1[3], rule=MIDDLE))
#a = mdb.models['Model-1'].rootAssembly
#f1 = a.instances['Part-1-rock'].faces
#pickedFaces = f1.getSequenceFromMask(mask=('[#3 ]', ), )
#e11 = a.instances['Part-1-rock'].edges
#a.PartitionFaceByShortestPath(faces=pickedFaces,
# point1=a.instances['Part-1-rock'].InterestingPoint(edge=e11[9],
# rule=MIDDLE), point2=a.instances['Part-1-rock'].InterestingPoint(
# edge=e11[2], rule=MIDDLE))
#attribute mesh type
import mesh
elemType1 = mesh.ElemType(elemCode=CPS4R, elemLibrary=STANDARD,
secondOrderAccuracy=OFF, hourglassControl=DEFAULT,
distortionControl=DEFAULT)
elemType2 = mesh.ElemType(elemCode=CPS3, elemLibrary=STANDARD)
a = mdb.models['Model-1'].rootAssembly
f1 = a.instances['Part-1-rock'].faces
faces1 = f1.getSequenceFromMask(mask=('[#1 ]', ), )
pickedRegions =(faces1, )
a.setElementType(regions=pickedRegions, elemTypes=(elemType1, elemType2))
a = mdb.models['Model-1'].rootAssembly
e1 = a.instances['Part-1-rock'].edges
pickedEdges = e1.getSequenceFromMask(mask=('[#f ]', ), )
a.seedEdgeByNumber(edges=pickedEdges, number=8)
a = mdb.models['Model-1'].rootAssembly
partInstances =(a.instances['Part-1-rock'], )
a.generateMesh(regions=partInstances)
a = mdb.models['Model-1'].rootAssembly
a.PartFromInstanceMesh(name='Part-1-mesh-1')
p1 = mdb.models['Model-1'].parts['Part-1-mesh-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p1)
#create kill node
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
n = p.nodes
nodes = n.getSequenceFromMask(mask=('[#c0000000 #381 ]', ), )
p.Set(nodes=nodes, name='Set-kill-node')
#: The set 'Set-kill-node' has been created (6 nodes).
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
e = p.elements
elements = e.getSequenceFromMask(mask=('[#ffffffff:2 ]', ), )
p.Set(elements=elements, name='Set-all-element')
#: The set 'Set-all-element' has been created (64 elements).
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
region = p.sets['Set-all-element']
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
p.SectionAssignment(region=region, sectionName='Section-rock', offset=0.0)
a1 = mdb.models['Model-1'].rootAssembly
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
a1.Instance(name='Part-rock-mesh', part=p, dependent=ON)
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
p = mdb.models['Model-1'].parts['Part-1-mesh-1']
e = p.elements
elements = e.getSequenceFromMask(mask=('[#3c3c0000 #3c3c ]', ), )
p.Set(elements=elements, name='Set-kill-e')
#: The set 'Set-kill-e' has been created (16 elements).
mdb.models['Model-1'].keywordBlock.synchVersions(storeNodesAndElements=FALSE)
mdb.models['Model-1'].keywordBlock.insert(59, """
*MODEL CHANGE ,remove
Part-rock-mesh.Set-kill-e""")
#Part-rock-mesh.Set-all-element""")
#Part-rock-mesh.Set-kill-e""")
jobName = 'tun-exp'
a = mdb.models['Model-1']
myJob = mdb.Job(name=jobName, model=a,
description='tunnel tutorial') |
|