Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate outflow generalized #390

Merged
merged 19 commits into from
May 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ before_script:
# Get the test cases
- git clone https://github.com/su2code/TestCases.git ./TestData
- cd TestData/
- git checkout develop
- git checkout deprecate_OutflowGeneralized
# Go back to SU2 root and copy the test data into the folder structure
- cd $TRAVIS_BUILD_DIR
- cp -R ./TestData/* ./TestCases/
Expand Down
2 changes: 0 additions & 2 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,6 @@ enum ENUM_OBJECTIVE {
AVG_TOTAL_PRESSURE = 28, /*!< \brief Total Pressure objective function definition. */
AVG_OUTLET_PRESSURE = 29, /*!< \brief Static Pressure objective function definition. */
MASS_FLOW_RATE = 30, /*!< \brief Mass Flow Rate objective function definition. */
OUTFLOW_GENERALIZED = 31, /*!<\brief Objective function defined via chain rule on primitive variable gradients. */
AERO_DRAG_COEFFICIENT = 35, /*!< \brief Aero Drag objective function definition. */
RADIAL_DISTORTION = 36, /*!< \brief Radial Distortion objective function definition. */
CIRCUMFERENTIAL_DISTORTION = 37 /*!< \brief Circumferential Distortion objective function definition. */
Expand Down Expand Up @@ -989,7 +988,6 @@ static const map<string, ENUM_OBJECTIVE> Objective_Map = CCreateMap<string, ENUM
("AVG_TOTAL_PRESSURE", AVG_TOTAL_PRESSURE)
("AVG_OUTLET_PRESSURE", AVG_OUTLET_PRESSURE)
("MASS_FLOW_RATE", MASS_FLOW_RATE)
("OUTFLOW_GENERALIZED", OUTFLOW_GENERALIZED)
("AERO_DRAG", AERO_DRAG_COEFFICIENT)
("RADIAL_DISTORTION", RADIAL_DISTORTION)
("CIRCUMFERENTIAL_DISTORTION", CIRCUMFERENTIAL_DISTORTION);
Expand Down
6 changes: 1 addition & 5 deletions Common/src/config_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3954,9 +3954,8 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
case FFD_ROTATION: cout << "FFD (rotation) <-> "; break;
case FFD_CONTROL_SURFACE: cout << "FFD (control surface) <-> "; break;
case FFD_CAMBER: cout << "FFD (camber) <-> "; break;
case FFD_THICKNESS: cout << "FFD (thickness) <-> "; break;
case FFD_THICKNESS: cout << "FFD (thickness) -> "; break;
case FFD_ANGLE_OF_ATTACK: cout << "FFD (angle of attack) <-> "; break;
case CUSTOM: cout << "Custom DV <-> "; break;
}

