su2code / SU2

SU2: An Open-Source Suite for Multiphysics Simulation and Design
https://su2code.github.io
Other
1.28k stars 829 forks source link

Preprocessing screen output #591

Closed talbring closed 5 years ago

talbring commented 5 years ago

Along with the restructuring of the output internals (see branch feature_output), I am introducing a more structured and unified way of outputting tables on screen. This enables for example a more structured output of the preprocessing information that is printed on screen at the beginning.

For the table output I use a very simple and easy to use class. For example the table

+-------------------------------------------+
|  MG Level| Presmooth|PostSmooth|CorrectSmo|
+-------------------------------------------+
|         0|         1|         0|         0|
|         1|         1|         0|         0|
|         2|         1|         0|         0|
|         3|         1|         0|         0|
+-------------------------------------------+

is generated using the code

TablePrinter MGTable(&std::cout);

MGTable.AddColumn("MG Level",         10);
MGTable.AddColumn("Presmooth",     10);
MGTable.AddColumn("PostSmooth",    10);
MGTable.AddColumn("CorrectSmooth", 10);
MGTable.set_flush_right();
MGTable.PrintHeader();
for (unsigned short iLevel = 0; iLevel < nMGLevels+1; iLevel++) {
  MGTable << iLevel << MG_PreSmooth[iLevel] << MG_PostSmooth[iLevel] << MG_CorrecSmooth[iLevel];
}
 MGTable.PrintFooter();

An example of the current preprocessing output in the feature_output branch can be found below. Especially the information for the free-stream and non-dimensionalization is more readible this way. Furthermore the convergence history uses the same table class.

Let me know what you think. Any comments are appreciated.

------------------------ Physical Case Definition -----------------------
Compressible RANS equations.
Turbulence model: Spalart Allmaras
Hybrid RANS/LES: No Hybrid RANS/LES
Mach number: 0.15.
Angle of attack (AoA): 10 deg, and angle of sideslip (AoS): 0 deg.
Reynolds number: 6e+06. Reference length 1.
No restart solution, use the values at infinity (freestream).
Non-Dimensional simulation (P=1.0, Rho=1.0, T=1.0 at the farfield).
The reference area is 1 m^2.
The semi-span will be computed using the max y(3D) value.
The reference length is 1 m.
Reference origin for moment evaluation is (0.25, 0, 0).
Surface(s) where the force coefficients are evaluated: airfoil.

Surface(s) plotted in the output file: airfoil.
Input mesh file name: n0012_225-65.su2

---------------------- Space Numerical Integration ----------------------
Roe (with entropy fix = 0.001) solver for the flow inviscid terms.
Standard Roe without low-dissipation function.
Second order integration in space, with slope limiter.
Venkatakrishnan slope-limiting method, with constant: 0.03. 
The reference element size is: 1. 
Scalar upwind solver for the turbulence model.
Second order integration in space with slope limiter.
No slope-limiting method. 
Average of gradients with correction (viscous flow terms).
Average of gradients with correction (viscous turbulence terms).
Gradient Computation using weighted Least-Squares method.

---------------------- Time Numerical Integration -----------------------
Local time stepping (steady state simulation).
Euler implicit method for the flow equations.
FGMRES is used for solving the linear system.
Using a LU-SGS preconditioning.
Convergence criteria of the linear solver: 1e-10.
Max number of linear iterations: 5.
V Multigrid Cycle, with 3 multigrid levels.
Damping factor for the residual restriction: 0.75.
Damping factor for the correction prolongation: 0.75.
No CFL adaptation.
+-------------------------------------------+
|  MG Level| Presmooth|PostSmooth|CorrectSmo|
+-------------------------------------------+
|         0|         1|         0|         0|
|         1|         1|         0|         0|
|         2|         1|         0|         0|
|         3|         1|         0|         0|
+-------------------------------------------+
Courant-Friedrichs-Lewy number:       10
Euler implicit time integration for the turbulence model.

------------------------- Convergence Criteria --------------------------
Maximum number of iterations: 99999.
Reduce the density residual 10 orders of magnitude.
The minimum bound for the density residual is 10^(-12).
Start convergence criteria at iteration 10.

-------------------------- Output Information ---------------------------
Writing a solution file every 10000 iterations.
Writing the convergence history every 1 iterations.
The output file format is Tecplot ASCII (.dat).
Convergence history file name: history.
Forces breakdown file name: forces_breakdown.dat.
Surface flow coefficients file name: surface_flow.
Flow variables file name: flow.
Restart flow file name: restart_flow.dat.

------------------- Config File Boundary Information --------------------
Far-field boundary marker(s): farfield.
Constant heat flux wall boundary marker(s): airfoil.

---------------------- Read Grid File Information -----------------------
Two dimensional problem.
14576 points.
2 surface markers.
+------------------------------------+
| Index|        Marker|      Elements|
+------------------------------------+
|     0|       airfoil|           128|
|     1|      farfield|           352|
+------------------------------------+
14336 quadrilaterals.

------------------------- Geometry Preprocessing ------------------------
Setting point connectivity.
Renumbering points (Reverse Cuthill McKee Ordering).
Recomputing point connectivity.
Setting element connectivity.
Checking the numerical grid orientation.
There has been a re-orientation of the LINE surface elements.
Identifying edges and vertices.
Computing centers of gravity.
Setting the control volume structure.
Area of the computational grid: 8.76e+05.
Searching for the closest normal neighbors to the surfaces.
Storing a mapping from global to local point index.
Compute the surface curvature.
Max K: 465. Mean K: 4.52. Standard deviation K: 24.6.
Checking for periodicity.
Setting the multigrid structure.
+-------------------------------------------+
|  MG Level|       CVs|Aggl. Rate|       CFL|
+-------------------------------------------+
|         0|     14576|    1/1.00|        10|
|         1|      3701|    1/3.94|      7.56|
|         2|       931|    1/3.98|      5.69|
|         3|       227|     1/4.1|      4.21|
+-------------------------------------------+
Computing wall distances.
Wetted area = 2.04 m.
Area projection in the x-plane = 0.119 m, y-plane = 0.998 m.
Max. coordinate in the x-direction = 1 m, y-direction = 0.0595 m.
Min coordinate in the x-direction = 0 m, y-direction = -0.0595 m.

