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

打印 上一主题 下一主题

主题 534|帖子 534|积分 1602

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

  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       dictionary;
  12.     object      blockMeshDict;
  13. }
  14. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  15. convertToMeters 1;
  16. vertices
  17. (
  18.     (0.5 0 0)
  19.     (1 0 0)
  20.     (2 0 0)
  21.     (2 0.707107 0)
  22.     (0.707107 0.707107 0)
  23.     (0.353553 0.353553 0)
  24.     (2 2 0)
  25.     (0.707107 2 0)
  26.     (0 2 0)
  27.     (0 1 0)
  28.     (0 0.5 0)
  29.     (0.5 0 0.5)
  30.     (1 0 0.5)
  31.     (2 0 0.5)
  32.     (2 0.707107 0.5)
  33.     (0.707107 0.707107 0.5)
  34.     (0.353553 0.353553 0.5)
  35.     (2 2 0.5)
  36.     (0.707107 2 0.5)
  37.     (0 2 0.5)
  38.     (0 1 0.5)
  39.     (0 0.5 0.5)
  40. );
  41. blocks
  42. (
  43.     hex (5 4 9 10 16 15 20 21) (10 10 1) simpleGrading (1 1 1)
  44.     hex (0 1 4 5 11 12 15 16) (10 10 1) simpleGrading (1 1 1)
  45.     hex (1 2 3 4 12 13 14 15) (20 10 1) simpleGrading (1 1 1)
  46.     hex (4 3 6 7 15 14 17 18) (20 20 1) simpleGrading (1 1 1)
  47.     hex (9 4 7 8 20 15 18 19) (10 20 1) simpleGrading (1 1 1)
  48. );
  49. edges
  50. (
  51.     arc 0 5 (0.469846 0.17101 0)
  52.     arc 5 10 (0.17101 0.469846 0)
  53.     arc 1 4 (0.939693 0.34202 0)
  54.     arc 4 9 (0.34202 0.939693 0)
  55.     arc 11 16 (0.469846 0.17101 0.5)
  56.     arc 16 21 (0.17101 0.469846 0.5)
  57.     arc 12 15 (0.939693 0.34202 0.5)
  58.     arc 15 20 (0.34202 0.939693 0.5)
  59. );
  60. boundary
  61. (
  62.     left
  63.     {
  64.         type symmetryPlane; // 对称边界条件
  65.         faces
  66.         (
  67.             (8 9 20 19)
  68.             (9 10 21 20)
  69.         );
  70.     }
  71.     right
  72.     {
  73.         type patch; // 对称边界条件
  74.         faces
  75.         (
  76.             (2 3 14 13)
  77.             (3 6 17 14)
  78.         );
  79.     }
  80.     down
  81.     {
  82.         type symmetryPlane; // 对称边界条件
  83.         faces
  84.         (
  85.             (0 1 12 11)
  86.             (1 2 13 12)
  87.         );
  88.     }
  89.     up
  90.     {
  91.         type patch;
  92.         faces
  93.         (
  94.             (7 8 19 18)
  95.             (6 7 18 17)
  96.         );
  97.     }
  98.     hole
  99.     {
  100.         type patch;
  101.         faces
  102.         (
  103.             (10 5 16 21)
  104.             (5 0 11 16)
  105.         );
  106.     }
  107.     frontAndBack
  108.     {
  109.         type empty; // 表示一个2D算例
  110.         faces
  111.         (
  112.             (10 9 4 5)
  113.             (5 4 1 0)
  114.             (1 4 3 2)
  115.             (4 7 6 3)
  116.             (4 9 8 7)
  117.             (21 16 15 20)
  118.             (16 11 12 15)
  119.             (12 13 14 15)
  120.             (15 14 17 18)
  121.             (15 18 19 20)
  122.         );
  123.     }
  124. );
  125. mergePatchPairs
  126. (
  127. );
  128. // ************************************************************************* //
复制代码
2、边界条件

2.1 位移量D

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

  • 关键词traction:指定牵引力边界。指定牵引力边界矢量和大小;
  • pressure:如果这个边界面法向牵引力的压力指向表面之外,就被定义为负值。
  • right边界牵引力为(10000 0 0)Pa,pressure为0
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       volVectorField;
  12.     object      D;
  13. }
  14. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  15. dimensions      [0 1 0 0 0 0 0];
  16. internalField   uniform (0 0 0);
  17. boundaryField
  18. {
  19.     left
  20.     {
  21.         type            symmetryPlane;
  22.     }
  23.     right
  24.     {
  25.         type            tractionDisplacement;
  26.         traction        uniform (10000 0 0); // 牵引力
  27.         pressure        uniform 0;
  28.         value           uniform (0 0 0);
  29.     }
  30.     down
  31.     {
  32.         type            symmetryPlane;
  33.     }
  34.     up
  35.     {
  36.         type            tractionDisplacement;
  37.         traction        uniform (0 0 0);
  38.         pressure        uniform 0;
  39.         value           uniform (0 0 0);
  40.     }
  41.     hole
  42.     {
  43.         type            tractionDisplacement;
  44.         traction        uniform (0 0 0);
  45.         pressure        uniform 0;
  46.         value           uniform (0 0 0);
  47.     }
  48.     frontAndBack
  49.     {
  50.         type            empty;
  51.     }
  52. }
  53. // ************************************************************************* //
复制代码
2.2 物理特性

