在 ABAQUS 中使用 findAt 选择多个分区区域以设置网格控制 [英] Selecting multiple partitioned regions in ABAQUS with findAt for setting mesh controls

查看:146
本文介绍了在 ABAQUS 中使用 findAt 选择多个分区区域以设置网格控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考我之前的问题,

更快的分区方法用脚本在 ABAQUS 中面对 Sketch,

我必须选择通过分区方法创建的多个区域来分配网格控件和种子边缘,最后分别对区域进行网格划分.

I have to select the multiple regions created by the partitioning method to assign the mesh controls and seed the edges and finally, mesh the regions respectively.

问题是,由于分区区域是参数化的并且数量如此之多,因此为此目的定义一个函数并在循环中运行它是似乎适合我的唯一方法.因此,我尝试以两种不同的方式定义一个函数,如下所示:

Problem is, since the partitioned regions are parametrised and of such a greater number, defining a function for the purpose and running it in a loop was the only way that seemed fit to me. Hence, I tried to define a function in two different ways like so:

  1. 定义了一个函数来选择区域并在整个身体长度上循环运行.在这里,每个小区域都被选取一次,并且重复应用相同的网格控制,导致生成网格的时间很长.

  1. A function is defined to select the regions and run in a loop throughout the length of the body. Here, each small region is picked once and the same mesh controls are applied repeatedly leading to a long time in generating the mesh.

def set_mesh_control_structured(x_left, x_right, y_top, y_bottom,
    element_type, mesh_technique, minimize_transition):

    p = mdb.models['Model-1'].parts['Part']
    f = p.faces
    pickedRegions = f.findAt(((x_left + (x_right - x_left)/2, y_bottom
        (y_top - y_bottom)/2, 0.0), ))

    return p.setMeshControls(regions=pickedRegions,
        elemShape=element_type, technique=mesh_technique,
        minTransition=minimize_transition)

# Executed within a 'for' loop like e.g.: 
for i in range((8 * total_blocks) + 6):  
    set_mesh_control_structured(x_left, x_right + (i *
    block_length), y_coord[0], 0.0, QUAD, STRUCTURED, OFF)  

  • 第二个函数尝试一个一个选择所有区域,然后在最后只应用一次网格控件.这就是问题蔓延的地方.有人假设 findAt() 的参数是一个元组元组,但它不起作用,ABAQUS 给出一个错误警告说...in set_mesh_control_structured;pickRegions = f.findAt(regions_tuple); TypeError: arg1(coordinates)[0][0];found tuple expecting float".

    def set_mesh_control_structured(range_arg, x_left, x_right, y_top,
        y_bottom, element_type, mesh_technique, minimize_transition):
    
        p = mdb.models['TDCB'].parts['Part_TDCB']
        f = p.faces
    
        regions_tuple = ()
        for i in range(range_arg):
            # Put x,y,z coords in one value
            incremental_picked_regions = (x_left + (i * (x_right - 
                x_left)/2), y_bottom + (i * (y_top - y_bottom)/2), 0.0)
    
            # Abaqus wants each repeating unit as ((x,y,z),)
            incremental_picked_regions = ((incremental_picked_regions),)
    
            # Adding all the coordinates into 1 tuple
            regions_tuple += (incremental_picked_regions,)
    
        pickedRegions = f.findAt(regions_tuple)
        return p.setMeshControls(regions=pickedRegions,
            elemShape=element_type, technique=mesh_technique,
            minTransition=minimize_transition) 
    

  • 谁能告诉我我在第二个函数定义中做错了什么,或者有没有更好的方法来选择多个区域以设置网格控件和除 findAt() 之外的种子?我知道 getBoundingBox 和 faces.index[#] 等,但我不知道如何使用它们.因此,MWE 也将受到高度赞赏.

    Can anyone please tell me what I'm doing wrong in the second function definition or is there a better way to select multiple regions for the purpose of setting mesh controls and seeding apart from findAt()? I am aware of getBoundingBox and faces.index[#] etc. but I have no clue on how to use them. So, a MWE will also be highly appreciated.

    非常感谢.

    推荐答案

    任何想要更好地理解这个问题的人,我首先建议查看我的其他链接问题.

    Anyone looking for a better understanding of this question, I'd first of all, advise to look up on my other linked question.

    我通过使用具有以下语法的 getByBoundingBox 解决了我的这个问题:getByBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax)

    I solved this problem of mine by using getByBoundingBoxwhich has the following syntax: getByBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax)

    因此,可以方便地使用它代替 findAt() 来选择大量分区面或边.

    So, this can be conveniently used instead of findAt() to select a large number of partitioned faces or also edges.

    所以以平面矩形为例,四个角分别为 (0.0, 0.0, 0.0), (2.0, 0.0, 0.0), (2.0, 2.0, 0.0) 和 (0.0, 2.0, 0.0) 让我们假设在这个矩形内有多个分割面,它们都需要像在 GUI 中一样一次选择.首先,getByBoundingBox 的六个参数是:

    So taking a planar rectangle for example, having the four corners as (0.0, 0.0, 0.0), (2.0, 0.0, 0.0), (2.0, 2.0, 0.0) and (0.0, 2.0, 0.0) respectively and let's assume that there are multiple partitioned faces inside this rectangle which all need to be selected at once as one does in the GUI. First, the six arguments of the getByBoundingBox will be:

    xmin = 0.0, 
    ymin = 0.0, 
    zmin = 0.0, 
    xmax = 2.0, 
    ymax = 2.0, 
    zmax = 0.0
    

    然后,只需选择所需的区域,如下所示:

    Then, it's just a matter of picking the desired region as follows:

    pickedRegions = f.getByBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax) 
    

    这篇关于在 ABAQUS 中使用 findAt 选择多个分区区域以设置网格控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