Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion SU2_CFD/src/output/CFlowOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,10 @@ void CFlowOutput::AddAerodynamicCoefficients(const CConfig* config) {
}

void CFlowOutput::SetAerodynamicCoefficients(const CConfig* config, const CSolver* flow_solver){

if (config->GetRefArea() <= 0.0) {
return;
}

SetHistoryOutputValue("REFERENCE_FORCE", flow_solver->GetAeroCoeffsReferenceForce());
SetHistoryOutputValue("DRAG", flow_solver->GetTotal_CD());
SetHistoryOutputValue("LIFT", flow_solver->GetTotal_CL());
Expand Down
15 changes: 15 additions & 0 deletions SU2_CFD/src/solvers/CAdjNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short
/*--- Objective scaling: a factor must be applied to certain objectives ---*/
for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
Weight_ObjFunc = config->GetWeight_ObjFunc(iMarker_Monitoring);
ObjFunc = config->GetKind_ObjFunc(iMarker_Monitoring);

if ((ObjFunc == DRAG_COEFFICIENT) || (ObjFunc == LIFT_COEFFICIENT) || (ObjFunc == SIDEFORCE_COEFFICIENT) ||
(ObjFunc == MOMENT_X_COEFFICIENT) || (ObjFunc == MOMENT_Y_COEFFICIENT) || (ObjFunc == MOMENT_Z_COEFFICIENT)) {
if (RefArea <= 0.0) {
SU2_MPI::Error("The requested adjoint objective requires a valid REF_AREA, but it is currently 0.0.", CURRENT_FUNCTION);
}
}

factor = 1.0/(0.5*RefDensity*RefArea*RefVel2);

Expand Down Expand Up @@ -643,6 +651,13 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
factor = 1.0;
/*-- For multi-objective problems these scaling factors are applied before solution ---*/
if (config->GetnObj()==1) {
if ((ObjFunc == DRAG_COEFFICIENT) || (ObjFunc == LIFT_COEFFICIENT) || (ObjFunc == SIDEFORCE_COEFFICIENT) ||
(ObjFunc == MOMENT_X_COEFFICIENT) || (ObjFunc == MOMENT_Y_COEFFICIENT) || (ObjFunc == MOMENT_Z_COEFFICIENT)) {
if (RefArea <= 0.0) {
SU2_MPI::Error("REF_AREA is 0.0. Cannot compute viscous sensitivity for aerodynamic objective.", CURRENT_FUNCTION);
}
}

factor = 1.0/(0.5*RefDensity*RefArea*RefVel2);

if ((ObjFunc == INVERSE_DESIGN_HEATFLUX) ||
Expand Down