Skip to content

Commit 6a2f950

Browse files
author
paan882
committed
Fix errors in regression tests (hopefully)
1 parent ca99d8d commit 6a2f950

4 files changed

Lines changed: 56 additions & 49 deletions

File tree

SU2_CFD/src/output/CFlowCompOutput.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){
315315
void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
316316

317317
const auto* Node_Flow = solver[FLOW_SOL]->GetNodes();
318-
const auto* Node_Turb = solver[TURB_SOL]->GetNodes();
318+
const CVariable* Node_Turb = nullptr;
319+
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) Node_Turb = solver[TURB_SOL]->GetNodes();
319320
auto* Node_Geo = geometry->nodes;
320321

321322
LoadCoordinates(Node_Geo->GetCoord(iPoint), iPoint);

SU2_CFD/src/output/CFlowIncOutput.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ void CFlowIncOutput::SetVolumeOutputFields(CConfig *config){
399399
void CFlowIncOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
400400

401401
const auto* Node_Flow = solver[FLOW_SOL]->GetNodes();
402-
const auto* Node_Turb = solver[TURB_SOL]->GetNodes();
402+
const CVariable* Node_Turb = nullptr;
403+
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) Node_Turb = solver[TURB_SOL]->GetNodes();
403404
const CVariable* Node_Heat = nullptr;
404405
const CVariable* Node_Rad = nullptr;
405406
auto* Node_Geo = geometry->nodes;

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4133,19 +4133,21 @@ void CFlowOutput::SetTimeAveragedFields(const CConfig *config) {
41334133
AddVolumeOutput("VWPRIME", "w'v'", "TIME_AVERAGE", "Mean Reynolds-stress component w'v'");
41344134
}
41354135

4136-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_11", "ModeledReynoldsStress_11", "TIME_AVERAGE", "Modeled Reynolds stress xx-component");
4137-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_22", "ModeledReynoldsStress_22", "TIME_AVERAGE", "Modeled Reynolds stress yy-component");
4138-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_12", "ModeledReynoldsStress_12", "TIME_AVERAGE", "Modeled Reynolds stress xy-component");
4139-
if (nDim == 3){
4140-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_33", "ModeledReynoldsStress_33", "TIME_AVERAGE", "Modeled Reynolds stress zz-component");
4141-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_13", "ModeledReynoldsStress_13", "TIME_AVERAGE", "Modeled Reynolds stress xz-component");
4142-
AddVolumeOutput("MODELED_REYNOLDS_STRESS_23", "ModeledReynoldsStress_23", "TIME_AVERAGE", "Modeled Reynolds stress yz-component");
4143-
}
4136+
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) {
4137+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_11", "ModeledReynoldsStress_11", "TIME_AVERAGE", "Modeled Reynolds stress xx-component");
4138+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_22", "ModeledReynoldsStress_22", "TIME_AVERAGE", "Modeled Reynolds stress yy-component");
4139+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_12", "ModeledReynoldsStress_12", "TIME_AVERAGE", "Modeled Reynolds stress xy-component");
4140+
if (nDim == 3){
4141+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_33", "ModeledReynoldsStress_33", "TIME_AVERAGE", "Modeled Reynolds stress zz-component");
4142+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_13", "ModeledReynoldsStress_13", "TIME_AVERAGE", "Modeled Reynolds stress xz-component");
4143+
AddVolumeOutput("MODELED_REYNOLDS_STRESS_23", "ModeledReynoldsStress_23", "TIME_AVERAGE", "Modeled Reynolds stress yz-component");
4144+
}
41444145

4145-
if (config->GetSBSParam().StochasticBackscatter) {
4146-
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_12", "StochasticReynoldsStress_12", "TIME_AVERAGE", "Stochastic Reynolds stress xy-component");
4147-
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_13", "StochasticReynoldsStress_13", "TIME_AVERAGE", "Stochastic Reynolds stress xz-component");
4148-
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_23", "StochasticReynoldsStress_23", "TIME_AVERAGE", "Stochastic Reynolds stress yz-component");
4146+
if (config->GetSBSParam().StochasticBackscatter) {
4147+
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_12", "StochasticReynoldsStress_12", "TIME_AVERAGE", "Stochastic Reynolds stress xy-component");
4148+
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_13", "StochasticReynoldsStress_13", "TIME_AVERAGE", "Stochastic Reynolds stress xz-component");
4149+
AddVolumeOutput("STOCHASTIC_REYNOLDS_STRESS_23", "StochasticReynoldsStress_23", "TIME_AVERAGE", "Stochastic Reynolds stress yz-component");
4150+
}
41494151
}
41504152
}
41514153

@@ -4189,41 +4191,43 @@ void CFlowOutput::LoadTimeAveragedData(unsigned long iPoint, const CVariable *No
41894191
SetVolumeOutputValue("VWPRIME", iPoint, -(vmean*wmean - vwmean));
41904192
}
41914193

