Skip to content

Commit 0e03ead

Browse files
authored
Merge branch 'develop' into feature_mz_turbomachinery_adjoint
2 parents 6c9de92 + 87369b0 commit 0e03ead

File tree

360 files changed

+2004
-1831
lines changed

Some content is hidden

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

360 files changed

+2004
-1831
lines changed

.github/workflows/code-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v5
1616
- name: Setup python
1717
uses: actions/setup-python@v5
1818
with:

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828

2929
- name: Install Packages (cpp)
3030
if: ${{ matrix.language == 'cpp' }}

.github/workflows/regression.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ jobs:
187187
entrypoint: /bin/rm
188188
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
189189
- name: Download All artifacts
190-
uses: actions/download-artifact@v4
190+
uses: actions/download-artifact@v5
191191
- name: Uncompress and Move Binaries
192192
run: |
193193
BIN_FOLDER="$PWD/install/bin"
@@ -282,7 +282,7 @@ jobs:
282282
entrypoint: /bin/rm
283283
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
284284
- name: Download All artifacts
285-
uses: actions/download-artifact@v4
285+
uses: actions/download-artifact@v5
286286
- name: Uncompress and Move Binaries
287287
run: |
288288
BIN_FOLDER="$PWD/install/bin"
@@ -327,7 +327,7 @@ jobs:
327327
entrypoint: /bin/rm
328328
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
329329
- name: Download All artifacts
330-
uses: actions/download-artifact@v4
330+
uses: actions/download-artifact@v5
331331
- name: Uncompress and Move Binaries
332332
run: |
333333
BIN_FOLDER="$PWD/install/bin"
@@ -379,17 +379,17 @@ jobs:
379379
entrypoint: /bin/rm
380380
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
381381
- name: Download Base
382-
uses: actions/download-artifact@v4
382+
uses: actions/download-artifact@v5
383383
with:
384384
name: ${{format('Base{0}', matrix.tag)}}
385385
path: ${{format('Base{0}', matrix.tag)}}
386386
- name: Download Reverse
387-
uses: actions/download-artifact@v4
387+
uses: actions/download-artifact@v5
388388
with:
389389
name: ${{format('Reverse{0}', matrix.tag)}}
390390
path: ${{format('Reverse{0}', matrix.tag)}}
391391
- name: Download Forward
392-
uses: actions/download-artifact@v4
392+
uses: actions/download-artifact@v5
393393
with:
394394
name: ${{format('Forward{0}', matrix.tag)}}
395395
path: ${{format('Forward{0}', matrix.tag)}}

Common/include/CConfig.hpp

Lines changed: 160 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
#include "option_structure.hpp"
4747
#include "containers/container_decorators.hpp"
48+
#include "toolboxes/printing_toolbox.hpp"
4849

