首页/文章/ 详情

几何非线性FEM 程序|一维杆 UL格式

8天前浏览130

数值案例

考虑初始长度    、初始截面积    的两节点一维杆。节点 1 固定,节点 2 施加轴向集中力    ,尝求解节点 2 的位移    

程序

import math

import numpy as np

YOUNG_MODULUS = 200.0
INITIAL_LENGTH = 1.0
INITIAL_AREA = 1.0
TARGET_FORCE = 100.0


def deformation_gradient(u):
    """Return the deformation gradient F of the uniaxial bar."""
    displacement_gradient = u / INITIAL_LENGTH

    F = np.array([
        [1.0 + displacement_gradient]
    ])

    return F


def green_lagrange_strain(F):
    """Return the Green-Lagrange strain E = 0.5 * (F.T F - I)."""
    identity = np.eye(1)

    E = 0.5 * (F.T @ F - identity)

    return E


def second_p_k_stress(E):
    """Return the second Piola-Kirchhoff stress S = Young's modulus * E."""
    S = YOUNG_MODULUS * E

    return S


def jacobian(F):
    """Return the one-dimensional Jacobian J = det(F)."""
    J = np.linalg.det(F)

    return J


def cauchy_stress(F, S, J):
    """Return the Cauchy stress sigma = (1 / J) * F S F.T."""
    sigma = (1.0 / J) * F @ S @ F.T

    return sigma


def internal_force(F, sigma, J):
    """Return the internal force obtained from the UL internal virtual work."""
    F11 = F[00]
    sigma11 = sigma[00]

    A = J * INITIAL_AREA / F11
    force = sigma11 * A

    return force


def tangent_stiffness(F, sigma, J):
    """Return the UL tangent stiffness Kt = k_mat + k_geo."""
    F11 = F[00]
    sigma11 = sigma[00]

    A = J * INITIAL_AREA / F11
    L = F11 * INITIAL_LENGTH

    k_mat = YOUNG_MODULUS * A * F11 ** 3 / L
    k_geo = sigma11 * A / L

    tangent = k_mat + k_geo

    return tangent


def calculate_state(u):
    """Calculate all physical quantities from the current displacement."""
    F = deformation_gradient(u)
    E = green_lagrange_strain(F)
    S = second_p_k_stress(E)

    J = jacobian(F)
    sigma = cauchy_stress(F, S, J)
    force = internal_force(F, sigma, J)

    return F, E, sigma, J, force


def convergence_residual(residual, target_force):
    """Return the normalized squared residual used in the original example."""
    return residual**2 / (1.0 + target_force**2)


def newton_raphson(
    initial_u,
    target_force,
    tol=1.0e-5,
    max_iter=20,
)
:

    """Solve one load increment with the Newton-Raphson method."""
    trial_u = float(initial_u)
    iteration = 0

    F, E, sigma, J, force = calculate_state(trial_u)
    residual = target_force - force
    conv_residual = convergence_residual(residual, target_force)

    print(
        f"{'iter':>5} {'u2':>10} {'E11':>10} "
        f"{'sigma11':>12} {'conv_R':>12}"
    )
    print(
        f"{iteration:5d} {trial_u:10.5f} {E[00]:10.5f} "
        f"{sigma[00]:12.3e} {conv_residual:12.3e}"
    )

    while conv_residual > tol and iteration < max_iter:
        tangent = tangent_stiffness(F, sigma, J)
        if math.isclose(tangent, 0.0, abs_tol=1.0e-14):
            raise ZeroDivisionError("Zero tangent stiffness.")

        delta_u = residual / tangent
        trial_u += delta_u

        iteration += 1
        F, E, sigma, J, force = calculate_state(trial_u)
        residual = target_force - force
        conv_residual = convergence_residual(residual, target_force)

        print(
            f"{iteration:5d} {trial_u:10.5f} {E[00]:10.5f} "
            f"{sigma[00]:12.3e} {conv_residual:12.3e}"
        )

    converged = conv_residual <= tol

    return trial_u, iteration, converged

结果汇总

固定步长

