Skip to content

Commit 36be2b8

Browse files
authored
Options for appending iteration number to filenames (keep solution snapshots) (#1465)
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> * copies the regular saved file with iteration number appended * use outer iterations for multizone * modified filewriter class * switched to enum class for enum_output * consistent naming of string valFileName -> val_filename * removed comment lines for option TABULAR_FORMAT and OUTPUT_FILES in all testcases * changed STL to STL_ASCII in testcases * fixing and rewriting of paraview multiblock output * add options to config_template.cfg
1 parent d5d1e27 commit 36be2b8

264 files changed

Lines changed: 774 additions & 715 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/include/CConfig.hpp

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,12 @@ class CConfig {
661661
unsigned short Res_FEM_CRIT; /*!< \brief Criteria to apply to the FEM convergence (absolute/relative). */
662662
unsigned long StartConv_Iter; /*!< \brief Start convergence criteria at iteration. */
663663
su2double Cauchy_Eps; /*!< \brief Epsilon used for the convergence. */
664-
bool Restart, /*!< \brief Restart solution (for direct, adjoint, and linearized problems).*/
665-
Read_Binary_Restart, /*!< \brief Read binary SU2 native restart files.*/
666-
Restart_Flow; /*!< \brief Restart flow solution for adjoint and linearized problems. */
664+
bool Restart, /*!< \brief Restart solution (for direct, adjoint, and linearized problems).*/
665+
Read_Binary_Restart, /*!< \brief Read binary SU2 native restart files.*/
666+
Wrt_Restart_Overwrite, /*!< \brief Overwrite restart files or append iteration number.*/
667+
Wrt_Surface_Overwrite, /*!< \brief Overwrite surface output files or append iteration number.*/
668+
Wrt_Volume_Overwrite, /*!< \brief Overwrite volume output files or append iteration number.*/
669+
Restart_Flow; /*!< \brief Restart flow solution for adjoint and linearized problems. */
667670
unsigned short nMarker_Monitoring, /*!< \brief Number of markers to monitor. */
668671
nMarker_Designing, /*!< \brief Number of markers for the objective function. */
669672
nMarker_GeoEval, /*!< \brief Number of markers for the objective function. */
@@ -725,7 +728,7 @@ class CConfig {
725728
su2double *nBlades; /*!< \brief number of blades for turbomachinery computation. */
726729
unsigned short Geo_Description; /*!< \brief Description of the geometry. */
727730
unsigned short Mesh_FileFormat; /*!< \brief Mesh input format. */
728-
unsigned short Tab_FileFormat; /*!< \brief Format of the output files. */
731+
TAB_OUTPUT Tab_FileFormat; /*!< \brief Format of the output files. */
729732
unsigned short output_precision; /*!< \brief <ofstream>.precision(value) for SU2_DOT and HISTORY output */
730733
unsigned short ActDisk_Jump; /*!< \brief Format of the output files. */
731734
unsigned long StartWindowIteration; /*!< \brief Starting Iteration for long time Windowing apporach . */
@@ -1103,7 +1106,7 @@ class CConfig {
11031106
unsigned long HistoryWrtFreq[3], /*!< \brief Array containing history writing frequencies for timer iter, outer iter, inner iter */
11041107
ScreenWrtFreq[3]; /*!< \brief Array containing screen writing frequencies for timer iter, outer iter, inner iter */
11051108
unsigned long VolumeWrtFreq; /*!< \brief Writing frequency for solution files. */
1106-
unsigned short* VolumeOutputFiles; /*!< \brief File formats to output */
1109+
OUTPUT_TYPE* VolumeOutputFiles; /*!< \brief File formats to output */
11071110
unsigned short nVolumeOutputFiles; /*!< \brief Number of File formats to output */
11081111

11091112
bool Multizone_Mesh; /*!< \brief Determines if the mesh contains multiple zones. */
@@ -5225,6 +5228,24 @@ class CConfig {
52255228
*/
52265229
bool GetRead_Binary_Restart(void) const { return Read_Binary_Restart; }
52275230

5231+
/*!
5232+
* \brief Flag for whether restart solution files are overwritten.
5233+
* \return Flag for overwriting. If Flag=false, iteration nr is appended to filename
5234+
*/
5235+
bool GetWrt_Restart_Overwrite(void) const { return Wrt_Restart_Overwrite; }
5236+
5237+
/*!
5238+
* \brief Flag for whether visualization files are overwritten.
5239+
* \return Flag for overwriting. If Flag=false, iteration nr is appended to filename
5240+
*/
5241+
bool GetWrt_Surface_Overwrite(void) const { return Wrt_Surface_Overwrite; }
5242+
5243+
/*!
5244+
* \brief Flag for whether visualization files are overwritten.
5245+
* \return Flag for overwriting. If Flag=false, iteration nr is appended to filename
5246+
*/
5247+
bool GetWrt_Volume_Overwrite(void) const { return Wrt_Volume_Overwrite; }
5248+
52285249
/*!
52295250
* \brief Provides the number of varaibles.
52305251
* \return Number of variables.
@@ -5326,7 +5347,7 @@ class CConfig {
53265347
* \brief Get the format of the output solution.
53275348
* \return Format of the output solution.
53285349
*/
5329-
unsigned short GetTabular_FileFormat(void) const { return Tab_FileFormat; }
5350+
TAB_OUTPUT GetTabular_FileFormat(void) const { return Tab_FileFormat; }
53305351

53315352
/*!
53325353
* \brief Get the output precision to be used in <ofstream>.precision(value) for history and SU2_DOT output.
@@ -5373,13 +5394,22 @@ class CConfig {
53735394

53745395
/*!
53755396
* \brief Add any numbers necessary to the filename (iteration number, zone ID ...)
5376-
* \param[in] config - Definition of the particular problem.
53775397
* \param[in] filename - the base filename.
53785398
* \param[in] ext - the extension to be added.
5399+
* \param[in] Iter - the current iteration
53795400
* \return The new filename
53805401
*/
53815402
string GetFilename(string filename, string ext, int Iter) const;
53825403

5404+
/*!
5405+
* \brief Add steady iteration number to the filename (does not overwrite previous files)
5406+
* \param[in] filename - the base filename.
5407+
* \param[in] inner_iter - the inner iterations
5408+
* \param[in] outer_iter - the outer iterations
5409+
* \return The new filename
5410+
*/
5411+
string GetFilename_Iter(const string& filename_iter, unsigned long curInnerIter, unsigned long curOuterIter) const;
5412+
53835413
/*!
53845414
* \brief Append the zone index to the restart or the solution files.
53855415
* \return Name of the restart file for the flow variables.
@@ -5388,18 +5418,26 @@ class CConfig {
53885418

53895419
/*!
53905420
* \brief Append the zone index to the restart or the solution files.
5421+
* \param[in] val_filename - the base filename.
5422+
* \param[in] val_iZone - the zone ID.
5423+
* \param[in] ext - the filename extension.
53915424
* \return Name of the restart file for the flow variables.
53925425
*/
53935426
string GetMultizone_HistoryFileName(string val_filename, int val_iZone, string ext) const;
53945427

53955428
/*!
53965429
* \brief Append the instance index to the restart or the solution files.
5430+
* \param[in] val_filename - the base filename.
5431+
* \param[in] val_iInst - the current instance.
5432+
* \param[in] ext - the filename extension.
53975433
* \return Name of the restart file for the flow variables.
53985434
*/
53995435
string GetMultiInstance_FileName(string val_filename, int val_iInst, string ext) const;
54005436

54015437
/*!
54025438
* \brief Append the instance index to the restart or the solution files.
5439+
* \param[in] val_filename - the base filename.
5440+
* \param[in] val_iInst - the current instance.
54035441
* \return Name of the restart file for the flow variables.
54045442
*/
54055443
string GetMultiInstance_HistoryFileName(string val_filename, int val_iInst) const;
@@ -5462,6 +5500,7 @@ class CConfig {
54625500
* \brief Augment the input filename with the iteration number for an unsteady file.
54635501
* \param[in] val_filename - String value of the base filename.
54645502
* \param[in] val_iter - Unsteady iteration number or time instance.
5503+
* \param[in] ext - the filename extension.
54655504
* \return Name of the file with the iteration number for an unsteady solution file.
54665505
*/
54675506
string GetUnsteady_FileName(string val_filename, int val_iter, string ext) const;
@@ -5587,6 +5626,7 @@ class CConfig {
55875626
/*!
55885627
* \brief Set the value of the design variable step, we use this value in design problems.
55895628
* \param[in] val_dv - Number of the design variable that we want to read.
5629+
* \param[in] val_ind - value of initial deformation.
55905630
* \param[in] val - Value of the design variable.
55915631
*/
55925632
void SetDV_Value(unsigned short val_dv, unsigned short val_ind, su2double val) { DV_Value[val_dv][val_ind] = val; }
@@ -5634,7 +5674,6 @@ class CConfig {
56345674

56355675
/*!
56365676
* \brief Set the type of dynamic mesh motion.
5637-
* \param[in] val_iZone - Number for the current zone in the mesh (each zone has independent motion).
56385677
* \param[in] motion_Type - Specify motion type.
56395678
*/
56405679
void SetKind_GridMovement(unsigned short motion_Type) { Kind_GridMovement = motion_Type; }
@@ -5753,7 +5792,7 @@ class CConfig {
57535792

57545793
/*!
57555794
* \brief Get the pitching phase of the mesh.
5756-
* \param[in] val_iZone - Number for the current zone in the mesh (each zone has independent motion).
5795+
* \param[in] iDim - spatial component.
57575796
* \return pitching phase of the mesh.
57585797
*/
57595798
su2double GetPitching_Phase(unsigned short iDim) const { return Pitching_Phase[iDim];}
@@ -5783,7 +5822,6 @@ class CConfig {
57835822

57845823
/*!
57855824
* \brief Get the plunging amplitude of the mesh.
5786-
* \param[in] val_iZone - Number for the current zone in the mesh (each zone has independent motion).
57875825
* \param[in] iDim - spatial component
57885826
* \return Plunging amplitude of the mesh.
57895827
*/
@@ -9375,7 +9413,7 @@ class CConfig {
93759413
/*!
93769414
* \brief GetVolumeOutputFiles
93779415
*/
9378-
const unsigned short* GetVolumeOutputFiles() const { return VolumeOutputFiles; }
9416+
const OUTPUT_TYPE* GetVolumeOutputFiles() const { return VolumeOutputFiles; }
93799417

93809418
/*!
93819419
* \brief GetnVolumeOutputFiles

Common/include/option_structure.hpp

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ static const MapType<std::string, ENUM_ROELOWDISS> RoeLowDiss_Map = {
10541054
* \brief Types of wall functions.
10551055
*/
10561056
enum class WALL_FUNCTIONS {
1057-
NONE , /*!< \brief No wall function treatment, integration to the wall. Default behavior. */
1057+
NONE , /*!< \brief No wall function treatment, integration to the wall. Default behavior. */
10581058
STANDARD_FUNCTION , /*!< \brief Standard wall function. */
10591059
ADAPTIVE_FUNCTION , /*!< \brief Adaptive wall function. Formulation depends on y+. */
10601060
SCALABLE_FUNCTION , /*!< \brief Scalable wall function. */
@@ -1450,7 +1450,7 @@ enum TURBO_MARKER_TYPE{
14501450
/*!
14511451
* \brief Types inlet boundary treatments
14521452
*/
1453-
enum INLET_TYPE {
1453+
enum class INLET_TYPE {
14541454
TOTAL_CONDITIONS, /*!< \brief User specifies total pressure, total temperature, and flow direction. */
14551455
MASS_FLOW, /*!< \brief User specifies density and velocity (mass flow). */
14561456
INPUT_FILE, /*!< \brief User specifies an input file. */
@@ -1635,65 +1635,67 @@ static const MapType<std::string, ENUM_INPUT> Input_Map = {
16351635
MakePair("BOX", BOX)
16361636
};
16371637

1638+
16381639
/*!
16391640
* \brief Type of solution output file formats
16401641
*/
1641-
enum ENUM_OUTPUT {
1642-
TECPLOT = 1, /*!< \brief Tecplot format for the solution output. */
1643-
TECPLOT_BINARY = 2, /*!< \brief Tecplot binary format for the solution output. */
1644-
SURFACE_TECPLOT = 3, /*!< \brief Tecplot format for the solution output. */
1645-
SURFACE_TECPLOT_BINARY = 4, /*!< \brief Tecplot binary format for the solution output. */
1646-
CSV = 5, /*!< \brief Comma-separated values format for the solution output. */
1647-
SURFACE_CSV = 6, /*!< \brief Comma-separated values format for the solution output. */
1648-
PARAVIEW = 7, /*!< \brief Paraview ASCII format for the solution output. */
1649-
PARAVIEW_BINARY = 8, /*!< \brief Paraview binary format for the solution output. */
1650-
SURFACE_PARAVIEW = 9, /*!< \brief Paraview ASCII format for the solution output. */
1651-
SURFACE_PARAVIEW_BINARY = 10, /*!< \brief Paraview binary format for the solution output. */
1652-
MESH = 11, /*!< \brief SU2 mesh format. */
1653-
RESTART_BINARY = 12, /*!< \brief SU2 binary restart format. */
1654-
RESTART_ASCII = 13, /*!< \brief SU2 ASCII restart format. */
1655-
STL = 14, /*!< \brief STL ASCII format for surface solution output. */
1656-
STL_BINARY = 15, /*!< \brief STL binary format for surface solution output. Not implemented yet. */
1657-
PARAVIEW_XML = 16, /*!< \brief Paraview XML with binary data format */
1658-
SURFACE_PARAVIEW_XML = 17, /*!< \brief Surface Paraview XML with binary data format */
1659-
PARAVIEW_MULTIBLOCK = 18, /*!< \brief Paraview XML Multiblock */
1660-
CGNS = 19, /*!< \brief CGNS format. */
1661-
SURFACE_CGNS = 20 /*!< \brief CGNS format. */
1662-
};
1663-
static const MapType<std::string, ENUM_OUTPUT> Output_Map = {
1664-
MakePair("TECPLOT_ASCII", TECPLOT)
1665-
MakePair("TECPLOT", TECPLOT_BINARY)
1666-
MakePair("SURFACE_TECPLOT_ASCII", SURFACE_TECPLOT)
1667-
MakePair("SURFACE_TECPLOT", SURFACE_TECPLOT_BINARY)
1668-
MakePair("CSV", CSV)
1669-
MakePair("SURFACE_CSV", SURFACE_CSV)
1670-
MakePair("PARAVIEW_ASCII", PARAVIEW)
1671-
MakePair("PARAVIEW_LEGACY", PARAVIEW_BINARY)
1672-
MakePair("SURFACE_PARAVIEW_ASCII", SURFACE_PARAVIEW)
1673-
MakePair("SURFACE_PARAVIEW_LEGACY", SURFACE_PARAVIEW_BINARY)
1674-
MakePair("PARAVIEW", PARAVIEW_XML)
1675-
MakePair("SURFACE_PARAVIEW", SURFACE_PARAVIEW_XML)
1676-
MakePair("PARAVIEW_MULTIBLOCK", PARAVIEW_MULTIBLOCK)
1677-
MakePair("RESTART_ASCII", RESTART_ASCII)
1678-
MakePair("RESTART", RESTART_BINARY)
1679-
MakePair("CGNS", CGNS)
1680-
MakePair("SURFACE_CGNS", SURFACE_CGNS)
1681-
MakePair("STL", STL)
1682-
MakePair("STL_BINARY", STL_BINARY)
1642+
enum class OUTPUT_TYPE {
1643+
TECPLOT_ASCII, /*!< \brief Tecplot format for the solution output. */
1644+
TECPLOT_BINARY, /*!< \brief Tecplot binary format for the solution output. */
1645+
SURFACE_TECPLOT_ASCII, /*!< \brief Tecplot format for the solution output. */
1646+
SURFACE_TECPLOT_BINARY, /*!< \brief Tecplot binary format for the solution output. */
1647+
CSV, /*!< \brief Comma-separated values format for the solution output. */
1648+
SURFACE_CSV, /*!< \brief Comma-separated values format for the solution output. */
1649+
PARAVIEW_ASCII, /*!< \brief Paraview ASCII format for the solution output. */
1650+
PARAVIEW_LEGACY_BINARY, /*!< \brief Paraview binary format for the solution output. */
1651+
SURFACE_PARAVIEW_ASCII, /*!< \brief Paraview ASCII format for the solution output. */
1652+
SURFACE_PARAVIEW_LEGACY_BINARY, /*!< \brief Paraview binary format for the solution output. */
1653+
MESH, /*!< \brief SU2 mesh format. */
1654+
RESTART_BINARY, /*!< \brief SU2 binary restart format. */
1655+
RESTART_ASCII, /*!< \brief SU2 ASCII restart format. */
1656+
PARAVIEW_XML, /*!< \brief Paraview XML with binary data format */
1657+
SURFACE_PARAVIEW_XML, /*!< \brief Surface Paraview XML with binary data format */
1658+
PARAVIEW_MULTIBLOCK, /*!< \brief Paraview XML Multiblock */
1659+
CGNS, /*!< \brief CGNS format. */
1660+
SURFACE_CGNS, /*!< \brief CGNS format. */
1661+
STL_ASCII, /*!< \brief STL ASCII format for surface solution output. */
1662+
STL_BINARY, /*!< \brief STL binary format for surface solution output. Not implemented yet. */
1663+
};
1664+
static const MapType<std::string, OUTPUT_TYPE> Output_Map = {
1665+
MakePair("TECPLOT_ASCII", OUTPUT_TYPE::TECPLOT_ASCII)
1666+
MakePair("TECPLOT", OUTPUT_TYPE::TECPLOT_BINARY)
1667+
MakePair("SURFACE_TECPLOT_ASCII", OUTPUT_TYPE::SURFACE_TECPLOT_ASCII)
1668+
MakePair("SURFACE_TECPLOT", OUTPUT_TYPE::SURFACE_TECPLOT_BINARY)
1669+
MakePair("CSV", OUTPUT_TYPE::CSV)
1670+
MakePair("SURFACE_CSV", OUTPUT_TYPE::SURFACE_CSV)
1671+
MakePair("PARAVIEW_ASCII", OUTPUT_TYPE::PARAVIEW_ASCII)
1672+
MakePair("PARAVIEW_LEGACY", OUTPUT_TYPE::PARAVIEW_LEGACY_BINARY)
1673+
MakePair("SURFACE_PARAVIEW_ASCII", OUTPUT_TYPE::SURFACE_PARAVIEW_ASCII)
1674+
MakePair("SURFACE_PARAVIEW_LEGACY", OUTPUT_TYPE::SURFACE_PARAVIEW_LEGACY_BINARY)
1675+
MakePair("PARAVIEW", OUTPUT_TYPE::PARAVIEW_XML)
1676+
MakePair("SURFACE_PARAVIEW", OUTPUT_TYPE::SURFACE_PARAVIEW_XML)
1677+
MakePair("PARAVIEW_MULTIBLOCK", OUTPUT_TYPE::PARAVIEW_MULTIBLOCK)
1678+
MakePair("MESH", OUTPUT_TYPE::MESH)
1679+
MakePair("RESTART_ASCII", OUTPUT_TYPE::RESTART_ASCII)
1680+
MakePair("RESTART", OUTPUT_TYPE::RESTART_BINARY)
1681+
MakePair("CGNS", OUTPUT_TYPE::CGNS)
1682+
MakePair("SURFACE_CGNS", OUTPUT_TYPE::SURFACE_CGNS)
1683+
MakePair("STL_ASCII", OUTPUT_TYPE::STL_ASCII)
1684+
MakePair("STL_BINARY", OUTPUT_TYPE::STL_BINARY)
16831685
};
16841686

16851687
/*!
16861688
* \brief Return true if format is one of the Paraview options.
16871689
*/
1688-
inline bool isParaview(ENUM_OUTPUT format) {
1690+
inline bool isParaview(OUTPUT_TYPE format) {
16891691
switch(format) {
1690-
case PARAVIEW:
1691-
case PARAVIEW_BINARY:
1692-
case SURFACE_PARAVIEW:
1693-
case SURFACE_PARAVIEW_BINARY:
1694-
case PARAVIEW_XML:
1695-
case SURFACE_PARAVIEW_XML:
1696-
case PARAVIEW_MULTIBLOCK:
1692+
case OUTPUT_TYPE::PARAVIEW_ASCII:
1693+
case OUTPUT_TYPE::PARAVIEW_LEGACY_BINARY:
1694+
case OUTPUT_TYPE::SURFACE_PARAVIEW_ASCII:
1695+
case OUTPUT_TYPE::SURFACE_PARAVIEW_LEGACY_BINARY:
1696+
case OUTPUT_TYPE::PARAVIEW_XML:
1697+
case OUTPUT_TYPE::SURFACE_PARAVIEW_XML:
1698+
case OUTPUT_TYPE::PARAVIEW_MULTIBLOCK:
16971699
return true;
16981700
default:
16991701
return false;
@@ -1703,12 +1705,12 @@ inline bool isParaview(ENUM_OUTPUT format) {
17031705
/*!
17041706
* \brief Return true if format is one of the Tecplot options.
17051707
*/
1706-
inline bool isTecplot(ENUM_OUTPUT format) {
1708+
inline bool isTecplot(OUTPUT_TYPE format) {
17071709
switch(format) {
1708-
case TECPLOT:
1709-
case TECPLOT_BINARY:
1710-
case SURFACE_TECPLOT:
1711-
case SURFACE_TECPLOT_BINARY:
1710+
case OUTPUT_TYPE::TECPLOT_ASCII:
1711+
case OUTPUT_TYPE::TECPLOT_BINARY:
1712+
case OUTPUT_TYPE::SURFACE_TECPLOT_ASCII:
1713+
case OUTPUT_TYPE::SURFACE_TECPLOT_BINARY:
17121714
return true;
17131715
default:
17141716
return false;
@@ -1718,13 +1720,13 @@ inline bool isTecplot(ENUM_OUTPUT format) {
17181720
/*!
17191721
* \brief Type of solution output file formats
17201722
*/
1721-
enum ENUM_TAB_OUTPUT {
1722-
TAB_CSV = 1, /*!< \brief Comma-separated values format for the solution output. */
1723-
TAB_TECPLOT = 2 /*!< \brief Tecplot format for the solution output. */
1723+
enum class TAB_OUTPUT {
1724+
TAB_CSV, /*!< \brief Comma-separated values format for the solution output. */
1725+
TAB_TECPLOT /*!< \brief Tecplot format for the solution output. */
17241726
};
1725-
static const MapType<std::string, ENUM_TAB_OUTPUT> TabOutput_Map = {
1726-
MakePair("CSV", TAB_CSV)
1727-
MakePair("TECPLOT", TAB_TECPLOT)
1727+
static const MapType<std::string, TAB_OUTPUT> TabOutput_Map = {
1728+
MakePair("CSV", TAB_OUTPUT::TAB_CSV)
1729+
MakePair("TECPLOT", TAB_OUTPUT::TAB_TECPLOT)
17281730
};
17291731

17301732
/*!

0 commit comments

Comments
 (0)