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

Structural stress penalty function for optimization, fix some CConfig problems #1176

Merged
merged 11 commits into from
Jan 27, 2021
268 changes: 99 additions & 169 deletions Common/include/CConfig.hpp

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Common/include/geometry/elements/CElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,13 @@ class CElement {
AD::SetPreaccOut(Mab.data(), nNodes*nNodes);
}

/*!
* \brief Register the dead load as a pre-accumulation output.
*/
inline void SetPreaccOut_FDL_a(void) {
AD::SetPreaccOut(FDL_a.data(), nNodes*nDim);
}

};

/*!
Expand Down
39 changes: 3 additions & 36 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ enum SU2_COMPONENT {
SU2_CFD = 1, /*!< \brief Running the SU2_CFD software. */
SU2_DEF = 2, /*!< \brief Running the SU2_DEF software. */
SU2_DOT = 3, /*!< \brief Running the SU2_DOT software. */
SU2_MSH = 4, /*!< \brief Running the SU2_MSH software. */
SU2_GEO = 5, /*!< \brief Running the SU2_GEO software. */
SU2_SOL = 6 /*!< \brief Running the SU2_SOL software. */
};
Expand Down Expand Up @@ -1524,7 +1523,8 @@ enum ENUM_OBJECTIVE {
REFERENCE_NODE = 61, /*!< \brief Objective function defined as the difference of a particular node respect to a reference position. */
VOLUME_FRACTION = 62, /*!< \brief Volume average physical density, for material-based topology optimization applications. */
TOPOL_DISCRETENESS = 63, /*!< \brief Measure of the discreteness of the current topology. */
TOPOL_COMPLIANCE = 64 /*!< \brief Measure of the discreteness of the current topology. */
TOPOL_COMPLIANCE = 64, /*!< \brief Measure of the discreteness of the current topology. */
STRESS_PENALTY = 65, /*!< \brief Penalty function of VM stresses above a maximum value. */
};
static const MapType<string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("DRAG", DRAG_COEFFICIENT)
Expand Down Expand Up @@ -1575,6 +1575,7 @@ static const MapType<string, ENUM_OBJECTIVE> Objective_Map = {
MakePair("VOLUME_FRACTION", VOLUME_FRACTION)
MakePair("TOPOL_DISCRETENESS", TOPOL_DISCRETENESS)
MakePair("TOPOL_COMPLIANCE", TOPOL_COMPLIANCE)
MakePair("STRESS_PENALTY", STRESS_PENALTY)
};

/*!
Expand Down Expand Up @@ -1617,40 +1618,6 @@ static const MapType<string, ENUM_SENS> Sens_Map = {
MakePair("SENS_AOS", SENS_AOS)
};

/*!
* \brief Types of grid adaptation/refinement
*/
enum ENUM_ADAPT {
NO_ADAPT = 0, /*!< \brief No grid adaptation. */
FULL = 1, /*!< \brief Do a complete grid refinement of all the computational grids. */
FULL_FLOW = 2, /*!< \brief Do a complete grid refinement of the flow grid. */
FULL_ADJOINT = 3, /*!< \brief Do a complete grid refinement of the adjoint grid. */
GRAD_FLOW = 5, /*!< \brief Do a gradient based grid adaptation of the flow grid. */
GRAD_ADJOINT = 6, /*!< \brief Do a gradient based grid adaptation of the adjoint grid. */
GRAD_FLOW_ADJ = 7, /*!< \brief Do a gradient based grid adaptation of the flow and adjoint grid. */
COMPUTABLE = 9, /*!< \brief Apply a computable error grid adaptation. */
REMAINING = 10, /*!< \brief Apply a remaining error grid adaptation. */
WAKE = 12, /*!< \brief Do a grid refinement on the wake. */
SMOOTHING = 14, /*!< \brief Do a grid smoothing of the geometry. */
SUPERSONIC_SHOCK = 15, /*!< \brief Do a grid smoothing. */
PERIODIC = 17 /*!< \brief Add the periodic halo cells. */
};
static const MapType<string, ENUM_ADAPT> Adapt_Map = {
MakePair("NONE", NO_ADAPT)
MakePair("FULL", FULL)
MakePair("FULL_FLOW", FULL_FLOW)
MakePair("FULL_ADJOINT", FULL_ADJOINT)
MakePair("GRAD_FLOW", GRAD_FLOW)
MakePair("GRAD_ADJOINT", GRAD_ADJOINT)
MakePair("GRAD_FLOW_ADJ", GRAD_FLOW_ADJ)
MakePair("COMPUTABLE", COMPUTABLE)
MakePair("REMAINING", REMAINING)
MakePair("WAKE", WAKE)
MakePair("SMOOTHING", SMOOTHING)
MakePair("SUPERSONIC_SHOCK", SUPERSONIC_SHOCK)
MakePair("PERIODIC", PERIODIC)
};

/*!
* \brief Types of input file formats
*/
Expand Down
39 changes: 11 additions & 28 deletions Common/include/option_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -335,25 +335,19 @@ public:
};

class COptionDoubleArray : public COptionBase {
su2double * & field; // Reference to the feildname
string name; // identifier for the option
const int size;
su2double * def;
su2double * vals;
su2double * default_value;
string name; // Identifier for the option
const int size; // Number of elements
su2double* field; // Reference to the fieldname

public:
COptionDoubleArray(string option_field_name, const int list_size, su2double * & option_field, su2double * default_value) : field(option_field), size(list_size) {
this->name = option_field_name;
this->default_value = default_value;
def = nullptr;
vals = nullptr;
COptionDoubleArray(string option_field_name, const int list_size, su2double* option_field) :
name(option_field_name),
size(list_size),
field(option_field) {
}

~COptionDoubleArray() override {
delete [] def;
delete [] vals;
};
~COptionDoubleArray() override {};

string SetValue(vector<string> option_value) override {
COptionBase::SetValue(option_value);
// Check that the size is correct
Expand All @@ -371,27 +365,16 @@ public:
newstring.append(" found");
return newstring;
}
vals = new su2double[this->size];
for (int i = 0; i < this->size; i++) {
istringstream is(option_value[i]);
su2double val;
if (!(is >> val)) {
delete [] vals;
if (!(is >> field[i])) {
return badValue(option_value, "su2double array", this->name);
}
vals[i] = val;
}
this->field = vals;
return "";
}

void SetDefault() override {
def = new su2double [size];
for (int i = 0; i < size; i++) {
def[i] = default_value[i];
}
this->field = def;
}
void SetDefault() override {}
};

class COptionDoubleList : public COptionBase {
Expand Down
Loading