Download Abaqus: Creating Sphere, Defining Material, and Running Dynamic Simulation and more Study notes History in PDF only on Docsity!
EN234: Computational methods in Structural and Solid Mechanics
EN234 ABAQUS TUTORIAL
School of Engineering Brown University
This tutorial will take you all the steps required to (1) Set up and run a basic ABAQUS simulation using ABAQUS/CAE and to visualize the results; (2) Read an output database with python; and (3) Automate a parameter study with a python script. (4) Run an abaqus simulation with a user material subroutine
Preamble : To understand the problem we will set up, read through the first 2015 ABAQUS homework assignment. This tutorial solves the FEA analysis part of the assignment.
- Open ABAQUS/CAE (you will find a link on the Start menu). From the ‘Start session’ menu select ‘Create Model Database’ with Standard/Explicit Model
- To set up and run a simulation in CAE, you can either work through the various ‘Modules’ in the dropdown menu at the top of the screen, or you can click on the menus in the workflow tree on the left hand side of the screen. We will do the former in this tutorial.
- The ‘Part’ module is used to define the geometry of the various interacting solids in the simulation. Here, we will create the elastomeric film and the rigid cylinder as two separate parts. Start by creating the sphere: a. Select Part>Create from the top menu bar, then use the menu that comes up to name the part ‘Sphere;’ select ‘Axisymmetric’ and ‘Discrete Rigid’ for the Modeling Space and Type, and enter an Approximate Size of 0.75. (you can try ‘Analytical Rigid’ as well if you like, but ABAQUS will sometimes throw an error when you try to make a semicircle with this option) b. Use the sketch tools from the left to draw a semicircle, centered at (0,0.05), with a radius of 0. c. To exit the sketch menu, click the circle sketch tool to unselect it (or you can click the sketch window with both mouse buttons and select ‘cancel procedure’), then select ‘Done’ from the menu below.
Rigid surfaces need a ‘reference point’ that can be used to define the motion of the part, or forces acting on the part. To add a reference point to the cylinder Select ‘Tools>Reference Point’ in the Part module, and select the point at the center of the sphere.
Next, create the film: a. Select Part>Create; name the part ‘Film’, and select ‘Axisymmetric’ and ‘Deformable;’ b. Draw a rectangle – the exact dimensions are not important, but place the top left corner of the rectangle at the origin. Exit the sketch menu.
If you need to make any changes to the parts, you can do so using the Model Database tree on the left- you can expand the various options and edit them as needed.
- Next, we will define material properties, and assign them to the parts. a. Switch the ‘Module’ to ‘Property’ b. To create a hyperelastic material, select Material>Create c. Change the name of the material to ‘Hyperelastic’. To define properties, Select ‘General’ on the popup window, and enter a density value of 1. d. Next select the Mechanical>Elastic>Hyperelastic. In the menu that comes up select ‘Neo Hooke’ for the strain energy potential, click the ‘Coefficients’ radio button, and enter a value of 1.0 for C10. Leave the D field blank – if you do this, ABAQUS will assign an internal value that makes the material approximately incompressible. e. Next, you have to create a ‘section.’ This makes more sense for parts like beams or truss elements, where you need to define the geometry of the cross section, but you have to do it even for a 3D part. Select Section> Create, then select Homogeneous Solid section from the menu, set the options in the Edit Section menu as shown, then check that press OK from the menu shown f. Switch the ‘Part’ to Film, then select Assign>Section. Click on the rectangular film to select it (it should turn pink), then select ‘Done’ from the bottom of the window. This has now assigned the hyperelastic material model to the part representing the film. If you want to make a part heterogeneous, you can partition it, and assign different properties to the different partition. g. Next, create the inertial properties of the rigid sphere. Switch the ‘Part’ to Sphere, then select Special> Inertial Properties. h. On the popup window rename the property to Sphere-Inertia, then select Point mass/inertia, then press Continue i. Select the reference point in the sketch window. j. On the menu that comes up, enter a mass of 0.2 units. The inertia can be left blank, since the axisymmetric boundary condition does not allow the sphere to rotate.
- Now we create an assembly of the parts. a. Switch the ‘Module’ to Assembly b. Select Instance>Create c. On the menu select the Sphere; check the ‘Independent’ radio button, make sure the ‘auto offset’ is unchecked, then press OK d. Repeat b-c to create an instance of the film. You should end up with the window shown below.
- Save the model database to a file named Sphere-Film-Impact.cae
- Next, we set up the properties of the contact between the sphere and the film. Select the ‘Interaction’ module to start a. First, define the properties of the contact. Select Interaction>Property>Create b. Name the property Hard-frictionless and select the Contact option, then press continue c. Select the Mechanical > Normal Behavior option and accept the defaults; d. Select the Mechanical > Tangential Behavior; check that the friction formulation says Frictionless, then press OK e. Next, specify the two surfaces that will contact: select Interaction>Create f. Name the interaction Sphere-Film-Interaction and apply it to the Impact step g. Select the Surface-to-surface contact option; press Continue h. Click the outline of the sphere in the window to select it, press Done, then select color of the arrow pointing towards the outer surface of the sphere (ABAQUS needs to know whether the contact will occur from inside the sphere or the outside) i. For the second surface, select the Surface option, then click the surface of the film, then press Done j. In the ‘Edit Interaction menu, check that ‘Finite Sliding’ is selected, the interaction property should be Hard-Frictionless. You can accept defaults for the other options. Press OK. You should see the interacting surfaces marked with small rectangles in the window Now that the interaction has been created, we can configure CAE to save results associated with the contact to the output database. To do this, return to the ‘step’ module (i.e. part 7 above), then k. select Output>History Output Requests>Create l. Name the history request Contact-Force, and apply it to the Impact step m. Select ‘Interaction’ for the domain dropdown menu; select ‘Every n time increments’ and set n=5 for the Frequency, and then activate the total forces due to contact pressure and the total contact area (see the figure)
- Next, we specify boundary conditions and initial conditions for the analysis. Switch to the ‘Load’ module. a. To enforce the axial symmetry boundary condition for the film, select BC>Create; then in the Create Boundary Condition menu, name the boundary condition Film-Axial-Sym; select the initial step; the Mechanical category, and the Symmetry/Antisymmetry/Encastre type; then press Continue. b. Select the leftmost side of the rectangular film c. Select the XSYMM option, and press OK (note that the UR2 and UR3 degrees of freedom are not active for the film, even though they show up in the menu) d. To constrain the vertical velocity of the base of the film, select BC>Create; in the Create Boundary Condition menu name the boundary condition Film-Base; select the Initial step; select Displacement/Rotation, and press Continue e. Select the base of the film and press Done f. In the Edit Boundary Condition menu select U2 and press OK g. To enforce the axial symmetry boundary condition for the sphere, select BC>Create h. Name the boundary condition Sphere-Axial_Sym; select the Initial step, the Mechanical category and Symmetry/Antisymmetry/Encastre and press Continue i. Select the reference point (RP) on the sphere and press Done
j. Select XSYMM on the Edit Boundary Condition menu and press OK k. To specify the initial downward velocity of the sphere, Predefined Field>Create l. Name the field Initial-Vel-Sphere; select the Initial step, the Mechanical category and the Velocity type. Press Continue m. Select the reference point (RP) on the sphere n. Enter -0.05 in the V2 box on the Edit Boundary Condition menu, and leave the V1 box blank. Press OK.
- The analysis will need a finite element mesh (the film must be meshed; and if the sphere is a Discrete Rigid surface, it must also be meshed. It is not necessary to mesh an Analytical Rigid Surface). Select the Mesh module a. Start by meshing the film. To specify the element type that will be used in the analysis, select Mesh > Element Type; then click on the film, and select Done. b. In the Element Type menu, select the Explicit element library, and select the default settings c. To specify the mesh generation algorithm that will be used, select Mesh > Controls; then click on the film, and select Done. d. In the Mesh Controls option select Quad for the element shape, and the Medial Axis algorithm, and press OK. You may need to press Done in the assembly window again to exit the mesh controls menu e. To specify the element size to be used, select Seed>Instance, then select the film, and press Done. f. In the Global Seeds menu enter 0.0025 for the mesh size, and press OK. Press Done in the assembly window to exit the Seed definition. g. Finally, to mesh the film, select Mesh>Instance, select the film, and enter Done h. If the sphere is a Discrete Rigid part, it will also need to be meshed. To specify the mesh size, select Seed>Instance, then select the sphere. i. In the Global Seeds menu enter 0.0025 for the mesh size, and press OK. Press Done in the assembly window.
don’t see the variable you want to plot that usually means ABAQUS did not save it to the odb. To get it, you will need to go back to the Step menu, and use the Output> menu to add the variable you are interested in. The analysis will need to be re-run. f. You can change the way the contour plots look by using the Options>Common menu, or Options>Contour. g. Some additional features of the viewport can be controlled using the Viewport>Viewport Annotation Options. h. You often want to change the background of the viewport to save plots for reports – you can do this using the View>Graphics Options menu i. ABAQUS can also plot graphs showing spatial or temporal variation of quantities of interest. For example, to plot the contact force acting between the sphere and the film as a function of time, you can use Result>History Output… and then select Total force due to contact pressure: CFN2 ASSEMBLY_M_SURF-1/ASSEMBLY_S_SURF-1 (you can select either of the CFN variables – one is the force on the sphere; the other is the force on the film. j. ABAQUS/CAE also allows you to post-process data. For example, you can save the contact force history to a dataset using Tools>XY Data>Create; then select Odb history from the XY Data menu. To change the data, you can use Tools>XY Data> Create, then select Operate on XY data. The menu that opens allows you to enter formulas that create new XY datasets by modifying existing ones. In practice it’s usually easier to post-process odb data by writing a python script that will read and modify data extracted from an odb, however. k. Similarly, you can plot the velocity or displacement of the center of the sphere, by using Result>History Output, and then select Spatial velocity: V2 Pl: SPHERE-1 Node nn in NSET SPHERE-REF-POINT’; then press plot l. The visualization module has many other features; if you have time, the best way to learn them is just to explore all the various options and see what happens.
Using Python to read and process data from an output database
Python can automate many ABAQUS pre-and post-processing operations. There are several ways to start the ABAQUS python scripting environment. You can run it from the ABAQUS command menu (you can find it in the Start menu). Open the start menu, then change the directory to the ABAQUS working directory (use the DOS cd command). Check that you can see the impact_simulation.odb file. You can start ABAQUS python with either of the following commands:
- abaqus python is the standard way, and does not require a license token, but only allows you to access a basic set of python modules
- abaqus viewer –noGUI will allow you to load modules needed to process an odb
- abaqus cae –noGUI will allow you to execute any ABAQUS/CAE operation – from model definition to postprocessing – through python
Try abaqus viewer –noGUI now (if the command doesn’t work, check the path environment variable for your PC) You are now in the python interpreter of ABAQUS. You can load the odb as follows: >>> from odbAccess import openOdb >>>odb = openOdb(‘Impact-Simulation.odb’) You can examine the top-level contents of the odb with >>>dir(odb) and you can use the python ‘print’ command to look at the odb in more detail. Try the following: >>> print odb.jobData >>> print odb.steps >>> print odb.steps[‘Impact’] >>> print odb.steps[‘Impact’].timePeriod
As you can see, the python interpreter can access just about everything about an ABAQUS simulation (but it is not easy to figure out exactly how variables you might be interested in have been labeled, and the manuals
- at least those that I can get to work, which are only for old ABAQUS versions - are virtually useless)
A useful operation for accessing history variables is >>> step1 = odb.steps[‘Impact’] >>> print step1.historyRegions.keys() This tells you the names that ABAQUS has assigned to any node or element sets you used in history output requests. The ‘node’ (which is probably named SPHERE-1. nn where nn is a number) is the reference node for the sphere.
To see what data are available for this node, you can use >>> region = step1.historyRegions[‘Node SPHERE-1. nn ’] (use the name of the reference node in the previous step) >>> print region.historyOutputs.keys() This tells you the variable names that were requested when the Step was defined in ABAQUS/CAE
To extract the data, you can use >>> u2data = region.historyOutputs[‘U2’].data >>> print u2data
You can then use most python commands to operate on the data (but ABAQUS is often using old versions of python, and also doesn’t have python packages like Numpy installed)
You can cut and paste the script below (or download a file from the EN234website) into a text file named impact_parameter_study.py You can run it in an ABAQUS command window with abaqus cae –noGUI impact_parameter_study.py
Python script to run parametric study
Run this from an abaqus command window with abaqus cae -noGUI impact_parameter_study.py
Make sure that the cae model database file is in the ABAQUS working directory
from abaqus import * from abaqusConstants import * from caeModules import * from odbAccess import * import sys openMdb('Sphere-film-impact.cae')
Sphere radius, film shear modulus, and impact velocity
We could read these from the mdb as well, of course, but simpler to hard code
R = 0. mu = 1 V0 = 0. minmass = 0. maxmass = 0. nmasses = 6
paramvals = [] tcvals = [] fmaxvals = []
Loop over different values of sphere mass
for i in range (0,nmasses): m = minmass + (maxmass-minmass)i/(nmasses-1) dimGroup = muR3/(mV0*2) paramvals.append(dimGroup) mdb.models['Model-1'].parts['Sphere'].engineeringFeatures.inertias['Inertia-1'].setValues( mass=m) thisJob = mdb.jobs['Impact-Simulation'] thisJob.submit(consistencyChecking=OFF) thisJob.waitForCompletion() odb = openOdb('Impact-Simulation.odb')
Extract the acceleration-time data for the sphere. You may need to change the name of the node
step1 = odb.steps['Impact'] region = step1.historyRegions['Node SPHERE-1.65'] acceldata = region.historyOutputs['A2'].data nn = len(acceldata)
Find the contact time by searching the accels from the end backwards to find the first nonzero
value for n in reversed(xrange(nn)): if (acceldata[n][1]>0.000001): tcontact = acceldata[n][0] break
Find the max contact force as the max value of mass*acceleration
maxforce = m*max([aval[1] for aval in acceldata])
Store data for printing later
tcvals.append(tcontactV0/R) fmaxvals.append(maxforce/(muR**2)) odb.close()
resultsFile = open('contactData.csv','w') for i in range(0, nmasses): resultsFile.write('%10.4E,%10.4E,%10.4E\n'% (paramvals[i],tcvals[i],fmaxvals[i])) resultsFile.close()
Running ABAQUS with a user-material subroutine
Several of the EN234 assignments will involve writing user-element subroutines or user-material subroutines for ABAQUS. Here we will run through the steps involved in running ABAQUS with a user-material subroutine.
The first test we usually run on a user-material subroutine is to stretch a single element and plot the uniaxial stress-strain curve (which can be compared with the exact solution).
Start by downloading the source code for the user material from the Programming page of the course website. Save it in the ABAQUS working directory in a file named usermat.for (you can open it with intel visual fortran or a text editor if you are curious, but we will just run it as-is for now)
If you have installed ABAQUS and visual fortran on your own computer, you will also need to download a batch script that will start ABAQUS with user subroutines. Save this file as abaqus_usersub.bat. You may need to edit the file paths in the batch script to get the script to work with your ABAQUS installation. To do this, right click the .bat file and select edit, then search your computer to find the correct directory to replace IntelSWTools\compilers_and_libraries_2017.4.210\windows\bin\compilervars.bat (you usually only need to change the 2017.4.210 to the appropriate version of the compiler). Check also that there is a file called C:\SIMULIA\Commands\abaqus.bat (this works with the default installation of ABAQUS 2017, but earlier versions may use a different file path)
- Use ABAQUS/CAE to create a part that is a solid 3D cube (the dimensions are not important)
- To define the properties of the user material, go to the Material module, then create a material, then select General>User Material in the Edit Material menu. The properties you enter in the GUI are passed to the user material subroutine as a list of numbers – it is up to you to figure out what to do with them. The sample user material code provided expects two numbers, defining the Young’s modulus and Poisson’s ratio for a linear elastic material. Enter 1000 and 0.
- Create a section with the user material property, and assign it to the cube
- In the Assembly module, create an instance of the cube
- Create a General Static step with time period 1 and NLGEOM off. In the Incrementation tab of the Edit Step menu, select a Fixed increment size, and enter an increment size of 0.
- In the Step module, use Tools > Set > Create to create an element set named Element-for-plotting that contains the element in the cube (check the Element radio button in the create step menu, and just click on the cube to select the element)
- Use Output>History Output Requests> Create to create a history output request. In the Edit History Output Request menu select Set for the domain, and select Element-for-plotting for the set. Select Every n increments for the frequency with n=1, and check the Stresses and Strains tabs in the Output Variables menu.
- In the Load module, define boundary conditions that will subject the cube to prescribed displacements that will induce a state of uniaxial tension in the cube (there is more than one way to do this – any method is fine).
- Generate a mesh consisting of a single fully integrated (uncheck the reduced integration box) linear hexahedral element that fills the cube.
- Create a job called User-Material-Test with all the defaults.
- Instead of submitting the job, run Job>Write Input
- Navigate to the Abaqus working directory – you should see a file called User-Material-Test.inp. You can open this file with a text editor; you should see that a user-material is defined in the file. It is sometimes necessary to edit this file (eg to add user elements to the analysis) but for this test it will run as is.
- To run the analysis, use one of the following methods.