07、【算例】openfoam带孔盘体应力分析

官网:https://doc.cfd.direct/openfoam/user-guide-v9/platehole
$FOAM_TUTORIALS/stressAnalysis/solidDisplacementFoam下的案例

1、网格划分

image

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0.5 0 0)
    (1 0 0)
    (2 0 0)
    (2 0.707107 0)
    (0.707107 0.707107 0)
    (0.353553 0.353553 0)
    (2 2 0)
    (0.707107 2 0)
    (0 2 0)
    (0 1 0)
    (0 0.5 0)
    (0.5 0 0.5)
    (1 0 0.5)
    (2 0 0.5)
    (2 0.707107 0.5)
    (0.707107 0.707107 0.5)
    (0.353553 0.353553 0.5)
    (2 2 0.5)
    (0.707107 2 0.5)
    (0 2 0.5)
    (0 1 0.5)
    (0 0.5 0.5)
);

blocks
(
    hex (5 4 9 10 16 15 20 21) (10 10 1) simpleGrading (1 1 1)
    hex (0 1 4 5 11 12 15 16) (10 10 1) simpleGrading (1 1 1)
    hex (1 2 3 4 12 13 14 15) (20 10 1) simpleGrading (1 1 1)
    hex (4 3 6 7 15 14 17 18) (20 20 1) simpleGrading (1 1 1)
    hex (9 4 7 8 20 15 18 19) (10 20 1) simpleGrading (1 1 1)
);

edges
(
    arc 0 5 (0.469846 0.17101 0)
    arc 5 10 (0.17101 0.469846 0)
    arc 1 4 (0.939693 0.34202 0)
    arc 4 9 (0.34202 0.939693 0)
    arc 11 16 (0.469846 0.17101 0.5)
    arc 16 21 (0.17101 0.469846 0.5)
    arc 12 15 (0.939693 0.34202 0.5)
    arc 15 20 (0.34202 0.939693 0.5)
);

boundary
(
    left
    {
        type symmetryPlane; // 对称边界条件
        faces
        (
            (8 9 20 19)
            (9 10 21 20)
        );
    }
    right
    {
        type patch; // 对称边界条件
        faces
        (
            (2 3 14 13)
            (3 6 17 14)
        );
    }
    down
    {
        type symmetryPlane; // 对称边界条件
        faces
        (
            (0 1 12 11)
            (1 2 13 12)
        );
    }
    up
    {
        type patch;
        faces
        (
            (7 8 19 18)
            (6 7 18 17)
        );
    }
    hole
    {
        type patch;
        faces
        (
            (10 5 16 21)
            (5 0 11 16)
        );
    }
    frontAndBack
    {
        type empty; // 表示一个2D算例
        faces
        (
            (10 9 4 5)
            (5 4 1 0)
            (1 4 3 2)
            (4 7 6 3)
            (4 9 8 7)
            (21 16 15 20)
            (16 11 12 15)
            (12 13 14 15)
            (15 14 17 18)
            (15 18 19 20)
        );
    }
);

mergePatchPairs
(
);

// ************************************************************************* //

2、边界条件

2.1 位移量D

对于无热应力的单纯应力分析,只有位移量D需要指定。0/D

  1. 关键词traction:指定牵引力边界。指定牵引力边界矢量和大小;
  2. pressure:如果这个边界面法向牵引力的压力指向表面之外,就被定义为负值。
  3. right边界牵引力为(10000 0 0)Pa,pressure为0
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       volVectorField;
    object      D;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 0 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    left
    {
        type            symmetryPlane;
    }
    right
    {
        type            tractionDisplacement;
        traction        uniform (10000 0 0); // 牵引力
        pressure        uniform 0;
        value           uniform (0 0 0);
    }
    down
    {
        type            symmetryPlane;
    }
    up
    {
        type            tractionDisplacement;
        traction        uniform (0 0 0);
        pressure        uniform 0;
        value           uniform (0 0 0);
    }
    hole
    {
        type            tractionDisplacement;
        traction        uniform (0 0 0);
        pressure        uniform 0;
        value           uniform (0 0 0);
    }
    frontAndBack
    {
        type            empty;
    }
}

// ************************************************************************* //

