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

Feature actuatordisk bem #2142

Merged
merged 49 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
c47a67a
Update CConfig.cpp
tnv-nal Sep 27, 2023
1b9d8a5
Update CEulerSolver.hpp
tnv-nal Sep 27, 2023
a4d482d
Update CEulerSolver.cpp
tnv-nal Sep 27, 2023
4e1b6c6
Update CConfig.hpp
tnv-nal Sep 27, 2023
1c2d53c
Create prop_defs.hpp
tnv-nal Sep 27, 2023
a6154e6
Update option_structure.hpp
tnv-nal Sep 27, 2023
7638f80
Update option_structure.inl
tnv-nal Sep 27, 2023
4362d89
Update option_structure.hpp
tnv-nal Sep 27, 2023
b1fdcc4
Merge branch 'develop' into feature-actuatordisk-bem
Sep 28, 2023
29118b4
added test case for actuatordisk-bem
chanduyal Sep 28, 2023
d3eb653
Update readme.txt
tnv-nal Sep 28, 2023
458dddd
Update actuatordisk_bem.cfg
tnv-nal Sep 28, 2023
c62e7cd
corrections in comments, su2 style comments, whitespaces
josy-nal Sep 28, 2023
3529fc3
Merge remote-tracking branch 'refs/remotes/origin/feature-actuatordis…
josy-nal Sep 28, 2023
9ae8d28
restore accidental rm of subprojects/CoolProp
josy-nal Sep 28, 2023
4c4e200
minor whitespaces
josy-nal Sep 29, 2023
d46f79c
TestCases/parallel_regression.py
josy-nal Sep 29, 2023
8aa0e5e
missed test case regression name
josy-nal Sep 29, 2023
73fe4ad
remove compiler warnings of unset, unused variabes
josy-nal Sep 29, 2023
3454830
Actuator disk BEM method for propellers feature currently not support…
josy-nal Sep 29, 2023
5adffd0
BEM method related user input template in config_template.cfg
josy-nal Sep 29, 2023
28a814d
Merge branch 'develop' into feature-actuatordisk-bem
josy-nal Oct 3, 2023
047d7c4
bem reorg: eliminate prop_defs.h, readsdata_(), bem_model_noa_() and …
josy-nal Oct 12, 2023
35afe87
bem reorg cleanup
josy-nal Oct 13, 2023
9ef05a7
cleanup based on review and reorg
josy-nal Oct 13, 2023
be67f72
Merge branch 'develop' into feature-actuatordisk-bem
kursatyurt Oct 14, 2023
6f3b45e
combined ActDisk_{X,Y,Z}CG into ActDisk_CG[3]
josy-nal Oct 16, 2023
5b67806
ActDisk_CG cleanup
josy-nal Oct 16, 2023
3b49e16
ActDisk axis, BEM minimal code
chanduyal Oct 18, 2023
6119b86
Merge branch 'develop' into feature-actuatordisk-bem
josy-nal Oct 19, 2023
59c8258
config options for CG and Axis, other minor cleanup
josy-nal Oct 21, 2023
6459108
static RPM,CG,Axis set from config once. Other minor cleanup
josy-nal Oct 21, 2023
7cae4a4
clang-format
josy-nal Oct 22, 2023
98562a4
accidental change of externals/codi/ subprojects/CoolProp/ checked ou…
josy-nal Oct 25, 2023
a4b8bdd
Update Common/include/CConfig.hpp
josy-nal Nov 2, 2023
81eb491
eliminate class COptionActDiskBem
josy-nal Nov 3, 2023
842232c
add BEM_FREQ option. move local variables in place.
josy-nal Nov 4, 2023
dda8ca0
comment and indentation cleanup
josy-nal Nov 4, 2023
8e36ded
Merge branch 'develop' into feature-actuatordisk-bem
josy-nal Nov 4, 2023
c5a4a38
clear github warning
josy-nal Nov 4, 2023
81c1381
Update SU2_CFD/src/solvers/CEulerSolver.cpp
pcarruscag Nov 5, 2023
e6280fb
following instructions from @pcarruscag to revert accidental change i…
josy-nal Nov 5, 2023
c4e264c
TestCases .cfg file cleanup of all comments.
josy-nal Nov 5, 2023
b85ed33
regression test fix
josy-nal Nov 7, 2023
89f72e3
codefactor fix
josy-nal Nov 7, 2023
88811d3
Update TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg
pcarruscag Nov 8, 2023
470943e
regression test_vals to reflect change RESTART_SOL=YES
josy-nal Nov 8, 2023
1a068ae
higher rms[nu] tolerance
josy-nal Nov 8, 2023
e1b4970
Merge branch 'develop' into feature-actuatordisk-bem
josy-nal Nov 9, 2023
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
60 changes: 60 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,15 @@ class CConfig {
su2double *ActDiskOutlet_GrossThrust; /*!< \brief Specified outlet gross thrust for actuator disk. */
su2double *ActDiskOutlet_Force; /*!< \brief Specified outlet force for actuator disk. */
su2double *ActDiskOutlet_Power; /*!< \brief Specified outlet power for actuator disk. */
su2double *ActDiskOutlet_Thrust_BEM; /*!< \brief Specified outlet thrust for actuator disk. */
su2double *ActDiskOutlet_Torque_BEM; /*!< \brief Specified outlet torque for actuator disk. */
su2double **ActDisk_PressJump,
**ActDisk_TempJump, **ActDisk_Omega; /*!< \brief Specified deltas for actuator disk.*/
su2double **ActDisk_XCG, **ActDisk_YCG, **ActDisk_ZCG; /*!< \brief Specified CG for actuator disk.*/
su2double **ActDisk_RotRate; /*!< \brief Value of the Rotation Rate.*/
su2double BEM_blade_angle ; /*!< \brief Propeller blade angle.*/
string BEM_prop_filename ; /*!< \brief Propeller filename.*/
bool History_File_Append_Flag; /*!< \brief Flag to append history file.*/
su2double *ActDisk_DeltaPress; /*!< \brief Specified pressure delta for actuator disk. */
su2double *ActDisk_DeltaTemp; /*!< \brief Specified temperature delta for actuator disk. */
su2double *ActDisk_TotalPressRatio; /*!< \brief Specified tot. pres. ratio for actuator disk. */
Expand Down Expand Up @@ -6649,6 +6656,31 @@ class CConfig {
*/
su2double GetActDisk_PressJump(const string& val_marker, unsigned short val_index) const;

/*!
* \brief Get the XCG of the actuator disk.
*/
su2double GetActDisk_XCG(string val_marker, unsigned short val_index) const;

/*!
* \brief Get the YCG of the actuator disk.
*/
su2double GetActDisk_YCG(string val_marker, unsigned short val_index) const;

/*!
* \brief Get the ZCG of the actuator disk.
*/
su2double GetActDisk_ZCG(string val_marker, unsigned short val_index) const;

/*!
* \brief Get the blade angle of the propeller.
*/
su2double GetBEM_blade_angle(void) { return BEM_blade_angle; }

/*!
* \brief Get the filename of the propeller.
*/
string GetBEM_prop_filename(void) { return BEM_prop_filename; }

/*!
* \brief Get the thrust corffient of the actuator disk.
*/
Expand Down Expand Up @@ -8191,6 +8223,20 @@ class CConfig {
*/
su2double GetActDiskOutlet_Power(const string& val_marker) const;

/*!
* \brief Get the thrust at the actuator disk outlet boundary.
* \param[in] val_marker - Marker corresponding to the outlet (actuator disk) boundary.
* \return The outlet (actuator disk) thrust.
*/
su2double GetActDiskOutlet_Thrust_BEM(string val_marker) const;

/*!
* \brief Get the torque at the actuator disk outlet boundary.
* \param[in] val_marker - Marker corresponding to the outlet boundary.
* \return The outlet (actuator disk) torque.
*/
su2double GetActDiskOutlet_Torque_BEM(string val_marker) const;

/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \param[in] val_index - Index corresponding to the outlet boundary.
Expand Down Expand Up @@ -8226,6 +8272,20 @@ class CConfig {
*/
void SetActDiskOutlet_Power(unsigned short val_marker, su2double val_actdisk_power) { ActDiskOutlet_Power[val_marker] = val_actdisk_power; }

/*!
* \brief Set the thrust at the outlet (actuator disk) boundary.
* \param[in] val_marker - Marker corresponding to the outlet (actuator disk) boundary.
* \param[in] val_actdisk_thrust_bem - Value of the actuator disk thrust.
*/
void SetActDiskOutlet_Thrust_BEM(unsigned short val_marker, su2double val_actdisk_thrust_bem) { ActDiskOutlet_Thrust_BEM[val_marker] = val_actdisk_thrust_bem; }

/*!
* \brief Get the back pressure (static) at an outlet boundary.
* \param[in] val_marker - Marker corresponding to the outlet boundary.
* \param[in] val_actdisk_torque_bem - Value of the actuator disk torque.
*/
void SetActDiskOutlet_Torque_BEM(unsigned short val_marker, su2double val_actdisk_torque_bem) { ActDiskOutlet_Torque_BEM[val_marker] = val_actdisk_torque_bem; }

/*!
* \brief Get the displacement value at an displacement boundary.
* \param[in] val_index - Index corresponding to the displacement boundary.
Expand Down
4 changes: 3 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,7 +1857,8 @@ enum ACTDISK_TYPE {
DRAG_MINUS_THRUST = 4, /*!< \brief User specifies the D-T. */
MASSFLOW = 5, /*!< \brief User specifies the massflow. */
POWER = 6, /*!< \brief User specifies the power. */
VARIABLE_LOAD = 7 /*!< \brief User specifies the load distribution. */
VARIABLE_LOAD = 7, /*!< \brief User specifies the load distribution. */
BLADE_ELEMENT = 8 /*!< \brief User specifies to use Blade element method. */
};
static const MapType<std::string, ACTDISK_TYPE> ActDisk_Map = {
MakePair("VARIABLES_JUMP", VARIABLES_JUMP)
Expand All @@ -1867,6 +1868,7 @@ static const MapType<std::string, ACTDISK_TYPE> ActDisk_Map = {
MakePair("MASSFLOW", MASSFLOW)
MakePair("POWER", POWER)
MakePair("VARIABLE_LOAD", VARIABLE_LOAD)
MakePair("BLADE_ELEMENT", BLADE_ELEMENT)
};

/*!
Expand Down
94 changes: 94 additions & 0 deletions Common/include/option_structure.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,100 @@ class COptionActDisk : public COptionBase {
}
};

class COptionActDiskCentroid : public COptionBase {
josy-nal marked this conversation as resolved.
Show resolved Hide resolved
string name; // identifier for the option
unsigned short & inlet_size;
unsigned short & outlet_size;
string * & marker_inlet;
string * & marker_outlet;
su2double ** & actdisk_xcg;
su2double ** & actdisk_ycg;
su2double ** & actdisk_zcg;

public:
COptionActDiskCentroid(const string name,
unsigned short & nMarker_ActDiskInlet, unsigned short & nMarker_ActDiskOutlet, string * & Marker_ActDiskInlet, string * & Marker_ActDiskOutlet,
su2double ** & ActDisk_XCG, su2double ** & ActDisk_YCG, su2double ** & ActDisk_ZCG) :
inlet_size(nMarker_ActDiskInlet), outlet_size(nMarker_ActDiskOutlet), marker_inlet(Marker_ActDiskInlet), marker_outlet(Marker_ActDiskOutlet),
actdisk_xcg(ActDisk_XCG), actdisk_ycg(ActDisk_YCG), actdisk_zcg(ActDisk_ZCG) {
this->name = name;
}

~COptionActDiskCentroid() {};
string SetValue(vector<string> option_value) {
const int mod_num = 8;
unsigned short totalVals = option_value.size();
if ((totalVals == 1) && (option_value[0].compare("NONE") == 0)) {
this->SetDefault();
return "";
}

if (totalVals % mod_num != 0) {
string newstring;
newstring.append(this->name);
newstring.append(": must have a number of entries divisible by 8");
this->SetDefault();
return newstring;
}

unsigned short nVals = totalVals / mod_num;
this->inlet_size = nVals;
this->outlet_size = nVals;
this->marker_inlet = new string[this->inlet_size];
Fixed Show fixed Hide fixed
this->marker_outlet = new string[this->outlet_size];
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed

this->actdisk_xcg = new su2double*[this->inlet_size];
this->actdisk_ycg = new su2double*[this->inlet_size];
this->actdisk_zcg = new su2double*[this->inlet_size];
for (int i = 0; i < this->inlet_size; i++) {
this->actdisk_xcg[i] = new su2double[2];
this->actdisk_ycg[i] = new su2double[2];
this->actdisk_zcg[i] = new su2double[2];
}

string tname = "actuator disk";

for (int i = 0; i < this->inlet_size; i++) {
this->marker_inlet[i].assign(option_value[mod_num*i]);
this->marker_outlet[i].assign(option_value[mod_num*i+1]);
istringstream ss_1st(option_value[mod_num*i + 2]);
if (!(ss_1st >> this->actdisk_xcg[i][0])) {
return badValue(tname, this->name);
}
istringstream ss_2nd(option_value[mod_num*i + 3]);
if (!(ss_2nd >> this->actdisk_ycg[i][0])) {
return badValue(tname, this->name);
}
istringstream ss_3rd(option_value[mod_num*i + 4]);
if (!(ss_3rd >> this->actdisk_zcg[i][0])) {
return badValue(tname, this->name);
}
istringstream ss_4th(option_value[mod_num*i + 5]);
if (!(ss_4th >> this->actdisk_xcg[i][1])) {
return badValue(tname, this->name);
}
istringstream ss_5th(option_value[mod_num*i + 6]);
if (!(ss_5th >> this->actdisk_ycg[i][1])) {
return badValue(tname, this->name);
}
istringstream ss_6th(option_value[mod_num*i + 7]);
if (!(ss_6th >> this->actdisk_zcg[i][1])) {
return badValue(tname, this->name);
}
}
return "";
}
void SetDefault() {
this->inlet_size = 0;
this->outlet_size = 0;
this->marker_inlet = NULL;
this->marker_outlet = NULL;
this->actdisk_xcg = NULL;
this->actdisk_ycg = NULL;
this->actdisk_zcg = NULL;
}
};

class COptionWallFunction : public COptionBase {
string name; // identifier for the option
unsigned short& nMarkers;
Expand Down
72 changes: 72 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,9 @@ void CConfig::SetPointersNull() {
ActDiskOutlet_Power = nullptr; ActDiskOutlet_Temperature = nullptr; ActDiskOutlet_TotalTemperature = nullptr;
ActDiskOutlet_MassFlow = nullptr;

ActDiskOutlet_Thrust_BEM = nullptr;
ActDiskOutlet_Torque_BEM = nullptr;

ActDisk_DeltaPress = nullptr; ActDisk_DeltaTemp = nullptr;
ActDisk_TotalPressRatio = nullptr; ActDisk_TotalTempRatio = nullptr; ActDisk_StaticPressRatio = nullptr;
ActDisk_StaticTempRatio = nullptr; ActDisk_NetThrust = nullptr; ActDisk_GrossThrust = nullptr;
Expand Down Expand Up @@ -1523,6 +1526,11 @@ void CConfig::SetConfig_Options() {
nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet,
ActDisk_PressJump, ActDisk_TempJump, ActDisk_Omega);

/*!\brief MARKER_ACTDISK_CG\n DESCRIPTION: Actuator disk with CG for blade element momentum (BEM) method. \ingroup Config*/
addActDiskOption("MARKER_ACTDISK_CG",
nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet,
ActDisk_XCG, ActDisk_YCG, ActDisk_ZCG);

/*!\brief ACTDISK_FILENAME \n DESCRIPTION: Input file for a specified actuator disk (w/ extension) \n DEFAULT: actdiskinput.dat \ingroup Config*/
addStringOption("ACTDISK_FILENAME", ActDisk_FileName, string("actdiskinput.dat"));

Expand Down Expand Up @@ -1648,6 +1656,14 @@ void CConfig::SetConfig_Options() {
addBoolOption("SUBSONIC_ENGINE", SubsonicEngine, false);
/* DESCRIPTION: Actuator disk double surface */
addBoolOption("ACTDISK_DOUBLE_SURFACE", ActDisk_DoubleSurface, false);

/* DESCRIPTION: Actuator disk BEM switch for history file appending.*/
addBoolOption("HISTORY_FILE_APPEND", History_File_Append_Flag, false);
/* DESCRIPTION: Propeller blade angle for actuator disk BEM.*/
addDoubleOption("BEM_PROP_BLADE_ANGLE", BEM_blade_angle, 23.9);
/* DESCRIPTION: Propeller file name for actuator disk BEM.*/
addStringOption("BEM_PROP_FILENAME", BEM_prop_filename,string("prop_geom_alfclcd_data.txt"));

/* DESCRIPTION: Only half engine is in the computational grid */
addBoolOption("ENGINE_HALF_MODEL", Engine_HalfModel, false);
/* DESCRIPTION: Actuator disk double surface */
Expand Down Expand Up @@ -4975,6 +4991,18 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("Vorticity confinement feature currently not supported for incompressible or non-equilibrium model or axisymmetric flows.", CURRENT_FUNCTION);
}

/*--- Actuator disk BEM method for propellers feature currently not supported for incompressible or non-equilibrium model or axisymmetric flows. ---*/

if ((Kind_Solver == MAIN_SOLVER::INC_EULER
|| Kind_Solver == MAIN_SOLVER::INC_NAVIER_STOKES
|| Kind_Solver == MAIN_SOLVER::INC_RANS
|| Kind_Solver == MAIN_SOLVER::NEMO_EULER
|| Kind_Solver == MAIN_SOLVER::NEMO_NAVIER_STOKES
|| Axisymmetric)
&& ActDisk_DoubleSurface) {
SU2_MPI::Error("Actuator disk BEM method for propellers feature currently not supported for incompressible or non-equilibrium model or axisymmetric flows.", CURRENT_FUNCTION);
}

/*--- Check the coefficients for the polynomial models. ---*/

if (Kind_Solver != MAIN_SOLVER::INC_EULER && Kind_Solver != MAIN_SOLVER::INC_NAVIER_STOKES && Kind_Solver != MAIN_SOLVER::INC_RANS) {
Expand Down Expand Up @@ -5682,6 +5710,9 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) {
ActDiskOutlet_Force = new su2double[nMarker_ActDiskOutlet] ();
ActDiskOutlet_Power = new su2double[nMarker_ActDiskOutlet] ();

ActDiskOutlet_Thrust_BEM = new su2double[nMarker_ActDiskOutlet] ();
ActDiskOutlet_Torque_BEM = new su2double[nMarker_ActDiskOutlet] ();

for (iMarker_ActDiskOutlet = 0; iMarker_ActDiskOutlet < nMarker_ActDiskOutlet; iMarker_ActDiskOutlet++) {
Marker_CfgFile_TagBound[iMarker_CfgFile] = Marker_ActDiskOutlet[iMarker_ActDiskOutlet];
Marker_CfgFile_KindBC[iMarker_CfgFile] = ACTDISK_OUTLET;
Expand Down Expand Up @@ -8091,6 +8122,9 @@ CConfig::~CConfig() {
delete[] ActDiskOutlet_Force;
delete[] ActDiskOutlet_Power;

delete[] ActDiskOutlet_Thrust_BEM;
delete[] ActDiskOutlet_Torque_BEM;

delete[] Outlet_MassFlow;
delete[] Outlet_Density;
delete[] Outlet_Area;
Expand Down Expand Up @@ -8660,6 +8694,30 @@ su2double CConfig::GetActDisk_PressJump(const string& val_marker, unsigned short
return ActDisk_PressJump[iMarker_ActDisk][val_value];
}

su2double CConfig::GetActDisk_XCG(string val_marker, unsigned short val_value) const {
unsigned short iMarker_ActDisk;
for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskInlet; iMarker_ActDisk++)
if ((Marker_ActDiskInlet[iMarker_ActDisk] == val_marker) ||
(Marker_ActDiskOutlet[iMarker_ActDisk] == val_marker)) break;
return ActDisk_XCG[iMarker_ActDisk][val_value];
}

su2double CConfig::GetActDisk_YCG(string val_marker, unsigned short val_value) const {
unsigned short iMarker_ActDisk;
for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskInlet; iMarker_ActDisk++)
if ((Marker_ActDiskInlet[iMarker_ActDisk] == val_marker) ||
(Marker_ActDiskOutlet[iMarker_ActDisk] == val_marker)) break;
return ActDisk_YCG[iMarker_ActDisk][val_value];
}

su2double CConfig::GetActDisk_ZCG(string val_marker, unsigned short val_value) const {
josy-nal marked this conversation as resolved.
Show resolved Hide resolved
unsigned short iMarker_ActDisk;
for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskInlet; iMarker_ActDisk++)
if ((Marker_ActDiskInlet[iMarker_ActDisk] == val_marker) ||
(Marker_ActDiskOutlet[iMarker_ActDisk] == val_marker)) break;
return ActDisk_ZCG[iMarker_ActDisk][val_value];
}

su2double CConfig::GetActDisk_TempJump(const string& val_marker, unsigned short val_value) const {
unsigned short iMarker_ActDisk;
for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskInlet; iMarker_ActDisk++)
Expand Down Expand Up @@ -9452,6 +9510,20 @@ su2double CConfig::GetActDiskOutlet_Power(const string& val_marker) const {
return ActDiskOutlet_Power[iMarker_ActDiskOutlet];
}

su2double CConfig::GetActDiskOutlet_Thrust_BEM(string val_marker) const {
unsigned short iMarker_ActDiskOutlet;
for (iMarker_ActDiskOutlet = 0; iMarker_ActDiskOutlet < nMarker_ActDiskOutlet; iMarker_ActDiskOutlet++)
if (Marker_ActDiskOutlet[iMarker_ActDiskOutlet] == val_marker) break;
return ActDiskOutlet_Thrust_BEM[iMarker_ActDiskOutlet];
}

su2double CConfig::GetActDiskOutlet_Torque_BEM(string val_marker) const {
unsigned short iMarker_ActDiskOutlet;
for (iMarker_ActDiskOutlet = 0; iMarker_ActDiskOutlet < nMarker_ActDiskOutlet; iMarker_ActDiskOutlet++)
if (Marker_ActDiskOutlet[iMarker_ActDiskOutlet] == val_marker) break;
return ActDiskOutlet_Torque_BEM[iMarker_ActDiskOutlet];
}

su2double CConfig::GetActDiskInlet_Temperature(const string& val_marker) const {
unsigned short iMarker_ActDiskInlet;
for (iMarker_ActDiskInlet = 0; iMarker_ActDiskInlet < nMarker_ActDiskInlet; iMarker_ActDiskInlet++)
Expand Down
Loading