增量步      
增量大小      
累计载荷因子      
当前力      
迭代次数      
Cutback      
       
空间应变               
       
conv      
0      
0.0000      
0.0000      
0.0      
0      
0      
0.0000      
0.0000      
0.0000      
0.00e+00      
1      
0.1000      
0.1000      
10.0      
2      
0      
0.0467      
0.0446      
10.0034      
1.17e-07      
2      
0.1000      
0.2000      
20.0      
2      
0      
0.0880      
0.0809      
20.0018      
8.41e-09      
3      
0.1000      
0.3000      
30.0      
2      
0      
0.1254      
0.1114      
30.0011      
1.34e-09      
4      
0.1000      
0.4000      
40.0      
2      
0      
0.1597      
0.1377      
40.0007      
3.16e-10      
5      
0.1000      
0.5000      
50.0      
2      
0      
0.1915      
0.1607      
50.0005      
9.49e-11      
6      
0.1000      
0.6000      
60.0      
2      
0      
0.2212      
0.1811      
60.0003      
3.37e-11      
7      
0.1000      
0.7000      
70.0      
2      
0      
0.2492      
0.1995      
70.0003      
1.36e-11      
8      
0.1000      
0.8000      
80.0      
2      
0      
0.2756      
0.2161      
80.0002      
6.04e-12      
9      
0.1000      
0.9000      
90.0      
1      
0      
0.3014      
0.2316      
90.2557      
8.07e-06      
10      
0.1000      
1.0000      
100.0      
1      
0      
0.3252      
0.2454      
100.2240      
5.02e-06      

自动步长

增量步      
增量大小      
累计载荷因子      
当前力      
迭代次数      
Cutback      
       
空间应变               
       
conv      
0      
0.0000      
0.0000      
0.0      
0      
0      
0.0000      
0.0000      
0.0000      
0.00e+00      
1      
0.1000      
0.1000      
10.0      
2      
0      
0.0467      
0.0446      
10.0034      
1.17e-07      
2      
0.1000      
0.2000      
20.0      
2      
0      
0.0880      
0.0809      
20.0018      
8.41e-09      
3      
0.1500      
0.3500      
35.0      
2      
0      
0.1429      
0.1251      
35.0052      
2.22e-08      
4      
0.1500      
0.5000      
50.0      
2      
0      
0.1915      
0.1607      
50.0028      
3.15e-09      
5      
0.2250      
0.7250      
72.5      
2      
0      
0.2559      
0.2038      
72.5080      
1.22e-08      
6      
0.2250      
0.9500      
95.0      
2      
0      
0.3129      
0.2383      
95.0043      
2.08e-09      
7      
0.0500      
1.0000      
100.0      
1      
0      
0.3249      
0.2452      
100.0567      
3.21e-07      

结果分析

从上面数据还有之前的 TL 格式的数据,可以看到两个现象:

  1. UL 格式下的应力收敛于 100N,这与施加的外力是一致的,而 TL 的应力小于该值
  2. UL 格式下的应变小于 TL 格式下的应变

UL 输出的是当前构形下的 Cauchy 应力    ,内力为    ;当前算例中面积    ,因此 Cauchy 应力的数值恰好等于外力100,但严格来说应力与力的单位并不相同。

TL 输出的是第二 P–K 应力    ,其内力为    ,拉伸时,所以达到相同的100外力时,    必然小于100。

应变也是同样的道理:TL 的 Green–Lagrange 应变相对于初始长度描述变形,而 UL 输出的空间应变相对于拉伸后的当前长度描述变形;由于当前长度大于初始长度,相同伸长量除以当前长度所得的空间应变自然更小。

因此,应力和应变数值的差异只是构形和度量方式不同,两种格式描述的是同一个变形与平衡状态。


来源:易木木响叮当
Deform非线性CONVERGEUMSCLOrigin
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2026-08-17
最近编辑:8天前
易木木响叮当
硕士 有限元爱好者
获赞 278粉丝 412文章 449课程 2
点赞
收藏
作者推荐
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习计划 福利任务
下载APP
联系我们
帮助与反馈