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

[WIP] fix volume names #2079

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
19fc59d
fix volume names
bigfooted Jul 9, 2023
9ef203f
Merge branch 'develop' into fix_volume_names
bigfooted Jul 12, 2023
59a0f58
Merge branch 'develop' into fix_volume_names
bigfooted Jul 19, 2023
627356e
Merge branch 'develop' into fix_volume_names
bigfooted Jul 25, 2023
6ce0cce
Merge branch 'develop' into fix_volume_names
bigfooted Jul 26, 2023
2a0e7db
Merge branch 'develop' into fix_volume_names
bigfooted Aug 8, 2023
32ac2ea
Merge branch 'develop' into fix_volume_names
bigfooted Aug 18, 2023
3b8bcd5
Merge branch 'develop' into fix_volume_names
bigfooted Aug 21, 2023
4f87d14
Merge branch 'develop' into fix_volume_names
bigfooted Aug 25, 2023
4269a4c
Merge branch 'develop' into fix_volume_names
bigfooted Aug 29, 2023
cdbcb43
Merge branch 'develop' into fix_volume_names
bigfooted Sep 15, 2023
3fa684d
remove other last_of occurrences
bigfooted Sep 21, 2023
92dacb0
Merge branch 'develop' into fix_volume_names
bigfooted Oct 26, 2023
0e729fa
Merge branch 'develop' into fix_volume_names
bigfooted Nov 17, 2023
a251a58
Merge branch 'develop' into fix_volume_names
bigfooted Feb 7, 2024
df9aecb
Merge branch 'develop' into fix_volume_names
bigfooted Feb 15, 2024
cba0317
Merge branch 'develop' into fix_volume_names
bigfooted Feb 27, 2024
f4bf669
Merge branch 'develop' into fix_volume_names
bigfooted Mar 5, 2024
b119bcb
Merge branch 'develop' into fix_volume_names
bigfooted Apr 4, 2024
6632ade
Merge branch 'develop' into fix_volume_names
bigfooted Apr 24, 2024
bde4228
Merge branch 'develop' into fix_volume_names
bigfooted May 14, 2024
5c08794
Merge branch 'develop' into fix_volume_names
bigfooted Jun 4, 2024
a4f031e
Merge branch 'develop' into fix_volume_names
bigfooted Jul 10, 2024
024a0a2
Merge branch 'develop' into fix_volume_names
bigfooted Aug 8, 2024
e351550
remove suffix from vandv
bigfooted Aug 8, 2024
8318ebd
remove suffix from testcases
bigfooted Aug 8, 2024
921d4d6
remove suffix from testcases
bigfooted Aug 8, 2024
92cc9cc
remove suffix from testcases
bigfooted Aug 8, 2024
acb72b3
suffix in subfunctions
bigfooted Aug 9, 2024
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
2 changes: 1 addition & 1 deletion Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5672,7 +5672,7 @@ class CConfig {
* \param[in] val_iInst - the current instance.
* \return Name of the restart file for the flow variables.
*/
string GetMultiInstance_HistoryFileName(string val_filename, int val_iInst) const;
string GetMultiInstance_HistoryFileName(string val_filename, int val_iInst, const string& ext) const;

/*!
* \brief Get the name of the restart file for the flow variables.
Expand Down
65 changes: 34 additions & 31 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2158,13 +2158,13 @@ void CConfig::SetConfig_Options() {
/*!\brief BREAKDOWN_FILENAME \n DESCRIPTION: Output file forces breakdown \ingroup Config*/
addStringOption("BREAKDOWN_FILENAME", Breakdown_FileName, string("forces_breakdown.dat"));
/*!\brief SOLUTION_FLOW_FILENAME \n DESCRIPTION: Restart flow input file (the file output under the filename set by RESTART_FLOW_FILENAME) \n DEFAULT: solution_flow.dat \ingroup Config */
addStringOption("SOLUTION_FILENAME", Solution_FileName, string("solution.dat"));
addStringOption("SOLUTION_FILENAME", Solution_FileName, string("solution"));
/*!\brief SOLUTION_ADJ_FILENAME\n DESCRIPTION: Restart adjoint input file. Objective function abbreviation is expected. \ingroup Config*/
addStringOption("SOLUTION_ADJ_FILENAME", Solution_AdjFileName, string("solution_adj.dat"));
addStringOption("SOLUTION_ADJ_FILENAME", Solution_AdjFileName, string("solution_adj"));
/*!\brief RESTART_FLOW_FILENAME \n DESCRIPTION: Output file restart flow \ingroup Config*/
addStringOption("RESTART_FILENAME", Restart_FileName, string("restart.dat"));
addStringOption("RESTART_FILENAME", Restart_FileName, string("restart"));
/*!\brief RESTART_ADJ_FILENAME \n DESCRIPTION: Output file restart adjoint. Objective function abbreviation will be appended. \ingroup Config*/
addStringOption("RESTART_ADJ_FILENAME", Restart_AdjFileName, string("restart_adj.dat"));
addStringOption("RESTART_ADJ_FILENAME", Restart_AdjFileName, string("restart_adj"));
/*!\brief VOLUME_FLOW_FILENAME \n DESCRIPTION: Output file flow (w/o extension) variables \ingroup Config */
addStringOption("VOLUME_FILENAME", Volume_FileName, string("vol_solution"));
/*!\brief VOLUME_ADJ_FILENAME
Expand Down Expand Up @@ -8249,11 +8249,6 @@ CConfig::~CConfig() {

string CConfig::GetFilename(string filename, const string& ext, int timeIter) const {

/*--- Remove any extension --- */

unsigned short lastindex = filename.find_last_of('.');
filename = filename.substr(0, lastindex);

/*--- Add the extension --- */

filename = filename + string(ext);
Expand All @@ -8267,9 +8262,8 @@ string CConfig::GetFilename(string filename, const string& ext, int timeIter) co
filename = GetMultiInstance_FileName(filename, GetiInst(), ext);

/*--- Append the iteration number for unsteady problems ---*/
if (GetTime_Domain()){
if (GetTime_Domain())
filename = GetUnsteady_FileName(filename, timeIter, ext);
}

return filename;
}
Expand All @@ -8286,15 +8280,17 @@ string CConfig::GetUnsteady_FileName(string val_filename, int val_iter, const st
string UnstExt, UnstFilename = std::move(val_filename);
char buffer[50];

/*--- Note that we always call this routine wit the extension already attached, so
we remove it. ---*/
unsigned short lastindex = UnstFilename.find_last_of('.');
UnstFilename = UnstFilename.substr(0, lastindex);

/*--- Check that a positive value iteration is requested (for now). ---*/

if (val_iter < 0) {
SU2_MPI::Error("Requesting a negative iteration number for the restart file!!", CURRENT_FUNCTION);
}

unsigned short lastindex = UnstFilename.find_last_of('.');
UnstFilename = UnstFilename.substr(0, lastindex);

/*--- Append iteration number for unsteady cases ---*/

if (Time_Domain) {
Expand All @@ -8317,6 +8313,8 @@ string CConfig::GetMultizone_FileName(string val_filename, int val_iZone, const
string multizone_filename = std::move(val_filename);
char buffer[50];

/*--- Note that we always call this routine wit the extension already attached, so
we remove it. ---*/
unsigned short lastindex = multizone_filename.find_last_of('.');
multizone_filename = multizone_filename.substr(0, lastindex);

Expand All @@ -8331,41 +8329,51 @@ string CConfig::GetMultizone_FileName(string val_filename, int val_iZone, const

string CConfig::GetMultizone_HistoryFileName(string val_filename, int val_iZone, const string& ext) const {

string multizone_filename = std::move(val_filename);
char buffer[50];
unsigned short lastindex = multizone_filename.find_last_of('.');
multizone_filename = multizone_filename.substr(0, lastindex);
if (Multizone_Problem) {
SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iZone));
multizone_filename.append(string(buffer));
}
multizone_filename += ext;
return multizone_filename;
string multizone_filename = std::move(val_filename);
char buffer[50];

/*--- Note that we always call this routine wit the extension already attached, so
we remove it. ---*/
unsigned short lastindex = multizone_filename.find_last_of('.');
multizone_filename = multizone_filename.substr(0, lastindex);

if (Multizone_Problem) {
SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iZone));
multizone_filename.append(string(buffer));
}
multizone_filename += ext;
return multizone_filename;
}