for (iMarker_DV = 0; iMarker_DV < nMarker_DV; iMarker_DV++) {
Expand Down Expand Up @@ -3994,7 +3993,6 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
if ((Design_Variable[iDV] == FFD_CONTROL_POINT) ||
(Design_Variable[iDV] == FFD_ROTATION) ||
(Design_Variable[iDV] == FFD_CONTROL_SURFACE) ) nParamDV = 7;
if (Design_Variable[iDV] == CUSTOM) nParamDV = 1;
if (Design_Variable[iDV] == FFD_TWIST) nParamDV = 8;

for (unsigned short iParamDV = 0; iParamDV < nParamDV; iParamDV++) {
Expand Down Expand Up @@ -4091,7 +4089,6 @@ void CConfig::SetOutput(unsigned short val_software, unsigned short val_izone) {
case AVG_TOTAL_PRESSURE: cout << "Average total objective pressure." << endl; break;
case AVG_OUTLET_PRESSURE: cout << "Average static objective pressure." << endl; break;
case MASS_FLOW_RATE: cout << "Mass flow rate objective function." << endl; break;
case OUTFLOW_GENERALIZED: cout << "Generalized outflow objective function." << endl; break;
case AERO_DRAG_COEFFICIENT: cout << "Aero CD objective function." << endl; break;
case RADIAL_DISTORTION: cout << "Radial distortion objective function." << endl; break;
case CIRCUMFERENTIAL_DISTORTION: cout << "Circumferential distortion objective function." << endl; break;
Expand Down Expand Up @@ -5626,7 +5623,6 @@ string CConfig::GetObjFunc_Extension(string val_filename) {
case AVG_TOTAL_PRESSURE: AdjExt = "_pt"; break;
case AVG_OUTLET_PRESSURE: AdjExt = "_pe"; break;
case MASS_FLOW_RATE: AdjExt = "_mfr"; break;
case OUTFLOW_GENERALIZED: AdjExt = "_chn"; break;
case AERO_DRAG_COEFFICIENT: AdjExt = "_acd"; break;
case RADIAL_DISTORTION: AdjExt = "_rdis"; break;
case CIRCUMFERENTIAL_DISTORTION: AdjExt = "_cdis"; break;
Expand Down
2 changes: 0 additions & 2 deletions Common/src/grid_adaptation_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ void CGridAdaptation::GetAdjResidual(CGeometry *geometry, CConfig *config) {
if (config->GetKind_ObjFunc() == AVG_TOTAL_PRESSURE) SPRINTF (buffer, "_pt.dat");
if (config->GetKind_ObjFunc() == AVG_OUTLET_PRESSURE) SPRINTF (buffer, "_pe.dat");
if (config->GetKind_ObjFunc() == MASS_FLOW_RATE) SPRINTF (buffer, "_mfr.dat");
if (config->GetKind_ObjFunc() == OUTFLOW_GENERALIZED) SPRINTF (buffer, "_chn.dat");
}

strcat(cstr, buffer);
Expand Down Expand Up @@ -3553,7 +3552,6 @@ void CGridAdaptation::SetRestart_AdjSolution(CConfig *config, CPhysicalGeometry
if (config->GetKind_ObjFunc() == AVG_TOTAL_PRESSURE) SPRINTF (buffer, "_pt.dat");
if (config->GetKind_ObjFunc() == AVG_OUTLET_PRESSURE) SPRINTF (buffer, "_pe.dat");
if (config->GetKind_ObjFunc() == MASS_FLOW_RATE) SPRINTF (buffer, "_mfr.dat");
if (config->GetKind_ObjFunc() == OUTFLOW_GENERALIZED) SPRINTF (buffer, "_chn.dat");
}

strcat(cstr, buffer);
Expand Down
2 changes: 0 additions & 2 deletions Common/src/grid_movement_structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3206,8 +3206,6 @@ void CSurfaceMovement::SetSurface_Deformation(CGeometry *geometry, CConfig *conf
cout << "No surface deformation (scaling, rotation, or translation)." << endl;
}
}
else if (config->GetDesign_Variable(0) == CUSTOM && rank == MASTER_NODE)
cout <<"Custom design variable will be used in external script" << endl;

/*--- Design variable not implement ---*/

Expand Down
69 changes: 23 additions & 46 deletions SU2_CFD/src/solver_adjoint_mean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned

myArea_Monitored = 0.0;
for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
if (config->GetKind_ObjFunc(iMarker_Monitoring)==OUTFLOW_GENERALIZED ||
config->GetKind_ObjFunc(iMarker_Monitoring)==AVG_TOTAL_PRESSURE ||
if (config->GetKind_ObjFunc(iMarker_Monitoring)==AVG_TOTAL_PRESSURE ||
config->GetKind_ObjFunc(iMarker_Monitoring)==AVG_OUTLET_PRESSURE) {

Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
Expand Down Expand Up @@ -371,8 +370,8 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned
(ObjFunc == TOTAL_HEATFLUX) || (ObjFunc == MAXIMUM_HEATFLUX) ||
(ObjFunc == MASS_FLOW_RATE) ) factor = 1.0;

if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE) ||
(ObjFunc == OUTFLOW_GENERALIZED)) factor = 1.0/Area_Monitored;
if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE))
factor = 1.0/Area_Monitored;

Weight_ObjFunc = Weight_ObjFunc*factor;
config->SetWeight_ObjFunc(iMarker_Monitoring, Weight_ObjFunc);
Expand Down Expand Up @@ -3363,8 +3362,7 @@ void CAdjEulerSolver::Inviscid_Sensitivity(CGeometry *geometry, CSolver **solver
(ObjFunc == MASS_FLOW_RATE) )
factor = 1.0;

if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE) ||
(ObjFunc == OUTFLOW_GENERALIZED)) factor = 1.0/Area_Monitored;
if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE)) factor = 1.0/Area_Monitored;

}

Expand Down Expand Up @@ -5084,25 +5082,18 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
Psi_outlet[iVar] = 0.0;
}

