openfoamquest

OpenFOAMや流体解析の使い方を紹介しています

XsimでESI版OpenFOAM-V2006を使う場合

XsimのサイトのテンプレートはFOUNDATION版のため

ESI版のOpenFOAMに設定しなおす方法を紹介します。

OpenFOAMv7でエクスポート後ControlDictを編集します。

system/controlDictを編集します。

 

・FoamFIleにlocation "system"を追加。

・writeCompression をoffに変更。

・#includeFunc residuals(U,p,k,epsilon);を//でコメントアウト

 

 

//==FOUNDATION版========

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}

application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 200;
deltaT 1.0;
adjustTimeStep no;
maxCo 0.9;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable true;

functions
{
#includeFunc residuals(U,p,k,epsilon);
}

//==ESI版=============

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}

application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 200;
deltaT 1.0;
adjustTimeStep no;
maxCo 0.9;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;

functions
{

//#includeFunc residuals(U,p,k,epsilon);

}

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Ubuntu20.04 OpenFOAM-V2006で残差を確認するには

plotという名前で以下の内容のファイルを作成します。

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

#!/usr/bin/gnuplot -persist

set title 'Residuals'
set xlabel 'Step'
set ylabel 'Initial residual'
set logscale y
set format y "%.0e"
set grid

plot 'logs/Ux_0' title 'Ux' w l
replot 'logs/Uy_0' title 'Uy' w l
replot 'logs/Uz_0' title 'Uz' w l
replot 'logs/p_0' title 'p' w l
replot 'logs/p_rgh_0' title 'p_rgh' w l
replot 'logs/T_0' title 'T' w l
replot 'logs/h_0' title 'h' w l
replot 'logs/k_0' title 'k' w l
replot 'logs/epsilon_0' title 'epsilon' w l
replot 'logs/omega_0' title 'omega' w l
replot 'logs/Rxx_0' title 'Rxx' w l
replot 'logs/Rxy_0' title 'Rxy' w l
replot 'logs/Rxz_0' title 'Rxz' w l
replot 'logs/Ryy_0' title 'Ryy' w l
replot 'logs/Ryz_0' title 'Ryz' w l
replot 'logs/Rzz_0' title 'Rzz' w l


set terminal png
set output 'residual.png'
replot

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

foamJobでソルバー実行時に(例えばfoamJob simpleFoam)

foamLog log

./plot

とコマンドを入力すれば残差がグラフで確認できます。

(gnuplotがインストールされていることが前提)