☰
These guidelines are based on the working folder located here.
Monitoring & Post-processing
1) Monitoring
1.1 Wall heat flux
Pre-requirement: the patch type in
Open the
writeWallHeatFlux on;
The field named wallHeatFlux will be printed as a result in each time folder. In addition, the wall heat flux is integrated for each wall and printed in the log file at write time
Wall heat fluxes [W]
Patch 4 named lowerWall: 416.2644537
Thus, the integrated wall heat flux can easily be monitored (and later plotted) during the simulation using the grep command. In the present case
grep lowerWall log.hy2Foam
Alternatively, use the dedicated monitoring script given in the
set output "gnuplot/integratedWallHeatFlux.eps"
set size 0.95,0.47
set origin 0.03,0.53
set xlabel "Time [sec]"
set ylabel "Integrated wall heat flux [kW]"
plot \
"< cat log.hy2Foam | grep -e 'named #patchName:' -e '^Time =' | awk '/^Time =/,/^Time =/ {lastc = $0; next}{ if ( lastc != \"\") { print lastc; lastc = \"\"; } print }' $1 | cut -d ':' -f 2 | cut -d '=' -f 2 | paste -d ' ' - -" u 1:($2/1000.0) w l ls 1 lw 1.8 not
1.2 Wall shear stress
In the
functions
{
//#include "probes"
//#include "forces"
#include "surfaceQuantities"
}
and review/edit the relevant subdictionary in the
wallShearStress
{
type wallShearStress;
libs ("libstrathFieldFunctionObjects.so");
patches ("cylinder");
writeControl outputTime;
log no;
}
1.3 Forces
In the
functions
{
//#include "probes"
#include "forces"
//#include "surfaceQuantities"
}
Open the
#include "../0/include/initialConditions"
forces
{
type forces;
functionObjectLibs ("libstrathForces.so");
log false;
writeFields false;
patches (cylinder); // edit accordingly
CofR (0 0 0);
dragDir (1 0 0);
liftDir (0 1 0);
pitchAxis (0 0 1);
}
forceCoeffs
{
#include "../0/include/initialConditions"
type forceCoeffs;
functionObjectLibs ("libstrathForces.so");
log false;
writeFields false;
patches (cylinder); // edit accordingly
rho rhoInf;
rhoInf $rhoInlet;
magUInf $velocityInlet;
CofR (0 0 0);
dragDir (1 0 0);
liftDir (0 1 0);
pitchAxis (0 0 1);
lRef 0.05; // edit accordingly, see constant/transportProperties/rarefiedParameters/characteristicLength
Aref 1.96646e-05; // edit accordingly
}
Review and edit the relevant entries. Forces / aerodynamic coefficients (e.g. drag coefficient) can be monitored using the script file given in the
set output "gnuplot/dragCoefficient.eps"
set size 0.95,0.47
set origin 0.03,0.53
set xlabel "Write time"
set ylabel "Drag coefficient"
plot \
"< cat log.hy2Foam | grep 'Cd' | cut -d '=' -f 2" w l ls 1 not
1.4 Residuals
An example is given below for monitoring the residuals. The fields (Ux, Uy, e_{ve, N2}, e) may be edited depending on the simulation set-up.
set output "gnuplot/residuals.eps"
set size 0.95,0.47
set origin 0.03,0.53
set logscale y
set format y "10^{\%01T}"
set xlabel "Timestep [x 100]"
set ylabel "Residuals"
set mytics 10
plot \
"< cat log.hy2Foam | grep 'Solving for Ux' | cut -d '=' -f 2 | cut -d ',' -f 1" every 100 w l ls 12 t 'Ux initial',\
"< cat log.hy2Foam | grep 'Solving for Ux' | cut -d '=' -f 3 | cut -d ',' -f 1" every 100 w l ls 1 t 'Ux final',\
"< cat log.hy2Foam | grep 'Solving for Uy' | cut -d '=' -f 2 | cut -d ',' -f 1" every 100 w l ls 22 t 'Uy initial',\
"< cat log.hy2Foam | grep 'Solving for Uy' | cut -d '=' -f 3 | cut -d ',' -f 1" every 100 w l ls 2 t 'Uy final',\
"< cat log.hy2Foam | grep 'Solving for evel_N2' | cut -d '=' -f 2 | cut -d ',' -f 1" every 100 w l ls 32 t 'e_{vel,{N_2}} initial',\
"< cat log.hy2Foam | grep 'Solving for evel_N2' | cut -d '=' -f 3 | cut -d ',' -f 1" every 100 w l ls 3 t 'e_{vel,{N_2}} final',\
"< cat log.hy2Foam | grep 'Solving for e,' | cut -d '=' -f 2 | cut -d ',' -f 1" every 100 w l ls 42 t 'e initial',\
"< cat log.hy2Foam | grep 'Solving for e,' | cut -d '=' -f 3 | cut -d ',' -f 1" every 100 w l ls 4 t 'e final'
and this script can be run as follows
gnuplot gnuplot/monitorResiduals
2) Post-processing
In a terminal window, type in
hy2Foam -postProcess -dict 'system/surfaceCoefficients' -latestTime
where
2.1 Pressure coefficient
In the
pressureCoefficient
{
type pressureCoefficient;
libs ("libstrathFieldFunctionObjects.so");
writeControl outputTime;
log no;
}
2.2 Stanton number
The wallHeatFlux field is a required input.
In the
StantonNumber
{
type StantonNo;
//- see constant/transportProperties/transportModels: writeWallHeatFlux
wallHeatFlux "wallHeatFlux";
libs ("libstrathFieldFunctionObjects.so");
writeControl outputTime;
log no;
}
2.3 Skin-friction coefficient
The wallShearStress field is a required input.
In the
frictionCoefficient
{
type frictionCoefficient;
libs ("libstrathFieldFunctionObjects.so");
writeControl outputTime;
log no;
}
2.4 y+
In the
yPlus
{
type yPlus;
libs ("libstrathFieldFunctionObjects.so");
writeControl outputTime;
log no;
}
2.5 ParaView
- Open ParaView and load wall patches in Mesh Regions
- Plot any of these surface quantities using the plotData filter