# # # This script generates the model used in the Eulerian # water column collapse example problem. # # from abaqus import * from abaqusConstants import * from caeModules import * from driverUtils import executeOnCaeStartup executeOnCaeStartup() Mdb() #Create the part geometry # session.viewports['Viewport: 1'].setValues(displayedObject=None) 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=(0.0, 0.0), point2=(10.0, 5.0)) p = mdb.models['Model-1'].Part(name='Domain', dimensionality=THREE_D, type=EULERIAN) p = mdb.models['Model-1'].parts['Domain'] p.BaseSolidExtrude(sketch=s, depth=0.05) s.unsetPrimaryObject() p = mdb.models['Model-1'].parts['Domain'] session.viewports['Viewport: 1'].setValues(displayedObject=p) del mdb.models['Model-1'].sketches['__profile__'] p = mdb.models['Model-1'].parts['Domain'] p.DatumPlaneByPrincipalPlane(principalPlane=YZPLANE, offset=2.25) p = mdb.models['Model-1'].parts['Domain'] p.DatumPlaneByPrincipalPlane(principalPlane=XZPLANE, offset=4.5) p = mdb.models['Model-1'].parts['Domain'] c = p.cells pickedCells = c.getSequenceFromMask(mask=('[#1 ]', ), ) d = p.datums p.PartitionCellByDatumPlane(datumPlane=d[2], cells=pickedCells) p = mdb.models['Model-1'].parts['Domain'] c = p.cells pickedCells = c.getSequenceFromMask(mask=('[#1 ]', ), ) d1 = p.datums p.PartitionCellByDatumPlane(datumPlane=d1[3], cells=pickedCells) # Water material definition # mdb.models['Model-1'].Material(name='Water') mdb.models['Model-1'].materials['Water'].Conductivity(table=((0.6, ), )) mdb.models['Model-1'].materials['Water'].Density(table=((998.2, ), )) mdb.models['Model-1'].materials['Water'].Eos(type=USUP, table=((1500.0, 0.0, 0.0), )) mdb.models['Model-1'].materials['Water'].Viscosity(table=((0.001003, ), )) mdb.models['Model-1'].materials['Water'].SpecificHeat(table=((4182.0, ), )) # Create and assign section # mdb.models['Model-1'].EulerianSection(name='EulerianSection', data={ 'water-1': 'Water'}) p = mdb.models['Model-1'].parts['Domain'] c = p.cells cells = c.getSequenceFromMask(mask=('[#7 ]', ), ) region = regionToolset.Region(cells=cells) p = mdb.models['Model-1'].parts['Domain'] p.SectionAssignment(region=region, sectionName='EulerianSection', offset=0.0, offsetType=MIDDLE_SURFACE, offsetField='') # Create assembly and sets # a = mdb.models['Model-1'].rootAssembly session.viewports['Viewport: 1'].setValues(displayedObject=a) a = mdb.models['Model-1'].rootAssembly a.DatumCsysByDefault(CARTESIAN) p = mdb.models['Model-1'].parts['Domain'] a.Instance(name='Domain-1', part=p, dependent=OFF) a = mdb.models['Model-1'].rootAssembly c1 = a.instances['Domain-1'].cells pickedCells = c1.getSequenceFromMask(mask=('[#4 ]', ), ) d1 = a.instances['Domain-1'].datums a.PartitionCellByDatumPlane(datumPlane=d1[3], cells=pickedCells) a = mdb.models['Model-1'].rootAssembly e1 = a.instances['Domain-1'].edges d1 = a.datums a.ParallelEdge(movableAxis=e1[31], fixedAxis=d1[1].axis3, flip=OFF) a = mdb.models['Model-1'].rootAssembly f1 = a.instances['Domain-1'].faces faces1 = f1.getSequenceFromMask(mask=('[#22000 ]', ), ) a.Set(faces=faces1, name='Bottom') a = mdb.models['Model-1'].rootAssembly f1 = a.instances['Domain-1'].faces faces1 = f1.getSequenceFromMask(mask=('[#8800 ]', ), ) a.Set(faces=faces1, name='Top') a = mdb.models['Model-1'].rootAssembly f1 = a.instances['Domain-1'].faces faces1 = f1.getSequenceFromMask(mask=('[#4000 ]', ), ) a.Set(faces=faces1, name='Left') a = mdb.models['Model-1'].rootAssembly f1 = a.instances['Domain-1'].faces faces1 = f1.getSequenceFromMask(mask=('[#4 ]', ), ) a.Set(faces=faces1, name='Right') a = mdb.models['Model-1'].rootAssembly c1 = a.instances['Domain-1'].cells cells1 = c1.getSequenceFromMask(mask=('[#4 ]', ), ) a.Set(cells=cells1, name='Water_Set') # Create step and output requests # mdb.models['Model-1'].ExplicitDynamicsStep(name='Flow', previous='Initial', description='Collapse of liquid under gravity') session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Flow') mdb.models['Model-1'].fieldOutputRequests['F-Output-1'].setValues(variables=( 'A', 'CSTRESS', 'DENSITYVAVG', 'EVF', 'PEEQVAVG', 'SVAVG', 'V')) del mdb.models['Model-1'].historyOutputRequests['H-Output-1'] # Define gravity load # session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=ON, bcs=ON, predefinedFields=ON, connectors=ON, adaptiveMeshConstraints=OFF) mdb.models['Model-1'].Gravity(name='Gravity', createStepName='Flow', comp3=-9.81, distributionType=UNIFORM, field='') # Define boundary conditions # a = mdb.models['Model-1'].rootAssembly c1 = a.instances['Domain-1'].cells cells1 = c1.getSequenceFromMask(mask=('[#f ]', ), ) f1 = a.instances['Domain-1'].faces faces1 = f1.getSequenceFromMask(mask=('[#c1fdb ]', ), ) e1 = a.instances['Domain-1'].edges edges1 = e1.getSequenceFromMask(mask=('[#424541b ]', ), ) v1 = a.instances['Domain-1'].vertices verts1 = v1.getSequenceFromMask(mask=('[#3 ]', ), ) region = regionToolset.Region(vertices=verts1, edges=edges1, faces=faces1, cells=cells1) mdb.models['Model-1'].VelocityBC(name='Fix_all_V2', createStepName='Flow', region=region, v1=UNSET, v2=0.0, v3=UNSET, vr1=UNSET, vr2=UNSET, vr3=UNSET, amplitude=UNSET, localCsys=None, distributionType=UNIFORM, fieldName='') a = mdb.models['Model-1'].rootAssembly region = a.sets['Bottom'] mdb.models['Model-1'].VelocityBC(name='Fix_Bottom', createStepName='Flow', region=region, v1=UNSET, v2=UNSET, v3=0.0, vr1=UNSET, vr2=UNSET, vr3=UNSET, amplitude=UNSET, localCsys=None, distributionType=UNIFORM, fieldName='') a = mdb.models['Model-1'].rootAssembly region = a.sets['Top'] mdb.models['Model-1'].VelocityBC(name='Fix_Top', createStepName='Flow', region=region, v1=UNSET, v2=UNSET, v3=0.0, vr1=UNSET, vr2=UNSET, vr3=UNSET, amplitude=UNSET, localCsys=None, distributionType=UNIFORM, fieldName='') a = mdb.models['Model-1'].rootAssembly region = a.sets['Left'] mdb.models['Model-1'].VelocityBC(name='Fix_Left', createStepName='Flow', region=region, v1=0.0, v2=UNSET, v3=UNSET, vr1=UNSET, vr2=UNSET, vr3=UNSET, amplitude=UNSET, localCsys=None, distributionType=UNIFORM, fieldName='') # Initial material assignment # a = mdb.models['Model-1'].rootAssembly instList = (a.instances['Domain-1'], ) a = mdb.models['Model-1'].rootAssembly rgn1 = a.sets['Water_Set'] fract1 = (1, ) mdb.models['Model-1'].MaterialAssignment(name='Initial_Water', instanceList=instList, useFields=False, assignmentList=((rgn1, fract1), )) # Mesh model # a = mdb.models['Model-1'].rootAssembly partInstances =(a.instances['Domain-1'], ) a.seedPartInstance(regions=partInstances, size=0.045, deviationFactor=0.1) a = mdb.models['Model-1'].rootAssembly partInstances =(a.instances['Domain-1'], ) a.generateMesh(regions=partInstances) import job elemType1 = mesh.ElemType(elemCode=EC3D8R, elemLibrary=EXPLICIT) elemType2 = mesh.ElemType(elemCode=UNKNOWN_WEDGE, elemLibrary=EXPLICIT) elemType3 = mesh.ElemType(elemCode=UNKNOWN_TET, elemLibrary=EXPLICIT) a = mdb.models['Model-1'].rootAssembly c1 = a.instances['Domain-1'].cells cells1 = c1.getSequenceFromMask(mask=('[#f ]', ), ) pickedRegions =(cells1, ) a.setElementType(regions=pickedRegions, elemTypes=(elemType1, elemType2, elemType3)) # Insert geostatic stress definition via keywords editor # mdb.models['Model-1'].keywordBlock.synchVersions(storeNodesAndElements=False) mdb.models['Model-1'].keywordBlock.insert(36, """ *Initial Conditions, type=stress, geostatic Water_set,0.0,4.5,-44065.54,0.0,1.0,1.0""") # Rename model # mdb.models.changeKey(fromName='Model-1', toName='WaterColumnCollapse') # Create job and write input file # mdb.Job(name='eulerian_column_model', model='WaterColumnCollapse', type=ANALYSIS, explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, description='Collapse of an Eulerian water column under gravity', parallelizationMethodExplicit=DOMAIN, multiprocessingMode=DEFAULT, numDomains=1, userSubroutine='', numCpus=1, memory=50, memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, scratch='', echoPrint=OFF, modelPrint=OFF, contactPrint=OFF, historyPrint=OFF) mdb.jobs['eulerian_column_model'].writeInput(consistencyChecking=OFF) # Save model # mdb.saveAs('water_column_example')