------------------------- Driver information --------------------------
A Fluid driver has been instantiated.

------------------------ Iteration Preprocessing ------------------------
Zone 1: Euler/Navier-Stokes/RANS fluid iteration.

------------------------- Solver Preprocessing --------------------------
Viscous flow: Computing pressure using the ideal gas law
based on the free-stream temperature and a density computed
from the Reynolds number.
Force coefficients computed using free-stream values.
-- Input conditions:
+--------------------------------------------------------------------------+
|              Name|    Dim. value|    Ref. value|      Unit|Non-dim. value|
+--------------------------------------------------------------------------+
|    Ref. Viscosity|     1.716e-05|       624.034|   N.s/m^2|   2.74985e-08|
|  Sutherland Temp.|        273.15|           300|         K|        0.9105|
| Sutherland Const.|         110.4|           300|         K|         0.368|
+--------------------------------------------------------------------------+
|    Prandtl (Lam.)|             -|             -|         -|          0.72|
|   Prandtl (Turb.)|             -|             -|         -|           0.9|
+--------------------------------------------------------------------------+
|      Gas Constant|       287.058|       287.058|  N.m/kg.K|             1|
|  Spec. Heat Ratio|             -|             -|         -|           1.4|
+--------------------------------------------------------------------------+
-- Free-stream conditions:
+--------------------------------------------------------------------------+
|              Name|    Dim. value|    Ref. value|      Unit|Non-dim. value|
+--------------------------------------------------------------------------+
|   Static Pressure|        183127|        183127|        Pa|             1|
|           Density|       2.12649|       2.12649|    kg/m^3|             1|
|       Temperature|           300|           300|         K|             1|
|      Total Energy|        216650|       86117.4|   m^2/s^2|       2.51575|
|        Velocity-X|       51.2923|       293.458|       m/s|      0.174786|
|        Velocity-Y|       9.04422|       293.458|       m/s|     0.0308195|
|Velocity Magnitude|       52.0836|       293.458|       m/s|      0.177482|
+--------------------------------------------------------------------------+
|         Viscosity|   1.84592e-05|       624.034|   N.s/m^2|   2.95804e-08|
|      Conductivity|             -|        179134|   W/m^2.K|             -|
| Turb. Kin. Energy|       10.1726|       86117.4|   m^2/s^2|   0.000118125|
| Spec. Dissipation|        117188|       293.458|       1/s|       399.335|
+--------------------------------------------------------------------------+
|       Mach Number|             -|             -|         -|          0.15|
|   Reynolds Number|             -|             -|         -|         6e+06|
+--------------------------------------------------------------------------+

Initialize Jacobian structure (Navier-Stokes). MG level: 0.
Initialize Jacobian structure (SA model).
Initialize Jacobian structure (Navier-Stokes). MG level: 1.
Initialize Jacobian structure (Navier-Stokes). MG level: 2.
Initialize Jacobian structure (Navier-Stokes). MG level: 3.

----------------- Integration and Numerics Preprocessing ----------------
Integration Preprocessing.
Numerics Preprocessing.

---------------------- Python Interface Preprocessing ---------------------
Setting customized boundary conditions for zone 0

-------------------------- Output Preprocessing ---------------------------
Zone 1: Euler/Navier-Stokes/RANS output structure.
History filename: history.dat

------------------------------ Begin Solver -----------------------------
+----------------------------------------------------------------+
|    Ext_Iter|    Res[Rho]|   Res[RhoU]|   Res[RhoV]|   Res[RhoE]|
+----------------------------------------------------------------+
|           0|   -4.165003|  -14.735159|  -14.709795|   -3.618985|
|           1|   -4.436685|   -4.791378|   -4.176224|   -3.887401|
|           2|   -4.772585|   -5.044913|   -4.741431|   -4.226021|
|           3|   -4.865861|   -4.936267|   -4.736063|   -4.319940|
|           4|   -4.908893|   -4.837536|   -4.707111|   -4.363705|
jayantmukho commented 5 years ago

I like this a lot. I often have a hard time reading the free-stream conditions, and this makes it a lot easier to read. Don't think it is as necessary for the solver iterations, but I don't see any detriment to outputting it like that. Would this require changing the regression testing script that reads the output log to diff the numerical values?

pcarruscag commented 5 years ago

This is very nice! The free-stream / reference values look so much better. My only suggestions would be to add a blank space between the value and the column separator and use + at every intersection for consistency.

+-------+---------------+------------+
| Index |        Marker |    Elements|
+-------+---------------+------------+
|     0 |       airfoil |        128 |
|     1 |      farfield |        352 |
+-------+---------------+------------+
LaSerpe commented 5 years ago

I like this a lot, but I agree with Jayant that it may be not necessary for the solver iteration. Perhaps we could add the + at intersections but remove them from the external bounds.

economon commented 5 years ago

Like it a lot, thanks, Tim! 👍

I also think it could be nice to leave the vertical bar out of the solver iterations. Is it easy to just have a flag for this in the table class constructor for customizing or perhaps a method to turn off/on (without making too much work for you, of course)?

talbring commented 5 years ago

Thanks for the feedback. I will modify the class in a way that it is possible to specify the separator and other decoration.

economon commented 5 years ago

Contributed in #633. Closing