Python script for analysis of a plate with hole

A python script was written to analyze a plate with a hole in Abaqus.

        
        
        
#  PLATE HOLE ANALYSIS USING SHELL ELEMENTS
#  ----------------------------------------
#  Copyright (C) 2015, Kedar A. Malusare
#  
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation(version 2);
#  
#  
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#  INFORMATION ABOUT THIS CODE
#  --------------------------

#  This code is a python script for the FEA software Abaqus.
#  It creates a FE model of a plate at the center. The problem is 
#  analyzed using shell elements and quarter symmetry is exploited. 


# INPUTS
# -------

phi_hole = 15.0
D = 50.0
P = 100
t = 10.0

# Do you want to submit the job ???
submit_job = 'False'





############ THE ACTUAL CODE STARTS FROM HERE ############ 

# IMPORTING SOME MODULES 
# ----------------------

from abaqus import *
from abaqusConstants import *
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 optimization import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
from caeModules import *

	
# Drawing the sketch
# ------------------
M = mdb.models['Model-1']
M.ConstrainedSketch(name='__profile__', sheetSize=200.0)

# draw hole
M.sketches['__profile__'].ArcByCenterEnds(center=(0.0, 0.0), 
	direction=CLOCKWISE,point1=(0.0, phi_hole/2.0), point2=(phi_hole/2.0, 0.0))

	
# draw the plate	
M.sketches['__profile__'].Line(point1=(phi_hole/2.0, 0.0), point2=(D/2, 0.0))	
M.sketches['__profile__'].Line(point1=(D/2.0, 0.0), point2=(D/2.0, D/2.0))	
M.sketches['__profile__'].Line(point1=(D/2.0, D/2.0), point2=(0.0, D/2.0))
M.sketches['__profile__'].Line(point1=(0.0, D/2.0), point2=(0.0, phi_hole/2.0))
	
# Save sketch	
M.sketches.changeKey(fromName='__profile__', toName='Plate_sketch')


# Create the material
# -------------------
M.Material(name='Steel')
M.materials['Steel'].Elastic(table=((100.0, 0.33), ))

# Create the section
mdb.models['Model-1'].HomogeneousShellSection(idealization=NO_IDEALIZATION, 
    integrationRule=SIMPSON, material='Steel', name='steel_section', numIntPts=
    5, poissonDefinition=DEFAULT, preIntegrate=OFF, temperature=GRADIENT, 
    thickness=t, thicknessField='', thicknessModulus=None, thicknessType=
    UNIFORM, useDensity=OFF)


# Create the part
# ---------------
M.Part(dimensionality=THREE_D, name='Plate', type=DEFORMABLE_BODY)
M.parts['Plate'].BaseShell(sketch=M.sketches['Plate_sketch'])


# Assign the section
p = M.parts['Plate']
f = p.faces
faces = f.getSequenceFromMask(mask=('[#1 ]', ), )
plate_region = regionToolset.Region(faces=faces)
p.SectionAssignment(region=plate_region, sectionName='steel_section', offset=0.0, 
	offsetType=BOTTOM_SURFACE, offsetField='',thicknessAssignment=FROM_SECTION)


# Mesh the part
# -------------
M.parts['Plate'].seedPart(deviationFactor=0.1,minSizeFactor=0.1, size=0.25)
M.parts['Plate'].generateMesh()


# Assembly
# --------
M.rootAssembly.DatumCsysByDefault(CARTESIAN)
M.rootAssembly.Instance(dependent=ON, name='Plate-1', part=M.parts['Plate'])

# Add a reference point 
M.rootAssembly.ReferencePoint(point=(D/4,D/2+0.25, 0.0))

# Add the RP to a set
RP1_key = M.rootAssembly.referencePoints.keys()[0]
M.rootAssembly.Set(name='RP1_set', referencePoints=(M.rootAssembly.referencePoints[RP1_key], ))
	
# Tying the RP to the upper edge

# find the edge 
all_edges = M.rootAssembly.instances['Plate-1'].edges
upper_edge_index = all_edges.findAt((D/4,D/2, 0.0)).index

# Identify the edges on left, bottom and right side
left_edge_index   = all_edges.findAt((0,phi_hole/2 + 0.05, 0.0)).index
bottom_edge_index = all_edges.findAt((phi_hole/2 + 0.05,0, 0.0)).index
right_edge_index  = all_edges.findAt((D/2,D/4 + 0.05, 0.0)).index


# Create a set of this edge
M.rootAssembly.Set(edges=all_edges[upper_edge_index:upper_edge_index+1], name = 'Upper_edge')
M.rootAssembly.Set(edges=all_edges[left_edge_index:left_edge_index+1],   name = 'left_edge')
M.rootAssembly.Set(edges=all_edges[bottom_edge_index:bottom_edge_index+1], name = 'bottom_edge')
M.rootAssembly.Set(edges=all_edges[right_edge_index:right_edge_index+1], name = 'right_edge')


# CREATE THE VERY IMPORTANT COUPLING
# ----------------------------------
A = M.rootAssembly
M.Coupling(name='Main_CPL', controlPoint=A.sets['RP1_set'], 
    surface=A.sets['Upper_edge'], influenceRadius=WHOLE_SURFACE, couplingType=KINEMATIC, 
    localCsys=None, u1=ON, u2=ON, u3=ON, ur1=ON, ur2=ON, ur3=ON)
	
 
# Apply boundary conditions
# -------------------------
M.XsymmBC(name='Symmetry-Left',createStepName='Initial', region=A.sets['left_edge'], localCsys=None)
M.YsymmBC(name='Symmetry-Bottom',createStepName='Initial', region=A.sets['bottom_edge'], localCsys=None) 

M.DisplacementBC(name='BC-4', createStepName='Initial', 
    region=A.sets['RP1_set'], u1=SET, u2=UNSET, u3=SET, ur1=SET, ur2=SET, ur3=SET, 
    amplitude=UNSET, distributionType=UNIFORM, fieldName='', localCsys=None)
 
 
# Create the load step
# --------------------
M.StaticStep(name='Load', previous='Initial')


# Create the load
# ---------------
M.ConcentratedForce(name='CF_load', createStepName='Load', 
    region=A.sets['RP1_set'], cf2=P, distributionType=UNIFORM, field='', localCsys=None)

	
# Create and submit the job if submit_job= 'True'
# -----------------------------------------------
name_job = 'Plate_job'
mdb.Job(atTime=None, contactPrint=OFF, description='', echoPrint=OFF, 
	explicitPrecision=SINGLE, getMemoryFromAnalysis=True, historyPrint=OFF, 
	memory=90, memoryUnits=PERCENTAGE, model='Model-1', modelPrint=OFF, 
	multiprocessingMode=DEFAULT, name= name_job, nodalOutputPrecision=SINGLE, 
	numCpus=1, numGPUs=0, queue=None, scratch='', type=ANALYSIS, 
	userSubroutine='', waitHours=0, waitMinutes=0)
	
if submit_job == 'True':
	mdb.jobs[name_job].submit(consistencyChecking=OFF)