# Add a 3D convex hull in ABAQUS

Convex hull is the smallest envelope that contains the points set. It is used to construct the grain in grain-based model. There are several methods to generate the convex hull data, but it may need some efforts if you want to put it into ABAQUS model. Here, I post a simple method which is suitable for programming.

### Generate convex hull data

Several methods can be used to generate the convex hull data. I am used to generate the convex hull data with my own code. But if you do not like write code, you can use Mathematica or Matlab to generate the data.

For example, in Mathematica, you can use following code to generate a 3D convex hull:

pts = RandomReal[{-1, 1}, {20, 3}];
ConvexHullMesh[pts] Then, you need do some extra work to get the detail of this convex hull.  To generate the convex hull in ABAQUS, you need to save the points, edges and faces information to file.

### Generate convex hull in ABAQUS

Unlike Ansys, it is hard to manipulate the points and lines in ABAQUS. Here is a simple method to generate a polyhedron in ABAQUS with GUI.

First, you need to create a part with reference point: No position requirement for the reference point, I just create it at $(0.0,0.0,0.0)$, and then Suppress it: I just need a blank part, but you cannot create a part without setting geometry in it. Now,  let us create some Datum points in this blank part: Click Menu bar: Shape->Wire->Point to Point, and add the first Chained wires:  Click “OK” and repeat this process until build the frame model: Click Menu bar: Tools->Geometry Edit…, and in Geometry Edit box, Click Face->Cover edges. Select the edges and click “Done”: Repeat until generate all faces. Now, we should turn these faces into a solid model. Click Menu bar: Shape->Solid->From Shell. Select all faces and press “Done” to generate the solid model: It’s done! In next section, I will use a real convex hull to generate this solid model with python script.

### Python script to generate

As we known, we can use python script to do everything in ABAQUS. But it is much difficult to generate this convex hull without some human recognition in model building process.

The example is a Gmsh model, you can download (BR75e6.geo) and open it with Gmsh: This model is generated by Voronoi algorithm, and formatted into a Gmat file. Before we start, you should note that ABAQUS will change the line featureName and index in entire process. Normally, we could get the Lineloop from convex hull data or Gmsh data. For example:

Lineloop(1) = {1, 2, 3, 4, 5} That means the first face is constructed by 5 lines. So, if we know the lines number, we could mark these lines and use them to generate the face. But how to mark these lines in ABAQUS is a big problem. At the beginning, I generate all lines in ABAQUS and use their featureName which is one of the members of Edge object to mark them, Such as “Wire-3”->3. But, when the first face is generate, the featureName of “Wire-3” is turned into “Cover edges-1”. So I use another member variable: pointOn to mark these lines.

Now let us try to turn it into a python script. The following figure shows the basic idea: Here is the python script (RH74T3.py) to turn a convex hull into a solid model in ABAQUS. Note that this python script is generated by C++, but it provides a basic approach to generate the convex hull automatically. Gmsh could generate the ABAQUS inp file or step file if you have a geo file. But if you want to control the model precisely, such as grain-based model, you need this method to generate your own model.

## 2 Replies to “Add a 3D convex hull in ABAQUS”

1. chris says: Reply

thanks for explanation. I have one question, how do you get all the points and their connectivity. Is there some good way to do it? Thanks!

1. DPZhu says: Reply

You can use Python or Mathematica to construct the convex hull. Scipy provides the function “ConvexHull” to construct the convex. If you use the Mathematica, save all the geometry data into a database first and then use python to build the model in ABAQUS.