该仓库包含用于批量生成二维多晶RVE模型和有限元分析操作的脚本。这些脚本用于模拟多晶材料中的疲劳裂纹扩展。所涉及的软件包括 Neper 4.9.0、Gmsh 4.13.1 和 Abaqus 2022。Neper 和 Gmsh 在通过 WSL 安装的 Ubuntu 上运行,相关安装说明可在参考文献部分找到。本脚本还不够完善,许多参数的设定和机理的选择仍有待推敲,唯希望给你一点启发或参考。
simulation_utils
:config.json
monitor.ps1
, startup.bat
和 subroutines3_revised.for
添加到你的工作区,之后我会介绍这些文件的作用。scriptGenerator.py
neper.sh
,这个批处理脚本通过改变 Neper
的 -T
命令中的 -id
参数生成了晶粒分布不同的模型,并划分好网格。另外,在工作目录中还会生成多个名称为 wpXXX
的子工作目录。但是 scriptGenerator.py
目前不生成 Abaqus 运算的启动脚本 startup.bat
,该脚本位于 workplace
文件夹中。neper.sh
所在目录,然后输入以下命令:
./neper.sh
scriptGenerator.py
已解决此问题。如有需要,可以在 Ubuntu 终端命令行中转换:
sed -i 's/\r$//' neper.sh
editInp1.py
inp
文件中添加材料信息。同时可以设置第二个随机数种子,即晶体取向随机数种子。preprocessor.py
abq2022.bat
中的调用编译器命令注释掉,运行完毕再启用。如下图使用 rem
注释掉了两条调用 VS 和 Fortran 的命令。
editInp2.py
startup.bat
workplace
,用于向 Abaqus 提交任务。脚本中默认运行 wp001
到 wp100
的运算,另外,为了节省存储空间会将 Abaqus 生成的 .dat
和 .stt
文件删除。你可以按需修改 startup.bat
。另外,当前启动批处理可以监控命令窗口(见 workplace
中的 monitor.ps1
),并解决因奇异矩阵(singular matrix)问题导致的计算停滞。postprocessor1.py
philsm
信息,分析裂纹长度是否符合指定标准,并删除不符合标准的文件夹。
postprocessor2.py
philsm
信息,并生成 EBSD 和裂纹图像。
postprocessor3.py
subroutines3_revised.for
位于 workplace
,除了原始版本 huang_umat_97.for
中含有的隐式 UMAT
外,还添加了控制损失起始的 UDMGINI
和早停机制,并根据 https://www.zhihu.com/question/45491271/answer/1192511740 将 UMAT
的某些项乘以2进行修正。UDMGINI
的机理是比较(FCC/BCC)晶体的 12 个滑移系(4 滑移面 × 3 滑移方向)上的累计塑性应变值,找出最大的其滑移系所对应的滑移面(四个中的一个)传递给 Abaqus 控制的主程序。neper -T -n from_morpho -dim 2 -morpho "diameq:lognormal(0.07923,0.02839),1-sphericity:lognormal(0.14,0.07)" -domain "square(1.5,1.5)" -transform "cut(cube(-0.2,0.2,0.65,0.85,-1,1,0.1))" -reg 1 -id 2 -o notched_poly
neper -M notched_poly.tess -nset edges -cledge "(y>0.25&&y<0.75&&x>-0.01&&x<1.0)?0.05:0.08" -order 1 -format msh -o notched_poly_msh
This repository contains scripts for the batch generation of 2D polycrystalline RVE models and finite element analysis operations. These scripts are used to simulate the growth of fatigue cracks in polycrystalline materials. The involved software includes Neper 4.9.0, Gmsh 4.13.1, and Abaqus 2022. Neper and Gmsh are run on Ubuntu installed via WSL, and the related installation instructions can be found in the References section. This script is still not fully developed, and the setting of many parameters as well as the selection of mechanisms require further refinement. I only hope this provides you with some inspiration or reference.
config.json
monitor.ps1
, startup.bat
, and subroutines3_revised.for
to your workplace, and I will explain the functions of these files shortly.scriptGenerator.py
neper.sh
. This batch script generates models with different grain distributions by changing the -id
parameter in the -T
command of Neper
and also performs the meshing. However, scriptGenerator.py
does not currently generate the Abaqus operation startup script, startup.bat
, which is now located in the workplace
folder.neper.sh
is located in the Ubuntu command line, then enter the following command:
./neper.sh
scriptGenerator.py
has resolved this issue. If needed, you can convert it in the Ubuntu command line with:
sed -i 's/\r$//' neper.sh
editInp1.py
inp
file. You can also set a second random seed, which is the random seed for the crystal orientation.preprocessor.py
abq2022.bat
, run it, and then enable them again. As shown in the image, use rem
to comment out the two commands that call Visual Studio and Fortran.
editInp2.py
startup.bat
workplace
and is used to submit the jobs to Abaqus. By default, the script runs computations from wp001
to wp100
, and it deletes the .dat
and .stt
files generated by Abaqus to save storage space. You can modify startup.bat
according to your need. Additionally, the current startup batch is capable of monitoring the command window (see monitor.ps1
in workplace
) and resolving stalls caused by Singular Matrix issues.postprocessor1.py
philsm
information from the last frame of the Odb file, analyzes whether the crack length meets the specified standard, and deletes any folders that do not meet the standard.
postprocessor2.py
philsm
information from selected frames of the Odb file and generates EBSD and crack images.
postprocessor3.py
subroutines3_revised.for
is located in the workplace
. In addition to the implicit UMAT
from the original version huang_umat_97.for
, it incorporates an an early-stopping mechanism includes the subroutine UDMGINI
, which controls the initiation of damage. Certain terms in UMAT
have been revised by multiplying by 2 according to https://www.zhihu.com/question/45491271/answer/1192511740.UDMGINI
involves comparing the accumulated plastic strain values across the twelve slip systems (4 slip planes × 3 slip directions) of the (FCC/BCC) crystal. The slip plane corresponding to the slip system with the largest accumulated strain is identified and passed to the main program controlled by Abaqus.neper -T -n from_morpho -dim 2 -morpho "diameq:lognormal(0.07923,0.02839),1-sphericity:lognormal(0.14,0.07)" -domain "square(1.5,1.5)" -transform "cut(cube(-0.2,0.2,0.65,0.85,-1,1,0.1))" -reg 1 -id 2 -o notched_poly
neper -M notched_poly.tess -nset edges -cledge "(y>0.25&&y<0.75&&x>-0.01&&x<1.0)?0.05:0.08" -order 1 -format msh -o notched_poly_msh