Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write compact restart files #2372

Merged
merged 59 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
838cd96
initial idea
bigfooted Oct 31, 2024
7d30a57
Merge branch 'develop' into feature_small_restart
bigfooted Oct 31, 2024
4fdc8b4
do not write SOLUTION by default
bigfooted Oct 31, 2024
028d148
Merge branch 'feature_small_restart' of https://github.com/su2code/su…
bigfooted Oct 31, 2024
de9ce79
small cleanup
bigfooted Oct 31, 2024
2992d7c
change default to false
bigfooted Nov 1, 2024
79bce1f
Merge branch 'develop' into feature_small_restart
bigfooted Nov 5, 2024
af2fd4f
fixed
bigfooted Nov 6, 2024
1f43902
cleanup
bigfooted Nov 6, 2024
f968780
variable renaming
bigfooted Nov 6, 2024
d2e69ea
Merge branch 'develop' into feature_small_restart
bigfooted Nov 19, 2024
ecfca08
Fix code scanning alert no. 625: Comparison of narrow type with wide …
bigfooted Nov 20, 2024
202cc3c
include surface csv
bigfooted Nov 21, 2024
8fbc825
change to size_t
bigfooted Nov 21, 2024
9307d7d
remove variable
bigfooted Nov 21, 2024
3db0627
change to size_t
bigfooted Nov 21, 2024
4c2ba55
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 25, 2024
fb8e895
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 25, 2024
6dc6724
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 25, 2024
bb0a568
Update Common/src/CConfig.cpp
bigfooted Nov 25, 2024
a5d27b3
Update config_template.cfg
bigfooted Nov 25, 2024
b18b92d
Update SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp
bigfooted Nov 25, 2024
b6f23c3
Update SU2_CFD/include/output/COutput.hpp
bigfooted Nov 25, 2024
c5a6c5e
introduce COMPACT keyword
bigfooted Nov 26, 2024
8cd04b0
update dry-run text
bigfooted Nov 26, 2024
4d6f92e
Update SU2_CFD/include/output/COutput.hpp
bigfooted Nov 27, 2024
1ba790c
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 27, 2024
d9ec993
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 27, 2024
e48c22a
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 27, 2024
6e6c70e
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 27, 2024
9134d8b
Update SU2_CFD/src/output/COutput.cpp
bigfooted Nov 27, 2024
1a0aef8
add better config_template description
bigfooted Nov 27, 2024
da4c87e
update variable name
bigfooted Nov 27, 2024
d54eb64
update variable name
bigfooted Nov 27, 2024
915fa30
update variable name
bigfooted Nov 27, 2024
2ece849
do not use compact to pass regressions
bigfooted Nov 27, 2024
605d42d
update naca0012 cfg
bigfooted Nov 27, 2024
cb748fd
fix writing surface csv
bigfooted Nov 27, 2024
452d589
add SENSITIVITY to required restart fields
bigfooted Nov 27, 2024
dc99d6f
fix regression tests
bigfooted Nov 27, 2024
145018b
add compact=no to pywrapper regressions
bigfooted Nov 29, 2024
b61e7ce
add compact=no to pywrapper regressions
bigfooted Nov 29, 2024
8645120
add compact=no to pywrapper regressions
bigfooted Nov 29, 2024
a9682ac
stl writer - change SU2_SOL to SU2_CFD
bigfooted Dec 1, 2024
cedd0b3
Merge branch 'develop' into feature_small_restart
bigfooted Dec 12, 2024
e22089f
fixing binary restart
bigfooted Dec 22, 2024
d93ffeb
Merge branch 'feature_small_restart' of https://github.com/su2code/su…
bigfooted Dec 22, 2024
49e7a81
Merge branch 'develop' into feature_small_restart
bigfooted Dec 22, 2024
35ee183
Merge branch 'feature_small_restart' of https://github.com/su2code/su…
bigfooted Dec 22, 2024
ff240b9
Merge branch 'develop' into feature_small_restart
bigfooted Dec 27, 2024
5064a89
Merge branch 'develop' into feature_small_restart
bigfooted Dec 29, 2024
dc862fd
compact restart testcases quick update
bigfooted Dec 29, 2024
76fddc4
compact restart for flamelet
bigfooted Dec 31, 2024
7a66387
remove unnecessary WRT_COMPACT_RESTART statements
bigfooted Dec 31, 2024
60d7256
remove unnecessary WRT_COMPACT_RESTART statements
bigfooted Jan 1, 2025
e599fa1
index cache for compact
pcarruscag Jan 1, 2025
cf4f609
missing initialization
pcarruscag Jan 1, 2025
ae84d15
time average fix
pcarruscag Jan 2, 2025
13b08f5
fix...
pcarruscag Jan 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ class CConfig {
unsigned long StartConv_Iter; /*!< \brief Start convergence criteria at iteration. */
su2double Cauchy_Eps; /*!< \brief Epsilon used for the convergence. */
bool Restart, /*!< \brief Restart solution (for direct, adjoint, and linearized problems).*/
Wrt_Restart_Compact, /*!< \brief Write compact restart files with minimum nr. of variables. */
Read_Binary_Restart, /*!< \brief Read binary SU2 native restart files.*/
Wrt_Restart_Overwrite, /*!< \brief Overwrite restart files or append iteration number.*/
Wrt_Surface_Overwrite, /*!< \brief Overwrite surface output files or append iteration number.*/
Expand Down Expand Up @@ -5503,6 +5504,12 @@ class CConfig {
*/
bool GetRead_Binary_Restart(void) const { return Read_Binary_Restart; }

/*!
* \brief Flag for whether restart files contain only necessary variables.
* \return Flag <code>TRUE</code> then the code will write compact restart files.
*/
bool GetWrt_Restart_Compact(void) const { return Wrt_Restart_Compact; }

/*!
* \brief Flag for whether restart solution files are overwritten.
* \return Flag for overwriting. If Flag=false, iteration nr is appended to filename
Expand Down
2 changes: 2 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,8 @@ void CConfig::SetConfig_Options() {

/*!\brief RESTART_SOL \n DESCRIPTION: Restart solution from native solution file \n Options: NO, YES \ingroup Config */
addBoolOption("RESTART_SOL", Restart, false);
/*!\brief WRT_RESTART_COMPACT \n DESCRIPTION: Minimize the size of restart files \n Options: NO, YES \ingroup Config */
addBoolOption("WRT_RESTART_COMPACT", Wrt_Restart_Compact, true);
/*!\brief BINARY_RESTART \n DESCRIPTION: Read binary SU2 native restart files. \n Options: YES, NO \ingroup Config */
addBoolOption("READ_BINARY_RESTART", Read_Binary_Restart, true);
/*!\brief WRT_RESTART_OVERWRITE \n DESCRIPTION: overwrite restart files or append iteration number. \n Options: YES, NO \ingroup Config */
Expand Down
27 changes: 17 additions & 10 deletions SU2_CFD/include/output/COutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ class COutput {
/*----------------------------- Volume output ----------------------------*/

CParallelDataSorter* volumeDataSorter; //!< Volume data sorter
CParallelDataSorter* volumeDataSorterCompact; //!< Volume data sorter
CParallelDataSorter* surfaceDataSorter; //!< Surface data sorter

vector<string> volumeFieldNames; //!< Vector containing the volume field names
unsigned short nVolumeFields; //!< Number of fields in the volume output

vector<string> requiredVolumeFieldNames; //!< Vector containing the minimum required volume field names.

string volumeFilename, //!< Volume output filename
surfaceFilename, //!< Surface output filename
Expand All @@ -259,10 +261,12 @@ class COutput {
/*! \brief The name of the field, i.e. the name that is printed in the file header.*/
string fieldName;
/*! \brief This value identifies the position of the values of this field at each node in the ::Local_Data array. */
short offset;
short offset;
/*! \brief This offset is used for the compact formulation. */
short offsetCompact;
/*! \brief The group this field belongs to. */
string outputGroup;
/*! \brief String containing the description of the field */
/*! \brief String containing the description of the field. */
string description;
/*! \brief Default constructor. */
VolumeOutputField () {}
Expand All @@ -277,22 +281,25 @@ class COutput {
/*! \brief Vector that contains the keys of the ::volumeOutput_Map in the order of their insertion. */
std::vector<string> volumeOutput_List;

/*! \brief Vector to cache the positions of the field in the data array */
/*! \brief Vector to cache the positions of the field in the data array. */
std::vector<short> fieldIndexCache;
/*! \brief Current value of the cache index */
/*! \brief Current value of the cache index. */
unsigned short cachePosition;
/*! \brief Boolean to store whether the field index cache should be build. */
bool buildFieldIndexCache;
/*! \brief Vector to cache the positions of the field in the data array */
/*! \brief Vector to cache the positions of the field in the data array. */
std::vector<short> fieldGetIndexCache;
/*! \brief Current value of the cache index */
/*! \brief Current value of the cache index. */
unsigned short curGetFieldIndex;

/*! \brief Requested volume field names in the config file. */
std::vector<string> requestedVolumeFields;
/*! \brief Number of requested volume field names in the config file. */
unsigned short nRequestedVolumeFields;

/*! \brief Minimum required volume fields for restart file. */
const std::vector<string> restartVolumeFields = {"COORDINATES", "SOLUTION", "SENSITIVITY", "GRID_VELOCITY"};
bigfooted marked this conversation as resolved.
Show resolved Hide resolved

/*----------------------------- Convergence monitoring ----------------------------*/

su2double cauchyValue, /*!< \brief Summed value of the convergence indicator. */
Expand Down Expand Up @@ -959,14 +966,14 @@ class COutput {

/*!
* \brief Sets the turboperformance screen output
* \param[in] TurboPerf - Turboperformance class
* \param[in] TurboPerf - Turboperformance class
* \param[in] config - Definition of the particular problem
* \param[in] TimeIter - Index of the current time-step
* \param[in] OuterIter - Index of current outer iteration
* \param[in] InnerIter - Index of current inner iteration
*/
inline virtual void SetTurboPerformance_Output(std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config, unsigned long TimeIter, unsigned long OuterIter, unsigned long InnerIter) {}

/*!
* \brief Sets the multizone turboperformacne screen output
* \param[in] TurboStagePerf - Stage turboperformance class
Expand All @@ -982,7 +989,7 @@ class COutput {
* \param[in] config - Definition of the particular problem
*/
inline virtual void LoadTurboHistoryData(std::shared_ptr<CTurbomachineryStagePerformance> TurboStagePerf, std::shared_ptr<CTurboOutput> TurboPerf, CConfig *config) {}

/*!
* \brief Write the kinematic and thermodynamic variables at each spanwise division
* \param[in] solver - The container hold all solution data
Expand Down
19 changes: 18 additions & 1 deletion SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class CParallelDataSorter{
int nSends, //!< Number of sends
nRecvs; //!< Number of receives

vector<string> fieldNames; //!< Vector with names of the output fields
vector<string> fieldNames; //!< Vector with names of all the output fields
vector<string> requiredFieldNames; //!< Vector with names of the required output fields that we write to file

unsigned short nDim; //!< Spatial dimension of the data

Expand Down Expand Up @@ -340,6 +341,22 @@ class CParallelDataSorter{
return fieldNames;
}

/*!
* \brief Get the vector containing the names of the required output fields
* \return Vector of strings containing the required field names
*/
const vector<string>& GetRequiredFieldNames() const{
return requiredFieldNames;
}

/*!
* \brief Set the vector of required output fields.
* \return None.
*/
void SetRequiredFieldNames(const vector<string>& req_field_names) {
requiredFieldNames = req_field_names;
}

/*!
* \brief Get the spatial dimension
* \return The spatial dimension
Expand Down
Loading
Loading