2.2 物理特性

constant/thermophysicalProperties

  1. planeStress yes; // 物理特性指定为yes
  2. thermalStress no; // 不求解热物理方程
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "constant";
    object      thermalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

rho // 密度
{
    type        uniform;
    value       7854;
}

nu // 泊松比
{
    type        uniform;
    value       0.3;
}

E // 杨氏模量
{
    type        uniform;
    value       2e+11;
}

Cp // 比热容
{
    type        uniform;
    value       434;
}

kappa // 热传导
{
    type        uniform;
    value       60.5;
}

alphav // 热膨胀系数
{
    type        uniform;
    value       1.1e-05;
}

planeStress     yes; // 物理特性指定为yes
thermalStress   no; // 不求解热物理方程


// ************************************************************************* //

2.3 控制

  1. 如果求解器是SIMPLE算法,deltaT设定为多少是无关紧要的。
  2. ? timeFormat general;
  3. ? timePrecision 6;
  4. ? graphFormat raw;
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     solidDisplacementFoam; // 求解器

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         100;

deltaT          1;

writeControl    timeStep; // 使用步长控制输出

writeInterval   20;

purgeWrite      0; // 文件数量上限,0表示不激活。设置为2只会输出最后2个

writeFormat     ascii; // 文件格式

writePrecision  6; // 文件的有效数字

writeCompression off; // 文件格式是否时压缩格式

timeFormat      general;

timePrecision   6;

graphFormat     raw;

runTimeModifiable true; // 运行中途修改配置文件是否有意义。如果true,则会读取修改文件


// ************************************************************************* //

2.4 离散格式和求解器

  1. 稳态求解:timeScheme为SteadyState,用于屏蔽掉时间离散项;
  2. 有限体积离散相建立与高斯定律上,对于大部分模拟高斯定律足够精准。但是在这个案例中没使用least squares;
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

d2dt2Schemes
{
    default         steadyState;
}

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         leastSquares;
    grad(D)         leastSquares;
    grad(T)         leastSquares;
}

divSchemes
{
    default         none;
    div(sigmaD)     Gauss linear;
}

laplacianSchemes
{
    default         none;
    laplacian(DD,D) Gauss linear corrected;
    laplacian(kappa,T) Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         none;
}

// ************************************************************************* //

fvSolution用于控制求解线性方程组使用的矩阵求解器

  1. stressAnalysis:求解所需要的控制参数;
  2. nCorrectors:整个方程组求解的外循环数,包括每个时间步长的拉伸边界条件;这里是稳态问题,时间步长代表迭代数以直到收敛,设置为1。
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    "(D|T)"
    {
        solver          GAMG; // D的矩阵求解器GAMG
        tolerance       1e-06; // 容差
        relTol          0.9; // 相对误差,控制每次迭代的残差最小量
        smoother        GaussSeidel;
        nCellsInCoarsestLevel 20;
    }
}

stressAnalysis
{
    compactNormalStress yes;
    nCorrectors     1;
    D               1e-06;
}


// ************************************************************************* //

3、运行

solidDisplacementFoam > log && cat log

最终残差始终小于最初残差的0.9倍。
image

4、后处理

计算张量分量

postProcess -func "components(sigma)"

image

4.1 对比解析解与数值解

需要把计算域中的对称面的左边的求解出来,可以使用sample生成。需要调用system下的sampleDict字典。

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
interpolationScheme cellPoint;

setFormat	raw;

sets
(
 leftPatch
 {
	type	uniform;
	axis	y;
	start	(0 0.5 0.25);
	end	(0 2 0.25);
	nPoints	100;	
 }
);

fields	(sigmaxx);

生成解析解

postProcess -func graphUniform

image

调用GnuPlot(需要安装)的plot命令

 plot [0.5:2] [0:] "postProcessing/graphUniform/100/line_sigmaxx.xy",
        1e4*(1+(0.125/(x**2))+(0.09375/(x**4)))

image

原文链接:https://www.cnblogs.com/dbai/p/17274389.html

本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:07、【算例】openfoam带孔盘体应力分析 - Python技术站

(0)
上一篇 2023年4月18日
下一篇 2023年4月18日