string CConfig::GetMultiInstance_FileName(string val_filename, int val_iInst, const string& ext) const {

string multizone_filename = std::move(val_filename);
char buffer[50];

/*--- Note that we always call this routine wit the extension already attached, so
we remove it. ---*/
unsigned short lastindex = multizone_filename.find_last_of('.');
multizone_filename = multizone_filename.substr(0, lastindex);

SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst));
multizone_filename.append(string(buffer));
multizone_filename += ext;
return multizone_filename;
}

string CConfig::GetMultiInstance_HistoryFileName(string val_filename, int val_iInst) const {
string CConfig::GetMultiInstance_HistoryFileName(string val_filename, int val_iInst, const string& ext) const {

string multizone_filename = std::move(val_filename);
char buffer[50];

/*--- Note that we always call this routine wit the extension already attached, so
we remove it. ---*/
unsigned short lastindex = multizone_filename.find_last_of('.');
multizone_filename = multizone_filename.substr(0, lastindex);

SPRINTF (buffer, "_%d", SU2_TYPE::Int(val_iInst));
multizone_filename.append(string(buffer));

multizone_filename += ext;
return multizone_filename;
}

Expand All @@ -8375,11 +8383,6 @@ string CConfig::GetObjFunc_Extension(string val_filename) const {

if (ContinuousAdjoint || DiscreteAdjoint) {

/*--- Remove filename extension (.dat) ---*/

unsigned short lastindex = Filename.find_last_of('.');
Filename = Filename.substr(0, lastindex);

if (nObj==1) {
switch (Kind_ObjFunc[0]) {
case DRAG_COEFFICIENT: AdjExt = "_cd"; break;
Expand Down
2 changes: 0 additions & 2 deletions Common/src/geometry/CPhysicalGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5676,8 +5676,6 @@ void CPhysicalGeometry::SetTurboVertex(CConfig* config, unsigned short val_iZone
char buffer[50];

if (GetnZone() > 1) {
unsigned short lastindex = multizone_filename.find_last_of('.');
multizone_filename = multizone_filename.substr(0, lastindex);
SPRINTF(buffer, "_%d.dat", SU2_TYPE::Int(val_iZone));
multizone_filename.append(string(buffer));
}
Expand Down
7 changes: 1 addition & 6 deletions Common/src/grid_movement/CSurfaceMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3514,8 +3514,6 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry* geometry, CConfig* con
physical time, so perform mesh motion in reverse. ---*/
unsigned long nFlowIter = config->GetnTime_Iter() - 1;
flowIter = nFlowIter - iter;
unsigned short lastindex = DV_Filename.find_last_of('.');
DV_Filename = DV_Filename.substr(0, lastindex);
if ((SU2_TYPE::Int(flowIter) >= 0) && (SU2_TYPE::Int(flowIter) < 10))
SPRINTF(buffer, "_0000%d.dat", SU2_TYPE::Int(flowIter));
if ((SU2_TYPE::Int(flowIter) >= 10) && (SU2_TYPE::Int(flowIter) < 100))
Expand All @@ -3530,8 +3528,6 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry* geometry, CConfig* con
} else {
/*--- Forward time for the direct problem ---*/
flowIter = iter;
unsigned short lastindex = DV_Filename.find_last_of('.');
DV_Filename = DV_Filename.substr(0, lastindex);
if ((SU2_TYPE::Int(flowIter) >= 0) && (SU2_TYPE::Int(flowIter) < 10))
SPRINTF(buffer, "_0000%d.dat", SU2_TYPE::Int(flowIter));
if ((SU2_TYPE::Int(flowIter) >= 10) && (SU2_TYPE::Int(flowIter) < 100))
Expand Down Expand Up @@ -4922,8 +4918,7 @@ void CSurfaceMovement::WriteFFDInfo(CSurfaceMovement** surface_movement, CGeomet
/*--- Read the name of the output file ---*/

auto str = config[ZONE_0]->GetMesh_Out_FileName();
unsigned short lastindex = str.find_last_of('.');
str = str.substr(0, lastindex) + ".su2";
str = ".su2";

output_file.precision(15);
output_file.open(str, ios::out | ios::app);
Expand Down
8 changes: 4 additions & 4 deletions QuickStart/inv_NACA0012.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ MESH_FORMAT= SU2
MESH_OUT_FILENAME= mesh_out.su2
%
% Restart flow input file
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_FILENAME= solution_flow
%
% Restart adjoint input file
SOLUTION_ADJ_FILENAME= solution_adj.dat
SOLUTION_ADJ_FILENAME= solution_adj
%
% Output file format (TECPLOT, CSV)
TABULAR_FORMAT= CSV
Expand All @@ -262,10 +262,10 @@ TABULAR_FORMAT= CSV
CONV_FILENAME= history
%
% Output file restart flow
RESTART_FILENAME= restart_flow.dat
RESTART_FILENAME= restart_flow
%
% Output file restart adjoint
RESTART_ADJ_FILENAME= restart_adj.dat
RESTART_ADJ_FILENAME= restart_adj
%
% Output file flow (w/o extension) variables
VOLUME_FILENAME= flow
Expand Down
16 changes: 7 additions & 9 deletions SU2_CFD/src/output/COutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output):
volumeFilename = "volume";
restartFilename = "restart";

/*--- Retrieve the history filename ---*/

historyFilename = config->GetConv_FileName();

/*--- Add the correct file extension depending on the file format ---*/

string hist_ext = ".csv";
if (config->GetTabular_FileFormat() == TAB_OUTPUT::TAB_TECPLOT) hist_ext = ".dat";

/*--- Retrieve the history filename ---*/

historyFilename = config->GetConv_FileName() + string(hist_ext);

/*--- Append the zone ID ---*/

historyFilename = config->GetMultizone_HistoryFileName(historyFilename, config->GetiZone(), hist_ext);
Expand Down Expand Up @@ -169,7 +171,7 @@ COutput::COutput(const CConfig *config, unsigned short ndim, bool fem_output):
volumeDataSorter = nullptr;
surfaceDataSorter = nullptr;

headerNeeded = false;
headerNeeded = false;
}

COutput::~COutput() {
Expand Down Expand Up @@ -233,7 +235,7 @@ void COutput::SetHistoryOutput(CGeometry ****geometry, CSolver *****solver, CCon

if (config[ZONE_0]->GetMultizone_Problem())
Iter = OuterIter;

/*--- Turbomachinery Performance Screen summary output---*/
if (Iter%100 == 0 && rank == MASTER_NODE) {
SetTurboPerformance_Output(TurboPerf, config[val_iZone], TimeIter, OuterIter, InnerIter);
Expand Down Expand Up @@ -360,15 +362,11 @@ void COutput::LoadData(CGeometry *geometry, CConfig *config, CSolver** solver_co

}

void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE format, string fileName){
void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE format, string fileName) {

/*--- File writer that will later be used to write the file to disk. Created below in the "switch" ---*/
CFileWriter *fileWriter = nullptr;

/*--- If it is still present, strip the extension (suffix) from the filename ---*/
const auto lastindex = fileName.find_last_of('.');
fileName = fileName.substr(0, lastindex);

/*--- If the filename with appended iteration is set (depending on the WRT_*_OVERWRITE options)
* two files are writen, the normal one and a copy to avoid overwriting previous outputs. ---*/
string filename_iter, extension;
Expand Down
5 changes: 3 additions & 2 deletions SU2_CFD/src/solvers/CBaselineSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ void CBaselineSolver::SetOutputVariables(CGeometry *geometry, CConfig *config) {
} else {
filename = config->GetSolution_FileName();
}


//nijso
cout << "filename = "<<filename << endl;
/*--- Read only the number of variables in the restart file. ---*/

if (config->GetRead_Binary_Restart()) {

/*--- Multizone problems require the number of the zone to be appended. ---*/

filename = config->GetFilename(filename, ".dat", config->GetTimeIter());
cout << "filename = "<<filename << endl;

char fname[100];
strcpy(fname, filename.c_str());
Expand Down
4 changes: 2 additions & 2 deletions TestCases/aeroelastic/aeroelastic_NACA64A010.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ CONV_CAUCHY_EPS= 1E-10
%
MESH_FILENAME= mesh_NACA64A010_hybrid_inv.su2
MESH_FORMAT= SU2
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_FILENAME= solution_flow
TABULAR_FORMAT= CSV
CONV_FILENAME= history
RESTART_FILENAME= restart_flow.dat
RESTART_FILENAME= restart_flow
VOLUME_FILENAME= flow
SURFACE_FILENAME= surface_flow
OUTPUT_WRT_FREQ= 1000
Expand Down
4 changes: 2 additions & 2 deletions TestCases/axisymmetric_rans/air_nozzle/air_nozzle_restart.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ CONV_STARTITER= 10
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
%
MESH_FILENAME= nozzle.su2
SOLUTION_FILENAME= solution_flow.dat
RESTART_FILENAME= restart_flow.dat
SOLUTION_FILENAME= solution_flow
RESTART_FILENAME= restart_flow
OUTPUT_WRT_FREQ= 1000
SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, RMS_TKE, RMS_DISSIPATION, TOTAL_HEATFLUX, \
RMS_ADJ_DENSITY, RMS_ADJ_ENERGY, RMS_ADJ_TKE, RMS_ADJ_DISSIPATION)
8 changes: 4 additions & 4 deletions TestCases/cont_adj_euler/naca0012/inv_NACA0012.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ CONV_CAUCHY_EPS= 1E-6
MESH_FILENAME= mesh_NACA0012_inv.su2
MESH_FORMAT= SU2
MESH_OUT_FILENAME= mesh_out.su2
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_ADJ_FILENAME= solution_adj.dat
SOLUTION_FILENAME= solution_flow
SOLUTION_ADJ_FILENAME= solution_adj
TABULAR_FORMAT= TECPLOT
CONV_FILENAME= history
RESTART_FILENAME= restart_flow.dat
RESTART_ADJ_FILENAME= restart_adj.dat
RESTART_FILENAME= restart_flow
RESTART_ADJ_FILENAME= restart_adj
VOLUME_FILENAME= flow
VOLUME_ADJ_FILENAME= adjoint
GRAD_OBJFUNC_FILENAME= of_grad.dat
Expand Down
8 changes: 4 additions & 4 deletions TestCases/cont_adj_euler/naca0012/inv_NACA0012_FD.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ CONV_CAUCHY_EPS= 1E-6
MESH_FILENAME= mesh_NACA0012_inv.su2
MESH_FORMAT= SU2
MESH_OUT_FILENAME= mesh_out.su2
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_ADJ_FILENAME= solution_adj.dat
SOLUTION_FILENAME= solution_flow
SOLUTION_ADJ_FILENAME= solution_adj
TABULAR_FORMAT= TECPLOT
CONV_FILENAME= history
RESTART_FILENAME= restart_flow.dat
RESTART_ADJ_FILENAME= restart_adj.dat
RESTART_FILENAME= restart_flow
RESTART_ADJ_FILENAME= restart_adj
VOLUME_FILENAME= flow
VOLUME_ADJ_FILENAME= adjoint
GRAD_OBJFUNC_FILENAME= of_grad.dat
Expand Down
8 changes: 4 additions & 4 deletions TestCases/cont_adj_euler/naca0012/inv_NACA0012_discadj.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ CONV_CAUCHY_EPS= 1E-6
MESH_FILENAME= mesh_NACA0012_inv.su2
MESH_FORMAT= SU2
MESH_OUT_FILENAME= mesh_out.su2
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_ADJ_FILENAME= solution_adj.dat
SOLUTION_FILENAME= solution_flow
SOLUTION_ADJ_FILENAME= solution_adj
TABULAR_FORMAT= TECPLOT
CONV_FILENAME= history
RESTART_FILENAME= restart_flow.dat
RESTART_ADJ_FILENAME= restart_adj.dat
RESTART_FILENAME= restart_flow
RESTART_ADJ_FILENAME= restart_adj
VOLUME_FILENAME= flow
VOLUME_ADJ_FILENAME= adjoint
GRAD_OBJFUNC_FILENAME= of_grad.dat
Expand Down
8 changes: 4 additions & 4 deletions TestCases/cont_adj_euler/oneram6/inv_ONERAM6.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ CONV_CAUCHY_EPS= 1E-10
%
MESH_FILENAME= mesh_ONERAM6_inv_ffd.su2
MESH_OUT_FILENAME= mesh_out.su2
SOLUTION_FILENAME= solution_flow.dat
SOLUTION_ADJ_FILENAME= solution_adj.dat
SOLUTION_FILENAME= solution_flow
SOLUTION_ADJ_FILENAME= solution_adj
MESH_FORMAT= SU2
TABULAR_FORMAT= CSV
CONV_FILENAME= history
RESTART_FILENAME= restart_flow.dat
RESTART_ADJ_FILENAME= restart_adj.dat
RESTART_FILENAME= restart_flow
RESTART_ADJ_FILENAME= restart_adj
VOLUME_FILENAME= flow
VOLUME_ADJ_FILENAME= adjoint
GRAD_OBJFUNC_FILENAME= of_grad.dat
Expand Down
Loading