Skip to content

Commit c7c9dfb

Browse files
committed
Cleanup 2
1 parent 9653fc3 commit c7c9dfb

7 files changed

Lines changed: 44 additions & 51 deletions

File tree

SU2_CFD/src/iteration/CDiscAdjFluidIteration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ void CDiscAdjFluidIteration::SetDependencies(CSolver***** solver, CGeometry****
540540

541541
SU2_OMP_PARALLEL_(if(solver[iZone][iInst][MESH_0][ADJFLOW_SOL]->GetHasHybridParallel())) {
542542

543-
/*--- Compute coupling between flow and turbulent equations ---*/
543+
/*--- Compute coupling between flow, turbulent and species equations ---*/
544544
solver[iZone][iInst][MESH_0][FLOW_SOL]->Preprocessing(geometry[iZone][iInst][MESH_0], solver[iZone][iInst][MESH_0],
545545
config[iZone], MESH_0, NO_RK_ITER, RUNTIME_FLOW_SYS, true);
546546
solver[iZone][iInst][MESH_0][FLOW_SOL]->InitiateComms(geometry[iZone][iInst][MESH_0], config[iZone], SOLUTION);

SU2_CFD/src/numerics/species/species_sources.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
2-
* \file turb_sources.cpp
2+
* \file species_sources.cpp
33
* \brief Implementation of numerics classes for integration of
4-
* turbulence source-terms.
4+
* species transport source-terms.
55
* \author T. Kattmann
66
* \version 7.2.1 "Blackbird"
77
*

SU2_CFD/src/output/CFlowIncOutput.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
393393
Node_Heat = solver[HEAT_SOL]->GetNodes();
394394
}
395395

396-
397396
LoadCoordinates(Node_Geo->GetCoord(iPoint), iPoint);
398397

399398
SetVolumeOutputValue("PRESSURE", iPoint, Node_Flow->GetSolution(iPoint, 0));
@@ -448,7 +447,7 @@ void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolve
448447
SetVolumeOutputValue("LIMITER_TEMPERATURE", iPoint, Node_Flow->GetLimiter_Primitive(iPoint, nDim+1));
449448
}
450449

451-
// All turbulence outputs.
450+
// All turbulence and species outputs.
452451
LoadVolumeData_Scalar(config, solver, geometry, iPoint);
453452