相关文章

  • 【Visual Leak Detector】在 VS 2015 中使用 VLD

    说明 使用 VLD 内存泄漏检测工具辅助开发时整理的学习笔记。本篇介绍在 VS 2015 中使用 VLD。同系列文章目录可见 《内存泄漏检测工具》目录 目录 说明 1. 使用前的准备 3. 在 VS 2015 中使用 VLD 3.1 无内存泄漏时的输出报告 3.2 有内存泄漏时的输出报告 4. 无法正常使用的可能原因 1. 使用前的准备 参考本人另一篇博客 …

    C++ 2023年4月17日
    00
  • 洛谷:P5716日份天数

    题目描述 输入年份和月份,输出这一年的这一月有多少天。需要考虑闰年。 输入格式 输入两个正整数,分别表示年份 \(y\) 和月数 \(m\),以空格隔开。 输出格式 输出一行一个正整数,表示这个月有多少天。 样例 #1 样例输入 #1 1926 8 样例输出 #1 31 样例输入 #2 2000 2 样例输出 #2 29 提示 数据保证 \(1583 \le…

    C++ 2023年4月24日
    00
  • STL 容器 002 (vector 详解)

    为什么 各方面表现都比较中等, 适用范围广 尾插很快, 查找也比较快 是什么 动态数组 特点: 动态数组, 三个指针控制 两倍增长 扩充的方法: 不能原地扩充, 因为后面可能会有其他的东西, 必须在 其他地方开辟一块更大的内存 提供[] 所有的有连续空间的容器都有[] iterator是class类型的 怎么样 制造 两倍增长 //push_back() 检…

    C++ 2023年4月18日
    00
  • 【Visual Leak Detector】配置项 StartDisabled

    说明 使用 VLD 内存泄漏检测工具辅助开发时整理的学习笔记。本篇介绍 VLD 配置文件中配置项 StartDisabled 的使用方法。同系列文章目录可见 《内存泄漏检测工具》目录 目录 说明 1. 配置文件使用说明 2. 设置是否禁用自动初始化 2.1 测试代码 2.2 StartDisabled = no 时的输出 2.3 StartDisabled …

    C++ 2023年4月18日
    00
  • C++文件处理

    ? 新建文件 //这是要操作的文件名称 string str_filename = “E:/data/t/haha.txt”; //创建一个流对象 o 就是从这个流对象出去, 出到哪里, 当然是我们要建立的文件 ofstream ofs; //out会覆盖 ofs.open(str_filename, ios::out); ofs << “我创建…

    C++ 2023年4月17日
    00
  • 玩一玩 Ubuntu 下的 VSCode 编程

    一:背景 1. 讲故事 今天是五一的最后一天,想着长期都在 Windows 平台上做开发,准备今天换到 Ubuntu 系统上体验下,主要是想学习下 AT&T 风格的汇编,这里 Visual Studio 肯定是装不了了,还得上 VSCode,刚好前几天买了一个小工控机,这里简单记录下 零到一 的过程吧。 二:搭建一览 1. VSCode 安装 在 U…

    C++ 2023年5月3日
    00
  • 用C++编写一个简单的发布者和订阅者

    摘要:节点(Node)是通过 ROS 图进行通信的可执行进程。 本文分享自华为云社区《编写一个简单的发布者和订阅者》,作者: MAVER1CK 。 @[toc] 参考官方文档:Writing a simple publisher and subscriber (C++) 背景 节点(Node)是通过 ROS 图进行通信的可执行进程。 在本教程中,节点将通过话…

    C++ 2023年4月27日
    00
  • 驱动开发:探索DRIVER_OBJECT驱动对象

    本章将探索驱动程序开发的基础部分,了解驱动对象DRIVER_OBJECT结构体的定义,一般来说驱动程序DriverEntry入口处都会存在这样一个驱动对象,该对象内所包含的就是当前所加载驱动自身的一些详细参数,例如驱动大小,驱动标志,驱动名,驱动节等等,每一个驱动程序都会存在这样的一个结构。 首先来看一下微软对其的定义,此处我已将重要字段进行了备注。 typ…

    C++ 2023年4月18日
    00
合作推广
合作推广
分享本页
返回顶部