Skip to content

Commit c603132

Browse files
committed
update FEA_Filename
1 parent 785edae commit c603132

File tree

11 files changed

+32
-39
lines changed

11 files changed

+32
-39
lines changed

Common/include/CConfig.hpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,23 @@ class CConfig {
22602260
* \brief Get the name of the file with the element properties for structural problems.
22612261
* \return Name of the file with the element properties of the structural problem.
22622262
*/
2263-
string GetFEA_FileName(void) const { return FEA_FileName; }
2263+
string GetFEA_FileName(void) const {
2264+
string FEAFilename = FEA_FileName;
2265+
2266+
/*--- strip the extension if it is present, only if it is .dat ---*/
2267+
auto extIndex = FEAFilename.rfind(".dat");
2268+
if (extIndex != std::string::npos) FEAFilename.resize(extIndex);
2269+
2270+
/*--- If multizone, append zone name ---*/
2271+
if (Multizone_Problem)
2272+
FEAFilename = GetMultizone_FileName(FEAFilename, GetiZone(), "");
2273+
2274+
/*--- Add the extension again ---*/
2275+
FEAFilename += ".dat";
2276+
2277+
/*--- return the stripped filename base, without extension. ---*/
2278+
return FEAFilename;
2279+
}
22642280

22652281
/*!
22662282
* \brief Determine if advanced features are used from the element-based FEA analysis (experimental feature).
@@ -5484,8 +5500,6 @@ class CConfig {
54845500
extIndex = meshFilename.rfind(".cgns");
54855501
if (extIndex != std::string::npos) meshFilename.resize(extIndex);
54865502

5487-
cout << "mesh file format = " << GetMesh_FileFormat() << " , file = " << meshFilename<< endl;
5488-
54895503
switch (GetMesh_FileFormat()) {
54905504
case SU2:
54915505
case RECTANGLE:

Common/src/CConfig.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7419,7 +7419,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
74197419
}
74207420

74217421
if (val_software == SU2_COMPONENT::SU2_DEF) {
7422-
cout << "Output mesh file name: " << Mesh_Out_FileName << ".su2 . " << endl;
7422+
cout << "Output mesh file name: " << Mesh_Out_FileName << ".su2 . " << endl;
74237423
switch (GetDeform_Stiffness_Type()) {
74247424
case INVERSE_VOLUME:
74257425
cout << "Cell stiffness scaled by inverse of the cell volume." << endl;
@@ -8428,14 +8428,7 @@ string CConfig::GetUnsteady_FileName(string val_filename, int val_iter, const st
84288428
if (Time_Domain) {
84298429
/*--- Determine dynamic number of zeroes, note that we always add 5 digits. ---*/
84308430
int zeroes = 6 - to_string(val_iter).length();
8431-
cout << "zeroes = " << zeroes << " , val = " << val_iter <<endl;
84328431
SPRINTF (buffer, "_%0*ld", 5,val_iter);
8433-
//if ((val_iter >= 0) && (val_iter < 10)) SPRINTF (buffer, "_0000%d", val_iter);
8434-
//if ((val_iter >= 10) && (val_iter < 100)) SPRINTF (buffer, "_000%d", val_iter);
8435-
//if ((val_iter >= 100) && (val_iter < 1000)) SPRINTF (buffer, "_00%d", val_iter);
8436-
//if ((val_iter >= 1000) && (val_iter < 10000)) SPRINTF (buffer, "_0%d", val_iter);
8437-
//if (val_iter >= 10000) SPRINTF (buffer, "_%d", val_iter);
8438-
84398432

84408433
UnstExt = string(buffer);
84418434
}
@@ -8535,9 +8528,6 @@ string CConfig::GetObjFunc_Extension(string val_filename) const {
85358528
}
85368529
Filename.append(AdjExt);
85378530

8538-
/*--- Lastly, add the .dat extension ---*/
8539-
//Filename.append(".dat");
8540-
85418531
}
85428532

85438533
return Filename;

