Demo entry 6360715

Test

   

Submitted by anonymous on May 02, 2017 at 16:40
Language: Python. Code size: 17.0 kB.

# load modulus
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 math import *

import numpy as np

### DIMENSIONS ###
RL=0.00625	# Radius loading ring
RS=0.015	# Radius supporting ring
RT=0.0025	# Tip radius
AL=(pow(RL, 2)-pow((RL-2*RT), 2))*pi

H=0.00251	# Height of rings
RG=0.0225	# Radius of glass specimen

### GLASS THICKNESS ###
T=[0.00286]

### LOAD DEFINITION ###
#magLoad=[2e3, 6e3, 10e3, 14e3]		# 2mm glass
#magLoad=[2e3, 8e3, 16e3, 22e3]		# 3mm glass
#magLoad=[5e3, 10e3, 25e3, 40e3]	# 4mm glass
#magLoad=[1e3, 2e3, 4e3, 6e3, 8e3, 10e3, 12e3, 14e3]
#magLoad=[4e3]
magLoad=np.loadtxt('C:/Users/s123090/Dropbox/DTU/10. Semester/MSc Thesis/Abaqus/RingOnRing/Python/StaticLoad.txt')

### ELEMENT SIZE ###
#elSize=[0.002, 0.0015, 0.001, 0.00075, 0.0005, 0.0004, 0.0003, 0.0002, 0.000175, 0.00015, 0.000125, 0.0001125, 0.0001]
elSize=[0.00015]

### FRICTION COEFFICIENT ###
friction = 0.0

#################################
numbering1=range(0,len(T))
numbering2=range(0,len(magLoad))
numbering3=range(0,len(elSize))

