Skip to content

Commit 454964b

Browse files
committed
do not repeat loading the volume data, make flow dir unit in CEulerSolver
1 parent 0232486 commit 454964b

2 files changed

Lines changed: 23 additions & 12 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: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6456,7 +6456,7 @@ 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,
6459+
Pressure, Density, Energy, Flow_Dir[MAXNDIM] = {0.0}, Mach2, SoundSpeed2, SoundSpeed_Total2, Vel_Mag,
64606460
alpha, aa, bb, cc, dd, Area, UnitNormal[MAXNDIM], Normal[MAXNDIM] = {0.0};
64616461
su2double *V_inlet, *V_domain;
64626462

@@ -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

@@ -6623,7 +6627,11 @@ void CEulerSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container,
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

0 commit comments

Comments
 (0)