4950
#ifdef HAVE_CGNS
5051
#include "cgnslib.h"
@@ -358,7 +359,6 @@ class CConfig {
358359
su2double BEM_blade_angle; /*!< \brief Propeller blade angle.*/
359360
string BEM_prop_filename; /*!< \brief Propeller filename.*/
360361
unsigned short ActDiskBem_Frequency; /*!< \brief Frequency of updating actuator disk with BEM. */
361-
bool History_File_Append_Flag; /*!< \brief Flag to append history file.*/
362362
su2double *ActDisk_DeltaPress; /*!< \brief Specified pressure delta for actuator disk. */
363363
su2double *ActDisk_DeltaTemp; /*!< \brief Specified temperature delta for actuator disk. */
364364
su2double *ActDisk_TotalPressRatio; /*!< \brief Specified tot. pres. ratio for actuator disk. */
@@ -632,7 +632,7 @@ class CConfig {
632632
unsigned short nInc_Outlet; /*!< \brief Number of inlet boundary treatment types listed. */
633633
su2double Inc_Inlet_Damping; /*!< \brief Damping factor applied to the iterative updates to the velocity at a pressure inlet in incompressible flow. */
634634
su2double Inc_Outlet_Damping; /*!< \brief Damping factor applied to the iterative updates to the pressure at a mass flow outlet in incompressible flow. */
635-
bool Inc_Inlet_UseNormal; /*!< \brief Flag for whether to use the local normal as the flow direction for an incompressible pressure inlet. */
635+
bool InletUseNormal; /*!< \brief Flag for whether to use the local normal as the flow direction for a pressure inlet. */
636636
su2double Linear_Solver_Error; /*!< \brief Min error of the linear solver for the implicit formulation. */
637637
su2double Deform_Linear_Solver_Error; /*!< \brief Min error of the linear solver for the implicit formulation. */
638638
su2double Linear_Solver_Smoother_Relaxation; /*!< \brief Relaxation factor for iterative linear smoothers. */
@@ -2281,7 +2281,22 @@ class CConfig {
22812281
* \brief Get the name of the file with the element properties for structural problems.
22822282
* \return Name of the file with the element properties of the structural problem.
22832283
*/
2284-
string GetFEA_FileName(void) const { return FEA_FileName; }
2284+
string GetFEA_FileName(void) const {
2285+
string FEAFilename = FEA_FileName;
2286+
2287+
/*--- strip the extension if it is present, only if it is .dat ---*/
2288+
PrintingToolbox::TrimExtension(".dat", FEAFilename);
2289+
2290+
/*--- If multizone, append zone name ---*/
2291+
if (Multizone_Problem)
2292+
FEAFilename = GetMultizone_FileName(FEAFilename, GetiZone(), "");
2293+
2294+
/*--- Add the extension again ---*/
2295+
FEAFilename += ".dat";
2296+
2297+
/*--- return the stripped filename base, without extension. ---*/
2298+
return FEAFilename;
2299+
}
22852300

22862301
/*!
22872302
* \brief Determine if advanced features are used from the element-based FEA analysis (experimental feature).
@@ -5026,12 +5041,6 @@ class CConfig {
50265041
*/
50275042
bool GetInlet_Profile_From_File(void) const { return Inlet_From_File; }
50285043

5029-
/*!
5030-
* \brief Get name of the input file for the specified inlet profile.
5031-
* \return Name of the input file for the specified inlet profile.
5032-
*/
5033-
string GetInlet_FileName(void) const { return Inlet_Filename; }
5034-
50355044
/*!
50365045
* \brief Get name of the input file for the specified actuator disk.
50375046
* \return Name of the input file for the specified actuator disk.
@@ -5060,7 +5069,7 @@ class CConfig {
50605069
* \brief Flag for whether the local boundary normal is used as the flow direction for an incompressible pressure inlet.
50615070
* \return <code>FALSE</code> means the prescribed flow direction is used.
50625071
*/
5063-
bool GetInc_Inlet_UseNormal(void) const { return Inc_Inlet_UseNormal;}
5072+
bool GetInletUseNormal(void) const { return InletUseNormal; }
50645073

50655074
/*!
50665075
* \brief Get the type of incompressible outlet from the list.
@@ -5554,28 +5563,82 @@ class CConfig {
55545563
* \brief Get name of the input grid.
55555564
* \return File name of the input grid.
55565565
*/
5557-
string GetMesh_FileName(void) const { return Mesh_FileName; }
5566+
string GetMesh_FileName(void) const {
5567+
5568+
/*--- we keep the original Mesh_FileName ---*/
5569+
string meshFilename = Mesh_FileName;
5570+
5571+
/*--- strip the extension, only if it is .su2 or .cgns ---*/
5572+
PrintingToolbox::TrimExtension(".su2",meshFilename);
5573+
PrintingToolbox::TrimExtension(".cgns",meshFilename);
5574+
5575+
switch (GetMesh_FileFormat()) {
5576+
case SU2:
5577+
case RECTANGLE:
5578+
case BOX:
5579+
meshFilename += ".su2";
5580+
break;
5581+
case CGNS_GRID:
5582+
meshFilename += ".cgns";
5583+
break;
5584+
default:
5585+
SU2_MPI::Error("Unrecognized mesh format specified!", CURRENT_FUNCTION);
5586+
break;
5587+
}
5588+
5589+
return meshFilename;
5590+
}
55585591

55595592
/*!
55605593
* \brief Get name of the output grid, this parameter is important for grid
55615594
* adaptation and deformation.
55625595
* \return File name of the output grid.
55635596
*/
5564-
string GetMesh_Out_FileName(void) const { return Mesh_Out_FileName; }
5597+
string GetMesh_Out_FileName(void) const {
5598+
5599+
/*--- we keep the original Mesh_Out_FileName ---*/
5600+
string meshFilename = Mesh_Out_FileName;
5601+
5602+
/*--- strip the extension, only if it is .su2 or .cgns ---*/
5603+
PrintingToolbox::TrimExtension(".su2",meshFilename);
5604+
PrintingToolbox::TrimExtension(".cgns",meshFilename);
5605+
5606+
return meshFilename;
5607+
}
55655608

55665609
/*!
55675610
* \brief Get the name of the file with the solution of the flow problem.
55685611
* \return Name of the file with the solution of the flow problem.
55695612
*/
5570-
string GetSolution_FileName(void) const { return Solution_FileName; }
5613+
string GetSolution_FileName(void) const {
5614+
/*--- we keep the original Solution_FileName ---*/
5615+
string solutionFilename = Solution_FileName;
5616+
5617+
/*--- strip the extension, only if it is .dat or .csv ---*/
5618+
PrintingToolbox::TrimExtension(".dat",solutionFilename);
5619+
PrintingToolbox::TrimExtension(".csv",solutionFilename);
5620+
5621+
/*--- return the stripped filename base, without extension. ---*/
5622+
return solutionFilename;
5623+
}
55715624

55725625
/*!
55735626
* \brief Get the name of the file with the solution of the adjoint flow problem
55745627
* with drag objective function.
55755628
* \return Name of the file with the solution of the adjoint flow problem with
55765629
* drag objective function.
55775630
*/
5578-
string GetSolution_AdjFileName(void) const { return Solution_AdjFileName; }
5631+
string GetSolution_AdjFileName(void) const {
5632+
/*--- we keep the original Solution_FileName ---*/
5633+
string solutionAdjFilename = Solution_AdjFileName;
5634+
5635+
/*--- strip the extension, only if it is .dat or .csv ---*/
5636+
PrintingToolbox::TrimExtension(".dat",solutionAdjFilename);
5637+
PrintingToolbox::TrimExtension(".csv",solutionAdjFilename);
5638+
5639+
/*--- return the stripped filename base, without extension. ---*/
5640+
return solutionAdjFilename;
5641+
}
55795642

55805643
/*!
55815644
* \brief Get the format of the input/output grid.
@@ -5605,7 +5668,64 @@ class CConfig {
56055668
* \brief Get the name of the file with the convergence history of the problem.
56065669
* \return Name of the file with convergence history of the problem.
56075670
*/
5608-
string GetConv_FileName(void) const { return Conv_FileName; }
5671+
string GetHistory_FileName(void) const {
5672+
5673+
/*--- we keep the original Conv_FileName ---*/
5674+
string historyFilename = Conv_FileName;
5675+
5676+
/*--- strip the extension, only if it is .dat or .csv ---*/
5677+
PrintingToolbox::TrimExtension(".dat", historyFilename);
5678+
PrintingToolbox::TrimExtension(".csv", historyFilename);
5679+
5680+
/*--- Multizone problems require the number of the zone to be appended. ---*/
5681+
if (GetMultizone_Problem())
5682+
historyFilename = GetMultizone_FileName(historyFilename, GetiZone(), "");
5683+
5684+
/*--- Append the restart iteration ---*/
5685+
if (GetTime_Domain() && GetRestart()) {
5686+
historyFilename = GetUnsteady_FileName(historyFilename, GetRestart_Iter(), "");
5687+
}
5688+
5689+
/*--- Add the correct file extension depending on the file format ---*/
5690+
string hist_ext = ".csv";
5691+
if (GetTabular_FileFormat() == TAB_OUTPUT::TAB_TECPLOT) hist_ext = ".dat";
5692+
5693+
/*--- Append the extension ---*/
5694+
historyFilename += hist_ext;
5695+
5696+
return historyFilename;
5697+
}
5698+
5699+
/*!
5700+
* \brief Get name of the input file for the specified inlet profile.
5701+
* \return Name of the input file for the specified inlet profile.
5702+
*/
5703+
string GetInlet_FileName(void) const {
5704+
5705+
/*--- we keep the original inlet profile filename ---*/
5706+
string inletProfileFilename = Inlet_Filename;
5707+
5708+
/*--- strip the extension, only if it is .dat or .csv ---*/
5709+
PrintingToolbox::TrimExtension(".dat", inletProfileFilename);
5710+
PrintingToolbox::TrimExtension(".csv", inletProfileFilename);
5711+
5712+
/*--- Multizone problems require the number of the zone to be appended. ---*/
5713+
if (GetMultizone_Problem())
5714+
inletProfileFilename = GetMultizone_FileName(inletProfileFilename, GetiZone(), "");
5715+
5716+
/*--- Modify file name for an unsteady restart ---*/
5717+
if (GetTime_Domain() && GetRestart()) {
5718+
inletProfileFilename = GetUnsteady_FileName(inletProfileFilename, GetRestart_Iter(), "");
5719+
}
5720+
/*--- Add the correct file extension depending on the file format ---*/
5721+
string ext = ".dat";
5722+
5723+
inletProfileFilename += ext;
5724+
5725+
5726+
return inletProfileFilename;
5727+
}
5728+
56095729

56105730
/*!
56115731
* \brief Get the Starting Iteration for the windowing approach
@@ -5656,15 +5776,6 @@ class CConfig {
56565776
*/
56575777
string GetMultizone_FileName(string val_filename, int val_iZone, const string& ext) const;
56585778

5659-
/*!
5660-
* \brief Append the zone index to the restart or the solution files.
5661-
* \param[in] val_filename - the base filename.
5662-
* \param[in] val_iZone - the zone ID.
5663-
* \param[in] ext - the filename extension.
5664-
* \return Name of the restart file for the flow variables.
5665-
*/
5666-
string GetMultizone_HistoryFileName(string val_filename, int val_iZone, const string& ext) const;
5667-
56685779
/*!
56695780
* \brief Append the instance index to the restart or the solution files.
56705781
* \param[in] val_filename - the base filename.
@@ -5686,13 +5797,35 @@ class CConfig {
56865797
* \brief Get the name of the restart file for the flow variables.
56875798
* \return Name of the restart file for the flow variables.
56885799
*/
5689-
string GetRestart_FileName(void) const { return Restart_FileName; }
5800+
string GetRestart_FileName(void) const {
5801+
5802+
/*--- we keep the original Restart_FileName ---*/
5803+
string restartFilename = Restart_FileName;
5804+
5805+
/*--- strip the extension, only if it is .dat or .csv ---*/
5806+
PrintingToolbox::TrimExtension(".dat", restartFilename);
5807+
PrintingToolbox::TrimExtension(".csv", restartFilename);
5808+
5809+
/*--- return the stripped filename base, without extension. ---*/
5810+
return restartFilename;
5811+
}
56905812

56915813
/*!
56925814
* \brief Get the name of the restart file for the adjoint variables (drag objective function).
56935815
* \return Name of the restart file for the adjoint variables (drag objective function).
56945816
*/
5695-
string GetRestart_AdjFileName(void) const { return Restart_AdjFileName; }
5817+
string GetRestart_AdjFileName(void) const {
5818+
5819+
/*--- we keep the original Restart_FileName ---*/
5820+
string restartAdjFilename = Restart_AdjFileName;
5821+
5822+
/*--- strip the extension, only if it is .dat or .csv ---*/
5823+
PrintingToolbox::TrimExtension(".dat", restartAdjFilename);
5824+
PrintingToolbox::TrimExtension(".csv", restartAdjFilename);
5825+
5826+
/*--- return the stripped filename base, without extension. ---*/
5827+
return restartAdjFilename;
5828+
}
56965829

56975830
/*!
56985831
* \brief Get the name of the file with the adjoint variables.
@@ -5737,7 +5870,7 @@ class CConfig {
57375870
string GetVolSens_FileName(void) const { return VolSens_FileName; }
57385871

57395872
/*!
5740-
* \brief Augment the input filename with the iteration number for an unsteady file.
5873+
* \brief Append the input filename with the iteration number for an unsteady file.
57415874
* \param[in] val_filename - String value of the base filename.
57425875
* \param[in] val_iter - Unsteady iteration number or time instance.
57435876
* \param[in] ext - the filename extension.

Common/include/toolboxes/printing_toolbox.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
2626
*/
2727

28+
#pragma once
29+
2830
#include <iostream>
2931
#include <iomanip>
3032
#include <cstdint>
@@ -287,4 +289,16 @@ inline std::string StringToUpperCase(const std::string& str) {
287289
return upp_str;
288290
}
289291

292+
/*!
293+
* \brief Trim an extension from a name.
294+
* \param[in] - extension we want to remove.
295+
* \param[in,out] - string we want to trim.
296+
*/
297+
inline void TrimExtension(const std::string& ext, std::string& name) {
298+
const auto extIndex = name.rfind(ext);
299+
if (extIndex != std::string::npos && extIndex + ext.size() == name.size()) {
300+
name.resize(extIndex);
301+
}
302+
}
303+
290304
} // namespace PrintingToolbox

0 commit comments

Comments
 (0)