SU2_CFD/src/drivers/CDriver.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,18 +2313,8 @@ void CDriver::InitializeNumerics(CConfig *config, CGeometry **geometry, CSolver
23132313

23142314
ifstream properties_file;
23152315

2316-
23172316
string filename = config->GetFEA_FileName();
23182317

2319-
unsigned short lastindex = filename.find_last_of('.');
2320-
filename = filename.substr(0, lastindex);
2321-
2322-
if (nZone > 1)
2323-
filename = config->GetMultizone_FileName(filename, iZone, "");
2324-
2325-
/*--- At the moment we stay consistent with the default extension .dat for all input files. ---*/
2326-
filename += ".dat";
2327-
23282318
properties_file.open(filename.data(), ios::in);
23292319

23302320
/*--- In case there is a properties file, containers are allocated for a number of material models. ---*/

SU2_CFD/src/solvers/CFEASolver.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,7 @@ void CFEASolver::Set_ElementProperties(CGeometry *geometry, CConfig *config) {
295295

296296
auto filename = config->GetFEA_FileName();
297297

298-
/*--- If multizone, append zone name ---*/
299-
if (nZone > 1)
300-
filename = config->GetMultizone_FileName(filename, iZone, "");
301298

302-
filename += ".dat";
303299
if (rank == MASTER_NODE) cout << "Filename: " << filename << "." << endl;
304300

305301
ifstream properties_file;

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned
7272
/*--- Multizone problems require the number of the zone to be appended. ---*/
7373

7474
auto filename_ = config->GetSolution_FileName();
75-
// nijso: check this!
76-
if (nZone > 1) filename_ = config->GetMultizone_FileName(filename_, iZone, ".dat");
75+
// // nijso: this is inconsistent with line 70, nZone<= 1!
76+
if (nZone > 1) filename_ = config->GetMultizone_FileName(filename_, iZone, "");
7777

7878
/*--- Modify file name for a dual-time unsteady restart ---*/
7979

@@ -82,24 +82,27 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned
8282
else if (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST)
8383
Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1;
8484
else Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-2;
85-
filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, ".dat");
85+
filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, "");
8686
}
8787

8888
/*--- Modify file name for a time stepping unsteady restart ---*/
8989

9090
if (time_stepping) {
9191
if (adjoint) Unst_RestartIter = SU2_TYPE::Int(config->GetUnst_AdjointIter())-1;
9292
else Unst_RestartIter = SU2_TYPE::Int(config->GetRestart_Iter())-1;
93-
filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, ".dat");
93+
filename_ = config->GetUnsteady_FileName(filename_, Unst_RestartIter, "");
9494
}
9595

96-
/*--- Read and store the restart metadata. ---*/
96+
filename_ += ".dat";
9797

98+
/*--- Read and store the restart metadata. ---*/
99+
// nijso: We now overwrite all previous modifications of filename ?!?
98100
filename_ = "flow";
99101
filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter);
100102
Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_);
101103

102104
}
105+
103106
if (restart && (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW)) {
104107
string filename_ = "flow";
105108
filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter);

TestCases/disc_adj_fsi/dyn_fsi/configFEA.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NEWMARK_GAMMA=0.52
88

99
% Optimization --------------------------------------------------------- %
1010
FEA_ADVANCED_MODE= YES
11-
FEA_FILENAME= element_properties
11+
FEA_FILENAME= element_properties.dat
1212
GRAD_OBJFUNC_FILENAME= of_grad
1313
REFERENCE_NODE= 234
1414
REFERENCE_NODE_DISPLACEMENT= (0.0, 0.0)

TestCases/fea_topology/config.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ TOPOLOGY_OPTIMIZATION= YES
1313
% this file, those are the variables the optimizer should manipulate.
1414
% Values below 0 or above 1 will result in density of 0 or 1 respectively,
1515
% i.e. the value after filtering is ignored.
16-
FEA_FILENAME= element_properties
16+
FEA_FILENAME= element_properties.dat
1717
% Filtering is required to avoid numerical issues, see [Sigmund, 2007]
1818
% (DOI 10.1007/s00158-006-0087-x). Currently available options:
1919
% CONSTANT; CONICAL (default); GAUSSIAN; DILATE; ERODE.

TestCases/fea_topology/quick_start/settings.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ITER= 1
66
%
77
% Optimization
88
TOPOLOGY_OPTIMIZATION= YES
9-
FEA_FILENAME= element_properties
9+
FEA_FILENAME= element_properties.dat
1010
TOPOL_OPTIM_FILTER_RADIUS= 0.013
1111
TOPOL_OPTIM_FILTER_KERNEL= ( DILATE,ERODE )
1212
TOPOL_OPTIM_KERNEL_PARAM= 0.01

TestCases/fea_topology/quick_start/settings_compliance.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ITER= 1
66
%
77
% Optimization
88
TOPOLOGY_OPTIMIZATION= YES
9-
FEA_FILENAME= element_properties
9+
FEA_FILENAME= element_properties.dat
1010
TOPOL_OPTIM_FILTER_RADIUS= 0.013
1111
TOPOL_OPTIM_FILTER_KERNEL= ( DILATE,ERODE )
1212
TOPOL_OPTIM_KERNEL_PARAM= 0.01

TestCases/fea_topology/quick_start/settings_volfrac.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ITER= 1
66
%
77
% Optimization
88
TOPOLOGY_OPTIMIZATION= YES
9-
FEA_FILENAME= element_properties
9+
FEA_FILENAME= element_properties.dat
1010
TOPOL_OPTIM_FILTER_RADIUS= 0.013
1111
TOPOL_OPTIM_FILTER_KERNEL= ( DILATE,ERODE )
1212
TOPOL_OPTIM_KERNEL_PARAM= 0.01

0 commit comments

Comments
 (0)