-
Notifications
You must be signed in to change notification settings - Fork 847
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
Custom objective function (e.g. 'DRAG + LIFT') #1478
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
67296cb
cleanup objective function handling
pcarruscag 9fd4ee0
working primal version
pcarruscag ab5ab6c
some optimization
pcarruscag 7ff9060
multizone implementation
pcarruscag 407423b
Merge remote-tracking branch 'upstream/develop' into custom_objective…
pcarruscag 6df54b6
testcases and a bunch of output fixes
pcarruscag 9f5dff1
missing file
pcarruscag 4d51419
compiler fix
pcarruscag d16a78e
Update TestCases/parallel_regression_AD.py
pcarruscag 14dabda
Update TestCases/user_defined_functions/lam_flatplate.cfg
pcarruscag 130e2dd
Add limits header to ensure gcc11 compatibility
30f0b2e
gcc4.8 fix
pcarruscag 1ea8b02
Merge remote-tracking branch 'upstream/develop' into custom_objective…
pcarruscag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1563,17 +1563,8 @@ enum ENUM_OBJECTIVE { | |
SURFACE_SPECIES_0 = 58, /*!< \brief Surface Avg. Species_0 objective function definition. */ | ||
SURFACE_SPECIES_VARIANCE = 59,/*!< \brief Species Variance objective function definition. */ | ||
CUSTOM_OBJFUNC = 31, /*!< \brief Custom objective function definition. */ | ||
TOTAL_PRESSURE_LOSS = 39, | ||
KINETIC_ENERGY_LOSS = 40, | ||
TOTAL_EFFICIENCY = 41, | ||
TOTAL_STATIC_EFFICIENCY = 42, | ||
Comment on lines
-1566
to
-1569
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess these are never implemented? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or they were dropped in v7 |
||
EULERIAN_WORK = 43, | ||
TOTAL_ENTHALPY_IN = 44, | ||
FLOW_ANGLE_IN = 45, | ||
FLOW_ANGLE_OUT = 46, | ||
MASS_FLOW_IN = 47, | ||
MASS_FLOW_OUT = 48, | ||
PRESSURE_RATIO = 49, | ||
ENTROPY_GENERATION = 50, | ||
REFERENCE_GEOMETRY = 60, /*!< \brief Norm of displacements with respect to target geometry. */ | ||
REFERENCE_NODE = 61, /*!< \brief Objective function defined as the difference of a particular node respect to a reference position. */ | ||
|
@@ -1617,18 +1608,9 @@ static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = { | |
MakePair("SURFACE_SPECIES_0", SURFACE_SPECIES_0) | ||
MakePair("SURFACE_SPECIES_VARIANCE", SURFACE_SPECIES_VARIANCE) | ||
MakePair("CUSTOM_OBJFUNC", CUSTOM_OBJFUNC) | ||
MakePair("TOTAL_EFFICIENCY", TOTAL_EFFICIENCY) | ||
MakePair("TOTAL_STATIC_EFFICIENCY", TOTAL_STATIC_EFFICIENCY) | ||
MakePair("TOTAL_PRESSURE_LOSS", TOTAL_PRESSURE_LOSS) | ||
MakePair("EULERIAN_WORK", EULERIAN_WORK) | ||
MakePair("TOTAL_ENTHALPY_IN", TOTAL_ENTHALPY_IN) | ||
MakePair("FLOW_ANGLE_IN", FLOW_ANGLE_IN) | ||
MakePair("FLOW_ANGLE_OUT", FLOW_ANGLE_OUT) | ||
MakePair("MASS_FLOW_IN", MASS_FLOW_IN) | ||
MakePair("MASS_FLOW_OUT", MASS_FLOW_OUT) | ||
MakePair("PRESSURE_RATIO", PRESSURE_RATIO) | ||
MakePair("ENTROPY_GENERATION", ENTROPY_GENERATION) | ||
MakePair("KINETIC_ENERGY_LOSS", KINETIC_ENERGY_LOSS) | ||
MakePair("REFERENCE_GEOMETRY", REFERENCE_GEOMETRY) | ||
MakePair("REFERENCE_NODE", REFERENCE_NODE) | ||
MakePair("VOLUME_FRACTION", VOLUME_FRACTION) | ||
|
@@ -1637,46 +1619,6 @@ static const MapType<std::string, ENUM_OBJECTIVE> Objective_Map = { | |
MakePair("STRESS_PENALTY", STRESS_PENALTY) | ||
}; | ||
|
||
/*! | ||
* \brief Types of residual criteria equations | ||
*/ | ||
enum ENUM_RESIDUAL { | ||
RHO_RESIDUAL = 1, /*!< \brief Rho equation residual criteria equation. */ | ||
RHO_ENERGY_RESIDUAL = 2 /*!< \brief RhoE equation residual criteria equation. */ | ||
}; | ||
static const MapType<std::string, ENUM_RESIDUAL> Residual_Map = { | ||
MakePair("RHO", RHO_RESIDUAL) | ||
MakePair("RHO_ENERGY", RHO_ENERGY_RESIDUAL) | ||
}; | ||
|
||
/*! | ||
* \brief Types of residual criteria for structural problems | ||
*/ | ||
enum ENUM_RESFEM { | ||
RESFEM_RELATIVE = 1, /*!< \brief Relative criteria: Res/Res0. */ | ||
RESFEM_ABSOLUTE = 2 /*!< \brief Absolute criteria: abs(Res). */ | ||
}; | ||
static const MapType<std::string, ENUM_RESFEM> ResFem_Map = { | ||
MakePair("RELATIVE", RESFEM_RELATIVE) | ||
MakePair("ABSOLUTE", RESFEM_ABSOLUTE) | ||
}; | ||
|
||
/*! | ||
* \brief Types of sensitivities to compute | ||
*/ | ||
enum ENUM_SENS { | ||
SENS_GEOMETRY = 1, /*!< \brief Geometrical sensitivity. */ | ||
SENS_MACH = 2, /*!< \brief Mach number sensitivity. */ | ||
SENS_AOA = 3, /*!< \brief Angle of attack sensitivity. */ | ||
SENS_AOS = 4 /*!< \brief Angle of Sideslip sensitivity. */ | ||
}; | ||
static const MapType<std::string, ENUM_SENS> Sens_Map = { | ||
MakePair("SENS_GEOMETRY", SENS_GEOMETRY) | ||
MakePair("SENS_MACH", SENS_MACH) | ||
MakePair("SENS_AOA", SENS_AOA) | ||
MakePair("SENS_AOS", SENS_AOS) | ||
}; | ||
|
||
/*! | ||
* \brief Types of input file formats | ||
*/ | ||
|
@@ -1823,32 +1765,6 @@ static const MapType<std::string, MG_CYCLE> MG_Cycle_Map = { | |
MakePair("FULLMG_CYCLE", FULLMG_CYCLE) | ||
}; | ||
|
||
/*! | ||
* \brief Type of solution output variables | ||
*/ | ||
enum ENUM_OUTPUT_VARS { | ||
DENSITY = 1, /*!< \brief Density. */ | ||
VEL_X = 2, /*!< \brief X-component of velocity. */ | ||
VEL_Y = 3, /*!< \brief Y-component of velocity. */ | ||
VEL_Z = 4, /*!< \brief Z-component of velocity. */ | ||
PRESSURE = 5, /*!< \brief Static pressure. */ | ||
MACH = 6, /*!< \brief Mach number. */ | ||
TEMPERATURE = 7, /*!< \brief Temperature. */ | ||
LAM_VISC = 8, /*!< \brief Laminar viscosity. */ | ||
EDDY_VISC = 9 /*!< \brief Eddy viscosity. */ | ||
}; | ||
static const MapType<std::string, ENUM_OUTPUT_VARS> Output_Vars_Map = { | ||
MakePair("DENSITY", DENSITY) | ||
MakePair("VEL_X", VEL_X) | ||
MakePair("VEL_Y", VEL_Y) | ||
MakePair("VEL_Z", VEL_Z) | ||
MakePair("PRESSURE", PRESSURE) | ||
MakePair("MACH", MACH) | ||
MakePair("TEMPERATURE", TEMPERATURE) | ||
MakePair("LAM_VISC", LAM_VISC) | ||
MakePair("EDDY_VISC", EDDY_VISC) | ||
}; | ||
|
||
/*! | ||
* \brief Types of design parameterizations | ||
*/ | ||
|
@@ -2352,35 +2268,35 @@ class COptionBase { | |
private: | ||
std::vector<std::string> value; | ||
public: | ||
COptionBase() {}; | ||
virtual ~COptionBase() = 0; | ||
virtual ~COptionBase() = default; | ||
|
||
const std::vector<std::string>& GetValue() const {return value;} | ||
|
||
virtual std::string SetValue(std::vector<std::string> value){this->value = value; return "";} | ||
std::vector<std::string> GetValue() {return value;} | ||
virtual std::string SetValue(const std::vector<std::string>& val) { | ||
value = val; | ||
return ""; | ||
} | ||
virtual void SetDefault() = 0; | ||
|
||
std::string optionCheckMultipleValues(std::vector<std::string> & option_value, std::string type_id, std::string option_name) { | ||
std::string optionCheckMultipleValues(const std::vector<std::string>& option_value, | ||
std::string type_id, const std::string& option_name) { | ||
if (option_value.size() != 1) { | ||
std::string newString; | ||
newString.append(option_name); | ||
std::string newString(option_name); | ||
newString.append(": multiple values for type "); | ||
newString.append(type_id); | ||
return newString; | ||
} | ||
return ""; | ||
} | ||
|
||
std::string badValue(std::vector<std::string> & option_value, std::string type_id, std::string option_name) { | ||
std::string newString; | ||
newString.append(option_name); | ||
std::string badValue(std::string type_id, const std::string& option_name) { | ||
std::string newString(option_name); | ||
newString.append(": improper option value for type "); | ||
newString.append(type_id); | ||
return newString; | ||
} | ||
}; | ||
|
||
inline COptionBase::~COptionBase() {} | ||
|
||
#ifdef ENABLE_MAPS | ||
#include "option_structure.inl" | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, nice to have this modularized away (also with a compatible license 😉 )