使用OpenFoam计算时,过程中的残差,自定义点位置变量值的监测,需要进行的设置。
一,在system下创建文件
system/residuals
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
For specified fields, writes out the initial residuals for the first
solution of each time step; for non-scalar fields (e.g. vectors), writes
the largest of the residuals for each component (e.g. x, y, z).
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/numerical/residuals.cfg"
fields (p U k epsilon);
// ************************************************************************* //
system/probes
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes out values of fields from cells nearest to specified locations.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/probes/probes.cfg"
fields (p U);
probeLocations
(
(3 6.15 0.15) //0
(3 6.15 1)
(3 6.15 2)
(3 6.15 3)
(3 6.15 4)
(3 6.15 5)
(3 6.15 6.15) //6
(3 5 6.15)
(3 4 6.15)
(3 3 6.15)
(3 2 6.15)
(3 1 6.15)
(3 -0.15 6.15) //12
(3 -0.15 5)
(3 -0.15 4)
(3 -0.15 3)
(3 -0.15 2)
(3 -0.15 1)
(3 -0.15 0.15) //18
);
// ************************************************************************* //
二,在system/controlDict 中添加功能项,链接 residuals 和 probes
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1706+ |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
/* Butterfly 0.0.4 https://github.com/ladybug-tools/butterfly *\
\*---------------------------------------------------------------------------*/
FoamFile
{
version 4.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
//#include "probes";
application simpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 3000;
deltaT 1;
writeControl timeStep;
writeInterval 200;
purgeWrite 0;
writeFormat ascii;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions{
#includeFunc probes
#includeFunc probes_lines_0.1m
#includeFunc probes_lines_0.01m
#includeFunc probes_lines_0m
#includeFunc residuals
}
三,计算开始后,postProcessing 文件夹 出现 residuals 和 probes 文件夹记录监测数据。使用gnu plot 或者 python 处理数据,进行可视化。