[Python] How to Apply Meshing to a Custom Abaqus Model Script?

Discussão em 'Python' iniciado por Stack, Janeiro 30, 2025.

  1. Stack

    Stack Membro Participativo

    I have written a custom Abaqus Python script that defines a pier structure consisting of a beam, column, and base using solid extrusions. The script successfully creates these parts, but I am unsure how to properly apply meshing to them.

    Below is a simplified version of how the beam is created:

    def create_beam(model, beam_length, beam_width, beam_height):
    beam_sketch = model.ConstrainedSketch(name='BeamSketch', sheetSize=50.0)
    beam_sketch.rectangle(point1=(0.0, 0.0), point2=(beam_length, beam_width))
    beam_part = model.Part(name='Beam', dimensionality=THREE_D, type=DEFORMABLE_BODY)
    beam_part.BaseSolidExtrude(sketch=beam_sketch, depth=beam_height)
    return beam_part


    I want to apply meshing to each part, ensuring proper element type selection and mesh controls for accurate simulation results.

    The script follows these structured steps:


    1. Import required Abaqus modules


    2. Define key geometric parameters


    3. Create the model and assign it a name ('PierModel')


    4. Generate parts (beam, columns, and bases) using dedicated functions


    5. Assemble the pier by positioning the components


    6. Apply meshing to all parts (This is the area where I need help)
    Key Parameters in the Script


    beam_length = 24.0 # Length of the
    beam beam_height = 5.0 # Height of the beam
    beam_width = 6.0 # Width of the beam column_radius = 2.0 # Radius of each column
    column_height = 20.0# Height of each column base_length = 8.0 # Length of each base
    base_width = 4.0 # Width of each base
    base_height = 4.0 # Height of each base


    The model follows standard Abaqus part creation and assembly techniques. Below is a breakdown of each function.

    Step-by-Step Breakdown of the Code

    1. Creating the Beam


    The beam is created using a rectangular sketch and extruded to its height.

    def create_beam(model, beam_length, beam_width, beam_height): beam_sketch = model.ConstrainedSketch(name='BeamSketch', sheetSize=50.0) beam_sketch.rectangle(point1=(0.0, 0.0), point2=(beam_length, beam_width)) beam_part = model.Part(name='Beam', dimensionality=THREE_D, type=DEFORMABLE_BODY) beam_part.BaseSolidExtrude(sketch=beam_sketch, depth=beam_height) return beam_part


    Question: What is the best meshing strategy for a rectangular solid beam to ensure accurate structural analysis?

    2. Creating the Columns


    The columns are cylindrical and are created using a circle sketch that is extruded.

    def create_column(model, column_radius, column_height): column_sketch = model.ConstrainedSketch(name='ColumnSketch', sheetSize=50.0) column_sketch.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(column_radius, 0.0)) column_part = model.Part(name='Column', dimensionality=THREE_D, type=DEFORMABLE_BODY) column_part.BaseSolidExtrude(sketch=column_sketch, depth=column_height) return column_part


    Question: Should I use tetrahedral or hexahedral elements for meshing cylindrical columns? How can I ensure a uniform mesh distribution for accurate results?

    3. Creating the Base


    The base is another rectangular solid that serves as the foundation of the structure.

    def create_base(model, base_length, base_width, base_height): base_sketch = model.ConstrainedSketch(name='BaseSketch', sheetSize=50.0) base_sketch.rectangle(point1=(0.0, 0.0), point2=(base_length, base_width)) base_part = model.Part(name='Base', dimensionality=THREE_D, type=DEFORMABLE_BODY) base_part.BaseSolidExtrude(sketch=base_sketch, depth=base_height) return base_part


    Question: What meshing approach should be used for rectangular bases to ensure stability under loading?

    4. Assembling the Pier Components


    The parts are then positioned and assembled correctly.

    def assemble_pier(model, beam, columns, bases): assembly = model.rootAssembly assembly.DatumCsysByDefault(CARTESIAN) # Create instances beam_instance = assembly.Instance(name='Beam-1', part=beam, dependent=ON) column_instance_1 = assembly.Instance(name='Column-1', part=columns, dependent=ON) column_instance_2 = assembly.Instance(name='Column-2', part=columns, dependent=ON) base_instance_1 = assembly.Instance(name='Base-1', part=bases, dependent=ON) base_instance_2 = assembly.Instance(name='Base-2', part=bases, dependent=ON) # Position columns column_instance_1.translate(vector=(5, 0, 0)) column_instance_2.translate(vector=(19, 0, 0)) # Position beam beam_instance.translate(vector=(0, 0, column_height)) # Position bases base_instance_1.translate(vector=(5, 0, -base_height)) base_instance_2.translate(vector=(19, 0, -base_height)) return assembly


    Question: Do I need to apply tie constraints between the components to ensure correct load transfer?

    Current Meshing Implementation


    Here is how I am currently attempting to apply meshing:

    def mesh_parts(model, beam, columns, bases, mesh_size=1.0): for part in [beam, columns, bases]: part.seedPart(size=mesh_size, deviationFactor=0.1, minSizeFactor=0.1) part.setMeshControls(regions=part.cells, elemShape=TET, technique=FREE) part.generateMesh()


    Problems with Current Meshing:


    1. Mesh Control Strategy: I'm using TET elements with the FREE technique, but I’m unsure if this is the best approach.


    2. Hex vs. Tet Elements: Should I attempt structured meshing for the beam and bases?


    3. Column Meshing: Since the column is cylindrical, should I use swept meshing instead of free meshing?


    4. Mesh Size Optimization: Is mesh_size=1.0 too coarse or too fine for this type of structure?

    What I Have Tried:

    I attempted to use seedPart() and generateMesh(), but I'm unsure about the best settings for element size and type.

    I tried applying structured meshing using setMeshControls(), but I'm not confident in how to set up the mesh correctly for cylindrical and rectangular solids. Pier Model Unmeshed

    What I Need Help With:

    • How should I define meshing settings for both rectangular and cylindrical solids?
    • What is the best way to specify element type for structural analysis?
    • Are there specific mesh control strategies recommended for beams and columns?
    • Any guidance or example code for correctly meshing my beam, column, and base in Abaqus Python scripting would be greatly appreciated!
    • I would appreciate expert guidance on the best meshing strategies for my bridge pier model in Abaqus. Any insights on element type selection, mesh refinement techniques, or alternative approaches would be incredibly valuable.

    Continue reading...

Compartilhe esta Página