A.11 Vibration of a piping system

gsi_pipe_caemodel.py

#
# Getting Started with ABAQUS
#
# Script for pipe example
#
#
from abaqus import *
from abaqusConstants import *
session.journalOptions.setValues(replayGeometry=COORDINATE, 
    recoverGeometry=COORDINATE)
session.Viewport(name='Viewport: 1', origin=(1.3671875, 1.3671875), 
    width=201.25, height=135.625)
session.viewports['Viewport: 1'].makeCurrent()
Mdb()
##
##  Rename the model 'Original'
##
session.viewports['Viewport: 1'].setValues(displayedObject=None)
mdb.models.changeKey('Model-1', 'Original')
##
##  Switch to the part module
##
import part
##
##  Sketch profile of the pipe
##
s = mdb.models['Original'].Sketch(name='__profile__', sheetSize=20.0)
g, v, d = s.geometry, s.vertices, s.dimensions
s.sketchOptions.setValues(sheetSize=20.0, gridSpacing=0.5, grid=ON, 
    gridFrequency=2, constructionGeometry=ON, dimensionTextHeight=0.5, 
    decimalPlaces=2)
s.Line(point1=(0.0, 0.0), point2=(5.0, 0.0))
s.HorizontalDimension(vertex1=v[1], vertex2=v[2], textPoint=(4.80955791473389, 
    1.86559057235718))
p = mdb.models['Original'].Part(name='Pipe', dimensionality=THREE_D, 
    type=DEFORMABLE_BODY)
p = mdb.models['Original'].parts['Pipe']
p.BaseWire(sketch=s)
p = mdb.models['Original'].parts['Pipe']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Original'].sketches['__profile__']
##
##  Switch to the property module
##
import material
import section
##
##  Create material 'Steel'
##
mdb.models['Original'].Material('Steel')
mdb.models['Original'].materials['Steel'].Elastic(table=((2.E+11, 0.3), ))
mdb.models['Original'].materials['Steel'].Density(table=((7800.0, ), ))
##
##  Create pipe profile and section 
##
mdb.models['Original'].PipeProfile(name='PipeProfile', r=0.09, t=0.02)
mdb.models['Original'].BeamSection(name='PipeSection', profile='PipeProfile', 
    integration=DURING_ANALYSIS, material='Steel', temperatureVar=LINEAR)
##
##  Assign pipe section
##
p0 = mdb.models['Original'].parts['Pipe']
e = p0.edges
region=(None, 
    e.findAt(((1.25, 0.0, 0.0), ), ), 
    None, None)
p0 = mdb.models['Original'].parts['Pipe']
p0.SectionAssignment(region=region, sectionName='PipeSection')
##
##  Assign beam orientations
##
p0 = mdb.models['Original'].parts['Pipe']
e = p0.edges
region=(None, 
    e.findAt(((1.25, 0.0, 0.0), ), ), 
    None, None)
p0.assignBeamSectionOrientation(region=region, method=N1_COSINES, 
    n1=(0.0, 0.0, -1.0))
##
##  Switch to the assembly module
##
import assembly
import part
a = mdb.models['Original'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
##
##  Set coordinate system (done by default)
##
a = mdb.models['Original'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
##
##  Instance the pipe
##
p = mdb.models['Original'].parts['Pipe']
a.Instance(name='Pipe-1', part=p, dependent=ON)
##
##  Create geometry set 'Left'
##
a = mdb.models['Original'].rootAssembly
v1 = a.instances['Pipe-1'].vertices
a.Set(vertices=v1.findAt(
    ((0.0, 0.0, 0.0), ), ), name='Left')
##
##  Create geometry set 'Right'
##
a = mdb.models['Original'].rootAssembly
v1 = a.instances['Pipe-1'].vertices
a.Set(vertices=v1.findAt(
    ((5.0, 0.0, 0.0), ), ), name='Right')
##
##  Switch to the step module
##
import step
##
##  Create a static general step
##
mdb.models['Original'].StaticStep(name='Pull I', previous='Initial', 
    description="""Apply axial tensile load of 4.0 MN""", timePeriod=1, 
    adiabatic=OFF, maxNumInc=100, stabilization=None, 
    timeIncrementationMethod=AUTOMATIC, 
    initialInc=0.1, minInc=1e-05, maxInc=1, matrixSolver=SOLVER_DEFAULT, 
    amplitude=RAMP, extrapolation=LINEAR, fullyPlastic="", nlgeom=ON)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Pull I')
##
##  Create a frequency extraction step
##
mdb.models['Original'].FrequencyStep(name='Frequency I', previous='Pull I', 
    description="""Extract modes and frequencies""", numEigen=8, 
    maxEigen=None, shift=None, vectors=16, maxIterations=30, 
    eigensolver=SUBSPACE)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Pull I')
##
##  Modify output requests
##
mdb.models['Original'].fieldOutputRequests['F-Output-1'].setValues(
    variables=PRESELECT)
del mdb.models['Original'].historyOutputRequests['H-Output-1']
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Frequency I')
mdb.models['Original'].fieldOutputRequests['F-Output-2'].setValues(
    variables=PRESELECT)
mdb.models['Original'].steps['Pull I'].Restart(frequency=10, overlay=OFF)
mdb.models['Original'].steps['Frequency I'].Restart(frequency=1)
##
##  Switch to load module
##
import load
session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=ON, bcs=ON,
    fields=ON)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Pull I')
##
##  Apply encastre bc to left end
##
a0 = mdb.models['Original'].rootAssembly
region = a0.sets['Left']
mdb.models['Original'].EncastreBC(name='Left end', createStepName='Pull I', 
    region=region)
##
##  Fix all dofs at right end except for U1
##
a0 = mdb.models['Original'].rootAssembly
region = a0.sets['Right']
mdb.models['Original'].DisplacementBC(name='Right end', 
    createStepName='Pull I', 
    region=region, u2=0.0, u3=0.0, ur1=0.0, ur2=0.0, ur3=0.0)
##
##  Apply concentrated force to right end
##
a0 = mdb.models['Original'].rootAssembly
region = a0.sets['Right']
mdb.models['Original'].ConcentratedForce(name='Force', createStepName='Pull I', 
    region=region, cf1=4000000.0)
##
##  Switch to mesh module
##
import mesh
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON, loads=OFF,
    bcs=OFF, fields=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=ON)
