Skip to content

Commit 1e5d4ff

Browse files
authored
Merge pull request #1427 from su2code/fix_inletfiles
Fixes to inlet files
2 parents ccc1c6e + e242f47 commit 1e5d4ff

4 files changed

Lines changed: 43 additions & 25 deletions

File tree

SU2_CFD/src/CMarkerProfileReaderFVM.cpp

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,8 @@ void CMarkerProfileReaderFVM::MergeProfileMarkers() {
357357
}
358358
}
359359

360-
/*--- Sort and remove the duplicate profile marker strings. ---*/
360+
/*--- Remove the duplicate profile marker strings. From 1 per point to 1 per marker. ---*/
361361

362-
sort(profileTags.begin(), profileTags.end());
363362
profileTags.erase(unique(profileTags.begin(),
364363
profileTags.end()),
365364
profileTags.end());
@@ -450,37 +449,41 @@ void CMarkerProfileReaderFVM::WriteMarkerProfileTemplate() {
450449

451450
node_file << "NMARK= " << numberOfProfiles << endl;
452451

453-
for (unsigned short iMarker = 0; iMarker < numberOfProfiles; iMarker++) {
452+
unsigned short iMarkerCounter = 0;
453+
for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
454+
if (config->GetMarker_All_KindBC(iMarker) == markerType) {
454455

455-
/*--- Access the default data for this marker. ---*/
456+
/*--- Access the default data for this marker. ---*/
456457

457-
string Marker_Tag = profileTags[iMarker];
458+
string Marker_Tag = profileTags[iMarkerCounter];
458459

459-
/*--- Header information for this marker. ---*/
460+
/*--- Header information for this marker. ---*/
460461

461-
node_file << "MARKER_TAG= " << Marker_Tag << endl;
462-
node_file << "NROW=" << numberOfRowsInProfile[iMarker] << endl;
463-
node_file << "NCOL=" << nColumns << endl;
462+
node_file << "MARKER_TAG= " << Marker_Tag << endl;
463+
node_file << "NROW=" << numberOfRowsInProfile[iMarkerCounter] << endl;
464+
node_file << "NCOL=" << nColumns << endl;
464465

465-
/*--- header line (names of the columns) --- */
466-
node_file << columnNames[iMarker] << endl;
466+
/*--- header line (names of the columns) --- */
467+
node_file << columnNames[iMarkerCounter] << endl;
467468

468-
node_file << setprecision(15);
469-
node_file << std::scientific;
469+
node_file << setprecision(15);
470+
node_file << std::scientific;
470471

471-
/*--- Loop over the data structure and write the coords and vars. ---*/
472+
/*--- Loop over the data structure and write the coords and vars. ---*/
472473

473-
for (unsigned long iPoint = 0; iPoint < numberOfRowsInProfile[iMarker]; iPoint++) {
474+
for (unsigned long iPoint = 0; iPoint < numberOfRowsInProfile[iMarkerCounter]; iPoint++) {
474475

475-
for (unsigned short iDim = 0; iDim < dimension; iDim++) {
476-
node_file << profileCoords[iMarker][iDim][iPoint] << "\t";
477-
}
476+
for (unsigned short iDim = 0; iDim < dimension; iDim++) {
477+
node_file << profileCoords[iMarkerCounter][iDim][iPoint] << "\t";
478+
}
478479

479-
node_file << columnValues[iMarker] << endl;
480+
node_file << columnValues[iMarkerCounter] << endl;
480481

481-
}
482+
}
482483

483-
}
484+
iMarkerCounter++;
485+
}
486+
} // iMarker
484487
node_file.close();
485488

486489
/*--- Print a message to inform the user about the template file. ---*/

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3617,7 +3617,7 @@ void CSolver::LoadInletProfile(CGeometry **geometry,
36173617
case TURB_MODEL::SA: case TURB_MODEL::SA_NEG: case TURB_MODEL::SA_E: case TURB_MODEL::SA_COMP: case TURB_MODEL::SA_E_COMP:
36183618
/*--- 1-equation turbulence model: SA ---*/
36193619
columnName << "NU_TILDE " << setw(24);
3620-
columnValue << config->GetNuFactor_FreeStream()*config->GetViscosity_FreeStreamND()/config->GetDensity_FreeStreamND() <<"\t";
3620+
columnValue << config->GetNuFactor_FreeStream() * config->GetViscosity_FreeStream() / config->GetDensity_FreeStream() <<"\t";
36213621
break;
36223622
case TURB_MODEL::SST: case TURB_MODEL::SST_SUST:
36233623
/*--- 2-equation turbulence model (SST) ---*/

SU2_CFD/src/solvers/CTurbSASolver.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,16 @@ void CTurbSASolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, CN
598598

599599
conv_numerics->SetPrimitive(V_domain, V_inlet);
600600

601+
/*--- Non-dimensionalize Inlet_TurbVars if Inlet-Files are used. ---*/
602+
su2double Inlet_Vars[MAXNVAR];
603+
Inlet_Vars[0] = Inlet_TurbVars[val_marker][iVertex][0];
604+
if (config->GetInlet_Profile_From_File()) {
605+
Inlet_Vars[0] *= config->GetDensity_Ref() / config->GetViscosity_Ref();
606+
}
607+
601608
/*--- Load the inlet turbulence variable (uniform by default). ---*/
602609

603-
conv_numerics->SetScalarVar(nodes->GetSolution(iPoint), Inlet_TurbVars[val_marker][iVertex]);
610+
conv_numerics->SetScalarVar(nodes->GetSolution(iPoint), Inlet_Vars);
604611

605612
/*--- Set various other quantities in the conv_numerics class ---*/
606613

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,20 @@ void CTurbSSTSolver::BC_Inlet(CGeometry *geometry, CSolver **solver_container, C
628628

629629
conv_numerics->SetPrimitive(V_domain, V_inlet);
630630

631+
/*--- Non-dimensionalize Inlet_TurbVars if Inlet-Files are used. ---*/
632+
su2double Inlet_Vars[MAXNVAR];
633+
Inlet_Vars[0] = Inlet_TurbVars[val_marker][iVertex][0];
634+
Inlet_Vars[1] = Inlet_TurbVars[val_marker][iVertex][1];
635+
if (config->GetInlet_Profile_From_File()) {
636+
Inlet_Vars[0] /= pow(config->GetVelocity_Ref(), 2);
637+
Inlet_Vars[1] *= config->GetViscosity_Ref() / (config->GetDensity_Ref() * pow(config->GetVelocity_Ref(), 2));
638+
}
639+
631640
/*--- Set the turbulent variable states. Use free-stream SST
632641
values for the turbulent state at the inflow. ---*/
633642
/*--- Load the inlet turbulence variables (uniform by default). ---*/
634643

635-
conv_numerics->SetScalarVar(nodes->GetSolution(iPoint),
636-
Inlet_TurbVars[val_marker][iVertex]);
644+
conv_numerics->SetScalarVar(nodes->GetSolution(iPoint), Inlet_Vars);
637645

638646
/*--- Set various other quantities in the solver class ---*/
639647

0 commit comments

Comments
 (0)