Writing model data

To define the geometry of your model, you first create the parts that are used by the model and then you add nodes and elements to the parts. You then define the assembly by creating instances of the parts. If the output database already contains results data, you should not change the geometry of the model. This is to ensure that the results remain synchronized with the model.

Part

If the part was created by Abaqus/CAE, the description of the native Abaqus/CAE geometry is stored in the model database, but it is not stored in the output database. A part is stored in an output database as a collection of nodes, elements, surfaces, and sets. You use the Part constructor to add a part to the Odb object. You can specify the type of the part; however, only DEFORMABLE_BODY is currently supported. For example,


  odb_Part& part1 = odb.Part("part-1",
       odb_Enum::THREE_D, odb_Enum::DEFORMABLE_BODY);
 

For a full description of the Part constructor, see OdbPart object. The new Part object is empty and does not contain geometry. After you create the Part object, you then add nodes and elements.

You use the addNodes method to add nodes by defining node labels and coordinates. You can also define an optional node set. For example,


  odb_SequenceInt nodeLabels;
  nodeLabels.append(1);
  nodeLabels.append(2);
  nodeLabels.append(3);
  nodeLabels.append(5);
  nodeLabels.append(7);
  nodeLabels.append(11);
  double c[6][3] = { {2.0, 1.0, 0.0},
		     {1.0, 1.0, 0.0},
		     {1.0, 0.0, 0.0},
		     {2.0, 0.0, 0.0},
		     {1.0, 0.0, 1.0},
		     {2.0, 0.0, 1.0} };
  odb_SequenceSequenceFloat nodeCoor;
  for (int n=0; n<nodeLabels.size(); n++) {    
    odb_SequenceFloat loc;
    for (int i=0; i<3; i++)
      loc.append(c[n][i]);
    nodeCoor.append(loc);
  }
  part1.addNodes(nodeLabels, nodeCoor, "nodes_1");
 

For a full description of the addNodes command, see addNodes(...).

Similarly, you use the addElements method to add elements to the part using a sequence of element labels, element connectivity, and element type. You can also define an optional element set and an optional section category. For example,


  odb_SequenceInt elLabels;
  elLabels.append(9);
  elLabels.append(99);
  odb_SequenceSequenceInt connect;
  const int numNodePerEl = 4;
  int conn[2][numNodePerEl] = {{1, 2, 3, 5},
			       {5, 3, 7, 11}};  
  for (int e=0; e<elLabels.size(); e++) {
    odb_SequenceInt l;
    for (int i=0; i<numNodePerEl; i++)
      l.append(conn[e][i]);
    connect.append(l);
  }
  part1.addElements(elLabels, connect, "S4R",
		    "s4_els", shellCat);
 

For a full description of the addElements command, see addElements(...).

The RootAssembly object

The root assembly is created when you create the output database. You access the RootAssembly object using the same syntax as that used for reading from an output database.

    odb_Assembly& rootAssy = odb.rootAssembly();
 

You can create both instances and regions on the RootAssembly object.

Part instances

You use the Instance constructor to create part instances of the parts you have already defined using the Part constructor. For example,


  odb_Instance& instanceA =
    odb.rootAssembly().Instance("part-1-1", part1);
 

You can also supply an optional local coordinate system that specifies the rotation and translation of the part instance. You can add nodes and elements only to a part; you cannot add elements and nodes to a part instance. As a result, you should create the nodes and elements that define the geometry of a part before you instance the part. For a full description of the Instance command, see OdbInstance object.

Regions

Region commands are used to create sets from element labels, node labels, and element faces. You can create a set on a part, part instance, or the root assembly. Node and element labels are unique within an instance but not within the assembly. As a result, a set on the root assembly requires the names of the part instances associated with the nodes and elements. You can also use region commands to create surfaces.

For example,


  // An ElementSet on an instance  
  odb_SequenceInt eLabelsA(2);
  eLabelsA.append(9);
  eLabelsA.append(99);
  instanceA.ElementSet("elSetA", eLabelsA);
  
  // A NodeSet on the rootAssembly

  odb_SequenceSequenceInt nodeLabelsRA;
  odb_SequenceString namesRA;
  namesRA.append("part-1-1");
  odb_SequenceInt nodeLabelsRA_A;
  nodeLabelsRA_A.append(5);
  nodeLabelsRA_A.append(11);
  nodeLabelsRA.append(nodeLabelsRA_A);
  const odb_Set& nSetRA = rootAssy.NodeSet("nodeSetRA",
					   namesRA, nodeLabelsRA);  
 
Materials

You use the Material object to list material properties. Material objects are members of the Odb object.

Materials are stored in the materials repository under the Odb object.

Extend the Material commands available to the Odb object using the following statement:

   odb_MaterialApi materialApi;
    odb.extendApi(odb_Enum::odb_MATERIAL,materialApi); 

To create an isotropic elastic material, with a Young's modulus of 12000.0 and an effective Poisson's ratio of 0.3 in the output database:

    odb_String materialName("Elastic Material");
    odb_Material& material = materialApi.Material(materialName);
    odb_SequenceSequenceFloat myTable;
    odb_SequenceFloat myData;
    myData.append(12000.0); myData.append(0.3);
    myTable.append(myData);
    odb_String type("ISOTROPIC");
    material.Elastic(myTable,type);       

For more information, see Material commands.

Sections

You use the Section object to create sections and profiles. Section objects are members of the Odb object.

Sections are stored in the sections repository under the Odb object.

Extend the API commands available to the Odb object using the following statement:

    odb_SectionApi sectionApi;
    odb.extendApi(odb_Enum::odb_SECTION, 
                  sectionApi);

The following code creates a homogeneous solid section object. A Material object must be present before creating a Section object. An exception is thrown if the material does not exist.

odb_String sectionName("Homogeneous Solid Section");
float thickness = 2.0;
odb_HomogeneousSolidSection& mySection = 
    sectionApi.HomogeneousSolidSection( sectionName, 
                                            materialName, 
                                            thickness);

To create a circular beam profile object in the output database:

    odb_String profileName("Circular Profile");
    float radius = 10.00;
    sectionApi.CircularProfile(profileName, radius);
Section assignments

You use the SectionAssignment object to assign sections and their associated material properties to regions of the model. SectionAssignment objects are members of the Odb object. For a full description of the assignSection method, see assignSection(...).

All Elements in an Abaqus analysis need to be associated with section and material properties. Section assignments provide the relationship between elements in an Instance object and their section properties. The section properties include the associated material name. To create an element set and assign a section:

odb_SequenceInt setLabels; 
setLabels.append(1);
setLabels.append(2);
elsetName = "Material 1";
odb_Set& elset = instance.ElementSet(elsetName,setLabels);
// section assignment on instance
instance.assignSection(elset,section);