# # Script to generate coupled Eulerian-Lagrangian # bottle drop model in Abaqus/CAE # 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 stub import * from connectorBehavior import * mdb.models.changeKey(fromName='Model-1', toName='Bottle drop') # # Materials and sections # mdb.models['Bottle drop'].Material(name='HDPE', description='High density polyethelyne') mdb.models['Bottle drop'].materials['HDPE'].Density(table=((8.76e-07, ), )) mdb.models['Bottle drop'].materials['HDPE'].Elastic(table=((903114.0, 0.39), )) mdb.models['Bottle drop'].materials['HDPE'].Plastic(table=((8618.0, 0.0), (13064.0, 0.007), (16787.0, 0.025), (18476.0, 0.044), (20337.0, 0.081), (24543.0, 0.28), (26887.0, 0.59))) mdb.models['Bottle drop'].materials['HDPE'].DuctileDamageInitiation(table=((0.59, 0.0, 0.0), )) mdb.models['Bottle drop'].materials['HDPE'].ductileDamageInitiation.DamageEvolution( type=DISPLACEMENT, table=((0.0, ), )) # mdb.models['Bottle drop'].Material(name='Fluid', description='Fluid') mdb.models['Bottle drop'].materials['Fluid'].Density(table=((9.96e-07, ), )) mdb.models['Bottle drop'].materials['Fluid'].Eos(type=USUP, table=((1450000.0, 0.0, 0.0), )) mdb.models['Bottle drop'].materials['Fluid'].Viscosity(table=((1e-05, ), )) # mdb.models['Bottle drop'].HomogeneousShellSection(name='Bottle-thin', preIntegrate=OFF, material='HDPE', thicknessType=UNIFORM, thickness=0.5, thicknessField='', idealization=NO_IDEALIZATION, poissonDefinition=DEFAULT, thicknessModulus=None, temperature=GRADIENT, useDensity=OFF, nodalThicknessField='', integrationRule=SIMPSON, numIntPts=3) # mdb.models['Bottle drop'].HomogeneousShellSection(name='Bottle-thick', preIntegrate=OFF, material='HDPE', thicknessType=UNIFORM, thickness=0.65, thicknessField='', idealization=NO_IDEALIZATION, poissonDefinition=DEFAULT, thicknessModulus=None, temperature=GRADIENT, useDensity=OFF, nodalThicknessField='', integrationRule=SIMPSON, numIntPts=3) # mdb.models['Bottle drop'].HomogeneousShellSection(name='Cap', preIntegrate=OFF, material='HDPE', thicknessType=UNIFORM, thickness=1.0, thicknessField='', idealization=NO_IDEALIZATION, poissonDefinition=DEFAULT, thicknessModulus=None, temperature=GRADIENT, useDensity=OFF, nodalThicknessField='', integrationRule=SIMPSON, numIntPts=3) # mdb.models['Bottle drop'].EulerianSection(name='Eulerian', data={ 'Fluid-1': 'Fluid'}) # mdb.models['Bottle drop'].SurfaceSection(name='Floor', useDensity=OFF) # # Cap geometry # s = mdb.models['Bottle drop'].ConstrainedSketch(name='__profile__', sheetSize=50.0) g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints s.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(3.0, 0.0)) s.RadialDimension(curve=g[2], textPoint=(4.75961494445801, 3.3653838634491), radius=15.65) p = mdb.models['Bottle drop'].Part(name='Cap', dimensionality=THREE_D, type=DEFORMABLE_BODY) p.BaseSolidExtrude(sketch=s, depth=7.75) del mdb.models['Bottle drop'].sketches['__profile__'] # c = p.cells pickedCells = c.getSequenceFromMask(mask=('[#1 ]', ), ) v1, e, d1 = p.vertices, p.edges, p.datums p.PartitionCellByPlaneThreePoints(point1=v1[1], point2=v1[0], cells=pickedCells, point3=p.InterestingPoint(edge=e[0], rule=MIDDLE)) c = p.cells pickedCells = c.getSequenceFromMask(mask=('[#3 ]', ), ) v2, e1, d2 = p.vertices, p.edges, p.datums p.PartitionCellByPlaneThreePoints(cells=pickedCells, point1=p.InterestingPoint( edge=e1[4], rule=MIDDLE), point2=p.InterestingPoint(edge=e1[7], rule=MIDDLE), point3=p.InterestingPoint(edge=e1[5], rule=MIDDLE)) # c1 = p.cells p.RemoveCells(cellList = c1[0:4]) f = p.faces p.RemoveFaces(faceList = f[5:7]+f[10:11]+f[15:16], deleteCells=True) f1 = p.faces p.RemoveFaces(faceList = f1[0:2]+f1[6:8], deleteCells=True) f = p.faces # faces = f.getSequenceFromMask(mask=('[#ff ]', ), ) p.Set(faces=faces, name='All') s = p.faces side12Faces = s.getSequenceFromMask(mask=('[#ff ]', ), ) p.Surface(side12Faces=side12Faces, name='Surf') # # Eulerian geometry # s1 = mdb.models['Bottle drop'].ConstrainedSketch(name='__profile__', sheetSize=800.0) g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints s1.rectangle(point1=(-150.0, -100.0), point2=(150.0, 100.0)) s1.ObliqueDimension(vertex1=v[3], vertex2=v[0], textPoint=(43.6525192260742, -19.4680843353271), value=300.0) s1.ObliqueDimension(vertex1=v[2], vertex2=v[3], textPoint=(343.681854248047, 33.3142585754395), value=200.0) p = mdb.models['Bottle drop'].Part(name='Eulerian', dimensionality=THREE_D, type=EULERIAN) p.BaseSolidExtrude(sketch=s1, depth=250.0) del mdb.models['Bottle drop'].sketches['__profile__'] # c = p.cells cells = c.getSequenceFromMask(mask=('[#1 ]', ), ) p.Set(cells=cells, name='All') # # Floor geometry # s = mdb.models['Bottle drop'].ConstrainedSketch(name='__profile__', sheetSize=800.0) g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints s.rectangle(point1=(-40.0, -40.0), point2=(40.0, 60.0)) s.ConstructionLine(point1=(0.0, 0.0), angle=90.0) s.VerticalConstraint(entity=g[6]) s.ConstructionLine(point1=(0.0, 0.0), angle=0.0) s.HorizontalConstraint(entity=g[7]) s.FixedConstraint(entity=g[7]) s.FixedConstraint(entity=g[6]) s.delete(objectList=(c[24], )) s.delete(objectList=(c[23], )) s.SymmetryConstraint(entity1=g[2], entity2=g[4], symmetryAxis=g[6]) s.SymmetryConstraint(entity1=g[5], entity2=g[3], symmetryAxis=g[7]) s.ObliqueDimension(vertex1=v[2], vertex2=v[3], textPoint=(67.6598434448242, 18.0700168609619), value=600.0) s.ObliqueDimension(vertex1=v[1], vertex2=v[2], textPoint=(600.0, 0.0), value=600.0) p = mdb.models['Bottle drop'].Part(name='Floor', dimensionality=THREE_D, type=DEFORMABLE_BODY) p.BaseShell(sketch=s) del mdb.models['Bottle drop'].sketches['__profile__'] # f = p.faces faces = f.getSequenceFromMask(mask=('[#1 ]', ), ) p.Set(faces=faces, name='All') s = p.faces side1Faces = s.getSequenceFromMask(mask=('[#1 ]', ), ) p.Surface(side1Faces=side1Faces, name='Surf') # # Solid bottle geometry (imported from SAT file). DO NOT NEED THIS .SAT FILE: SEE CASE 1 CEL # #acis = mdb.openAcis('cel_bottle_drop_solidgeom.sat',scaleFromFile=OFF) #mdb.models['Bottle drop'].PartFromGeometryFile(name='Solid-bottle', # geometryFile=acis, dimensionality=THREE_D, type=DEFORMABLE_BODY) # # Oriented solid bottle geometry (imported from SAT file and used for volume fraction calculation) # acis = mdb.openAcis('cel_bottle_drop_watergeom.sat', scaleFromFile=OFF) mdb.models['Bottle drop'].PartFromGeometryFile(name='Water-geometry', geometryFile=acis, dimensionality=THREE_D, type=DEFORMABLE_BODY) # # Mesh the parts # p = mdb.models['Bottle drop'].parts['Cap'] f = p.faces faces = f.getSequenceFromMask(mask=('[#ff ]', ), ) pickedRegions =(faces, ) p.setElementType(elemTypes=( ElemType(elemCode=S4R, elemLibrary=EXPLICIT, secondOrderAccuracy=OFF, hourglassControl=DEFAULT), ElemType( elemCode=S3R, elemLibrary=EXPLICIT)),regions=pickedRegions) pickedRegions = f.getSequenceFromMask(mask=('[#ff ]', ), ) p.setMeshControls(regions=pickedRegions, technique=STRUCTURED) p.seedPart(size=2.2, deviationFactor=0.1) p.generateMesh() # p = mdb.models['Bottle drop'].parts['Eulerian'] c = p.cells cells = c.getSequenceFromMask(mask=('[#1 ]', ), ) pickedRegions =(cells, ) p.setElementType(regions=pickedRegions, elemTypes=( ElemType(elemCode=EC3D8R, elemLibrary=EXPLICIT, hourglassControl=DEFAULT), ElemType(elemCode=UNKNOWN_WEDGE, elemLibrary=EXPLICIT), ElemType(elemCode=UNKNOWN_TET, elemLibrary=EXPLICIT))) p.seedPart(size=5.0, deviationFactor=0.1) p.generateMesh() # p = mdb.models['Bottle drop'].parts['Floor'] f = p.faces faces = f.getSequenceFromMask(mask=('[#1 ]', ), ) pickedRegions =(faces, ) p.setElementType(regions=pickedRegions, elemTypes=( ElemType(elemCode=SFM3D4R, elemLibrary=EXPLICIT), ElemType(elemCode=SFM3D3, elemLibrary=EXPLICIT))) f = p.faces pickedRegions = f.getSequenceFromMask(mask=('[#1 ]', ), ) p.setMeshControls(regions=pickedRegions, technique=STRUCTURED) p.seedPart(size=15.0, deviationFactor=0.1) p.generateMesh() # # Bottle geometry (imported as an orphan mesh) # mdb.ModelFromInputFile(name='Bottle', inputFileName='cel_bottle_drop_mesh.inp') mdb.models['Bottle'].parts.changeKey(fromName='BOTTLE', toName='Bottle') mdb.models['Bottle drop'].Part('Bottle', mdb.models['Bottle'].parts['Bottle']) del mdb.models['Bottle'] mdb.models['Bottle drop'].parts['Bottle'].sets.changeKey(fromName='ALL', toName='All') mdb.models['Bottle drop'].parts['Bottle'].sets.changeKey(fromName='BOT', toName='Bot') mdb.models['Bottle drop'].parts['Bottle'].sets.changeKey(fromName='TOP', toName='Top') mdb.models['Bottle drop'].parts['Bottle'].surfaces.changeKey(fromName='SURF', toName='Surf') p = mdb.models['Bottle drop'].parts['Bottle'] n = p.nodes nodes = n.getSequenceFromMask(mask=('[#0:109 #8000 ]', ), ) p.Set(nodes=nodes, name='QA_TEST_NOUT') e = p.elements elements = e.getSequenceFromMask(mask=('[#0:97 #100 ]', ), ) p.Set(elements=elements, name='QA_TEST_EOUT') # # Section assignments # p = mdb.models['Bottle drop'].parts['Bottle'] region = p.sets['Top'] p.SectionAssignment(region=region, sectionName='Bottle-thick', offset=0.0, offsetType=BOTTOM_SURFACE, offsetField='') region = p.sets['Bot'] p.SectionAssignment(region=region, sectionName='Bottle-thin', offset=0.0, offsetType=BOTTOM_SURFACE, offsetField='') # p = mdb.models['Bottle drop'].parts['Cap'] region = p.sets['All'] p.SectionAssignment(region=region, sectionName='Cap', offset=0.0, offsetType=BOTTOM_SURFACE, offsetField='') # p = mdb.models['Bottle drop'].parts['Eulerian'] region = p.sets['All'] p.SectionAssignment(region=region, sectionName='Eulerian', offset=0.0, offsetType=MIDDLE_SURFACE, offsetField='') # p = mdb.models['Bottle drop'].parts['Floor'] region = p.sets['All'] p.SectionAssignment(region=region, sectionName='Floor', offset=0.0, offsetType=MIDDLE_SURFACE, offsetField='') # # Instance parts into the assembly # a = mdb.models['Bottle drop'].rootAssembly a.DatumCsysByDefault(CARTESIAN) # p = mdb.models['Bottle drop'].parts['Floor'] a.Instance(name='Floor', part=p, dependent=ON) p = mdb.models['Bottle drop'].parts['Bottle'] a.Instance(name='Bottle', part=p, dependent=ON) a.translate(instanceList=('Bottle', ), vector=(56.671678, -7.476258, 47.399967)) a.rotate(instanceList=('Bottle', ), axisPoint=(56.671678, -7.476258, 47.399967), axisDirection=(-0.086827, -0.257842, 0.962278), angle=90.4352318522132) # p = mdb.models['Bottle drop'].parts['Water-geometry'] a.Instance(name='Water-geometry', part=p, dependent=ON) # p = mdb.models['Bottle drop'].parts['Cap'] a.Instance(name='Cap', part=p, dependent=ON) a.translate(instanceList=('Cap', ), vector=(-99.855302, -37.729497, 218.974611)) a.rotate(instanceList=('Cap', ), axisPoint=(-99.855302, -37.729497, 218.974611), axisDirection=(0.430599, -0.902544, 0.0), angle=22.2687445839842) # p = mdb.models['Bottle drop'].parts['Eulerian'] a.Instance(name='Eulerian', part=p, dependent=ON) a.translate(instanceList=('Eulerian', ), vector=(-45.0, -15.0, -5.0)) a.translate(instanceList=('Eulerian', ), vector=(0.0, -0.0, -10.0)) # # Step definition w/ mass scaling # mdb.models['Bottle drop'].ExplicitDynamicsStep(name='Step-1', previous='Initial', description='Drop from 305 mm', timePeriod=0.05) # regionDef0=mdb.models['Bottle drop'].rootAssembly.instances['Bottle'].sets['All'] mdb.models['Bottle drop'].steps['Step-1'].setValues(massScaling=(( SEMI_AUTOMATIC, regionDef0, AT_BEGINNING, 0.0, 7.528e-07, BELOW_MIN, 0, 0, 0.0, 0.0, 0, None), )) # # General contact # mdb.models['Bottle drop'].ContactProperty('Default') mdb.models['Bottle drop'].ContactExp(name='General contact', createStepName='Step-1') mdb.models['Bottle drop'].interactions['General contact'].setValues(globalSmoothing=False) mdb.models['Bottle drop'].interactions['General contact'].includedPairs.setValuesInStep( stepName='Step-1', useAllstar=ON) r11=mdb.models['Bottle drop'].rootAssembly.instances['Floor'].surfaces['Surf'] mdb.models['Bottle drop'].interactions['General contact'].excludedPairs.setValuesInStep( stepName='Step-1', addPairs=((r11, 'Eulerian.Fluid-1'), )) mdb.models['Bottle drop'].interactions['General contact'].contactPropertyAssignments.appendInStep( stepName='Step-1', assignments=((GLOBAL, SELF, 'Default'), )) # # Rigid floor # a.ReferencePoint(point=(0.0, 0.0, -50.0)) r1 = a.referencePoints refPoints1=(r1[12], ) a.Set(referencePoints=refPoints1, name='Floor ref pt') region2=a.instances['Floor'].sets['All'] region1=a.sets['Floor ref pt'] mdb.models['Bottle drop'].RigidBody(name='Rigid floor', refPointRegion=region1, bodyRegion=region2) # # Initial velocity for bottle, cap, and fluid # region = a.instances['Bottle'].sets['All'] mdb.models['Bottle drop'].Velocity(name='Bottle initial velocity', region=region, field='', distributionType=MAGNITUDE, velocity1=0.0, velocity2=0.0, velocity3=-2444.0, omega=0.0) # region = a.instances['Cap'].sets['All'] mdb.models['Bottle drop'].Velocity(name='Cap initial velocity', region=region, field='', distributionType=MAGNITUDE, velocity1=0.0, velocity2=0.0, velocity3=-2444.0, omega=0.0) # region = a.instances['Eulerian'].sets['All'] mdb.models['Bottle drop'].Velocity(name='Fluid initial velocity', region=region, field='', distributionType=MAGNITUDE, velocity1=0.0, velocity2=0.0, velocity3=-2444.0, omega=0.0) # # Fix the floor # region = a.sets['Floor ref pt'] mdb.models['Bottle drop'].DisplacementBC(name='Fix floor', createStepName='Initial', region=region, u1=SET, u2=SET, u3=SET, ur1=SET, ur2=SET, ur3=SET, amplitude=UNSET, distributionType=UNIFORM, fieldName='', localCsys=None) # # Gravity on the bottle, cap, and fluid # region = a.instances['Bottle'].sets['All'] mdb.models['Bottle drop'].Gravity(name='Gravity on bottle', createStepName='Step-1', comp3=-9800.0, distributionType=UNIFORM, field='', region=region) # region = a.instances['Cap'].sets['All'] mdb.models['Bottle drop'].Gravity(name='Gravity on cap', createStepName='Step-1', comp3=-9800.0, distributionType=UNIFORM, field='', region=region) # region = a.instances['Eulerian'].sets['All'] mdb.models['Bottle drop'].Gravity(name='Gravity on fluid', createStepName='Step-1', comp3=-9800.0, distributionType=UNIFORM, field='', region=region) # # Volume fraction field and fluid material assignment # mdb.models['Bottle drop'].rootAssembly.DiscreteFieldByVolumeFraction( name='Fluid volume fractions', description='Initial fluid material boundary', eulerianInstance=a.instances['Eulerian'], referenceInstance=a.instances['Water-geometry']) # instList = (a.instances['Eulerian'], ) rgn1 = a.instances['Eulerian'].sets['All'] fract1 = ("Fluid volume fractions", ) mdb.models['Bottle drop'].MaterialAssignment(name='Fluid material assignment', instanceList=instList, useFields=True, fieldList=((rgn1, fract1), )) # # Output requests # mdb.models['Bottle drop'].fieldOutputRequests.changeKey(fromName='F-Output-1', toName='Bottle U,V, strain, damage, status') regionDef=mdb.models['Bottle drop'].rootAssembly.instances['Bottle'].sets['All'] mdb.models['Bottle drop'].fieldOutputRequests['Bottle U,V, strain, damage, status'].setValues( variables=('UT', 'VT', 'PEEQ', 'LE', 'DMICRT', 'STATUS'), numIntervals=20, region=regionDef, sectionPoints=DEFAULT, rebar=EXCLUDE) # regionDef=mdb.models['Bottle drop'].rootAssembly.instances['Cap'].sets['All'] mdb.models['Bottle drop'].FieldOutputRequest( name='Cap U, V, strain, damage, status', createStepName='Step-1', variables=('UT', 'VT', 'PEEQ', 'LE', 'DMICRT', 'STATUS'), numIntervals=20, region=regionDef, sectionPoints=DEFAULT, rebar=EXCLUDE) # regionDef=mdb.models['Bottle drop'].rootAssembly.instances['Eulerian'].sets['All'] mdb.models['Bottle drop'].FieldOutputRequest( name='Fluid volume fraction and stress', createStepName='Step-1', variables=('SVAVG', 'EVF'), numIntervals=20, region=regionDef, sectionPoints=DEFAULT, rebar=EXCLUDE) # regionDef=mdb.models['Bottle drop'].rootAssembly.instances['Bottle'].sets['QA_TEST_NOUT'] mdb.models['Bottle drop'].FieldOutputRequest(name='Node output for QA', createStepName='Step-1', variables=('V', ), region=regionDef, sectionPoints=DEFAULT, rebar=EXCLUDE) # regionDef=mdb.models['Bottle drop'].rootAssembly.instances['Bottle'].sets['QA_TEST_EOUT'] mdb.models['Bottle drop'].FieldOutputRequest(name='Element output for QA', createStepName='Step-1', variables=('LE', ), region=regionDef, sectionPoints=DEFAULT, rebar=EXCLUDE) # mdb.models['Bottle drop'].historyOutputRequests.changeKey( fromName='H-Output-1', toName='Whole model energy') mdb.models['Bottle drop'].historyOutputRequests['Whole model energy'].setValues( variables=('ALLAE', 'ALLDMD', 'ALLFD', 'ALLIE', 'ALLKE', 'ALLPD', 'ALLSE', 'ALLWK', 'ALLCW', 'ALLMW', 'ALLPW', 'ETOTAL'), timeInterval=0.0025) # regionDef=mdb.models['Bottle drop'].rootAssembly.sets['Floor ref pt'] mdb.models['Bottle drop'].ButterworthFilter(name='Smooth', cutoffFrequency=2000.0, order=4) mdb.models['Bottle drop'].HistoryOutputRequest(name='Floor reaction forces', createStepName='Step-1', variables=('RF1', 'RF2', 'RF3'), frequency=100, region=regionDef, filter='Smooth', sectionPoints=DEFAULT, rebar=EXCLUDE) # # Job # a.features['Water-geometry'].suppress() mdb.Job(name='Bottle-drop', model='Bottle drop', type=ANALYSIS, explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, description='Fluid filled bottle drop using CEL', parallelizationMethodExplicit=DOMAIN, multiprocessingMode=DEFAULT, numDomains=1, userSubroutine='', numCpus=1, memory=50, memoryUnits=PERCENTAGE, scratch='', echoPrint=OFF, modelPrint=OFF, contactPrint=OFF, historyPrint=OFF) # # Display color-coded assembly with transparency # session.viewports['Viewport: 1'].setValues(displayedObject=a) session.viewports['Viewport: 1'].enableMultipleColors() session.viewports['Viewport: 1'].setColor(initialColor='#BDBDBD') cmap = session.viewports['Viewport: 1'].colorMappings['Part'] cmap.updateOverrides(overrides={'Bottle':(True, '#00FF00', 'Default', '#00FF00'), 'Bottle-solid-oriented':(False, ), 'Cap':(True, '#FF0000', 'Default', '#FF0000'), 'Eulerian':(False, ), 'Floor':(True, '#FFFF00', 'Default', '#FFFF00')}) session.viewports['Viewport: 1'].setColor(colorMapping=cmap) session.viewports['Viewport: 1'].disableMultipleColors() # session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues( meshVisibleEdges=FEATURE, featureAngle=65.0) session.viewports['Viewport: 1'].assemblyDisplay.setValues(interactions=OFF, constraints=OFF, connectors=OFF, loads=OFF, engineeringFeatures=OFF, predefinedFields=OFF) session.viewports['Viewport: 1'].setValues(displayedObject=a) # # Write out input file and save model # mdb.jobs['Bottle-drop'].writeInput(consistencyChecking=OFF) mdb.saveAs('Bottle_Drop_CEL')