##
##  Assign edge seed
##
p = mdb.models['Original'].parts['Pipe']
e = p.edges
edges=(e.findAt((1.25, 0.0, 0.0), ), )
p.seedEdgeByNumber(edges=edges, number=30)
##
##  Assign element type
##
elemType1 = mesh.ElemType(elemCode=PIPE32)
regions=(None, 
    e.findAt(((1.25, 0.0, 0.0), ), ), None, None)
p.setElementType(regions=regions, elemTypes=(elemType1, ))
##
##  Generate mesh
##
p.generateMesh()
##
##  Switch to job module
##
import job
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=OFF)
##
##  Create job
##
mdb.Job(name='Pipe', model='Original', 
    description='Analysis of a 5 meter long pipe under axial load')
##
##  Save model database
##
mdb.saveAs('Pipe')
##
##  Copy model to 'Restart'
##
mdb.Model('Restart', mdb.models['Original'])
##
##  Edit restart model attributes
##
mdb.models['Restart'].setValues(restartJob='Pipe', restartStep='Frequency I', 
    restartIncrement=STEP_END)
##
##  Switch to step module
##
import step
a = mdb.models['Restart'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
##
##  Create general static step; insert after previous frequency step
##
mdb.models['Restart'].StaticStep(name='Pull II', previous='Frequency I', 
    description="""Apply axial tensile load of 8.0 MN""", timePeriod=1, 
    adiabatic=OFF, maxNumInc=100, 
    stabilizationMethod=NONE, timeIncrementationMethod=AUTOMATIC, 
    initialInc=0.1, minInc=1e-05, maxInc=1, matrixSolver=SOLVER_DEFAULT, 
    amplitude=RAMP, extrapolation=LINEAR, fullyPlastic="")
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Pull II')
##
##  Create frequency extraction step
##
mdb.models['Restart'].FrequencyStep(name='Frequency II', previous='Pull II', 
    description="""Extract modes and frequencies""", numEigen=8, 
    maxEigen=None, shift=None, vectors=16, maxIterations=30, 
    eigensolver=SUBSPACE)
##
##  Modify output requests
##
mdb.models['Restart'].steps['Pull II'].Restart(frequency=10, overlay=OFF)
mdb.models['Restart'].steps['Frequency II'].Restart(frequency=1)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Frequency II')
##
##  Switch to load module
##
import load
session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=ON, bcs=ON,
    fields=ON)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Pull II')
##
##  Double the magnitude of the applied force 
##  in the second general step
##
mdb.models['Restart'].loads['Force'].setValuesInStep(stepName='Pull II', 
    cf1=8000000.0)
##
##  Switch to job module
##
import job
session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=OFF, bcs=OFF,
    fields=OFF)
##
##  Create a restart analysis job
##
mdb.Job(name='PipeRestart', model='Restart', type=RESTART, 
    explicitPrecision=SINGLE, 
    description='Restart analysis of a 5 meter long pipe under axial load', 
    userSubroutine='', numCpus=1, 
    standardMemory=128.0, scratch='', echoPrint=OFF, 
    modelPrint=OFF, contactPrint=OFF, historyPrint=OFF)
#
a = mdb.models['Original'].rootAssembly
a.regenerate()
a = mdb.models['Restart'].rootAssembly
a.regenerate()
##
##  Save model database
##
mdb.saveAs('Pipe')