Skip to content

Commit 12974ab

Browse files
committed
fewer cases in CSlidingInterface::GetDonor_Variable
1 parent 8efbe0b commit 12974ab

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

SU2_CFD/src/interfaces/cfd/CSlidingInterface.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,16 @@ void CSlidingInterface::GetDonor_Variable(CSolver *donor_solution, CGeometry *do
4747
const CConfig *donor_config, unsigned long Marker_Donor,
4848
unsigned long Vertex_Donor, unsigned long Point_Donor) {
4949

50-
unsigned short iVar, nDonorVar;
51-
nDonorVar = donor_solution->GetnPrimVar();
52-
53-
/*--- the number of primitive variables is set to two by default for the turbulent solver ---*/
54-
bool SA, SST;
55-
SA = (nDonorVar == 1);
56-
SST = (nDonorVar == 2);
57-
58-
if (SA){
59-
/*--- for SA turbulent solver retrieve solution and set it as the donor variable ---*/
60-
Donor_Variable[0] = donor_solution->GetNodes()->GetSolution(Point_Donor,0);
61-
}
62-
else if (SST){
63-
/*--- for SST turbulent solver retrieve solution and set it as the donor variable ---*/
64-
Donor_Variable[0] = donor_solution->GetNodes()->GetSolution(Point_Donor,0);
65-
Donor_Variable[1] = donor_solution->GetNodes()->GetSolution(Point_Donor,1);
66-
}
67-
else{
68-
/*--- Retrieve primitive variables and set them as the donor variables ---*/
69-
for (iVar = 0; iVar < nDonorVar; iVar++) {
50+
const unsigned short nDonorVar = donor_solution->GetnPrimVar();
51+
const bool turbulent = (nDonorVar==1) || (nDonorVar==2); // SA or SST
52+
if (turbulent){
53+
/*--- For turbulent solver retrieve solution variables and set then as the donor variables. ---*/
54+
for (unsigned short iVar = 0; iVar < nDonorVar; iVar++) {
55+
Donor_Variable[iVar] = donor_solution->GetNodes()->GetSolution(Point_Donor, iVar);
56+
}
57+
} else {
58+
/*--- For flow solver retrieve primitive variables and set them as the donor variables. ---*/
59+
for (unsigned short iVar = 0; iVar < nDonorVar; iVar++) {
7060
Donor_Variable[iVar] = donor_solution->GetNodes()->GetPrimitive(Point_Donor, iVar);
7161
}
7262
}

0 commit comments

Comments
 (0)