Skip to content

Commit

Permalink
Merge pull request #845 from su2code/feature_multiblock
Browse files Browse the repository at this point in the history
Support for Paraview/VTK XML (*.vtu) and Multiblock (*.vtm) visualization files
  • Loading branch information
pcarruscag authored Jan 28, 2020
2 parents 1a64163 + 318acd1 commit eb28158
Show file tree
Hide file tree
Showing 75 changed files with 2,423 additions and 1,972 deletions.
9 changes: 9 additions & 0 deletions Common/include/config_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,7 @@ class CConfig {
unsigned short pastix_verb_lvl; /*!< \brief Verbosity level for PaStiX */
unsigned short pastix_fill_lvl; /*!< \brief Fill level for PaStiX ILU */

string caseName; /*!< \brief Name of the current case
/*!
* \brief Set the default values of config options not set in the config file using another config object.
Expand Down Expand Up @@ -9337,11 +9338,19 @@ class CConfig {
*/
bool OptionIsSet(string option);

/*!
* \brief Get the name of the current case
* \return the case name
*/
const string& GetCaseName() const;


/*!
* \brief Get the number of threads per rank to use for ILU and LU_SGS preconditioners.
* \return Number of threads per rank.
*/
inline unsigned long GetLinear_Solver_Prec_Threads(void) const {return Linear_Solver_Prec_Threads;}

};