if (Vn > SoundSpeed) {
/*--- Objective-dependent additions to energy term ---*/
Vn_Exit = Vn; /* Vn_Exit comes from Reiman conditions in subsonic case*/
Vn_rel = Vn_Exit-ProjGridVel;
/* Repeated term */
a1 = Gamma_Minus_One/(Vn_rel*Vn_rel-SoundSpeed*SoundSpeed);

switch (config->GetKind_ObjFunc(iMarker_Monitoring)) {
case OUTFLOW_GENERALIZED:
velocity_gradient = 0.0;
for (iDim=0; iDim<nDim; iDim++) velocity_gradient += UnitNormal[iDim]*config->GetCoeff_ObjChainRule(iDim+1);
density_gradient = config->GetCoeff_ObjChainRule(0);
pressure_gradient = config->GetCoeff_ObjChainRule(4);
Psi_outlet[nDim+1]+=Weight_ObjFunc*(a1*(density_gradient/Vn_rel+pressure_gradient*Vn_rel-velocity_gradient/Density));
break;
case AVG_TOTAL_PRESSURE:
/*--- Total Pressure term. NOTE: this is AREA averaged
* Additional terms are added later (as they are common between subsonic,
* supersonic equations) ---*/
if (Vn > SoundSpeed) {
/*--- Objective-dependent additions to energy term ---*/
Vn_Exit = Vn; /* Vn_Exit comes from Reiman conditions in subsonic case*/
Vn_rel = Vn_Exit-ProjGridVel;
/* Repeated term */
a1 = Gamma_Minus_One/(Vn_rel*Vn_rel-SoundSpeed*SoundSpeed);

switch (config->GetKind_ObjFunc(iMarker_Monitoring)) {
case AVG_TOTAL_PRESSURE:
/*--- Total Pressure term. NOTE: this is AREA averaged
* Additional terms are added later (as they are common between subsonic,
* supersonic equations) ---*/
Velocity2 = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
Velocity2 += Velocity[iDim]*Velocity[iDim];
Expand All @@ -5113,12 +5104,12 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
for (iDim=0; iDim<nDim; iDim++)
velocity_gradient+=a2*Gamma_Minus_One*Density/(Gamma*Pressure)*Velocity[iDim]*UnitNormal[iDim];
pressure_gradient = a2*(-Gamma_Minus_One*Density*Velocity2/(2.0*Gamma*pow(Pressure,2.0)))+pow((1.0+Gamma_Minus_One*Density*Velocity2/(2.0*Gamma*Pressure)),(Gamma/Gamma_Minus_One));
Psi_outlet[nDim+1]+=Weight_ObjFunc*a1*(density_gradient/Vn_rel+pressure_gradient*Vn_rel-velocity_gradient/Density);
Psi_outlet[nDim+1]+=Weight_ObjFunc*a1*(density_gradient/Vn_rel+pressure_gradient*Vn_rel-velocity_gradient/Density);
break;
case AVG_OUTLET_PRESSURE:
/*Area averaged static pressure*/
/*--- Note: further terms are NOT added later for this case, only energy term is modified ---*/
Psi_outlet[nDim+1]+=Weight_ObjFunc*(a1*Vn_Exit);
Psi_outlet[nDim+1]+=Weight_ObjFunc*(a1*Vn_Exit);
break;
default:
break;
Expand Down Expand Up @@ -5178,19 +5169,6 @@ void CAdjEulerSolver::BC_Outlet(CGeometry *geometry, CSolver **solver_container,
case MASS_FLOW_RATE:
Psi_outlet[0]+=Weight_ObjFunc;
break;
case OUTFLOW_GENERALIZED:
density_gradient = config->GetCoeff_ObjChainRule(0);
pressure_gradient = config->GetCoeff_ObjChainRule(4);
velocity_gradient = 0.0; /*Inside the option, this term is $\vec{v} \cdot \frac{dg}{d\vec{v}}$ */
for (iDim=0; iDim<nDim; iDim++)
velocity_gradient += Velocity[iDim]*config->GetCoeff_ObjChainRule(iDim+1);
/*Pressure-fixed version*/
Psi_outlet[0]+=Weight_ObjFunc*(density_gradient*2.0/Vn_Exit-velocity_gradient/Density/Vn_Exit);
for (iDim=0; iDim<nDim; iDim++) {
Psi_outlet[iDim+1]+=Weight_ObjFunc*(config->GetCoeff_ObjChainRule(iDim+1)/Density/Vn_Exit-UnitNormal[iDim]*density_gradient/Vn_Exit/Vn_Exit);

}
break;
case AVG_TOTAL_PRESSURE:
/*--- For total pressure objective function. NOTE: this is AREA averaged term---*/
Velocity2 = 0.0;
Expand Down Expand Up @@ -6137,8 +6115,7 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short
/*--- Calculate area monitored for area-averaged-outflow-quantity-based objectives ---*/
myArea_Monitored = 0.0;
for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
if (config->GetKind_ObjFunc(iMarker_Monitoring)==OUTFLOW_GENERALIZED ||
config->GetKind_ObjFunc(iMarker_Monitoring)==AVG_TOTAL_PRESSURE ||
if (config->GetKind_ObjFunc(iMarker_Monitoring)==AVG_TOTAL_PRESSURE ||
config->GetKind_ObjFunc(iMarker_Monitoring)==AVG_OUTLET_PRESSURE) {

Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
Expand Down Expand Up @@ -6195,8 +6172,8 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short
(ObjFunc == TOTAL_HEATFLUX) || (ObjFunc == MAXIMUM_HEATFLUX) ||
(ObjFunc == MASS_FLOW_RATE) ) factor = 1.0;

if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE) ||
(ObjFunc == OUTFLOW_GENERALIZED)) factor = 1.0/Area_Monitored;
if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE))
factor = 1.0/Area_Monitored;

Weight_ObjFunc = Weight_ObjFunc*factor;
config->SetWeight_ObjFunc(iMarker_Monitoring, Weight_ObjFunc);
Expand Down Expand Up @@ -6566,8 +6543,8 @@ void CAdjNSSolver::Viscous_Sensitivity(CGeometry *geometry, CSolver **solver_con
(ObjFunc == MASS_FLOW_RATE))
factor = 1.0;

if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE) ||
(ObjFunc == OUTFLOW_GENERALIZED)) factor = 1.0/Area_Monitored;
if ((ObjFunc == AVG_TOTAL_PRESSURE) || (ObjFunc == AVG_OUTLET_PRESSURE))
factor = 1.0/Area_Monitored;

}

Expand Down
Loading