454453
// Streamwise Periodicity

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void CFlowOutput::AddAnalyzeSurfaceOutput(const CConfig *config){
7474
for (unsigned short iVar = 0; iVar < config->GetnSpecies(); iVar++) {
7575
AddHistoryOutput("SURFACE_SPECIES_" + std::to_string(iVar), "Avg_Species_" + std::to_string(iVar), ScreenOutputFormat::FIXED, "SPECIES_COEFF", "Total average species " + std::to_string(iVar) + " on all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT);
7676
}
77-
/// DESCRIPTION: Average Species
77+
/// DESCRIPTION: Species Variance
7878
AddHistoryOutput("SURFACE_SPECIES_VARIANCE", "Species_Variance", ScreenOutputFormat::SCIENTIFIC, "SPECIES_COEFF", "Total species variance, measure for mixing quality. On all markers set in MARKER_ANALYZE", HistoryFieldType::COEFFICIENT);
7979
/// END_GROUP
8080

@@ -114,7 +114,7 @@ void CFlowOutput::AddAnalyzeSurfaceOutput(const CConfig *config){
114114
for (unsigned short iVar = 0; iVar < config->GetnSpecies(); iVar++) {
115115
AddHistoryOutputPerSurface("SURFACE_SPECIES_" + std::to_string(iVar), "Avg_Species_" + std::to_string(iVar), ScreenOutputFormat::FIXED, "SPECIES_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT);
116116
}
117-
/// DESCRIPTION: Average Species
117+
/// DESCRIPTION: Species Variance
118118
AddHistoryOutputPerSurface("SURFACE_SPECIES_VARIANCE", "Species_Variance", ScreenOutputFormat::SCIENTIFIC, "SPECIES_COEFF_SURF", Marker_Analyze, HistoryFieldType::COEFFICIENT);
119119
/// END_GROUP
120120
}
@@ -632,7 +632,10 @@ void CFlowOutput::SetAnalyzeSurface(const CSolver* const*solver, const CGeometry
632632
std::cout << std::resetiosflags(std::cout.flags());
633633
}
634634

635-
void CFlowOutput::SetAnalyzeSurface_SpeciesVariance(const CSolver* const*solver, const CGeometry *geometry, CConfig *config, su2activematrix Surface_Species_Total, vector<su2double> Surface_MassFlow_Abs_Total, vector<su2double> Surface_Area_Total) {
635+
void CFlowOutput::SetAnalyzeSurface_SpeciesVariance(const CSolver* const*solver, const CGeometry *geometry,
636+
CConfig *config, su2activematrix Surface_Species_Total,
637+
vector<su2double> Surface_MassFlow_Abs_Total,
638+
vector<su2double> Surface_Area_Total) {
636639

637640
const unsigned short nMarker = config->GetnMarker_All();
638641
const unsigned short nDim = geometry->GetnDim();
@@ -668,9 +671,6 @@ void CFlowOutput::SetAnalyzeSurface_SpeciesVariance(const CSolver* const*solver,
668671

669672
if (geometry->nodes->GetDomain(iPoint)) {
670673

671-
su2double Vector[3];
672-
geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
673-
674674
su2double AxiFactor = 0.0;
675675
if (axisymmetric) {
676676
if (geometry->nodes->GetCoord(iPoint, 1) != 0.0)
@@ -691,15 +691,15 @@ void CFlowOutput::SetAnalyzeSurface_SpeciesVariance(const CSolver* const*solver,
691691
AxiFactor = 1.0;
692692
}
693693

694+
su2double Vector[3];
695+
geometry->vertex[iMarker][iVertex]->GetNormal(Vector);
694696
const su2double Density = flow_nodes->GetDensity(iPoint);
695697
su2double Area = 0.0;
696698
su2double MassFlow = 0.0;
697-
su2double Velocity[3];
698699

699700
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
700701
Area += (Vector[iDim] * AxiFactor) * (Vector[iDim] * AxiFactor);
701-
Velocity[iDim] = flow_nodes->GetVelocity(iPoint,iDim);
702-
MassFlow += Vector[iDim] * AxiFactor * Density * Velocity[iDim];
702+
MassFlow += Vector[iDim] * AxiFactor * Density * flow_nodes->GetVelocity(iPoint,iDim);
703703
}
704704
Area= sqrt(Area);
705705

SU2_CFD/src/solvers/CSpeciesSolver.cpp

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,42 +59,41 @@ CSpeciesSolver::CSpeciesSolver(CGeometry* geometry, CConfig* config, unsigned sh
5959
nDim = geometry->GetnDim();
6060

6161
/*--- Single grid simulation ---*/
62-
/*--- do not see a reason to use only single grid ---*/
63-
// if (iMesh == MESH_0) {
64-
65-
/*--- Define some auxiliary vector related with the residual ---*/
66-
67-
Residual_RMS.resize(nVar, 0.0);
68-
Residual_Max.resize(nVar, 0.0);
69-
Point_Max.resize(nVar, 0);
70-
Point_Max_Coord.resize(nVar, nDim) = su2double(0.0);
71-
72-
/*--- Initialize the BGS residuals in multizone problems. ---*/
73-
if (config->GetMultizone_Problem()) {
74-
Residual_BGS.resize(nVar, 0.0);
75-
Residual_Max_BGS.resize(nVar, 0.0);
76-
Point_Max_BGS.resize(nVar, 0);
77-
Point_Max_Coord_BGS.resize(nVar, nDim) = su2double(0.0);
78-
}
7962

80-
/*--- Initialization of the structure of the whole Jacobian ---*/
63+
if (iMesh == MESH_0 || config->GetMGCycle() == FULLMG_CYCLE) {
8164

82-
if (rank == MASTER_NODE) cout << "Initialize Jacobian structure (passive scalar model)." << endl;
83-
Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config, ReducerStrategy);
65+
/*--- Define some auxiliary vector related with the residual ---*/
8466

85-
if (config->GetKind_Linear_Solver_Prec() == LINELET) {
86-
const auto nLineLets = Jacobian.BuildLineletPreconditioner(geometry, config);
87-
if (rank == MASTER_NODE)
88-
cout << "Compute linelet structure. " << nLineLets << " elements in each line (average)." << endl;
89-
}
67+
Residual_RMS.resize(nVar, 0.0);
68+
Residual_Max.resize(nVar, 0.0);
69+
Point_Max.resize(nVar, 0);
70+
Point_Max_Coord.resize(nVar, nDim) = su2double(0.0);
71+
72+
/*--- Initialize the BGS residuals in multizone problems. ---*/
73+
if (config->GetMultizone_Problem()) {
74+
Residual_BGS.resize(nVar, 0.0);
75+
Residual_Max_BGS.resize(nVar, 0.0);
76+
Point_Max_BGS.resize(nVar, 0);
77+
Point_Max_Coord_BGS.resize(nVar, nDim) = su2double(0.0);
78+
}
9079

91-
LinSysSol.Initialize(nPoint, nPointDomain, nVar, 0.0);
92-
LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0);
93-
System.SetxIsZero(true);
80+
/*--- Initialization of the structure of the whole Jacobian ---*/
9481

95-
if (ReducerStrategy) EdgeFluxes.Initialize(geometry->GetnEdge(), geometry->GetnEdge(), nVar, nullptr);
82+
if (rank == MASTER_NODE) cout << "Initialize Jacobian structure (passive scalar model)." << endl;
83+
Jacobian.Initialize(nPoint, nPointDomain, nVar, nVar, true, geometry, config, ReducerStrategy);
9684

97-
//} //iMESH_0
85+
if (config->GetKind_Linear_Solver_Prec() == LINELET) {
86+
const auto nLineLets = Jacobian.BuildLineletPreconditioner(geometry, config);
87+
if (rank == MASTER_NODE)
88+
cout << "Compute linelet structure. " << nLineLets << " elements in each line (average)." << endl;
89+
}
90+
91+
LinSysSol.Initialize(nPoint, nPointDomain, nVar, 0.0);
92+
LinSysRes.Initialize(nPoint, nPointDomain, nVar, 0.0);
93+
System.SetxIsZero(true);
94+
95+
if (ReducerStrategy) EdgeFluxes.Initialize(geometry->GetnEdge(), geometry->GetnEdge(), nVar, nullptr);
96+
}
9897

9998
/*--- Initialize lower and upper limits---*/
10099

@@ -376,9 +375,7 @@ void CSpeciesSolver::BC_Inlet(CGeometry* geometry, CSolver** solver_container, C
376375

377376
conv_numerics->SetPrimitive(V_domain, V_inlet);
378377

379-
/*--- Set the turbulent variable states. Use free-stream SST
380-
values for the turbulent state at the inflow. ---*/
381-
/*--- Load the inlet turbulence variables (uniform by default). ---*/
378+
/*--- Set the species variable state at the inlet. ---*/
382379

383380
conv_numerics->SetScalarVar(nodes->GetSolution(iPoint), Inlet_SpeciesVars[val_marker][iVertex]);
384381

SU2_CFD/src/variables/CSpeciesVariable.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ CSpeciesVariable::CSpeciesVariable(const su2double* species_inf, unsigned long n
3333
/*--- Allocate space for the mass diffusivity. ---*/
3434
Diffusivity.resize(nPoint, nVar) = su2double(0.0);
3535

36-
/// NOTE TK: Consistent with SST and SA.
3736
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++)
3837
for (unsigned long iVar = 0; iVar < nVar; iVar++)
3938
Solution(iPoint, iVar) = species_inf[iVar];

TestCases/species_transport/passive_transport_validation/passive_transport.cfg

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ SLOPE_LIMITER_SPECIES= NONE
4040
%
4141
TIME_DISCRE_SPECIES= EULER_IMPLICIT
4242
%
43-
% Scalar clipping
44-
SPECIES_CLIPPING= YES
4543
SPECIES_INIT = 0
44+
SPECIES_CLIPPING= YES
4645
SPECIES_CLIPPING_MIN= 0.0
4746
SPECIES_CLIPPING_MAX= 1.0
4847
%
@@ -90,7 +89,6 @@ CONV_STARTITER= 10
9089
%
9190
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
9291
%
93-
% Mesh input file
9492
MESH_FILENAME = rectangle_mixing.su2
9593
%
9694
SCREEN_OUTPUT = INNER_ITER WALL_TIME RMS_PRESSURE RMS_VELOCITY-X RMS_VELOCITY-Y RMS_SPECIES_0 LINSOL_ITER LINSOL_RESIDUAL LINSOL_ITER_SPECIES LINSOL_RESIDUAL_SPECIES

0 commit comments

Comments
 (0)