#include "config_structure.inl"
2 changes: 2 additions & 0 deletions Common/include/config_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2089,3 +2089,5 @@ inline unsigned short* CConfig::GetVolumeOutputFiles() {return VolumeOutputFiles
inline unsigned short CConfig::GetnVolumeOutputFiles() {return nVolumeOutputFiles;}

inline bool CConfig::OptionIsSet(string option){ return all_options.find(option) == all_options.end();}

inline const string& CConfig::GetCaseName() const { return caseName;}
12 changes: 9 additions & 3 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,10 @@ enum ENUM_OUTPUT {
RESTART_ASCII = 13, /*!< \brief SU2 ASCII restart format. */
CGNS = 14, /*!< \brief CGNS format. */
STL = 15, /*!< \brief STL ASCII format for surface solution output. */
STL_BINARY = 16 /*!< \brief STL binary format for surface solution output. Not implemented yet. */
STL_BINARY = 16, /*!< \brief STL binary format for surface solution output. Not implemented yet. */
PARAVIEW_XML = 17, /*!< \brief Paraview XML with binary data format */
SURFACE_PARAVIEW_XML = 18, /*!< \brief Surface Paraview XML with binary data format */
PARAVIEW_MULTIBLOCK = 19 /*!< \brief Paraview XML Multiblock */
};

static const map<string, ENUM_OUTPUT> Output_Map = CCreateMap<string, ENUM_OUTPUT>
Expand All @@ -1537,9 +1540,12 @@ static const map<string, ENUM_OUTPUT> Output_Map = CCreateMap<string, ENUM_OUTPU
("CSV", CSV)
("SURFACE_CSV", SURFACE_CSV)
("PARAVIEW_ASCII", PARAVIEW)
("PARAVIEW", PARAVIEW_BINARY)
("PARAVIEW_LEGACY", PARAVIEW_BINARY)
("SURFACE_PARAVIEW_ASCII", SURFACE_PARAVIEW)
("SURFACE_PARAVIEW", SURFACE_PARAVIEW_BINARY)
("SURFACE_PARAVIEW_LEGACY", SURFACE_PARAVIEW_BINARY)
("PARAVIEW", PARAVIEW_XML)
("SURFACE_PARAVIEW", SURFACE_PARAVIEW_XML)
("PARAVIEW_MULTIBLOCK", PARAVIEW_MULTIBLOCK)
("RESTART_ASCII", RESTART_ASCII)
("RESTART", RESTART_BINARY)
("CGNS", CGNS)
Expand Down
40 changes: 39 additions & 1 deletion Common/src/config_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ vector<double> GEMM_Profile_MaxTime; /*!< \brief Maximum time spent for thi

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software, bool verb_high) {

/*--- Set the case name to the base config file name without extension ---*/

caseName = PrintingToolbox::split(string(case_filename),'.')[0];

base_config = true;

/*--- Store MPI rank and size ---*/
Expand Down Expand Up @@ -102,6 +106,8 @@ CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_softwar

CConfig::CConfig(CConfig* config, char case_filename[MAX_STRING_SIZE], unsigned short val_software, unsigned short val_iZone, unsigned short val_nZone, bool verb_high) {

caseName = config->GetCaseName();

unsigned short val_nDim;

base_config = false;
Expand Down Expand Up @@ -157,6 +163,10 @@ CConfig::CConfig(CConfig* config, char case_filename[MAX_STRING_SIZE], unsigned

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_software) {

/*--- Set the case name to the base config file name without extension ---*/

caseName = PrintingToolbox::split(string(case_filename),'.')[0];

base_config = true;

nZone = 1;
Expand Down Expand Up @@ -203,6 +213,10 @@ CConfig::CConfig(char case_filename[MAX_STRING_SIZE], unsigned short val_softwar

CConfig::CConfig(char case_filename[MAX_STRING_SIZE], CConfig *config) {

/*--- Set the case name to the base config file name without extension ---*/

caseName = PrintingToolbox::split(string(case_filename),'.')[0];

base_config = true;

/*--- Store MPI rank and size ---*/
Expand Down Expand Up @@ -760,6 +774,7 @@ void CConfig::SetPointersNull(void) {
HistoryOutput = NULL;
VolumeOutput = NULL;
VolumeOutputFiles = NULL;
ConvField = NULL;

/*--- Variable initialization ---*/

Expand Down Expand Up @@ -7543,6 +7558,8 @@ CConfig::~CConfig(void) {
if (VolumeOutput != NULL) delete [] VolumeOutput;
if (Mesh_Box_Size != NULL) delete [] Mesh_Box_Size;
if (VolumeOutputFiles != NULL) delete [] VolumeOutputFiles;

if (ConvField != NULL) delete [] ConvField;

}

Expand Down Expand Up @@ -9459,7 +9476,28 @@ void CConfig::SetMultizone(CConfig *driver_config, CConfig **config_container){
if(driver_config->GetWnd_Cauchy_Crit() == true){
SU2_MPI::Error("Option WINDOW_CAUCHY_CRIT must be deactivated for multizone problems.", CURRENT_FUNCTION);
}


bool multiblockDriver = false;
for (unsigned short iFiles = 0; iFiles < driver_config->GetnVolumeOutputFiles(); iFiles++){
if (driver_config->GetVolumeOutputFiles()[iFiles] == PARAVIEW_MULTIBLOCK){
multiblockDriver = true;
}
}

bool multiblockZone = false;
for (unsigned short iZone = 0; iZone < nZone; iZone++){
multiblockZone = false;
for (unsigned short iFiles = 0; iFiles < config_container[iZone]->GetnVolumeOutputFiles(); iFiles++){
if (config_container[iZone]->GetVolumeOutputFiles()[iFiles] == PARAVIEW_MULTIBLOCK){
multiblockZone = true;
}
}
if (multiblockZone != multiblockDriver){
SU2_MPI::Error("To enable PARAVIEW_MULTIBLOCK output, add it to OUTPUT_FILES option in main config and\n"
"remove option from sub-config files.", CURRENT_FUNCTION);
}
}

/*--- Set the Restart iter for time dependent problems ---*/
if (driver_config->GetRestart()){
Unst_RestartIter = driver_config->GetRestart_Iter();
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CAdjElasticityOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
6 changes: 3 additions & 3 deletions SU2_CFD/include/output/CAdjFlowIncOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down Expand Up @@ -37,8 +37,8 @@
class CAdjFlowIncOutput final: public COutput {
private:

unsigned short turb_model; /*!< \brief The kind of turbulence model*/
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
unsigned short turb_model; /*!< \brief The kind of turbulence model*/
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/

public:
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CAdjFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CAdjHeatOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CBaselineOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CElasticityOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CFlowCompFEMOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CFlowCompOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CFlowIncOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CFlowOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CHeatOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CMeshOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/CMultizoneOutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
10 changes: 5 additions & 5 deletions SU2_CFD/include/output/COutput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down Expand Up @@ -224,7 +224,7 @@ class COutput {
su2double initResidual; /*!< \brief Initial value of the residual to evaluate the convergence level. */
vector<string> convFields; /*!< \brief Name of the field to be monitored for convergence. */

/*----------------------------- Adaptive CFL ----------------------------*/
/*----------------------------- Adaptive CFL ----------------------------*/

su2double rhoResNew, /*!< New value of the residual for adaptive CFL routine. */
rhoResOld; /*!< Old value of the residual for adaptive CFL routine. */
Expand Down Expand Up @@ -368,11 +368,11 @@ class COutput {
* \return Value of the field
*/
su2double GetHistoryFieldValue(string field){
return historyOutput_Map[field].value;
return historyOutput_Map.at(field).value;
}

su2double GetHistoryFieldValuePerSurface(string field, unsigned short iMarker){
return historyOutputPerSurface_Map[field][iMarker].value;
return historyOutputPerSurface_Map.at(field)[iMarker].value;
}

/*!
Expand All @@ -383,7 +383,7 @@ class COutput {
vector<HistoryOutputField> GetHistoryGroup(string groupname){
vector<HistoryOutputField> HistoryGroup;
for (unsigned short iField = 0; iField < historyOutput_Map.size(); iField++){
if (historyOutput_Map[historyOutput_List[iField]].outputGroup == groupname){
if (historyOutput_Map.at(historyOutput_List[iField]).outputGroup == groupname){
HistoryGroup.push_back((historyOutput_Map[historyOutput_List[iField]]));
}
}
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/output/COutputLegacy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down
13 changes: 5 additions & 8 deletions SU2_CFD/include/output/filewriter/CCSVFileWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand All @@ -33,14 +33,11 @@ class CCSVFileWriter final: public CFileWriter{
public:

/*!
* \brief Construct a file writer using field names, file extension and dimension.
* \param[in] fields - A list of field names
* \param[in] nDim - Physical dimension
* \brief Construct a file writer using field name and the data sorter.
* \param[in] valFileName - The name of the file
* \param[in] valDataSorter - The parallel sorted data to write
*/
CCSVFileWriter(vector<string> fields,
unsigned short nDim,
string fileName,
CParallelDataSorter* data_sorter);
CCSVFileWriter(string valFileName, CParallelDataSorter* valDataSorter);

/*!
* \brief Destructor
Expand Down
6 changes: 3 additions & 3 deletions SU2_CFD/include/output/filewriter/CFEMDataSorter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2019, SU2 Contributors (cf. AUTHORS.md)
Expand Down Expand Up @@ -37,9 +37,9 @@ class CFEMDataSorter final: public CParallelDataSorter{
* \brief Constructor
* \param[in] config - Pointer to the current config structure
* \param[in] geometry - Pointer to the current geometry
* \param[in] nFields - Number of output fields
* \param[in] valFieldNames - Vector containing the field names
*/
CFEMDataSorter(CConfig *config, CGeometry *geometry, unsigned short nFields);
CFEMDataSorter(CConfig *config, CGeometry *geometry, const vector<string> &valFieldNames);

/*!
* \brief Destructor
Expand Down
Loading

0 comments on commit eb28158

Please sign in to comment.