constant/thermophysicalProperties

  • planeStress     yes; // 物理特性指定为yes
  • thermalStress   no; // 不求解热物理方程
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       dictionary;
  12.     location    "constant";
  13.     object      thermalProperties;
  14. }
  15. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  16. rho // 密度
  17. {
  18.     type        uniform;
  19.     value       7854;
  20. }
  21. nu // 泊松比
  22. {
  23.     type        uniform;
  24.     value       0.3;
  25. }
  26. E // 杨氏模量
  27. {
  28.     type        uniform;
  29.     value       2e+11;
  30. }
  31. Cp // 比热容
  32. {
  33.     type        uniform;
  34.     value       434;
  35. }
  36. kappa // 热传导
  37. {
  38.     type        uniform;
  39.     value       60.5;
  40. }
  41. alphav // 热膨胀系数
  42. {
  43.     type        uniform;
  44.     value       1.1e-05;
  45. }
  46. planeStress     yes; // 物理特性指定为yes
  47. thermalStress   no; // 不求解热物理方程
  48. // ************************************************************************* //
复制代码
2.3 控制


  • 如果求解器是SIMPLE算法,deltaT设定为多少是无关紧要的。
  • ? timeFormat      general;
  • ? timePrecision   6;
  • ? graphFormat     raw;
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       dictionary;
  12.     location    "system";
  13.     object      controlDict;
  14. }
  15. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  16. application     solidDisplacementFoam; // 求解器
  17. startFrom       startTime;
  18. startTime       0;
  19. stopAt          endTime;
  20. endTime         100;
  21. deltaT          1;
  22. writeControl    timeStep; // 使用步长控制输出
  23. writeInterval   20;
  24. purgeWrite      0; // 文件数量上限,0表示不激活。设置为2只会输出最后2个
  25. writeFormat     ascii; // 文件格式
  26. writePrecision  6; // 文件的有效数字
  27. writeCompression off; // 文件格式是否时压缩格式
  28. timeFormat      general;
  29. timePrecision   6;
  30. graphFormat     raw;
  31. runTimeModifiable true; // 运行中途修改配置文件是否有意义。如果true,则会读取修改文件
  32. // ************************************************************************* //
复制代码
2.4 离散格式和求解器


  • 稳态求解:timeScheme为SteadyState,用于屏蔽掉时间离散项;
  • 有限体积离散相建立与高斯定律上,对于大部分模拟高斯定律足够精准。但是在这个案例中没使用least squares;
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       dictionary;
  12.     location    "system";
  13.     object      fvSchemes;
  14. }
  15. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  16. d2dt2Schemes
  17. {
  18.     default         steadyState;
  19. }
  20. ddtSchemes
  21. {
  22.     default         Euler;
  23. }
  24. gradSchemes
  25. {
  26.     default         leastSquares;
  27.     grad(D)         leastSquares;
  28.     grad(T)         leastSquares;
  29. }
  30. divSchemes
  31. {
  32.     default         none;
  33.     div(sigmaD)     Gauss linear;
  34. }
  35. laplacianSchemes
  36. {
  37.     default         none;
  38.     laplacian(DD,D) Gauss linear corrected;
  39.     laplacian(kappa,T) Gauss linear corrected;
  40. }
  41. interpolationSchemes
  42. {
  43.     default         linear;
  44. }
  45. snGradSchemes
  46. {
  47.     default         none;
  48. }
  49. // ************************************************************************* //
复制代码
fvSolution用于控制求解线性方程组使用的矩阵求解器

  • stressAnalysis:求解所需要的控制参数;
  • nCorrectors:整个方程组求解的外循环数,包括每个时间步长的拉伸边界条件;这里是稳态问题,时间步长代表迭代数以直到收敛,设置为1。
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. FoamFile
  9. {
  10.     format      ascii;
  11.     class       dictionary;
  12.     location    "system";
  13.     object      fvSolution;
  14. }
  15. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
  16. solvers
  17. {
  18.     "(D|T)"
  19.     {
  20.         solver          GAMG; // D的矩阵求解器GAMG
  21.         tolerance       1e-06; // 容差
  22.         relTol          0.9; // 相对误差,控制每次迭代的残差最小量
  23.         smoother        GaussSeidel;
  24.         nCellsInCoarsestLevel 20;
  25.     }
  26. }
  27. stressAnalysis
  28. {
  29.     compactNormalStress yes;
  30.     nCorrectors     1;
  31.     D               1e-06;
  32. }
  33. // ************************************************************************* //
复制代码
3、运行
  1. solidDisplacementFoam > log && cat log
复制代码
最终残差始终小于最初残差的0.9倍。

4、后处理

计算张量分量
  1. postProcess -func "components(sigma)"
复制代码

4.1 对比解析解与数值解

需要把计算域中的对称面的左边的求解出来,可以使用sample生成。需要调用system下的sampleDict字典。
  1. /*--------------------------------*- C++ -*----------------------------------*\
  2.   =========                 |
  3.   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
  4.    \\    /   O peration     | Website:  https://openfoam.org
  5.     \\  /    A nd           | Version:  9
  6.      \\/     M anipulation  |
  7. \*---------------------------------------------------------------------------*/
  8. interpolationScheme cellPoint;
  9. setFormat        raw;
  10. sets
  11. (
  12. leftPatch
  13. {
  14.         type        uniform;
  15.         axis        y;
  16.         start        (0 0.5 0.25);
  17.         end        (0 2 0.25);
  18.         nPoints        100;       
  19. }
  20. );
  21. fields        (sigmaxx);
复制代码
生成解析解
  1. postProcess -func graphUniform
复制代码

调用GnuPlot(需要安装)的plot命令
  1. plot [0.5:2] [0:] "postProcessing/graphUniform/100/line_sigmaxx.xy",
  2.         1e4*(1+(0.125/(x**2))+(0.09375/(x**4)))
复制代码


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

正序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

瑞星

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表