openfoamquest

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

OpenFOAM 残差の確認

OpenFOAM v2006やv2012を使用する場合、

計算中の残差の確認はgnuplotを使用しています。

PNGUINITISさんのサイトを参考しました。

 

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

////////////////////////////////////////////////////////////////

#!/usr/bin/gnuplot -persist

set title 'Residuals'
set xlabel 'Time'
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でソルバー実行後、以下のコマンドを入力すれば残差が確認できます。

$foamLog log

$./plot

f:id:openfoamquest:20210103213601p:plain

residual.pngという名前で保存されるため、残差の確認が便利です。

参考P27~28 2.5.5定常流動計算

[rakuten:book:18025959:detail]

OpenFOAMによる熱移動と流れの数値解析