diff --git a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp index b2e49b0d8c5..9f2b0e52031 100644 --- a/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp +++ b/SU2_CFD/include/output/filewriter/CParallelDataSorter.hpp @@ -109,6 +109,7 @@ class CParallelDataSorter{ nRecvs; //!< Number of receives vector fieldNames; //!< Vector with names of all the output fields + vector requiredFieldNames; //!< Vector with names of the required output fields that we write to file unsigned short nDim; //!< Spatial dimension of the data @@ -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& GetRequiredFieldNames() const{ + return requiredFieldNames; + } + + /*! + * \brief Set the vector of required output fields. + * \return None. + */ + void SetRequiredFieldNames(const vector& req_field_names) { + requiredFieldNames = req_field_names; + } + /*! * \brief Get the spatial dimension * \return The spatial dimension diff --git a/SU2_CFD/src/output/COutput.cpp b/SU2_CFD/src/output/COutput.cpp index 4fcc0eaa294..a376483cee5 100644 --- a/SU2_CFD/src/output/COutput.cpp +++ b/SU2_CFD/src/output/COutput.cpp @@ -411,6 +411,10 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form if (!config->GetWrt_Surface_Overwrite()) filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); + /*--- If we have compact restarts, we use only the required fields. ---*/ + if (config->GetWrt_Restart_Compact()) + surfaceDataSorter->SetRequiredFieldNames(requiredVolumeFieldNames); + surfaceDataSorter->SortConnectivity(config, geometry); surfaceDataSorter->SortOutputData(); @@ -431,8 +435,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form LogOutputFiles("SU2 ASCII restart"); - /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) { + /*--- If we have compact restarts, we use only the required fields. ---*/ + volumeDataSorterCompact->SetRequiredFieldNames(requiredVolumeFieldNames); fileWriter = new CSU2FileWriter(volumeDataSorterCompact); } else { fileWriter = new CSU2FileWriter(volumeDataSorter); @@ -451,8 +456,9 @@ void COutput::WriteToFile(CConfig *config, CGeometry *geometry, OUTPUT_TYPE form filename_iter = config->GetFilename_Iter(fileName, curInnerIter, curOuterIter); LogOutputFiles("SU2 binary restart"); - /*--- If we have compact restarts, we use only the required fields. ---*/ if (config->GetWrt_Restart_Compact()) { + /*--- If we have compact restarts, we use only the required fields. ---*/ + volumeDataSorterCompact->SetRequiredFieldNames(requiredVolumeFieldNames); fileWriter = new CSU2BinaryFileWriter(volumeDataSorterCompact); } else { fileWriter = new CSU2BinaryFileWriter(volumeDataSorter); diff --git a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp index e008e86f07c..915e33d5c33 100644 --- a/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp +++ b/SU2_CFD/src/output/filewriter/CParallelDataSorter.cpp @@ -32,7 +32,8 @@ CParallelDataSorter::CParallelDataSorter(CConfig *config, const vector &valFieldNames) : rank(SU2_MPI::GetRank()), size(SU2_MPI::GetSize()), - fieldNames(valFieldNames) { + fieldNames(valFieldNames), + requiredFieldNames(valFieldNames) { GlobalField_Counter = fieldNames.size(); diff --git a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp index 1e63aeeaa6b..b9c7e57ed86 100644 --- a/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2BinaryFileWriter.cpp @@ -41,7 +41,7 @@ void CSU2BinaryFileWriter::WriteData(string val_filename){ unsigned short iVar; - const vector& fieldNames = dataSorter->GetFieldNames(); + const vector& fieldNames = dataSorter->GetRequiredFieldNames(); unsigned short nVar = fieldNames.size(); unsigned long nParallel_Poin = dataSorter->GetnPoints(); unsigned long nPoint_Global = dataSorter->GetnPointsGlobal(); diff --git a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp index 331bb638486..e0e940b8328 100644 --- a/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp +++ b/SU2_CFD/src/output/filewriter/CSU2FileWriter.cpp @@ -35,7 +35,7 @@ CSU2FileWriter::CSU2FileWriter(CParallelDataSorter *valDataSorter) : void CSU2FileWriter::WriteData(string val_filename){ ofstream restart_file; - const vector& fieldNames = dataSorter->GetFieldNames(); + const vector fieldNames = dataSorter->GetRequiredFieldNames(); /*--- We append the pre-defined suffix (extension) to the filename (prefix) ---*/ val_filename.append(fileExt); diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 25fa0e315bc..ff9b8c66706 100755 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -1750,23 +1750,6 @@ def main(): species2_primitiveVenturi.test_vals = [-5.470699, -4.435379, -4.486544, -5.327925, -0.866369, -5.623281, 5.000000, -0.557915, 5.000000, -2.599732, 5.000000, -0.536608, 0.000037, 0.000037, 0.000000, 0.000000] test_list.append(species2_primitiveVenturi) - # Compact restart check. The case above writes a compact ASCII and binary restart file at - # iteration 49, holding the solution that enters iteration 50. The first iteration of these - # restarted runs must therefore reproduce its iteration 50, so they share its test values. - species2_compact_restart_ascii = TestCase('species2_primitiveVenturi_compact_restart_read_ascii') - species2_compact_restart_ascii.cfg_dir = "species_transport/venturi_primitive_3species" - species2_compact_restart_ascii.cfg_file = "species2_primitiveVenturi_compact_restart_read_ascii.cfg" - species2_compact_restart_ascii.test_iter = 0 - species2_compact_restart_ascii.test_vals = species2_primitiveVenturi.test_vals - test_list.append(species2_compact_restart_ascii) - - species2_compact_restart_binary = TestCase('species2_primitiveVenturi_compact_restart_read_binary') - species2_compact_restart_binary.cfg_dir = "species_transport/venturi_primitive_3species" - species2_compact_restart_binary.cfg_file = "species2_primitiveVenturi_compact_restart_read_binary.cfg" - species2_compact_restart_binary.test_iter = 0 - species2_compact_restart_binary.test_vals = species2_primitiveVenturi.test_vals - test_list.append(species2_compact_restart_binary) - # 2 species (1 eq) primitive venturi mixing with bounded scalar transport species_primitiveVenturi_boundedscalar = TestCase('species2_primitiveVenturi_bounded_scalar') species_primitiveVenturi_boundedscalar.cfg_dir = "species_transport/venturi_primitive_3species" diff --git a/TestCases/species_transport/venturi_primitive_3species/README.md b/TestCases/species_transport/venturi_primitive_3species/README.md index 897e52c69c3..e26fde2ae74 100644 --- a/TestCases/species_transport/venturi_primitive_3species/README.md +++ b/TestCases/species_transport/venturi_primitive_3species/README.md @@ -21,12 +21,6 @@ t 4. Adjoint simulation with 1 timestep, using the primal restart file from simulation in 2nd step. The printed direct residuals are taken for comparison -- `species2_primitiveVenturi_compact_restart_read_ascii.cfg` and `species2_primitiveVenturi_compact_restart_read_binary.cfg` check that compact restart files (`WRT_RESTART_COMPACT= YES`) are written and read correctly. -They restart from the files that `species2_venturiPrimitive.cfg` writes at iteration 49 (`WRT_RESTART_OVERWRITE= NO` with `OUTPUT_WRT_FREQ= 49, 49, 1000`), which hold the solution that enters iteration 50. -Their first iteration must therefore reproduce the residuals of iteration 50 of that case, and the regression test uses its values for all three cases. -`VOLUME_OUTPUT` contains fields outside the compact set, which is the situation in which the compact writers can shift the restart columns. - - - `species3_venturiPrimitive_inletFile.cfg` With the `test_inlet_files.sh` a simple sanity check for inlet files is performed. SU2 writes an `example_inlet_file.dat` when the specified inlet file is not available, with the values of the specified `MARKER_INLET` content. Therefore comparing a simulation with this example inlet file and without inlet files should result in exactly the same results. diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi.cfg index bf9c1a72cc0..d23ef78e0f5 100644 --- a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi.cfg +++ b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi.cfg @@ -119,15 +119,9 @@ SCREEN_WRT_FREQ_INNER= 10 HISTORY_OUTPUT= RMS_RES FLOW_COEFF LINSOL SPECIES_COEFF SPECIES_COEFF_SURF MARKER_ANALYZE= outlet gas_inlet air_axial_inlet % -% The restart files written at iteration 49 hold the solution that enters -% iteration 50 and are the starting point of the compact restart checks in -% species2_primitiveVenturi_compact_restart_read_ascii.cfg and -% species2_primitiveVenturi_compact_restart_read_binary.cfg. -OUTPUT_FILES= RESTART_ASCII, RESTART, PARAVIEW_MULTIBLOCK +OUTPUT_FILES= RESTART_ASCII, PARAVIEW_MULTIBLOCK VOLUME_OUTPUT= RESIDUAL, PRIMITIVE -WRT_RESTART_COMPACT= YES -WRT_RESTART_OVERWRITE= NO -OUTPUT_WRT_FREQ= 49, 49, 1000 +OUTPUT_WRT_FREQ= 1000 % RESTART_SOL= NO SOLUTION_FILENAME= solution diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_compact_restart_read_ascii.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_compact_restart_read_ascii.cfg deleted file mode 100644 index 5f001610215..00000000000 --- a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_compact_restart_read_ascii.cfg +++ /dev/null @@ -1,140 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SU2 configuration file % -% Case description: Species mixing with 2 species, i.e. 1 transport equations % -% restarted from the compact ASCII restart file of % -% species2_primitiveVenturi.cfg % -% Author: N. Beishuizen % -% Institution: TU Eindhoven % -% Date: 13-09-2026 % -% File Version 8.5.0 "Harrier" % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% This run restarts from the solution that entered iteration 50 of -% species2_primitiveVenturi.cfg, so its first iteration must reproduce the -% residuals printed at iteration 50 of that case. VOLUME_OUTPUT there holds -% fields outside the compact set, which is what the compact writers can get -% wrong. - -% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% -% -SOLVER= INC_RANS -KIND_TURB_MODEL= SST -% -% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% -% -INC_DENSITY_MODEL= CONSTANT -INC_DENSITY_INIT= 1.1766 -% -INC_VELOCITY_INIT= ( 1.00, 0.0, 0.0 ) -% -INC_ENERGY_EQUATION= YES -INC_TEMPERATURE_INIT= 300.0 -% -INC_NONDIM= DIMENSIONAL -% -% -------------------- FLUID PROPERTIES ------------------------------------- % -% -FLUID_MODEL= CONSTANT_DENSITY -% -CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY -THERMAL_CONDUCTIVITY_CONSTANT= 0.0357 -% -PRANDTL_LAM= 0.72 -TURBULENT_CONDUCTIVITY_MODEL= NONE -PRANDTL_TURB= 0.90 -% -VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 1.716E-5 -% -% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -% -MARKER_HEATFLUX= ( wall, 0.0 ) -MARKER_SYM= ( axis ) -% -INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET -MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ - air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -MARKER_INLET_SPECIES= (gas_inlet, 1.0,\ - air_axial_inlet, 0.6 ) -% -INC_OUTLET_TYPE= PRESSURE_OUTLET -MARKER_OUTLET= ( outlet, 0.0) -% -% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -% -CFL_NUMBER= 2000 -CFL_REDUCTION_SPECIES= 1.0 -CFL_REDUCTION_TURB= 1.0 -% -ITER= 1 -% -% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% -% -LINEAR_SOLVER= FGMRES -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-8 -LINEAR_SOLVER_ITER= 5 -% -% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% -CONV_NUM_METHOD_FLOW= FDS -MUSCL_FLOW= YES -SLOPE_LIMITER_FLOW = NONE -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% -------------------- SCALAR TRANSPORT ---------------------------------------% -% -KIND_SCALAR_MODEL= SPECIES_TRANSPORT -DIFFUSIVITY_MODEL= CONSTANT_DIFFUSIVITY -DIFFUSIVITY_CONSTANT= 0.001 -% -CONV_NUM_METHOD_SPECIES= SCALAR_UPWIND -MUSCL_SPECIES= NO -SLOPE_LIMITER_SPECIES = NONE -% -TIME_DISCRE_SPECIES= EULER_IMPLICIT -% -SPECIES_INIT= 1.0 -SPECIES_CLIPPING= YES -SPECIES_CLIPPING_MIN= 0.0 -SPECIES_CLIPPING_MAX= 1.0 -% -% -------------------- TURBULENT TRANSPORT ---------------------------------------% -% -CONV_NUM_METHOD_TURB= SCALAR_UPWIND -MUSCL_TURB= NO -% -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% -CONV_FIELD= RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TKE, RMS_SPECIES -CONV_RESIDUAL_MINVAL= -18 -CONV_STARTITER= 10 -% -% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% -MESH_FILENAME= primitiveVenturi.su2 -SCREEN_OUTPUT= INNER_ITER WALL_TIME \ - RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_TKE RMS_DISSIPATION RMS_SPECIES_0 \ - LINSOL_ITER LINSOL_RESIDUAL \ - LINSOL_ITER_TURB LINSOL_RESIDUAL_TURB \ - LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES SURFACE_SPECIES_VARIANCE -SCREEN_WRT_FREQ_INNER= 10 -% -HISTORY_OUTPUT= RMS_RES FLOW_COEFF LINSOL SPECIES_COEFF SPECIES_COEFF_SURF -MARKER_ANALYZE= outlet gas_inlet air_axial_inlet -% -OUTPUT_FILES= RESTART_ASCII -VOLUME_OUTPUT= RESIDUAL, PRIMITIVE -WRT_RESTART_COMPACT= YES -OUTPUT_WRT_FREQ= 1000 -% -RESTART_SOL= YES -READ_BINARY_RESTART= NO -SOLUTION_FILENAME= restart_000049 -RESTART_FILENAME= restart_compact_read_ascii -% -WRT_PERFORMANCE= YES diff --git a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_compact_restart_read_binary.cfg b/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_compact_restart_read_binary.cfg deleted file mode 100644 index da06ca86b73..00000000000 --- a/TestCases/species_transport/venturi_primitive_3species/species2_primitiveVenturi_compact_restart_read_binary.cfg +++ /dev/null @@ -1,140 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% SU2 configuration file % -% Case description: Species mixing with 2 species, i.e. 1 transport equations % -% restarted from the compact binary restart file of % -% species2_primitiveVenturi.cfg % -% Author: N. Beishuizen % -% Institution: TU Eindhoven % -% Date: 13-09-2026 % -% File Version 8.5.0 "Harrier" % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% This run restarts from the solution that entered iteration 50 of -% species2_primitiveVenturi.cfg, so its first iteration must reproduce the -% residuals printed at iteration 50 of that case. VOLUME_OUTPUT there holds -% fields outside the compact set, which is what the compact writers can get -% wrong. - -% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% -% -SOLVER= INC_RANS -KIND_TURB_MODEL= SST -% -% ---------------- INCOMPRESSIBLE FLOW CONDITION DEFINITION -------------------% -% -INC_DENSITY_MODEL= CONSTANT -INC_DENSITY_INIT= 1.1766 -% -INC_VELOCITY_INIT= ( 1.00, 0.0, 0.0 ) -% -INC_ENERGY_EQUATION= YES -INC_TEMPERATURE_INIT= 300.0 -% -INC_NONDIM= DIMENSIONAL -% -% -------------------- FLUID PROPERTIES ------------------------------------- % -% -FLUID_MODEL= CONSTANT_DENSITY -% -CONDUCTIVITY_MODEL= CONSTANT_CONDUCTIVITY -THERMAL_CONDUCTIVITY_CONSTANT= 0.0357 -% -PRANDTL_LAM= 0.72 -TURBULENT_CONDUCTIVITY_MODEL= NONE -PRANDTL_TURB= 0.90 -% -VISCOSITY_MODEL= CONSTANT_VISCOSITY -MU_CONSTANT= 1.716E-5 -% -% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -% -MARKER_HEATFLUX= ( wall, 0.0 ) -MARKER_SYM= ( axis ) -% -INC_INLET_TYPE= VELOCITY_INLET VELOCITY_INLET -MARKER_INLET= ( gas_inlet, 300, 1.0, 1.0, 0.0, 0.0,\ - air_axial_inlet, 300, 1.0, 0.0, -1.0, 0.0 ) -MARKER_INLET_SPECIES= (gas_inlet, 1.0,\ - air_axial_inlet, 0.6 ) -% -INC_OUTLET_TYPE= PRESSURE_OUTLET -MARKER_OUTLET= ( outlet, 0.0) -% -% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES -% -CFL_NUMBER= 2000 -CFL_REDUCTION_SPECIES= 1.0 -CFL_REDUCTION_TURB= 1.0 -% -ITER= 1 -% -% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% -% -LINEAR_SOLVER= FGMRES -LINEAR_SOLVER_PREC= ILU -LINEAR_SOLVER_ERROR= 1E-8 -LINEAR_SOLVER_ITER= 5 -% -% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% -CONV_NUM_METHOD_FLOW= FDS -MUSCL_FLOW= YES -SLOPE_LIMITER_FLOW = NONE -TIME_DISCRE_FLOW= EULER_IMPLICIT -% -% -------------------- SCALAR TRANSPORT ---------------------------------------% -% -KIND_SCALAR_MODEL= SPECIES_TRANSPORT -DIFFUSIVITY_MODEL= CONSTANT_DIFFUSIVITY -DIFFUSIVITY_CONSTANT= 0.001 -% -CONV_NUM_METHOD_SPECIES= SCALAR_UPWIND -MUSCL_SPECIES= NO -SLOPE_LIMITER_SPECIES = NONE -% -TIME_DISCRE_SPECIES= EULER_IMPLICIT -% -SPECIES_INIT= 1.0 -SPECIES_CLIPPING= YES -SPECIES_CLIPPING_MIN= 0.0 -SPECIES_CLIPPING_MAX= 1.0 -% -% -------------------- TURBULENT TRANSPORT ---------------------------------------% -% -CONV_NUM_METHOD_TURB= SCALAR_UPWIND -MUSCL_TURB= NO -% -% --------------------------- CONVERGENCE PARAMETERS --------------------------% -% -CONV_FIELD= RMS_PRESSURE, RMS_VELOCITY-X, RMS_VELOCITY-Y, RMS_TKE, RMS_SPECIES -CONV_RESIDUAL_MINVAL= -18 -CONV_STARTITER= 10 -% -% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% -MESH_FILENAME= primitiveVenturi.su2 -SCREEN_OUTPUT= INNER_ITER WALL_TIME \ - RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_TKE RMS_DISSIPATION RMS_SPECIES_0 \ - LINSOL_ITER LINSOL_RESIDUAL \ - LINSOL_ITER_TURB LINSOL_RESIDUAL_TURB \ - LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES SURFACE_SPECIES_VARIANCE -SCREEN_WRT_FREQ_INNER= 10 -% -HISTORY_OUTPUT= RMS_RES FLOW_COEFF LINSOL SPECIES_COEFF SPECIES_COEFF_SURF -MARKER_ANALYZE= outlet gas_inlet air_axial_inlet -% -OUTPUT_FILES= RESTART -VOLUME_OUTPUT= RESIDUAL, PRIMITIVE -WRT_RESTART_COMPACT= YES -OUTPUT_WRT_FREQ= 1000 -% -RESTART_SOL= YES -READ_BINARY_RESTART= YES -SOLUTION_FILENAME= restart_000049 -RESTART_FILENAME= restart_compact_read_binary -% -WRT_PERFORMANCE= YES