Abaqus光滑曲面、光滑表面建模,光顺操作

————————————————————抛出问题———————————————————

大家在使用ABAQUS进行参数化建模时,肯定会使用到如下三个关键命令:

wire = part.WirePolyLine(mergeType=SEPARATE, meshable=ON,
                                     points=(A, B, A))
face_edge = part.getFeatureEdges(name=wire.name)
part.CoverEdges(edgeList=face_edge, tryAnalytical=True)
wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

这样的命令可以生成类似下图所示的粗糙表面:

这样的表面不具备观赏性,我们通常需要对其进行光滑处理。

————————————————————解决步骤———————————————————

下面是处理的步骤:

(1)点击Part模块的修复工具;

(2)选中face面操作,选择replace替换工具;

 (3)选中需要光顺的面;

 (4)单击鼠标中键,即可得到光滑后的表面。


更新,1/7/2024。最近有很多朋友私信需要这个表面在abaqus中的建模脚本,我就不一一回复了,直接在文章后面附上吧,如下:

# -*- coding:utf-8 -*-
# @FileName    :csdn.py
# @Time        :1/7/2024
# @Author      :Louis

import numpy as np
from abaqus import *
from abaqusConstants import *


def island_3D(kk, thegma_2, Hurst):
    """
    :param kk: Number of iterations
    :param thegma_2: Variance at iteration
    :param Hurst: Hurst index
    :return: X, Y, Z For drawing in matplotlib
    """
    n = 2
    Z = np.random.normal(loc=0, scale=(thegma_2) ** 0.5, size=(2, 2))
    for row in range(n):
        for col in range(n):
            if Z[row, col] < 0:
                Z[row, col] = 0
            elif Z[row, col] > 0.3:
                Z[row, col] = 0.3
    # iteration
    for k in range(1, kk + 1):
        n = 2 ** k + 1
        Z_1 = np.zeros((n, n))
        for row in range(n):
            for col in range(n):
                if row % 2 == 0 and col % 2 == 0:
                    Z_1[row, col] = Z[int(row / 2.0), int(col / 2.0)]
                elif row % 2 == 0:
                    # col is odd and row is even.
                    average_col = (Z[int(row / 2.0), int(col / 2.0)] + Z[
                        int(row / 2.0), int(col / 2.0) + 1]) / 2.0
                    a = average_col + np.random.normal(loc=0,
                                                       scale=(
                        thegma_2 * (1 / 2.0) ** (2 * Hurst * k)) ** 0.5
                                                       )
                    if a >= 0:
                        Z_1[row, col] = a
                    else:
                        Z_1[row, col] = 0
                elif col % 2 == 0:
                    # row is odd and col is even.
                    average_col = (Z[int(row / 2.0) + 1, int(col / 2.0)] + Z[
                        int(row / 2.0), int(col / 2.0)]) / 2.0
                    a = average_col + np.random.normal(loc=0,
                                                       scale=(
                        thegma_2 * (1 / 2.0) ** (2.0 * Hurst * k)) ** 0.5
                                                       )
                    if a >= 0:
                        Z_1[row, col] = a
                    else:
                        Z_1[row, col] = 0
                else:
                    average_col = (Z[int(row / 2.0), int(col / 2.0)] + Z[
                        int(row / 2.0), int(col / 2.0) + 1] +
                                   Z[int(row / 2.0) + 1, int(col / 2.0)] + Z[
                                       int(row / 2.0) + 1, int(
                                           col / 2.0) + 1]) / 4.0
                    a = average_col + np.random.normal(loc=0,
                                                       scale=(
                        thegma_2 * (1 / 2.0) ** (Hurst * (2 * k - 1))) ** 0.5
                                                       )
                    if a >= 0:
                        Z_1[row, col] = a
                    else:
                        Z_1[row, col] = 0
        Z = Z_1
    x = np.linspace(0, 1, n)
    X, Y = np.meshgrid(x, x)
    return X, Y, Z


def Creat_Surface_in_Abaqus(X, Y, Z):
    """
    :param X: (width, length)
    :param Y: (width, length)
    :param Z: (width, length)
    :return: None
    """
    myMdb = Mdb()
    part = mdb.models['Model-1'].Part(name="Surface", dimensionality=THREE_D,
                                      type=DEFORMABLE_BODY)
    # create surface
    length, width = X.shape[1], X.shape[0]
    for i in range(width - 1):
        for j in range(length - 1):
            A = (X[i, j], Y[i, j], Z[i, j])
            B = (X[i + 1, j], Y[i + 1, j], Z[i + 1, j])
            C = (X[i + 1, j + 1], Y[i + 1, j + 1], Z[i + 1, j + 1])
            D = (X[i, j + 1], Y[i, j + 1], Z[i, j + 1])
            wire = part.WirePolyLine(mergeType=SEPARATE, meshable=ON,
                                     points=(A, B, C, D, A))
            face_edge = part.getFeatureEdges(name=wire.name)
            part.CoverEdges(edgeList=face_edge, tryAnalytical=True)
    p = mdb.models['Model-1'].parts['Surface']
    f = p.faces
    # smooth surface
    p.ReplaceFaces(faceList=f, stitch=True)


if __name__ == "__main__":
    thegma = 0.2  # control magnitude, -0.5~0.5.
    Hurst = 1.3  # control roughness, 1~2.5.
    n = 4  # the number of iterations, 3~9
    # create data
    X, Y, Z = island_3D(n, thegma, Hurst)
    # create surface
    Creat_Surface_in_Abaqus(X, Y, Z)

具体参数,可以参见分形几何教材,当然,代码中也附了一部分参数的常用取值。

评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值