Skip to content

Commit 52160fc

Browse files
authored
Merge pull request #1664 from su2code/fix_misc_issues
Small misc fixes
2 parents f4a64c3 + 23f843a commit 52160fc

4 files changed

Lines changed: 30 additions & 19 deletions

File tree

SU2_CFD/src/output/COutput.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ bool COutput::GetCauchyCorrectedTimeConvergence(const CConfig *config){
926926
bool COutput::SetResult_Files(CGeometry *geometry, CConfig *config, CSolver** solver_container,
927927
unsigned long iter, bool force_writing) {
928928

929-
bool isFileWrite = false;
929+
bool isFileWrite = false, dataIsLoaded = false;
930930
const auto nVolumeFiles = config->GetnVolumeOutputFiles();
931931
const auto* VolumeFiles = config->GetVolumeOutputFiles();
932932

@@ -938,10 +938,13 @@ bool COutput::SetResult_Files(CGeometry *geometry, CConfig *config, CSolver** so
938938
/*--- Collect the volume data from the solvers.
939939
* If time-domain is enabled, we also load the data although we don't output it,
940940
* since we might want to do time-averaging. ---*/
941-
if (WriteVolume_Output(config, iter, force_writing || cauchyTimeConverged, iFile) || config->GetTime_Domain())
942-
LoadDataIntoSorter(config, geometry, solver_container);
941+
const bool write_file = WriteVolume_Output(config, iter, force_writing || cauchyTimeConverged, iFile);
943942

944-
if (!(WriteVolume_Output(config, iter, force_writing || cauchyTimeConverged, iFile))) continue;
943+
if ((write_file || config->GetTime_Domain()) && !dataIsLoaded) {
944+
LoadDataIntoSorter(config, geometry, solver_container);
945+
dataIsLoaded = true;
946+
}
947+
if (!write_file) continue;
945948

946949
/*--- Partition and sort the data --- */
947950

@@ -1039,10 +1042,10 @@ bool COutput::Convergence_Monitoring(CConfig *config, unsigned long Iteration) {
10391042

10401043
oldFunc[iField_Conv] = newFunc[iField_Conv];
10411044
newFunc[iField_Conv] = monitor;
1042-
/*--- Automatically modify the scaling factor of relative Cauchy convergence for
1043-
* coefficients that are close to zero. Example: For the clean aircraft, the rolling
1044-
* moment coefficient MOMENT_X is close to zero and thus will never reach a relative
1045-
* cauchy convergence ->> dividing tiny numbers is not a good idea. Using absolute
1045+
/*--- Automatically modify the scaling factor of relative Cauchy convergence for
1046+
* coefficients that are close to zero. Example: For the clean aircraft, the rolling
1047+
* moment coefficient MOMENT_X is close to zero and thus will never reach a relative
1048+
* cauchy convergence ->> dividing tiny numbers is not a good idea. Using absolute
10461049
* cauchy convergence is more robust in this case. ---*/
10471050
cauchyFunc = fabs(newFunc[iField_Conv] - oldFunc[iField_Conv]) / fmax(fabs(monitor), 0.1);
10481051

SU2_CFD/src/solvers/CEulerSolver.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6456,8 +6456,8 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
64566456
unsigned short iDim;
64576457
unsigned long iVertex, iPoint;
64586458
su2double P_Total, T_Total, Velocity[MAXNDIM], Velocity2, H_Total, Temperature, Riemann,
6459-
Pressure, Density, Energy, *Flow_Dir, Mach2, SoundSpeed2, SoundSpeed_Total2, Vel_Mag,
6460-
alpha, aa, bb, cc, dd, Area, UnitNormal[MAXNDIM], Normal[MAXNDIM] = {0.0};
6459+
Pressure, Density, Energy, Flow_Dir[MAXNDIM], Mach2, SoundSpeed2, SoundSpeed_Total2, Vel_Mag,
6460+
alpha, aa, bb, cc, dd, Area, UnitNormal[MAXNDIM], Normal[MAXNDIM];
64616461
su2double *V_inlet, *V_domain;
64626462

64636463
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
@@ -6510,13 +6510,17 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
65106510

65116511
/*--- Total properties have been specified at the inlet. ---*/
65126512

6513-
case INLET_TYPE::TOTAL_CONDITIONS:
6513+
case INLET_TYPE::TOTAL_CONDITIONS: {
65146514

65156515
/*--- Retrieve the specified total conditions for this inlet. ---*/
65166516

65176517
P_Total = Inlet_Ptotal[val_marker][iVertex];
65186518
T_Total = Inlet_Ttotal[val_marker][iVertex];
6519-
Flow_Dir = Inlet_FlowDir[val_marker][iVertex];
6519+
const su2double* dir = Inlet_FlowDir[val_marker][iVertex];
6520+
const su2double mag = GeometryToolbox::Norm(nDim, dir);
6521+
for (iDim = 0; iDim < nDim; iDim++) {
6522+
Flow_Dir[iDim] = dir[iDim] / mag;
6523+
}
65206524

65216525
/*--- Non-dim. the inputs if necessary. ---*/
65226526

@@ -6614,16 +6618,20 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
66146618
V_inlet[nDim+3] = Energy + Pressure/Density;
66156619

66166620
break;
6621+
}
6622+
/*--- Mass flow has been specified at the inlet. ---*/
66176623

6618-
/*--- Mass flow has been specified at the inlet. ---*/
6619-
6620-
case INLET_TYPE::MASS_FLOW:
6624+
case INLET_TYPE::MASS_FLOW: {
66216625

66226626
/*--- Retrieve the specified mass flow for the inlet. ---*/
66236627

66246628
Density = Inlet_Ttotal[val_marker][iVertex];
66256629
Vel_Mag = Inlet_Ptotal[val_marker][iVertex];
6626-
Flow_Dir = Inlet_FlowDir[val_marker][iVertex];
6630+
const su2double* dir = Inlet_FlowDir[val_marker][iVertex];
6631+
const su2double mag = GeometryToolbox::Norm(nDim, dir);
6632+
for (iDim = 0; iDim < nDim; iDim++) {
6633+
Flow_Dir[iDim] = dir[iDim] / mag;
6634+
}
66276635

66286636
/*--- Non-dim. the inputs if necessary. ---*/
66296637

@@ -6672,7 +6680,7 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
66726680
V_inlet[nDim+3] = Energy + Pressure/Density;
66736681

66746682
break;
6675-
6683+
}
66766684
default:
66776685
SU2_MPI::Error("Unsupported INLET_TYPE.", CURRENT_FUNCTION);
66786686
break;

TestCases/hybrid_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def main():
132132
poiseuille_profile.cfg_dir = "navierstokes/poiseuille"
133133
poiseuille_profile.cfg_file = "profile_poiseuille.cfg"
134134
poiseuille_profile.test_iter = 10
135-
poiseuille_profile.test_vals = [-12.494752, -7.712204, -0.000000, 2.085796]
135+
poiseuille_profile.test_vals = [-12.494712, -7.710813, -0.000000, 2.085796]
136136
test_list.append(poiseuille_profile)
137137

138138
# 2D Rotational Periodic

TestCases/serial_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def main():
250250
poiseuille_profile.cfg_dir = "navierstokes/poiseuille"
251251
poiseuille_profile.cfg_file = "profile_poiseuille.cfg"
252252
poiseuille_profile.test_iter = 10
253-
poiseuille_profile.test_vals = [-12.494720, -7.711373, -0.000000, 2.085796] #last 4 columns
253+
poiseuille_profile.test_vals = [-12.494715, -7.711824, -0.000000, 2.085796] #last 4 columns
254254
poiseuille_profile.su2_exec = "SU2_CFD"
255255
poiseuille_profile.new_output = True
256256
poiseuille_profile.timeout = 1600

0 commit comments

Comments
 (0)