for number1 in numbering1:
	print '========================================================='
	print 'Glass thickness = %.2f mm' % (T[number1]*1000)
	
	for number2 in numbering2:
		print '========================================================='
		print 'Magnitude of load = %.2f kN' % (magLoad[number2]/1000)
		print 'Magnitude of pressure = %.2f MPa' % (magLoad[number2]/AL*1e-6)
	
		for number3 in numbering3:
			print '========================================================='
			print 'Mesh Nr. %.0f:' % (number3+1)
			print '========================================================='

			### PART - LoadingRing ###
			mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.1)
			mdb.models['Model-1'].sketches['__profile__'].sketchOptions.setValues(
				decimalPlaces=3, viewStyle=AXISYM)
			mdb.models['Model-1'].sketches['__profile__'].ConstructionLine(point1=(0.0, 
				-0.05), point2=(0.0, 0.05))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].FixedConstraint(entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.0), 
				))
			mdb.models['Model-1'].sketches['__profile__'].Line(point1=(RL-2*RT, RT), 
				point2=(RL-2*RT, H))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-2*RT, 
				RL))
			mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(addUndoState=
				False, entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-2*RT, 
				RT), ))
			mdb.models['Model-1'].sketches['__profile__'].Line(point1=(RL-2*RT, H), 
				point2=(RL, H))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-RT, H))
			mdb.models['Model-1'].sketches['__profile__'].HorizontalConstraint(
				addUndoState=False, entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-RT, 
				H), ))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-2*RT, 
				RT))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-RT, H))
			mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(
				addUndoState=False, entity1=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-2*RT, 
				RT), ), entity2=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-RT, 
				H), ))
			mdb.models['Model-1'].sketches['__profile__'].Line(point1=(RL, H), 
				point2=(RL, RT))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL, 
				RT))
			mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(addUndoState=
				False, entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL, 
				RT), ))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-RT, H))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL, 
				RT))
			mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(
				addUndoState=False, entity1=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL-RT, 
				H), ), entity2=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RL, 
				RT), ))
			mdb.models['Model-1'].sketches['__profile__'].ArcByCenterEnds(center=(RL-RT, 
				RT), direction=CLOCKWISE, point1=(RL, RT), point2=(RL-2*RT, 
				RT))
			mdb.models['Model-1'].Part(dimensionality=AXISYMMETRIC, name='LoadingRing', 
				type=DEFORMABLE_BODY)
			mdb.models['Model-1'].parts['LoadingRing'].BaseShell(sketch=
				mdb.models['Model-1'].sketches['__profile__'])
			del mdb.models['Model-1'].sketches['__profile__']

			### PART - SupportingRing ###
			mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.1)
			mdb.models['Model-1'].sketches['__profile__'].sketchOptions.setValues(
				decimalPlaces=3, viewStyle=AXISYM)
			mdb.models['Model-1'].sketches['__profile__'].ConstructionLine(point1=(0.0, 
				-0.05), point2=(0.0, 0.05))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].FixedConstraint(entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.0), 
				))
			mdb.models['Model-1'].sketches['__profile__'].Line(point1=(RS-2*RT, H-RT), 
				point2=(RS-2*RT, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-2*RT, 
				(H-RT)/2))
			mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(addUndoState=
				False, entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-2*RT, 
				(H-RT)/2), ))
			mdb.models['Model-1'].sketches['__profile__'].Line(point1=(RS-2*RT, 0.0), 
				point2=(RS, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-RT, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].HorizontalConstraint(
				addUndoState=False, entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-RT, 0.0), 
				))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-2*RT, 
				(H-RT)/2))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-RT, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(
				addUndoState=False, entity1=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-2*RT, 
				(H-RT)/2), ), entity2=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-RT, 0.0), 
				))
			mdb.models['Model-1'].sketches['__profile__'].Line(point1=(RS, 0.0), 
				point2=(RS, H-RT))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS, 
				(H-RT)/2))
			mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(addUndoState=
				False, entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS, 
				(H-RT)/2), ))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-RT, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS, 
				(H-RT)/2))
			mdb.models['Model-1'].sketches['__profile__'].PerpendicularConstraint(
				addUndoState=False, entity1=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((RS-RT, 0.0), 
				), entity2=mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((
				RS, (H-RT)/2), ))
			mdb.models['Model-1'].sketches['__profile__'].ArcByCenterEnds(center=(RS-RT, 
				H-RT), direction=CLOCKWISE, point1=(RS-2*RT, H-RT), point2=(RS, 
				H-RT))
			mdb.models['Model-1'].Part(dimensionality=AXISYMMETRIC, name='SupportingRing', 
				type=DEFORMABLE_BODY)
			mdb.models['Model-1'].parts['SupportingRing'].BaseShell(sketch=
				mdb.models['Model-1'].sketches['__profile__'])
			del mdb.models['Model-1'].sketches['__profile__']

			### PART - GlassSpecimen ###
			mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=0.1)
			mdb.models['Model-1'].sketches['__profile__'].sketchOptions.setValues(
				decimalPlaces=3, viewStyle=AXISYM)
			mdb.models['Model-1'].sketches['__profile__'].ConstructionLine(point1=(0.0, 
				-0.05), point2=(0.0, 0.05))
			mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.0))
			mdb.models['Model-1'].sketches['__profile__'].FixedConstraint(entity=
				mdb.models['Model-1'].sketches['__profile__'].geometry.findAt((0.0, 0.0), 
				))
			mdb.models['Model-1'].sketches['__profile__'].rectangle(point1=(0.0, 0.0), 
				point2=(RG, T[number1]))
			mdb.models['Model-1'].Part(dimensionality=AXISYMMETRIC, name='GlassSpecimen', 
				type=DEFORMABLE_BODY)
			mdb.models['Model-1'].parts['GlassSpecimen'].BaseShell(sketch=
				mdb.models['Model-1'].sketches['__profile__'])
			del mdb.models['Model-1'].sketches['__profile__']

			### MATERIALS ###
			mdb.models['Model-1'].Material(name='Glass')
			mdb.models['Model-1'].materials['Glass'].Elastic(table=((70000000000.0, 0.23), 
				))
			mdb.models['Model-1'].Material(name='Steel')
			mdb.models['Model-1'].materials['Steel'].Elastic(table=((210000000000.0, 0.3), 
				))

			### SECTIONS ###
			mdb.models['Model-1'].HomogeneousSolidSection(material='Glass', name=
				'GlassSpecimen', thickness=None)
			mdb.models['Model-1'].HomogeneousSolidSection(material='Steel', name=
				'SteelRing', thickness=None)
			mdb.models['Model-1'].parts['GlassSpecimen'].SectionAssignment(offset=0.0, 
				offsetField='', offsetType=MIDDLE_SURFACE, region=Region(
				faces=mdb.models['Model-1'].parts['GlassSpecimen'].faces.findAt(((RG/2, 
				T[number1]/2, 0.0), (0.0, 0.0, 1.0)), )), sectionName='GlassSpecimen', 
				thicknessAssignment=FROM_SECTION)
			mdb.models['Model-1'].parts['LoadingRing'].SectionAssignment(offset=0.0, 
				offsetField='', offsetType=MIDDLE_SURFACE, region=Region(
				faces=mdb.models['Model-1'].parts['LoadingRing'].faces.findAt(((RL-RT, 
				H/2, 0.0), (0.0, 0.0, 1.0)), )), sectionName='SteelRing', 
				thicknessAssignment=FROM_SECTION)
			mdb.models['Model-1'].parts['SupportingRing'].SectionAssignment(offset=0.0, 
				offsetField='', offsetType=MIDDLE_SURFACE, region=Region(
				faces=mdb.models['Model-1'].parts['SupportingRing'].faces.findAt(((
				RS-RT, H/2, 0.0), (0.0, 0.0, 1.0)), )), sectionName='SteelRing', 
				thicknessAssignment=FROM_SECTION)

			### SET & SURFACE ###
			mdb.models['Model-1'].parts['GlassSpecimen'].Set(faces=
				mdb.models['Model-1'].parts['GlassSpecimen'].faces.getSequenceFromMask((
				'[#1 ]', ), ), name='GlassNodes')

			### MESH - GlassSpecimen ###
			mdb.models['Model-1'].parts['GlassSpecimen'].setMeshControls(elemShape=QUAD, 
				regions=mdb.models['Model-1'].parts['GlassSpecimen'].faces.findAt(((RG/2, 
				T[number1]/2, 0.0), )), technique=STRUCTURED)
			mdb.models['Model-1'].parts['GlassSpecimen'].setElementType(elemTypes=(
				ElemType(elemCode=CAX8, elemLibrary=STANDARD), ElemType(elemCode=CAX6, 
				elemLibrary=STANDARD)), regions=(
				mdb.models['Model-1'].parts['GlassSpecimen'].faces.findAt(((RG/2, 
				T[number1]/2, 0.0), )), ))	
			mdb.models['Model-1'].parts['GlassSpecimen'].deleteMesh()
			mdb.models['Model-1'].parts['GlassSpecimen'].seedPart(deviationFactor=0.1, 
				minSizeFactor=0.1, size=elSize[number3])
			mdb.models['Model-1'].parts['GlassSpecimen'].generateMesh()

			### MESH - LoadingRing ###
			mdb.models['Model-1'].parts['LoadingRing'].setMeshControls(elemShape=
				QUAD_DOMINATED, regions=
				mdb.models['Model-1'].parts['LoadingRing'].faces.findAt(((RL-RT, 
				H/2, 0.0), )))
			mdb.models['Model-1'].parts['LoadingRing'].setElementType(elemTypes=(ElemType(
				elemCode=CAX8, elemLibrary=STANDARD), ElemType(elemCode=CAX6, 
				elemLibrary=STANDARD)), regions=(
				mdb.models['Model-1'].parts['LoadingRing'].faces.findAt(((RL-RT, 
				H/2, 0.0), )), ))
			mdb.models['Model-1'].parts['LoadingRing'].seedPart(deviationFactor=0.1, 
				minSizeFactor=0.1, size=0.00025) #0.00025
			mdb.models['Model-1'].parts['LoadingRing'].generateMesh()

			### MESH - SupportingRing ###
			mdb.models['Model-1'].parts['SupportingRing'].setMeshControls(elemShape=
				QUAD_DOMINATED, regions=
				mdb.models['Model-1'].parts['SupportingRing'].faces.findAt(((RS-RT, 
				H/2, 0.0), )))
			mdb.models['Model-1'].parts['SupportingRing'].setElementType(elemTypes=(
				ElemType(elemCode=CAX8, elemLibrary=STANDARD), ElemType(elemCode=CAX6, 
				elemLibrary=STANDARD)), regions=(
				mdb.models['Model-1'].parts['SupportingRing'].faces.findAt(((RS-RT, 
				H/2, 0.0), )), ))
			mdb.models['Model-1'].parts['SupportingRing'].seedPart(deviationFactor=0.1, 
				minSizeFactor=0.1, size=0.00025)
			mdb.models['Model-1'].parts['SupportingRing'].generateMesh()

			### ASSEMBLY ###
			mdb.models['Model-1'].rootAssembly.DatumCsysByThreePoints(coordSysType=
				CYLINDRICAL, origin=(0.0, 0.0, 0.0), point1=(1.0, 0.0, 0.0), point2=(0.0, 
				0.0, -1.0))
			mdb.models['Model-1'].rootAssembly.Instance(dependent=ON, name=
				'GlassSpecimen-1', part=mdb.models['Model-1'].parts['GlassSpecimen'])
			mdb.models['Model-1'].rootAssembly.Instance(dependent=ON, name='LoadingRing-1', 
				part=mdb.models['Model-1'].parts['LoadingRing'])
			mdb.models['Model-1'].rootAssembly.Instance(dependent=ON, name=
				'SupportingRing-1', part=mdb.models['Model-1'].parts['SupportingRing'])
			mdb.models['Model-1'].rootAssembly.translate(instanceList=('LoadingRing-1', ), 
				vector=(0.0, T[number1], 0.0))
			mdb.models['Model-1'].rootAssembly.translate(instanceList=('SupportingRing-1', 
				), vector=(0.0, -H, 0.0))

			### INTERACTION - Contact ###
			mdb.models['Model-1'].ContactProperty('IntProp-1')
			mdb.models['Model-1'].interactionProperties['IntProp-1'].TangentialBehavior(
				dependencies=0, directionality=ISOTROPIC, elasticSlipStiffness=None, 
				formulation=LAGRANGE, fraction=0.005, maximumElasticSlip=FRACTION, 
				pressureDependency=OFF, shearStressLimit=None, slipRateDependency=OFF, 
				table=((friction, ), ), temperatureDependency=OFF)
			mdb.models['Model-1'].ContactStd(createStepName='Initial', name='Int-1')
			mdb.models['Model-1'].interactions['Int-1'].includedPairs.setValuesInStep(
				stepName='Initial', useAllstar=ON)
			mdb.models['Model-1'].interactions['Int-1'].contactPropertyAssignments.appendInStep(
				assignments=((GLOBAL, SELF, 'IntProp-1'), ), stepName='Initial')

			### STEP, BC & LOAD ###
			mdb.models['Model-1'].StaticStep(name='Loading', nlgeom=OFF, previous='Initial')
			mdb.models['Model-1'].steps['Loading'].setValues(minInc=1e-5)
			mdb.models['Model-1'].DisplacementBC(amplitude=UNSET, createStepName='Initial', 
				distributionType=UNIFORM, fieldName='', localCsys=None, name=
				'BCLoadingRing', region=Region(
				edges=mdb.models['Model-1'].rootAssembly.instances['LoadingRing-1'].edges.findAt(
				((RL-RT, H+T[number1], 0.0), ), )), u1=SET, u2=UNSET, ur3=SET)
			mdb.models['Model-1'].DisplacementBC(amplitude=UNSET, createStepName='Initial', 
				distributionType=UNIFORM, fieldName='', localCsys=None, name=
				'BCSupportingRing', region=Region(
				edges=mdb.models['Model-1'].rootAssembly.instances['SupportingRing-1'].edges.findAt(
				((RS-RT, -H, 0.0), ), )), u1=SET, u2=SET, ur3=SET)
			mdb.models['Model-1'].Pressure(amplitude=UNSET, createStepName='Loading', 
				distributionType=UNIFORM, field='', magnitude=magLoad[number2]/AL, name='Load', 
				region=Region(
				side1Edges=mdb.models['Model-1'].rootAssembly.instances['LoadingRing-1'].edges.findAt(
				((RL-RT, H+T[number1], 0.0), ), )))
				
			### TIME INCREMENTATION ###
			mdb.models['Model-1'].steps['Loading'].control.setValues(allowPropagation=OFF, 
				resetDefaultValues=OFF, timeIncrementation=(4.0, 8.0, 9.0, 16.0, 10.0, 4.0, 
				12.0, 5.0, 6.0, 3.0, 50.0))
			##########---##################

			### FIELD OUTPUT ###
			mdb.models['Model-1'].fieldOutputRequests['F-Output-1'].setValues(variables=(
				'E','S', 'U', 'RF'))

			### JOB & CALCULATE ###
			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='RingOnRing', nodalOutputPrecision=SINGLE
				, numCpus=4, numDomains=4, numGPUs=0, queue=None, resultsFormat=ODB, 
				scratch='', type=ANALYSIS, userSubroutine='', waitHours=0, waitMinutes=0)
			mdb.jobs['RingOnRing'].submit(consistencyChecking=OFF)
			mdb.jobs['RingOnRing'].waitForCompletion()

			### OUTPUT ###
			execfile('C:/Users/s123090/Dropbox/DTU/10. Semester/MSc Thesis/Abaqus/RingOnRing/Python/RingOnRing_ODB.py')

This snippet took 0.03 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).