4192-
const su2double rho = Node_Flow->GetDensity(iPoint);
4193-
const su2double nu_t = Node_Flow->GetEddyViscosity(iPoint) / rho;
4194-
const auto vel_grad = Node_Flow->GetVelocityGradient(iPoint);
4195-
const su2double vel_div = vel_grad(0,0) + vel_grad(1,1) + (nDim ==3 ? vel_grad(2,2) : 0.0);
4196-
const su2double tau_xx = nu_t * (2*vel_grad(0,0) - (2.0/3.0)*vel_div);
4197-
const su2double tau_yy = nu_t * (2*vel_grad(1,1) - (2.0/3.0)*vel_div);
4198-
const su2double tau_xy = nu_t * (vel_grad(0,1) + vel_grad(1,0));
4199-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_11", iPoint, -tau_xx);
4200-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_22", iPoint, -tau_yy);
4201-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_12", iPoint, -tau_xy);
4202-
if (nDim == 3){
4203-
const su2double tau_zz = nu_t * (2*vel_grad(2,2) - (2.0/3.0)*vel_div);
4204-
const su2double tau_xz = nu_t * (vel_grad(0,2) + vel_grad(2,0));
4205-
const su2double tau_yz = nu_t * (vel_grad(1,2) + vel_grad(2,1));
4206-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_33", iPoint, -tau_zz);
4207-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_13", iPoint, -tau_xz);
4208-
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_23", iPoint, -tau_yz);
4209-
}
4194+
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) {
4195+
const su2double rho = Node_Flow->GetDensity(iPoint);
4196+
const su2double nu_t = Node_Flow->GetEddyViscosity(iPoint) / rho;
4197+
const auto vel_grad = Node_Flow->GetVelocityGradient(iPoint);
4198+
const su2double vel_div = vel_grad(0,0) + vel_grad(1,1) + (nDim ==3 ? vel_grad(2,2) : 0.0);
4199+
const su2double tau_xx = nu_t * (2*vel_grad(0,0) - (2.0/3.0)*vel_div);
4200+
const su2double tau_yy = nu_t * (2*vel_grad(1,1) - (2.0/3.0)*vel_div);
4201+
const su2double tau_xy = nu_t * (vel_grad(0,1) + vel_grad(1,0));
4202+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_11", iPoint, -tau_xx);
4203+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_22", iPoint, -tau_yy);
4204+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_12", iPoint, -tau_xy);
4205+
if (nDim == 3){
4206+
const su2double tau_zz = nu_t * (2*vel_grad(2,2) - (2.0/3.0)*vel_div);
4207+
const su2double tau_xz = nu_t * (vel_grad(0,2) + vel_grad(2,0));
4208+
const su2double tau_yz = nu_t * (vel_grad(1,2) + vel_grad(2,1));
4209+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_33", iPoint, -tau_zz);
4210+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_13", iPoint, -tau_xz);
4211+
SetAvgVolumeOutputValue("MODELED_REYNOLDS_STRESS_23", iPoint, -tau_yz);
4212+
}
42104213

4211-
if (config->GetSBSParam().StochasticBackscatter) {
4212-
const su2double DES_lengthscale = max(Node_Flow->GetDES_LengthScale(iPoint), 1e-10);
4213-
const su2double lesSensor = Node_Flow->GetLES_Mode(iPoint);
4214-
const su2double mag = config->GetSBSParam().SBS_Cmag;
4215-
const su2double threshold = config->GetSBSParam().stochFdThreshold;
4216-
su2double tke_estim = 0.0;
4217-
if (lesSensor > threshold) tke_estim = pow(nu_t/DES_lengthscale, 2);
4218-
const su2double csi_x = Node_Turb->GetSolution(iPoint, 1);
4219-
const su2double csi_y = Node_Turb->GetSolution(iPoint, 2);
4220-
const su2double csi_z = Node_Turb->GetSolution(iPoint, 3);
4221-
const su2double R_xy = - mag * tke_estim * csi_z;
4222-
const su2double R_xz = + mag * tke_estim * csi_y;
4223-
const su2double R_yz = - mag * tke_estim * csi_x;
4224-
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_12", iPoint, -R_xy);
4225-
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_13", iPoint, -R_xz);
4226-
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_23", iPoint, -R_yz);
4214+
if (config->GetSBSParam().StochasticBackscatter) {
4215+
const su2double DES_lengthscale = max(Node_Flow->GetDES_LengthScale(iPoint), 1e-10);
4216+
const su2double lesSensor = Node_Flow->GetLES_Mode(iPoint);
4217+
const su2double mag = config->GetSBSParam().SBS_Cmag;
4218+
const su2double threshold = config->GetSBSParam().stochFdThreshold;
4219+
su2double tke_estim = 0.0;
4220+
if (lesSensor > threshold) tke_estim = pow(nu_t/DES_lengthscale, 2);
4221+
const su2double csi_x = Node_Turb->GetSolution(iPoint, 1);
4222+
const su2double csi_y = Node_Turb->GetSolution(iPoint, 2);
4223+
const su2double csi_z = Node_Turb->GetSolution(iPoint, 3);
4224+
const su2double R_xy = - mag * tke_estim * csi_z;
4225+
const su2double R_xz = + mag * tke_estim * csi_y;
4226+
const su2double R_yz = - mag * tke_estim * csi_x;
4227+
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_12", iPoint, -R_xy);
4228+
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_13", iPoint, -R_xz);
4229+
SetAvgVolumeOutputValue("STOCHASTIC_REYNOLDS_STRESS_23", iPoint, -R_yz);
4230+
}
42274231
}
42284232
}
42294233

SU2_CFD/src/output/CNEMOCompOutput.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ void CNEMOCompOutput::SetVolumeOutputFields(CConfig *config){
306306
void CNEMOCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolver **solver, unsigned long iPoint){
307307

308308
const auto* Node_Flow = solver[FLOW_SOL]->GetNodes();
309-
const auto* Node_Turb = solver[TURB_SOL]->GetNodes();
309+
const CVariable* Node_Turb = nullptr;
310+
if (config->GetKind_Turb_Model() != TURB_MODEL::NONE) Node_Turb = solver[TURB_SOL]->GetNodes();
310311
auto* Node_Geo = geometry->nodes;
311312
const auto nSpecies = config->GetnSpecies();
312313

0 commit comments

Comments
 (0)