2

This may sound more like a rant to some extent, but I also would like to have your opinion on how to deal with the inconsistencies when using python scripting in abaqus. here my example: in my rootAssembly (ra) I have three instances called a, b, c. in the script below I assign general seed, then mesh control, and element types, finally I generate the mesh:

ra.seedPartInstance(regions=(a,b,c), size=1.0)

ra.setMeshControls(elemShape=QUAD,
    regions=(a.faces+b.faces+c.faces),
    technique=STRUCTURED)

ra.setElementType(
    elemTypes=eltyp, 
    regions=(a.faces,b.faces,c.faces))

ra.generateMesh(regions=(a,b,c))

As you can see, ABAQUS requires you to define the same region in several different modes. Even though the argument is called "regions", ABAQUS either asks for a Set, or a Vertex, or a GeomSequence.

how do you deal with this? scripting feels a lot like trial and error, as there is no way to know in advance what is expected. any suggestions?

houman.sanati
  • 1,054
  • 3
  • 18
  • 34
Francesco
  • 21
  • 2

2 Answers2

0

Yes, there is clearly "a way to know in advance what is expected" - the docs. These spell out exactly what arguments are allowed.

But seriously - I see no inconsistency in your example. In practice, the reuse of the argument regions makes complete sense when you consider the context for what each of the functions actually do. Consider how the word "region" is a useful conceptual framework that can be adapted to easily allow the user to specify the necessary info for a variety of different tasks.

Now consider the complexity of the underlying system that the Python API exposes, and the variety of tasks that different users want to control and do with that underlying system. I doubt it would be simpler if the args were named something like seq_of_geomCells_geomFaces_or_geomSets. Or even worse, if there were a different argument for each allowable model entity that the function was designed to handle - that would be a nightmare. In this respect, the reuse of the keyword regions as a logical conceptual framework makes complete sense.

Matt P
  • 2,287
  • 1
  • 11
  • 26
0

ok, i read now from the documentation of the three commands used above:

seedPartInstance(...)

regions: A sequence of PartInstance objects specifying the part instances to seed.

setMeshControls(...)

regions: A sequence of Face or Cell regions specifying the regions for which to set the mesh control parameters.

setElementType(...)

regions: A sequence of Geometry regions or MeshElement objects, or a Set object containing either geometry regions or elements, specifying the regions to which element types are to be assigned.

ok, i get the difference between partInstances and faces, but still it's not extremely clear why one is appended (using commas) and the other is added (using +), since they both call for a Sequence, and at this point, how does setElementType even works when passing faces objects to it?

I will take some more time to learn ABAQUS and to think through it, hopefully i can understand truly these differences.

Francesco
  • 21
  • 2