From c47a67af1af81edcac17d8075e3cadcaee41f788 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 09:12:16 +0530 Subject: [PATCH 01/42] Update CConfig.cpp Updated from branch feature-bem-variable-load --- Common/src/CConfig.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index f660ec5633d..122e5693349 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -920,6 +920,8 @@ void CConfig::SetPointersNull() { ActDiskOutlet_TotalPressure = nullptr; ActDiskOutlet_GrossThrust = nullptr; ActDiskOutlet_Force = nullptr; 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; @@ -1522,6 +1524,9 @@ void CConfig::SetConfig_Options() { addActDiskOption("MARKER_ACTDISK", nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet, ActDisk_PressJump, ActDisk_TempJump, ActDisk_Omega); + 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")); @@ -1648,6 +1653,13 @@ void CConfig::SetConfig_Options() { addBoolOption("SUBSONIC_ENGINE", SubsonicEngine, false); /* DESCRIPTION: Actuator disk double surface */ addBoolOption("ACTDISK_DOUBLE_SURFACE", ActDisk_DoubleSurface, false); + + /* DESCRIPTION: History File Append */ + addBoolOption("HISTORY_FILE_APPEND", History_File_Append_Flag, false); + /* DESCRIPTION: Propeller_Blade_angle */ + addDoubleOption("BEM_PROP_BLADE_ANGLE", BEM_blade_angle, 23.9); + 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 */ @@ -5682,6 +5694,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; @@ -8091,6 +8106,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; @@ -8660,6 +8678,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 { + 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++) @@ -9452,6 +9494,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++) From 1b9d8a57c1a11245b2016623f48a105b76d956b3 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 09:14:15 +0530 Subject: [PATCH 02/42] Update CEulerSolver.hpp Updated from feature-bem-variable-load --- SU2_CFD/include/solvers/CEulerSolver.hpp | 59 +++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 04b49d9c523..56d60fcf37c 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -29,6 +29,7 @@ #include "CFVMFlowSolverBase.hpp" #include "../variables/CEulerVariable.hpp" +#include "prop_defs.hpp" /*! * \class CEulerSolver @@ -65,6 +66,13 @@ class CEulerSolver : public CFVMFlowSolverBase > DonorGlobalIndex; /*!< \brief Value of the donor global index. */ vector DonorPrimVar; /*!< \brief Value of the donor variables at each boundary. */ vector > ActDisk_DeltaP; /*!< \brief Value of the Delta P. */ + vector > ActDisk_DeltaP_r; /*!< \brief Value of the Delta P. */ + vector > ActDisk_Thrust_r; /*!< \brief Value of the Delta P. */ + vector > ActDisk_Torque_r; /*!< \brief Value of the Delta P. */ + vector > ActDisk_RotRate; /*!< \brief Value of the Rotation Rate. */ + vector > ActDisk_XCG; + vector > ActDisk_YCG; + vector > ActDisk_ZCG; vector > ActDisk_DeltaT; /*!< \brief Value of the Delta T. */ su2activevector @@ -76,6 +84,10 @@ class CEulerSolver : public CFVMFlowSolverBase > ActDisk_Fx; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ vector > ActDisk_Fy; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ vector > ActDisk_Fz; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fa_BEM; /*!< \brief Value of the actuator disk Axial Force per Unit Area. */ + vector > ActDisk_Fx_BEM; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fy_BEM; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fz_BEM; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ su2double Total_CL_Prev = 0.0, /*!< \brief Total lift coefficient for all the boundaries (fixed lift mode). */ @@ -505,6 +517,7 @@ class CEulerSolver : public CFVMFlowSolverBase Date: Wed, 27 Sep 2023 09:15:49 +0530 Subject: [PATCH 03/42] Update CEulerSolver.cpp Updated from feature-bem-variable-load --- SU2_CFD/src/solvers/CEulerSolver.cpp | 737 +++++++++++++++++++++++++++ 1 file changed, 737 insertions(+) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index e665fbe06e1..aa7946b81c2 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -194,10 +194,24 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, AllocVectorOfVectors(nVertex, ActDisk_Fy); AllocVectorOfVectors(nVertex, ActDisk_Fz); + AllocVectorOfVectors(nVertex, ActDisk_Fa_BEM); + AllocVectorOfVectors(nVertex, ActDisk_Fx_BEM); + AllocVectorOfVectors(nVertex, ActDisk_Fy_BEM); + AllocVectorOfVectors(nVertex, ActDisk_Fz_BEM); + /*--- Store the value of the Delta P at the Actuator Disk ---*/ AllocVectorOfVectors(nVertex, ActDisk_DeltaP); + AllocVectorOfVectors(nVertex, ActDisk_RotRate); + AllocVectorOfVectors(nVertex, ActDisk_XCG); + AllocVectorOfVectors(nVertex, ActDisk_YCG); + AllocVectorOfVectors(nVertex, ActDisk_ZCG); + + AllocVectorOfVectors(nVertex, ActDisk_DeltaP_r); + AllocVectorOfVectors(nVertex, ActDisk_Thrust_r); + AllocVectorOfVectors(nVertex, ActDisk_Torque_r); + /*--- Store the value of the Delta T at the Actuator Disk ---*/ AllocVectorOfVectors(nVertex, ActDisk_DeltaT); @@ -2514,6 +2528,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns Velocity2, Density, Area, SoundSpeed, TotalPressure, Vel_Infty2, RamDrag, TotalTemperature, VelocityJet, Vel_Infty, MaxPressure, MinPressure, MFR, InfVel2; + su2double DeltaPressure=0.0, DeltaThrust=0.0, DeltaTorque=0.0; unsigned short iMarker_Inlet, iMarker_Outlet, nMarker_Inlet, nMarker_Outlet; string Inlet_TagBound, Outlet_TagBound; su2double DeltaPress = 0.0, DeltaTemp = 0.0, TotalPressRatio = 0.0, TotalTempRatio = 0.0, StaticPressRatio = 0.0, StaticTempRatio = 0.0, @@ -2566,6 +2581,10 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns auto *Outlet_Force = new su2double [config->GetnMarker_All()](); auto *Outlet_Power = new su2double [config->GetnMarker_All()](); + auto *Outlet_DeltaP = new su2double [config->GetnMarker_All()](); + auto *Outlet_Thrust = new su2double [config->GetnMarker_All()](); + auto *Outlet_Torque = new su2double [config->GetnMarker_All()](); + /*--- Comute MassFlow, average temp, press, etc. ---*/ for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { @@ -2674,6 +2693,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns TotalPressure = Pressure * pow( 1.0 + Mach * Mach * 0.5 * (Gamma - 1.0), Gamma / (Gamma - 1.0)); TotalTemperature = Temperature * (1.0 + Mach * Mach * 0.5 * (Gamma - 1.0)); VelocityJet = sqrt(Velocity2) ; + DeltaPressure = ActDisk_DeltaP_r[iMarker][iVertex]; + DeltaThrust = ActDisk_Thrust_r[iMarker][iVertex]; + DeltaTorque = ActDisk_Torque_r[iMarker][iVertex]; GrossThrust = MassFlow * VelocityJet; @@ -2685,6 +2707,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns Outlet_Area[iMarker] += Area; Outlet_GrossThrust[iMarker] += GrossThrust; Outlet_Power[iMarker] += MassFlow*Cp*TotalTemperature; + Outlet_DeltaP[iMarker] += DeltaPressure*Area; + Outlet_Thrust[iMarker] += DeltaThrust*Area; + Outlet_Torque[iMarker] += DeltaTorque*Area; su2double Outlet_ForceX = -(Pressure - Pressure_Inf)*Vector[0] -MassFlow*Velocity[0]; su2double Outlet_ForceY = -(Pressure - Pressure_Inf)*Vector[1] -MassFlow*Velocity[1]; @@ -2746,6 +2771,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns auto *Outlet_Force_Local = new su2double [nMarker_Outlet](); auto *Outlet_Power_Local = new su2double [nMarker_Outlet](); auto *Outlet_Area_Local = new su2double [nMarker_Outlet](); + auto *Outlet_DeltaP_Local = new su2double [nMarker_Outlet](); + auto *Outlet_Thrust_Local = new su2double [nMarker_Outlet](); + auto *Outlet_Torque_Local = new su2double [nMarker_Outlet](); auto *Outlet_MassFlow_Total = new su2double [nMarker_Outlet](); auto *Outlet_Pressure_Total = new su2double [nMarker_Outlet](); @@ -2756,6 +2784,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns auto *Outlet_Force_Total = new su2double [nMarker_Outlet](); auto *Outlet_Power_Total = new su2double [nMarker_Outlet](); auto *Outlet_Area_Total = new su2double [nMarker_Outlet](); + auto *Outlet_DeltaP_Total = new su2double [nMarker_Outlet](); + auto *Outlet_Thrust_Total = new su2double [nMarker_Outlet](); + auto *Outlet_Torque_Total = new su2double [nMarker_Outlet](); /*--- Copy the values to the local array for MPI ---*/ @@ -2805,6 +2836,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns Outlet_Force_Local[iMarker_Outlet] += Outlet_Force[iMarker]; Outlet_Power_Local[iMarker_Outlet] += Outlet_Power[iMarker]; Outlet_Area_Local[iMarker_Outlet] += Outlet_Area[iMarker]; + Outlet_DeltaP_Local[iMarker_Outlet] += Outlet_DeltaP[iMarker]; + Outlet_Thrust_Local[iMarker_Outlet] += Outlet_Thrust[iMarker]; + Outlet_Torque_Local[iMarker_Outlet] += Outlet_Torque[iMarker]; } } @@ -2855,6 +2889,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns SU2_MPI::Allreduce(Outlet_Force_Local, Outlet_Force_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(Outlet_Power_Local, Outlet_Power_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_DeltaP_Local, Outlet_DeltaP_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Outlet_Thrust_Local, Outlet_Thrust_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Outlet_Torque_Local, Outlet_Torque_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); /*--- Compute the value of the average surface temperature and pressure and set the value in the config structure for future use ---*/ @@ -2945,6 +2982,8 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns config->SetActDiskOutlet_GrossThrust(iMarker_Outlet, Outlet_GrossThrust_Total[iMarker_Outlet]); config->SetActDiskOutlet_Force(iMarker_Outlet, Outlet_Force_Total[iMarker_Outlet]); config->SetActDiskOutlet_Power(iMarker_Outlet, Outlet_Power_Total[iMarker_Outlet]); + config->SetActDiskOutlet_Thrust_BEM(iMarker_Outlet, Outlet_Thrust_Total[iMarker_Outlet]); + config->SetActDiskOutlet_Torque_BEM(iMarker_Outlet, Outlet_Torque_Total[iMarker_Outlet]); } } @@ -3299,6 +3338,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns cout << ". Power (HP): "; cout << setprecision(1) << Power * Ref * config->GetVelocity_Ref() / 550.0 << "." << endl; } + cout<GetActDiskOutlet_Thrust_BEM(Outlet_TagBound) <<" "<<"Torque_BEM(N-m).: "<< config->GetActDiskOutlet_Torque_BEM(Outlet_TagBound)<nblades); + fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->dia); + fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->rhub); + fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->ang0_75); +//.Skip reading next line................................................. + fgets(dummy,120,file_ang); + fgets(dummy,120,file_ang); + sscanf(dummy,"%d%d",&MAXRK,&MAXALFK); + sprop_sec-> nrad = MAXRK; + sprop_sec-> nalf = MAXALFK; +// + fgets(dummy,120,file_ang); + for(i=0; i < MAXRK; i++) + { + fgets(dummy,120,file_ang); + sscanf(dummy,"%d %lf %lf %lf",§[i],&sprop_sec->r1[i],&sprop_sec->chord[i],&sprop_sec->setangle[i]); + } +//.Read computed alpha v/s cl and cd from the file +// + for(i=0; i < MAXRK; i++) + { + fgets(dummy,128,file_ang); + for(j=0; j < MAXALFK; j++) + { + fgets(dummy,128,file_ang); + sscanf(dummy,"%lf %lf %lf",&sprop_sec->alf[j][i],&sprop_sec->cl_arr[j][i],&sprop_sec->cd_arr[j][i]); + } +} +// +} + + +void get_clcd_(int *isec,dpropeller_section_struct *sprop_sec,su2double *alpha,su2double *cl,su2double *cd) +{ + int i,salf=0; + su2double fact; + +//.interpolating values of cl and cd for given alpha..................................................... + if(*alpha >= sprop_sec->alf[salf][*isec-1] && *alpha <= sprop_sec->alf[sprop_sec->nalf-1][*isec-1]) + { + for(i=0;i < sprop_sec->nalf-1; i++) + { + if(*alpha>=sprop_sec->alf[i][*isec-1] && *alpha <= sprop_sec->alf[i+1][*isec-1]) + { + fact=(*alpha-sprop_sec->alf[i][*isec-1])/(sprop_sec->alf[i+1][*isec-1]-sprop_sec->alf[i][*isec-1]); + *cl=sprop_sec->cl_arr[i][*isec-1] + fact*(sprop_sec->cl_arr[i+1][*isec-1] - sprop_sec->cl_arr[i][*isec-1]); + *cd=sprop_sec->cd_arr[i][*isec-1] + fact*(sprop_sec->cd_arr[i+1][*isec-1] - sprop_sec->cd_arr[i][*isec-1]); + } + } + } + else + { + if(*alpha < sprop_sec->alf[salf][*isec-1]) + { + *cl=sprop_sec->cl_arr[0][*isec-1]; + *cd=sprop_sec->cd_arr[0][*isec-1]; + } + if(*alpha > sprop_sec->alf[sprop_sec->nalf-1][*isec-1]) + { + *cl=sprop_sec->cl_arr[sprop_sec->nalf-1][*isec-1]; + *cd=sprop_sec->cd_arr[sprop_sec->nalf-1][*isec-1]; + } + } +} + +//------------------------------------------------------------------------------------------ +//-------------------------------------------------------------------------------------- +void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *sprop_sec,su2double rad_p,su2double V, su2double RPM, su2double rho, su2double T, su2double blade_angle,su2double DtDr[], su2double *Thrust, su2double *Torque, su2double *dp_av,su2double *dp_at_r) +{ + int j,isec,converged,n_iter; + int NR=sprop_sec->nrad; + su2double r_75,dia,r_hub,r_tip,alpha_corr,cl_corr_fac; + su2double base_mach,s_mach,b_num,thrust,torque; + su2double r_dash,t_loss,c_phi,rad,phi,alpha,radtodeg; + su2double anew,bnew,V0,V2,cl,cd,Vlocal,DqDr,tem1,tem2,q; + su2double delta_r[BEM_MAXR],a[BEM_MAXR],b[BEM_MAXR]; + static su2double Dtorq[BEM_MAXR]; + + su2double n,omega,a0,den; + su2double ang_offset=0.0; + char line[1024]; + +//........................................... + radtodeg = 180.0/M_PI; + dia = s_prop.dia; + r_hub = s_prop.rhub; + r_tip = 0.5*dia ; + ang_offset = blade_angle - s_prop.ang0_75; +//........................................... + alpha_corr = 0.0; + base_mach = 0.22 ; + b_num = sqrt(1.0-base_mach*base_mach); + a0 = sqrt(1.4*287*T); +//........................................... +// +//Change pitch by ang_offset +//and calculate delta_r for integration by trapezoidal rule + + n = RPM/60.0; + omega =n*2.0*M_PI; +// + for (j=0; j < NR; j++) + { + + if (j < 1) + { delta_r[j] = sprop_sec->r1[j+1] - r_hub; } + else + { + if (j < NR-1) + { delta_r[j] = sprop_sec->r1[j+1] - sprop_sec->r1[j-1]; } + else + { delta_r[j] = r_tip - sprop_sec->r1[j-1]; } + } + + delta_r[j] *= 0.5; + } +//-------------------------------------------------------- + + thrust=0.0; + torque=0.0; + +//Main Loop ------------------------------------------------------------- + for (j=0; j < NR; j++) + { + b[j]=0.01; + converged=0; + n_iter=1; + while (converged==0) + { + V2=omega*sprop_sec->r1[j]*(1-b[j]); + V0=V; +// + phi=atan2(V0,V2); +// + alpha=sprop_sec->setangle[j] + ang_offset-radtodeg*phi+alpha_corr; + rad = sprop_sec->r1[j] ; +// get cl, cd from lookup table + isec = j+1 ; + get_clcd_(&isec,sprop_sec, &alpha, &cl, &cd) ; +// ...................................... + Vlocal=sqrt(V0*V0+V2*V2); + q = 0.5*rho*Vlocal*Vlocal ; + s_mach = Vlocal/a0; + cl_corr_fac = 1.0; + if (s_mach > base_mach) + { + den = 1.0-s_mach*s_mach ; + if (den > 0.0) cl_corr_fac = b_num / sqrt(den); + } +// ****************************** + cl *= cl_corr_fac ; +// ****************************** +// tip loss factor + r_dash = rad / r_tip+1.0e-5; + c_phi = cos(phi) ; + t_loss = 1.0; + if (r_dash > 0.90) + { + t_loss = (2.0/M_PI)*acos(exp(-(1.0*s_prop.nblades*(1-r_dash)/(r_dash*c_phi)))) ; + } + + DtDr[j]=q*s_prop.nblades*sprop_sec->chord[j]*(cl*cos(phi)-cd*sin(phi)); + DqDr=q*s_prop.nblades*sprop_sec->chord[j]*rad*(cd*cos(phi)+cl*sin(phi)); + + DtDr[j] *= t_loss; + DqDr *= t_loss; + + tem2=DqDr/(4.0*M_PI*rad*rad*rad*rho*V*omega); + bnew=0.6*b[j]+0.4*tem2; +// + if (bnew > 0.9) bnew = 0.9; + + if (fabs(bnew-b[j])<1.0e-5) + { + converged=1; + } + if (bnew<0.1) + b[j]=bnew; + n_iter++ ; + if (n_iter>BEM_MAX_ITER) + { + converged=1; + } + } // while loop + thrust=thrust+DtDr[j]*delta_r[j]; + torque=torque+DqDr*delta_r[j]; + Dtorq[j] = DqDr; + } // j loop +//End of Main Loop ------------------------------------------------------------- + + tem1 = rho*n*n*dia*dia*dia*dia; + tem2 = tem1*dia; + + + *Thrust=thrust; + *Torque=2.0*M_PI* torque; + *dp_av=2.0*M_PI* torque; + + for (j=0; j < NR; j++) + { + DtDr[j] /= (2.0*M_PI*sprop_sec->r1[j]) ; + Dtorq[j] = Dtorq[j]; + } + + if (rad_p < sprop_sec->r1[0]) + { + tem2 = sprop_sec->r1[0] - r_hub ; + tem1 = (rad_p - r_hub)/tem2 ; + tem2 = 1.0 - tem1 ; + *dp_at_r = DtDr[0]*tem1; + *Torque = Dtorq[0]*tem1; + } + else + { + if (rad_p > r_tip) + { + *dp_at_r = 0.0; + *Torque = 0.0; + } + else + { + if (rad_p > sprop_sec->r1[NR-1]) + { + tem2 = r_tip - sprop_sec->r1[NR-1]; + tem1 = (rad_p - sprop_sec->r1[NR-1])/tem2 ; + tem2 = 1.0 - tem1 ; + *dp_at_r = DtDr[NR-1]*tem2; + *Torque = Dtorq[NR-1]*tem2; + } + else + { + for (j=0; j < NR-1; j++) + { + if ((sprop_sec->r1[j] < rad_p) && (sprop_sec->r1[j+1] >= rad_p)) + { + tem2 = sprop_sec->r1[j+1] - sprop_sec->r1[j]; + tem1 = (rad_p - sprop_sec->r1[j])/tem2 ; + tem2 = 1.0 - tem1 ; + *dp_at_r = DtDr[j]*tem2+DtDr[j+1]*tem1; + *Torque = Dtorq[j]*tem2+Dtorq[j+1]*tem1; + } + } + } + }// r > r_tip + } +//---------------------------------------------------------------------- +} + void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output) { @@ -3425,6 +3736,12 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con su2double Fan_Poly_Eff = config->GetFan_Poly_Eff(); su2double PolyCoeff = 1.0/(1.0-((Gamma-1.0)/Gamma)/Fan_Poly_Eff); + static su2double AD_Omega= 0.0; + static su2double AD_XCG= 0.0,AD_YCG=0.0,AD_ZCG=0.0; + static dpropeller_geom_struct s_prop; + static dpropeller_section_struct sprop_sec; + char section_prop_filename[1024]; + RefDensity = Density_Inf; RefArea = config->GetRefArea(); RefVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim]; @@ -3432,6 +3749,39 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con Factor = (0.5*RefDensity*RefArea*RefVel2); Ref = config->GetDensity_Ref() * config->GetVelocity_Ref() * config->GetVelocity_Ref() * 1.0 * 1.0; + if (Kind_ActDisk == BLADE_ELEMENT) { + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + + if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || + (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { + + Marker_Tag = config->GetMarker_All_TagBound(iMarker); + AD_Omega = config->GetActDisk_Omega(Marker_Tag, 0); + AD_XCG = config->GetActDisk_XCG(Marker_Tag, 0); + AD_YCG = config->GetActDisk_YCG(Marker_Tag, 0); + AD_ZCG = config->GetActDisk_ZCG(Marker_Tag, 0); + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + //SetActDisk_DeltaP(iMarker, iVertex, DeltaP); + //SetActDisk_DeltaT(iMarker, iVertex, DeltaT); + SetActDisk_RotRate(iMarker, iVertex, AD_Omega); + SetActDisk_XCG(iMarker, iVertex, AD_XCG); + SetActDisk_YCG(iMarker, iVertex, AD_YCG); + SetActDisk_ZCG(iMarker, iVertex, AD_ZCG); + } + } + } + if(InnerIter == 0) + { + strcpy(section_prop_filename,config->GetBEM_prop_filename().c_str()); + readsdata_(section_prop_filename,&s_prop,&sprop_sec); + } + /* Update the propeller load according to the modified flow field after every 40 inner iterations */ + if(InnerIter % 40 == 0){ + GenActDiskData_BEM_VLAD(geometry, solver_container, config, iMesh,s_prop,sprop_sec,Output); + } + } + /*--- Variable load distribution is in input file. ---*/ if (Kind_ActDisk == VARIABLE_LOAD) { if(InnerIter == 0) { @@ -4037,6 +4387,145 @@ void CEulerSolver::ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_c } } +// { bem-vlad +void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver_container,CConfig *config, unsigned short iMesh, dpropeller_geom_struct s_prop, dpropeller_section_struct &sprop_sec, bool Output) { + + unsigned short iDim, iMarker; + unsigned long iVertex, iPoint; + string Marker_Tag; + int iRow, nRow, iEl; + su2double Omega_sw=0.0,Omega_RPM=0.0,Origin[3]={0.0},radius_[3]={0.0}; + static su2double omega_ref=0.0, Lref=0.0; + unsigned long InnerIter = config->GetInnerIter(); + static su2double RPM=0.0,blade_angle=0.0,dia=0.0,r_hub=0.0,r_tip=0.0,rps=0.0,radius=0.0; + static su2double V=0.0,rho=0.0,T=0.0; + static su2double Thrust=0.0,Torque=0.0,dp_av=0.0,dp_av1=0.0,dp_at_r=0.0,dp_at_r_Vn=0.0; + static su2double deltap_r[BEM_MAXR]={0.0}; + static su2double AD_Axis[MAXNDIM] = {0.0}, AD_J=0.0; + static su2double Target_Press_Jump=0.0, Target_Temp_Jump=0.0,Area=0.0,UnitNormal[3]={0.0},Vn=0.0; + static su2double Fa=0.0,Ft=0.0,Fr=0.0,Fx=0.0,Fy=0.0,Fz=0.0,dCt_v=0.0,dCp_v=0.0,dCr_v=0.0,rad_v=0.0; + su2double *V_domain,*Coord; + static su2double loc_Torque = 0.0,tot_Torque = 0.0; + static su2double loc_thrust = 0.0,tot_thrust=0.0; + static su2double tot_area = 0.0,tot_tq = 0.0; + dia = s_prop.dia; + r_hub = s_prop.rhub; + r_tip = 0.5*dia ; + + su2double Dens_FreeStream = config->GetDensity_FreeStream(); + const su2double *Vel_FreeStream = config->GetVelocity_FreeStream(); + + su2double *Normal = new su2double[nDim]; + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || + (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + + //Read Swirl params + Omega_RPM = GetActDisk_RotRate(iMarker, iVertex); + Origin[0] = GetActDisk_CGX(iMarker, iVertex) ; + Origin[1] = GetActDisk_CGY(iMarker, iVertex) ; + Origin[2] = GetActDisk_CGZ(iMarker, iVertex) ; + + omega_ref= config->GetOmega_Ref(); + Lref = config->GetLength_Ref(); + Omega_sw = Omega_RPM*(PI_NUMBER/30.0)/(omega_ref);//Swirl rate + Origin[0] = Origin[0]/Lref; + Origin[1] = Origin[1]/Lref; + Origin[2] = Origin[2]/Lref; +//---------------------------------------------------------------------- + /*--- Compute the distance to the center of the rotor ---*/ + + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + + /*Current version works only when propeller axis is aligned to horizontal*/ + AD_Axis[0] = 1.0; + AD_Axis[1] = 0.0; + AD_Axis[2] = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + ActDisk_Axis(iMarker, iDim) = AD_Axis[iDim]; + } + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; + Area = sqrt (Area); + + for (iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = Normal[iDim]/Area; + + if (geometry->nodes->GetDomain(iPoint)) { + Coord = geometry->nodes->GetCoord(iPoint) ; + } + + radius = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + radius += (Coord[iDim]-Origin[iDim])*(Coord[iDim]-Origin[iDim]); + radius_[iDim] = (Coord[iDim]-Origin[iDim]); + } + radius = sqrt(radius); + /*--- Current solution at this boundary node and jumps values ---*/ + V_domain = nodes->GetPrimitive(iPoint); +//--------------------------------------------------------------- + if (abs(Omega_sw) > 1.0e-1) + { + Vn = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim+1]*UnitNormal[iDim]; } + + RPM = abs(Omega_RPM); + rps = RPM/60.0; + AD_J = Vel_FreeStream[0]/(rps*dia); + rho = V_domain[nDim+2] ; + T = V_domain[0] ; + blade_angle = config->GetBEM_blade_angle(); + V = config->GetModVel_FreeStream(); + V = fabs(Vn); + bem_model_noa(s_prop,&sprop_sec, // Propeller properties + radius,V,RPM,rho,T,blade_angle, // Input + deltap_r,&Thrust,&Torque,&dp_av,&dp_at_r); // Output + + tot_area += Area; + loc_Torque += Torque*Area; + tot_tq += dp_av; + loc_thrust += dp_at_r*Area; + Target_Press_Jump = dp_at_r; + Target_Temp_Jump = Target_Press_Jump/(rho*287.0); + + ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; + ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; + ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); + /* Non-dimensionalize the elemental load */ + dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); + //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); + dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); + /* Force radial load to 0 as there is no information of radial load from BEM */ + dCr_v = 0.0; + rad_v = radius/r_tip; + //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + // (pow(AD_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); + Fa = dp_at_r; + Ft = (dCp_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + ((AD_J*PI_NUMBER*rad_v)*(AD_J*PI_NUMBER*rad_v))) / config->GetPressure_Ref(); + Fr = (dCr_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + (pow(AD_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); + Fx = (Ft+Fr)*(radius_[0]/(radius)); + Fy = (Ft+Fr)*(radius_[2]/(radius)); + Fz = -(Ft+Fr)*(radius_[1]/(radius)); + ActDisk_Fa_BEM[iMarker][iVertex] = Fa; + ActDisk_Fx_BEM[iMarker][iVertex] = Fx; + ActDisk_Fy_BEM[iMarker][iVertex] = Fy; + ActDisk_Fz_BEM[iMarker][iVertex] = Fz; + + } +//--------------------------------------------------------------------------------------------------------------------------------------------------------- + } + } + } + delete [] Normal; +} +// } bem-vlad + void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output) { @@ -7646,6 +8135,9 @@ void CEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_contai if(Kind_ActDisk == VARIABLE_LOAD){ BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } + else if(Kind_ActDisk == BLADE_ELEMENT){ + BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); + } else{ BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } @@ -7660,6 +8152,9 @@ void CEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_conta if(Kind_ActDisk == VARIABLE_LOAD){ BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } + else if(Kind_ActDisk == BLADE_ELEMENT){ + BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); + } else{ BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } @@ -8309,6 +8804,248 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver END_SU2_OMP_FOR } +// { bem-vlad +void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, + CConfig *config, unsigned short val_marker, bool val_inlet_surface) { + + /*! + * \function BC_ActDisk_BEM_VLAD + * \brief Actuator disk model with Blade Element Method (BEM) + * \author: Chandukrishna Y., T. N. Venkatesh and Josy Pullockara + * Institution: Computational and Theoretical Fluid Dynamics (CTFD), + * CSIR - National Aerospace Laboratories, Bangalore + * Academy of Scientific and Innovative Research, Ghaziabad + * \version 8.0.0 "Harrier" + * First release date : September 26 2023 + * modified on: + * + * Section properties of the propeller given in an input file. + * Cl, Cd of propeller sections need to be generated earlier and saved in this file + * Actuator disk data initialized in function SetActDisk_BCThrust. + * Propeller load calculated with Blade Element Method + * Interpolated load at each point on the actuator disk is set in GenActDiskData_BEM_VLAD function + * Rest calculations follows the Variable Load (BC_ActDisk_VariableLoad) approach + * + */ + + unsigned short iDim; + unsigned long iVertex, iPoint, GlobalIndex_donor, GlobalIndex; + su2double Pressure, Velocity[MAXNDIM], + Velocity2, Entropy, Density, Energy, Riemann, Vn, SoundSpeed, Vn_Inlet, + Area, UnitNormal[MAXNDIM] = {0.0}, *V_outlet, *V_domain, *V_inlet; + + su2double Pressure_out, Density_out, + Pressure_in, Density_in; + + su2double Prop_Axis[MAXNDIM]; + su2double Fa, Fx, Fy, Fz; + su2double u_in, v_in, w_in, u_out, v_out, w_out, uJ, vJ, wJ; + su2double Temperature_out, H_in, H_out; + su2double FQ, Q_out, Density_Disk; + su2double SoSextr, Vnextr[MAXNDIM], Vnextr_, RiemannExtr, QdMnorm[MAXNDIM], QdMnorm2, appo2, SoS_out; + su2double Normal[MAXNDIM]; + + const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); + const auto Gas_Constant = config->GetGas_ConstantND(); + const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST);// || (config->GetKind_Turb_Model() == TURB_MODEL::SST_SUST); + + /*--- Get the actuator disk center and axis coordinates for the current marker. ---*/ + for (iDim = 0; iDim < nDim; iDim++){ + Prop_Axis[iDim] = ActDisk_Axis(val_marker, iDim); + } + + /*--- Loop over all the vertices on this boundary marker. ---*/ + SU2_OMP_FOR_DYN(OMP_MIN_SIZE) + for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { + + iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); + GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint); + GlobalIndex_donor = GetDonorGlobalIndex(val_marker, iVertex); + + /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ + + if ((geometry->nodes->GetDomain(iPoint)) && + (GlobalIndex != GlobalIndex_donor)) { + + /*--- Normal vector for this vertex (negative for outward convention) ---*/ + + geometry->vertex[val_marker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; + conv_numerics->SetNormal(Normal); + + Area = GeometryToolbox::Norm(nDim, Normal); + for (iDim = 0; iDim < nDim; iDim++) + UnitNormal[iDim] = Normal[iDim]/Area; + + /*--- Current solution at this boundary node. ---*/ + + V_domain = nodes->GetPrimitive(iPoint); + + /*--- Get the values of Fa (axial force per unit area), Fx, Fy and Fz (x, y and z components of the tangential and + radial forces per unit area resultant). ---*/ + Fa = ActDisk_Fa_BEM[val_marker][iVertex]; + Fx = ActDisk_Fx_BEM[val_marker][iVertex]; + Fy = ActDisk_Fy_BEM[val_marker][iVertex]; + Fz = ActDisk_Fz_BEM[val_marker][iVertex]; + + /*--- Get the primitive variables and the extrapolated variables. ---*/ + if (val_inlet_surface){ + V_inlet = nodes->GetPrimitive(iPoint); + V_outlet = DonorPrimVar[val_marker][iVertex];} + else{ + V_outlet = nodes->GetPrimitive(iPoint); + V_inlet = DonorPrimVar[val_marker][iVertex];} + + /*--- u, v and w are the three momentum components. ---*/ + Pressure_out = V_outlet[nDim+1]; + Density_out = V_outlet[nDim+2]; + u_out = V_outlet[1]*V_outlet[nDim+2]; + v_out = V_outlet[2]*V_outlet[nDim+2]; + w_out = V_outlet[3]*V_outlet[nDim+2]; + + Pressure_in = V_inlet[nDim+1]; + Density_in = V_inlet[nDim+2]; + u_in = V_inlet[1]*Density_in; + v_in = V_inlet[2]*Density_in; + w_in = V_inlet[3]*Density_in; + H_in = V_inlet[nDim+3]*Density_in; + + /*--- Density on the disk is computed as an everage value between the inlet and outlet values. ---*/ + Density_Disk = 0.5*(Density_in + Density_out); + + /*--- Computation of the normal momentum flowing through the disk. ---*/ + Q_out = 0.5*((u_in + u_out)*Prop_Axis[0] + (v_in + v_out)*Prop_Axis[1] + (w_in + w_out)*Prop_Axis[2]); + + FQ = Q_out/Density_Disk; + + /*--- Computation of the momentum jumps due to the tnagential and radial forces per unit area. ---*/ + if (FQ < EPS){ + uJ = 0.0; + vJ = 0.0; + wJ = 0.0;} + else{ + uJ = Fx/FQ; + vJ = Fy/FQ; + wJ = Fz/FQ;} + + if (val_inlet_surface) { + /*--- Build the fictitious intlet state based on characteristics. + Retrieve the specified back pressure for this inlet ---*/ + + Density = V_domain[nDim+2]; + Velocity2 = 0.0; Vn = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Velocity[iDim] = V_domain[iDim+1]; + Velocity2 += Velocity[iDim]*Velocity[iDim]; + Vn += Velocity[iDim]*UnitNormal[iDim]; + } + Pressure = V_domain[nDim+1]; + SoundSpeed = sqrt(Gamma*Pressure/Density); + + Entropy = Pressure*pow(1.0/Density, Gamma); + Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One; + + /*--- Compute the new fictious state at the outlet ---*/ + + Pressure = Pressure_out - Fa; + Density = pow(Pressure/Entropy,1.0/Gamma); + SoundSpeed = sqrt(Gamma*Pressure/Density); + Vn_Inlet = Riemann - 2.0*SoundSpeed/Gamma_Minus_One; + + Velocity2 = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { + Velocity[iDim] = Velocity[iDim] + (Vn_Inlet-Vn)*UnitNormal[iDim]; + Velocity2 += Velocity[iDim]*Velocity[iDim]; + } + Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; + if (tkeNeeded) Energy += GetTke_Inf(); + + /*--- Conservative variables, using the derived quantities ---*/ + + V_inlet[0] = Pressure / ( Gas_Constant * Density); + for (iDim = 0; iDim < nDim; iDim++) V_inlet[iDim+1] = Velocity[iDim]; + V_inlet[nDim+1] = Pressure; + V_inlet[nDim+2] = Density; + V_inlet[nDim+3] = Energy + Pressure/Density; + V_inlet[nDim+4] = SoundSpeed; + conv_numerics->SetPrimitive(V_domain, V_inlet); + } + else { + /*--- Acoustic Riemann invariant extrapolation form the interior domain. ---*/ + SoSextr = V_domain[nDim+4]; + + Vnextr_ = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + Vnextr[iDim] = V_domain[iDim+1]*Prop_Axis[iDim]; + Vnextr_ += Vnextr[iDim]*Vnextr[iDim]; + } + Vnextr_ = sqrt(max(0.0,Vnextr_)); + RiemannExtr = Vnextr_ - ((2*SoSextr)/(Gamma_Minus_One)); + + /*--- Assigning the momentum in tangential direction jump and the pressure jump. ---*/ + Velocity[0] = u_in + uJ; + Velocity[1] = v_in + vJ; + Velocity[2] = w_in + wJ; + Pressure_out = Pressure_in + Fa; + + /*--- Computation of the momentum normal to the disk plane. ---*/ + QdMnorm[0] = u_in*Prop_Axis[0]; + QdMnorm[1] = v_in*Prop_Axis[1]; + QdMnorm[2] = w_in*Prop_Axis[2]; + + QdMnorm2 = 0.0; + for (iDim = 0; iDim < nDim; iDim++) QdMnorm2 += QdMnorm[iDim]*QdMnorm[iDim]; + + /*--- Resolving the second grade equation for the density. ---*/ + appo2 = -((2*sqrt(QdMnorm2)*RiemannExtr)+((4*Gamma*Pressure_out)/(pow(Gamma_Minus_One,2)))); + Density_out = (-appo2+sqrt(max(0.0,pow(appo2,2)-4*QdMnorm2*pow(RiemannExtr,2))))/(2*pow(RiemannExtr,2)); + + Velocity2 = 0; + for (iDim = 0; iDim < nDim; iDim++) Velocity2 += (Velocity[iDim]*Velocity[iDim]); + + /*--- Computation of the enthalpy, total energy, temperature and speed of sound. ---*/ + H_out = H_in/Density_in + Fa/Density_out; + Energy = H_out - Pressure_out/Density_out; + if (tkeNeeded) Energy += GetTke_Inf(); + Temperature_out = (Energy-0.5*Velocity2/(pow(Density_out,2)))*(Gamma_Minus_One/Gas_Constant); + + SoS_out = sqrt(Gamma*Gas_Constant*Temperature_out); + + /*--- Set the primitive variables. ---*/ + V_outlet[0] = Temperature_out; + for (iDim = 0; iDim < nDim; iDim++) + V_outlet[iDim+1] = Velocity[iDim]/Density_out; + V_outlet[nDim+1] = Pressure_out; + V_outlet[nDim+2] = Density_out; + V_outlet[nDim+3] = H_out; + V_outlet[nDim+4] = SoS_out; + conv_numerics->SetPrimitive(V_domain, V_outlet); + } + + /*--- Grid Movement (NOT TESTED!)---*/ + + if (dynamic_grid) + conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); + + /*--- Compute the residual using an upwind scheme ---*/ + + auto residual = conv_numerics->ComputeResidual(config); + + /*--- Update residual value ---*/ + + LinSysRes.AddBlock(iPoint, residual); + + /*--- Jacobian contribution for implicit integration ---*/ + + if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); + } + } +} + + + +// } bem-vlad + void CEulerSolver::PrintVerificationError(const CConfig *config) const { if ((rank != MASTER_NODE) || (MGLevel != MESH_0)) return; From 4e1b6c675a4b094b5f395bad1c26ab65457436e3 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 10:22:28 +0530 Subject: [PATCH 04/42] Update CConfig.hpp Updated --- Common/include/CConfig.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 563d477a696..e50576ba2eb 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -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 power for actuator disk. */ + su2double *ActDiskOutlet_Torque_BEM; /*!< \brief Specified outlet power for actuator disk. */ su2double **ActDisk_PressJump, **ActDisk_TempJump, **ActDisk_Omega; /*!< \brief Specified deltas for actuator disk.*/ + su2double **ActDisk_XCG, **ActDisk_YCG, **ActDisk_ZCG; + su2double **ActDisk_RotRate; /*!< \brief Value of the Rotation Rate */ + su2double BEM_blade_angle ; /*!< \brief Propeller blade angle */ + string BEM_prop_filename ; /*!< \brief Propeller blade angle */ + 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. */ @@ -6649,6 +6656,15 @@ class CConfig { */ su2double GetActDisk_PressJump(const string& val_marker, unsigned short val_index) const; + /*! + * \brief Get the CG of the actuator disk. + */ + su2double GetActDisk_XCG(string val_marker, unsigned short val_index) const; + su2double GetActDisk_YCG(string val_marker, unsigned short val_index) const; + su2double GetActDisk_ZCG(string val_marker, unsigned short val_index) const; + su2double GetBEM_blade_angle(void) { return BEM_blade_angle; } + string GetBEM_prop_filename(void) { return BEM_prop_filename; } + /*! * \brief Get the thrust corffient of the actuator disk. */ @@ -8191,6 +8207,9 @@ class CConfig { */ su2double GetActDiskOutlet_Power(const string& val_marker) const; + su2double GetActDiskOutlet_Thrust_BEM(string val_marker) const; + 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. @@ -8226,6 +8245,9 @@ class CConfig { */ void SetActDiskOutlet_Power(unsigned short val_marker, su2double val_actdisk_power) { ActDiskOutlet_Power[val_marker] = val_actdisk_power; } + void SetActDiskOutlet_Thrust_BEM(unsigned short val_marker, su2double val_actdisk_thrust_bem) { ActDiskOutlet_Thrust_BEM[val_marker] = val_actdisk_thrust_bem; } + 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. From 1c2d53ce114b58657c2fb408f2573633fdddaf7c Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 10:36:37 +0530 Subject: [PATCH 05/42] Create prop_defs.hpp --- SU2_CFD/include/solvers/prop_defs.hpp | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 SU2_CFD/include/solvers/prop_defs.hpp diff --git a/SU2_CFD/include/solvers/prop_defs.hpp b/SU2_CFD/include/solvers/prop_defs.hpp new file mode 100644 index 00000000000..977ff854eec --- /dev/null +++ b/SU2_CFD/include/solvers/prop_defs.hpp @@ -0,0 +1,43 @@ +#define BEM_MAXR 50 +#define BEM_MAXALF 100 +#define BEM_MAX_ITER 20 + +typedef struct +{ + int nblades; + float dia; + float rhub; + float ang0_75; +} propeller_geom_struct; + +typedef struct +{ + int nblades; + su2double dia; + su2double rhub; + su2double ang0_75; +} dpropeller_geom_struct; + +typedef struct +{ + int nalf; + int nrad; + float r1[BEM_MAXR]; + float chord[BEM_MAXR]; + float setangle[BEM_MAXR]; + float alf[BEM_MAXALF][BEM_MAXR]; + float cl_arr[BEM_MAXALF][BEM_MAXR]; + float cd_arr[BEM_MAXALF][BEM_MAXR]; +} propeller_section_struct; + +typedef struct +{ + int nalf; + int nrad; + su2double r1[BEM_MAXR]; + su2double chord[BEM_MAXR]; + su2double setangle[BEM_MAXR]; + su2double alf[BEM_MAXALF][BEM_MAXR]; + su2double cl_arr[BEM_MAXALF][BEM_MAXR]; + su2double cd_arr[BEM_MAXALF][BEM_MAXR]; +} dpropeller_section_struct; From a6154e6c862e8e70f8d42beae15e49ee790b9cb1 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 10:42:05 +0530 Subject: [PATCH 06/42] Update option_structure.hpp --- Common/include/option_structure.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 5fe8228925e..2cc62ac4813 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -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 ActDisk_Map = { MakePair("VARIABLES_JUMP", VARIABLES_JUMP) @@ -1867,6 +1868,7 @@ static const MapType ActDisk_Map = { MakePair("MASSFLOW", MASSFLOW) MakePair("POWER", POWER) MakePair("VARIABLE_LOAD", VARIABLE_LOAD) + MakePair("BLADE_ELEMENT", BLADE_ELEMENT) }; /*! @@ -2240,7 +2242,7 @@ static const MapType Continuity_Map = { MakePair("2ND_DERIVATIVE", DERIVATIVE_2ND) MakePair("USER_INPUT", USER_INPUT) }; - +BLADE /*! * \brief Types of coordinates systems for the FFD */ From 7638f800011e2b225f33cca7f16db183eb309fb5 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 10:44:30 +0530 Subject: [PATCH 07/42] Update option_structure.inl --- Common/include/option_structure.inl | 96 +++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/Common/include/option_structure.inl b/Common/include/option_structure.inl index ce94055fca5..c4592c56681 100644 --- a/Common/include/option_structure.inl +++ b/Common/include/option_structure.inl @@ -1772,6 +1772,102 @@ class COptionActDisk : public COptionBase { } }; +// { bem-vlad +class COptionActDiskCentroid : public COptionBase { + 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 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]; + this->marker_outlet = new string[this->outlet_size]; + + 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; + } +}; +// } bem-vlad + class COptionWallFunction : public COptionBase { string name; // identifier for the option unsigned short& nMarkers; From 4362d89737becc7dcc90f993417238d6bba54c8d Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Wed, 27 Sep 2023 11:19:33 +0530 Subject: [PATCH 08/42] Update option_structure.hpp Removed extra statement --- Common/include/option_structure.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/include/option_structure.hpp b/Common/include/option_structure.hpp index 2cc62ac4813..b26b4fcf699 100644 --- a/Common/include/option_structure.hpp +++ b/Common/include/option_structure.hpp @@ -2242,7 +2242,7 @@ static const MapType Continuity_Map = { MakePair("2ND_DERIVATIVE", DERIVATIVE_2ND) MakePair("USER_INPUT", USER_INPUT) }; -BLADE + /*! * \brief Types of coordinates systems for the FFD */ From 29118b4d10e82edf428abecf7cf38b165a9d9aca Mon Sep 17 00:00:00 2001 From: Y Chandukrishna Date: Thu, 28 Sep 2023 08:13:00 +0530 Subject: [PATCH 09/42] added test case for actuatordisk-bem --- .../actuatordisk_bem/actuatordisk_bem.cfg | 253 ++++++++ .../prop_geom_alfclcd_data.txt | 558 ++++++++++++++++++ TestCases/rans/actuatordisk_bem/readme.txt | 15 + 3 files changed, 826 insertions(+) create mode 100644 TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg create mode 100644 TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt create mode 100644 TestCases/rans/actuatordisk_bem/readme.txt diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg new file mode 100644 index 00000000000..45d2094f64b --- /dev/null +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -0,0 +1,253 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Actuator Disk - Blade Element Method % +% Author: Y Chandukrishna, Josy Poulose Pullockara, T N Venkatesh % +% Institution: Computational and Theoretical Fluid Dynamics (CTFD), % +% CSIR - National Aerospace Laboratories, Bangalore % +% Academy of Scientific and Innovative Research, Ghaziabad % +% Comments : +% Date: 23/09/2023 % +% File Version 8.0.0 "Harrier" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%----------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION -------------------------% +% Solver type (EULER, NAVIER_STOKES, RANS, +% INC_EULER, INC_NAVIER_STOKES, INC_RANS +% FEM_EULER, FEM_NAVIER_STOKES, FEM_RANS, FEM_LES, +% HEAT_EQUATION_FVM, ELASTICITY) +SOLVER= RANS +% +% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP, SST_SUST) +KIND_TURB_MODEL= SA +% +% Turbulence intensity at freestream +%FREESTREAM_TURBULENCEINTENSITY=0.01 +% +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) +MATH_PROBLEM= DIRECT +% +% Restart solution (NO, YES) +RESTART_SOL= NO +% +% System of measurements (SI, US) +% International system of units (SI): ( meters, kilograms, Kelvins, +% Newtons = kg m/s^2, Pascals = N/m^2, +% Density = kg/m^3, Speed = m/s, +% Equiv. Area = m^2 ) +SYSTEM_MEASUREMENTS= SI +% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% +% Mach number (non-dimensional, based on the free-stream values) +MACH_NUMBER= 0.11617164 +% +% Angle of attack (degrees, only for compressible flows) +AOA= 0.0 +% +% Side-slip angle (degrees, only for compressible flows) +SIDESLIP_ANGLE= 0.0 +% +% Reynolds number (non-dimensional, based on the free-stream values) +REYNOLDS_NUMBER= 0.62E6 +% +% Reynolds length (1 m, 1 inch by default) +REYNOLDS_LENGTH= 0.237 +% +FREESTREAM_TEMPERATURE= 295 +% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). +VISCOSITY_MODEL= CONSTANT_VISCOSITY +% +% Molecular Viscosity that would be constant (1.716E-5 by default) +MU_CONSTANT= 1.84554E-5 +% +% Sutherland Viscosity Ref (1.716E-5 default value for AIR SI) +MU_REF= 1.716E-5 +% +% Sutherland Temperature Ref (273.15 K default value for AIR SI) +MU_T_REF= 273.15 +% +% Sutherland constant (110.4 default value for AIR SI) +SUTHERLAND_CONSTANT= 110.4 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% +% Reference origin for moment computation (m or in) +REF_ORIGIN_MOMENT_X = 0.0 +REF_ORIGIN_MOMENT_Y = 0.0 +REF_ORIGIN_MOMENT_Z = 0.0 +% +% Reference length for moment non-dimensional coefficients (m or in) +REF_LENGTH= 1.0 +% +% Reference area for non-dimensional force coefficients (0 implies automatic +% calculation) (m^2 or in^2) +REF_AREA= 0.04411429 +% +% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE, +% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE) +REF_DIMENSIONALIZATION= DIMENSIONAL +% +% --------------- ENGINE AND ACTUATOR DISK SIMULATION -------------------------% +% Highlite area to compute MFR (1 in by default) +HIGHLITE_AREA= 0.04411429 +% +% Engine nu factor (SA model). +ENGINE_NU_FACTOR= 0.0 +% +% -------------------- BOUNDARY CONDITION DEFINITION --------------------------% +ACTDISK_DOUBLE_SURFACE = YES +% +% Actuator disk boundary type (VARIABLE_LOAD, VARIABLES_JUMP, BC_THRUST, +% DRAG_MINUS_THRUST) +ACTDISK_TYPE= BLADE_ELEMENT +ACTDISK_JUMP= DIFFERENCE +% +% Actuator disk boundary marker(s) with the following formats (NONE = no marker) +% Variable Load: (inlet face marker, outlet face marker, +% 0.0, 0.0, RPM , 0.0, 0.0, RPM) Markers only effectively used. +% Change the sign of RPM to change the direction of rotation of the propeller +MARKER_ACTDISK = ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 12715.2, 0.0, 0.0, 12715.2) +%Actuator Disk CG +%(inlet face marker, outlet face marker, X_CG of inlet, Y_CG of inlet, Z_CG of inlet , +% X_CG of outlet, Y_CG of outlet, Z_CG of outlet), X_CG, Y_CG, Z_CG of both inlet and +% outlet markers should be same +MARKER_ACTDISK_CG= ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 0.0, 0.0,0.0,0.0) +% Input file containing the propeller section data and aerodynamic details of blade sections +BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt +% Propeller blade angle (Degrees) at 0.75*Radius for the current calculation +BEM_PROP_BLADE_ANGLE = 23.9 +% +% Far-field boundary marker(s) (NONE = no marker) +MARKER_FAR= ( Farfield ) +% +% ------------------------ SURFACES IDENTIFICATION ----------------------------% +% Marker(s) of the surface in the surface flow solution file +MARKER_PLOTTING = ( ACTDISK_IN, ACTDISK_OUT ) +% +% Marker(s) of the surface where the non-dimensional coefficients are evaluated. +MARKER_MONITORING = ( ACTDISK_IN, ACTDISK_OUT ) +% +% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) +MARKER_ANALYZE = ( ACTDISK_IN, ACTDISK_OUT ) +% +% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX). +MARKER_ANALYZE_AVERAGE = MASSFLUX +% +% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% +% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +% +% CFL number (initial value for the adaptive CFL number) +CFL_NUMBER= 4.0 +% +% Adaptive CFL number (NO, YES) +CFL_ADAPT= NO +% +% Objective function in gradient evaluation (DRAG, LIFT, SIDEFORCE, MOMENT_X, +% MOMENT_Y, MOMENT_Z, EFFICIENCY, BUFFET, +% EQUIVALENT_AREA, NEARFIELD_PRESSURE, +% FORCE_X, FORCE_Y, FORCE_Z, THRUST, +% TORQUE, TOTAL_HEATFLUX, +% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, +% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, +% SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) +% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. +OBJECTIVE_FUNCTION= DRAG +% +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% +% Linear solver or smoother for implicit formulations: +% BCGSTAB, FGMRES, RESTARTED_FGMRES, CONJUGATE_GRADIENT (self-adjoint problems only), SMOOTHER. +LINEAR_SOLVER= FGMRES +% +% Preconditioner of the Krylov linear solver or type of smoother (ILU, LU_SGS, LINELET, JACOBI) +LINEAR_SOLVER_PREC= ILU +% +% Minimum error of the linear solver for implicit formulations +LINEAR_SOLVER_ERROR= 1E-12 +% +% Max number of iterations of the linear solver for the implicit formulation +LINEAR_SOLVER_ITER= 3 +% +% Number of elements to apply the criteria +CONV_CAUCHY_ELEMS= 1000 +% +% Epsilon to control the series convergence +CONV_CAUCHY_EPS= 1E-10 +% +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% +% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP, +% AUSMPLUSUP2, HLLC, TURKEL_PREC, MSW, FDS, SLAU, SLAU2) +CONV_NUM_METHOD_FLOW= ROE +MUSCL_FLOW= YES +% +% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) +TIME_DISCRE_FLOW= EULER_IMPLICIT +% +% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% +% Convective numerical method (SCALAR_UPWIND) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND +% +% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. +% Required for 2nd order upwind schemes (NO, YES) +MUSCL_TURB= NO +% +% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, +% BARTH_JESPERSEN, VAN_ALBADA_EDGE) +SLOPE_LIMITER_TURB= VENKATAKRISHNAN +% +% Time discretization (EULER_IMPLICIT) +TIME_DISCRE_TURB= EULER_IMPLICIT +% +% --------------------------- CONVERGENCE PARAMETERS --------------------------% +% Maximum number of iterations +ITER= 5000 +% +% Convergence criteria (CAUCHY, RESIDUAL) +%CONV_CRITERIA= RESIDUAL +% +% Min value of the residual (log10 of the residual) +CONV_RESIDUAL_MINVAL= -8 +% +% Start convergence criteria at iteration number +CONV_STARTITER= 10 +% +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% +% Mesh input file +MESH_FILENAME= actuatordisk_bem.su2 +% +% Mesh input file format (SU2, CGNS) +MESH_FORMAT= SU2 +% +% Mesh output file +MESH_OUT_FILENAME= mesh_out.su2 +% +% Restart flow input file +SOLUTION_FILENAME= actuatordisk_bem.dat +% +% Output tabular file format (TECPLOT, CSV) +TABULAR_FORMAT= CSV +OUTPUT_FILES= (RESTART, PARAVIEW, SURFACE_PARAVIEW) +% +% Output file convergence history (w/o extension) +CONV_FILENAME= history_actuatordisk_bem +% +% Write the forces breakdown file option (NO, YES) +WRT_FORCES_BREAKDOWN= YES +% +% Output file with the forces breakdown +BREAKDOWN_FILENAME= forces_breakdown_actuatordisk_bem.dat +% +% Output file restart flow +RESTART_FILENAME= restart_flow_actuatordisk_bem.dat +% +% Output file flow (w/o extension) variables +VOLUME_FILENAME= flow_actuatordisk_bem +% +% Output file surface flow coefficient (w/o extension) +SURFACE_FILENAME= surface_flow_actuatordisk_bem +% +% Writing solution file frequency +OUTPUT_WRT_FREQ= 500 +% +% Screen output fields +SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_DENSITY, RMS_NU_TILDE, NONPHYSICAL_POINTS, LIFT, DRAG) +HISTORY_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG, AERO_COEFF) diff --git a/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt b/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt new file mode 100644 index 00000000000..97dbb803b84 --- /dev/null +++ b/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt @@ -0,0 +1,558 @@ +# Geometric parameters of propeller +4 : number of blades +0.237 : diameter (m) +0.01754 : radius of hub (m) +23.9 : angle at 75% radius, has to be consistent with section data +# Nsection, Nalf + 22 23 +#section,radius,chord,set angle +1 0.029625 0.011802 39.738358 +2 0.035550 0.013272 36.824936 +3 0.041475 0.014546 34.978134 +4 0.047400 0.016093 33.867138 +5 0.053325 0.017495 32.648598 +6 0.056288 0.018061 31.824940 +7 0.059250 0.018628 30.987774 +8 0.065175 0.019253 29.155754 +9 0.068137 0.019335 28.223461 +10 0.071100 0.019398 27.291164 +11 0.077025 0.019398 26.051857 +12 0.079988 0.019224 25.441435 +13 0.082950 0.019038 24.831013 +14 0.088875 0.018572 23.900000 +15 0.091837 0.018218 23.311188 +16 0.094800 0.017864 22.824017 +17 0.100725 0.016862 21.970278 +18 0.103688 0.016231 21.604017 +19 0.106650 0.015600 21.237759 +20 0.109613 0.014859 20.871506 +21 0.112575 0.014110 20.506992 +22 0.115538 0.011545 20.322815 +#Sec_1, alpha,cl,cd +-15.00 -0.42201 0.14538 +-10.00 -0.47384 0.03066 +-7.000 -0.31633 0.02323 +-5.000 -0.17261 0.02101 +-2.000 0.062180 0.02041 +0.0000 0.217500 0.02160 +2.0000 0.362500 0.02415 +5.0000 0.545000 0.03092 +8.0000 0.663400 0.04315 +10.000 0.715250 0.05540 +12.000 0.772350 0.07025 +15.000 0.846930 0.09997 +17.000 0.793240 0.14274 +20.000 0.741380 0.21541 +25.000 0.809181 0.31423 +30.000 0.799410 0.45780 +35.000 0.842714 0.58514 +40.000 0.859940 0.72557 +50.000 0.842806 1.01662 +60.000 0.753790 1.27954 +70.000 0.581530 1.49396 +80.000 0.346121 1.63350 +90.000 0.074679 1.67220 +#Sec_2, alpha,cl,cd +-15.00 -0.42201 0.14538 +-10.00 -0.47384 0.03066 +-7.000 -0.31633 0.02323 +-5.000 -0.17261 0.02101 +-2.000 0.062180 0.02041 +0.0000 0.217500 0.02160 +2.0000 0.362500 0.02415 +5.0000 0.545000 0.03092 +8.0000 0.663400 0.04315 +10.000 0.715250 0.05540 +12.000 0.772350 0.07025 +15.000 0.846930 0.09997 +17.000 0.793240 0.14274 +20.000 0.741380 0.21541 +25.000 0.809181 0.31423 +30.000 0.799410 0.45780 +35.000 0.842714 0.58514 +40.000 0.859940 0.72557 +50.000 0.842806 1.01662 +60.000 0.753790 1.27954 +70.000 0.581530 1.49396 +80.000 0.346121 1.63350 +90.000 0.074679 1.67220 +#Sec_3, alpha,cl,cd +-15.00 -0.42201 0.14538 +-10.00 -0.47384 0.03066 +-7.000 -0.31633 0.02323 +-5.000 -0.17261 0.02101 +-2.000 0.062180 0.02041 +0.0000 0.217500 0.02160 +2.0000 0.362500 0.02415 +5.0000 0.545000 0.03092 +8.0000 0.663400 0.04315 +10.000 0.715250 0.05540 +12.000 0.772350 0.07025 +15.000 0.846930 0.09997 +17.000 0.793240 0.14274 +20.000 0.741380 0.21541 +25.000 0.809181 0.31423 +30.000 0.799410 0.45780 +35.000 0.842714 0.58514 +40.000 0.859940 0.72557 +50.000 0.842806 1.01662 +60.000 0.753790 1.27954 +70.000 0.581530 1.49396 +80.000 0.346121 1.63350 +90.000 0.074679 1.67220 +#Sec_4, alpha,cl,cd +-15.00 -0.42201 0.14538 +-10.00 -0.47384 0.03066 +-7.000 -0.31633 0.02323 +-5.000 -0.17261 0.02101 +-2.000 0.062180 0.02041 +0.0000 0.217500 0.02160 +2.0000 0.362500 0.02415 +5.0000 0.545000 0.03092 +8.0000 0.663400 0.04315 +10.000 0.715250 0.05540 +12.000 0.772350 0.07025 +15.000 0.846930 0.09997 +17.000 0.793240 0.14274 +20.000 0.741380 0.21541 +25.000 0.809181 0.31423 +30.000 0.799410 0.45780 +35.000 0.842714 0.58514 +40.000 0.859940 0.72557 +50.000 0.842806 1.01662 +60.000 0.753790 1.27954 +70.000 0.581530 1.49396 +80.000 0.346121 1.63350 +90.000 0.074679 1.67220 +#Sec_5, alpha,cl,cd +-15.00 -0.42201 0.14538 +-10.00 -0.47384 0.03066 +-7.000 -0.31633 0.02323 +-5.000 -0.17261 0.02101 +-2.000 0.062180 0.02041 +0.0000 0.217500 0.02160 +2.0000 0.362500 0.02415 +5.0000 0.545000 0.03092 +8.0000 0.663400 0.04315 +10.000 0.715250 0.05540 +12.000 0.772350 0.07025 +15.000 0.846930 0.09997 +17.000 0.793240 0.14274 +20.000 0.741380 0.21541 +25.000 0.809181 0.31423 +30.000 0.799410 0.45780 +35.000 0.842714 0.58514 +40.000 0.859940 0.72557 +50.000 0.842806 1.01662 +60.000 0.753790 1.27954 +70.000 0.581530 1.49396 +80.000 0.346121 1.63350 +90.000 0.074679 1.67220 +#Sec_6,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_7,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_8,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_9,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_10,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_11,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_12,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_13,alpha,cl,cd +-15.00 -0.38500 0.18600 +-10.00 -0.39240 0.08201 +-7.000 -0.34387 0.02873 +-5.000 -0.16518 0.02386 +-2.000 0.119372 0.02119 +0.0000 0.311530 0.02133 +2.0000 0.500006 0.02276 +5.0000 0.767233 0.02742 +8.0000 0.997630 0.03621 +10.000 1.114230 0.04588 +12.000 1.181340 0.06145 +15.000 1.152260 0.10511 +17.000 1.004230 0.16952 +20.000 0.920632 0.26388 +25.000 0.932029 0.40397 +30.000 0.956910 0.54778 +35.000 0.974480 0.71086 +40.000 0.990417 0.86521 +50.000 0.953389 1.17309 +60.000 0.823469 1.46302 +70.000 0.606730 1.70462 +80.000 0.320770 1.86131 +90.000 -0.00218 1.90357 +#Sec_14,alpha,cl,cd +-15.00 -0.71025 0.250000 +-10.00 -0.62520 0.152360 +-7.000 -0.46165 0.067514 +-5.000 -0.31109 0.028340 +-2.000 0.002995 0.020170 +0.0000 0.209724 0.019035 +2.0000 0.420804 0.019842 +5.0000 0.726100 0.024640 +8.0000 1.005110 0.035811 +10.000 1.142203 0.051340 +12.000 1.071063 0.097789 +15.000 0.885860 0.219350 +17.000 0.917480 0.273890 +20.000 0.929127 0.350000 +25.000 0.982100 0.480000 +30.000 1.038380 0.614900 +35.000 1.072214 0.704314 +40.000 1.082084 0.920430 +50.000 1.032150 1.244025 +60.000 0.884800 1.549000 +70.000 0.652577 1.810174 +80.000 0.346247 1.982400 +90.000 -0.00090 2.034369 +#Sec_15,alpha,cl,cd +-15.00 -0.71025 0.250000 +-10.00 -0.62520 0.152360 +-7.000 -0.46165 0.067514 +-5.000 -0.31109 0.028340 +-2.000 0.002995 0.020170 +0.0000 0.209724 0.019035 +2.0000 0.420804 0.019842 +5.0000 0.726100 0.024640 +8.0000 1.005110 0.035811 +10.000 1.142203 0.051340 +12.000 1.071063 0.097789 +15.000 0.885860 0.219350 +17.000 0.917480 0.273890 +20.000 0.929127 0.350000 +25.000 0.982100 0.480000 +30.000 1.038380 0.614900 +35.000 1.072214 0.704314 +40.000 1.082084 0.920430 +50.000 1.032150 1.244025 +60.000 0.884800 1.549000 +70.000 0.652577 1.810174 +80.000 0.346247 1.982400 +90.000 -0.00090 2.034369 +#Sec_16,alpha,cl,cd +-15.00 -0.450235 0.123572 +-10.00 -0.509059 0.092961 +-7.000 -0.473475 0.068098 +-5.000 -0.311293 0.028335 +-2.000 -0.000500 0.020111 +0.0000 0.212258 0.019451 +2.0000 0.423786 0.020642 +5.0000 0.731349 0.026056 +8.0000 1.008821 0.038666 +10.000 1.135043 0.058155 +12.000 0.937040 0.138576 +15.000 0.964997 0.255187 +17.000 0.872200 0.324306 +20.000 0.857793 0.333029 +25.000 0.922114 0.460801 +30.000 1.045545 0.626256 +35.000 1.076223 0.775646 +40.000 1.084297 0.932095 +50.000 1.031466 1.254707 +60.000 0.883621 1.561348 +70.000 0.645650 1.814277 +80.000 0.337736 1.982865 +90.000 -0.00965 2.034968 +#Sec_17,alpha,cl,cd +-15.00 -0.450235 0.123572 +-10.00 -0.509059 0.092961 +-7.000 -0.473475 0.068098 +-5.000 -0.311293 0.028335 +-2.000 -0.000500 0.020111 +0.0000 0.212258 0.019451 +2.0000 0.423786 0.020642 +5.0000 0.731349 0.026056 +8.0000 1.008821 0.038666 +10.000 1.135043 0.058155 +12.000 0.937040 0.138576 +15.000 0.964997 0.255187 +17.000 0.872200 0.324306 +20.000 0.857793 0.333029 +25.000 0.922114 0.460801 +30.000 1.045545 0.626256 +35.000 1.076223 0.775646 +40.000 1.084297 0.932095 +50.000 1.031466 1.254707 +60.000 0.883621 1.561348 +70.000 0.645650 1.814277 +80.000 0.337736 1.982865 +90.000 -0.00965 2.034968 +#Sec_18,alpha,cl,cd +-15.00 -0.450235 0.123572 +-10.00 -0.509059 0.092961 +-7.000 -0.473475 0.068098 +-5.000 -0.311293 0.028335 +-2.000 -0.000500 0.020111 +0.0000 0.212258 0.019451 +2.0000 0.423786 0.020642 +5.0000 0.731349 0.026056 +8.0000 1.008821 0.038666 +10.000 1.135043 0.058155 +12.000 0.937040 0.138576 +15.000 0.964997 0.255187 +17.000 0.872200 0.324306 +20.000 0.857793 0.333029 +25.000 0.922114 0.460801 +30.000 1.045545 0.626256 +35.000 1.076223 0.775646 +40.000 1.084297 0.932095 +50.000 1.031466 1.254707 +60.000 0.883621 1.561348 +70.000 0.645650 1.814277 +80.000 0.337736 1.982865 +90.000 -0.00965 2.034968 +#Sec_19,alpha,cl,cd +-15.00 -0.624154 0.154154 +-10.00 -0.538409 0.080512 +-7.000 -0.481732 0.075544 +-5.000 -0.313564 0.031177 +-2.000 -0.002507 0.018085 +0.0000 0.210838 0.016733 +2.0000 0.422316 0.017475 +5.0000 0.727235 0.022779 +8.0000 0.990487 0.038041 +10.000 1.023327 0.079155 +12.000 1.014323 0.123481 +15.000 1.002321 0.213523 +17.000 0.965321 0.261254 +20.000 0.942346 0.312364 +25.000 0.925641 0.375215 +30.000 1.056059 0.616220 +35.000 1.086160 0.764234 +40.000 1.097267 0.923027 +50.000 1.046694 1.250085 +60.000 0.903101 1.564407 +70.000 0.665977 1.821230 +80.000 0.357959 1.994476 +90.000 0.008920 2.053167 +#Sec_20,alpha,cl,cd +-15.00 -0.624154 0.154154 +-10.00 -0.538409 0.080512 +-7.000 -0.481732 0.075544 +-5.000 -0.313564 0.031177 +-2.000 -0.002507 0.018085 +0.0000 0.210838 0.016733 +2.0000 0.422316 0.017475 +5.0000 0.727235 0.022779 +8.0000 0.990487 0.038041 +10.000 1.023327 0.079155 +12.000 1.014323 0.123481 +15.000 1.002321 0.213523 +17.000 0.965321 0.261254 +20.000 0.942346 0.312364 +25.000 0.925641 0.375215 +30.000 1.056059 0.616220 +35.000 1.086160 0.764234 +40.000 1.097267 0.923027 +50.000 1.046694 1.250085 +60.000 0.903101 1.564407 +70.000 0.665977 1.821230 +80.000 0.357959 1.994476 +90.000 0.008920 2.053167 +#Sec_21,alpha,cl,cd +-15.00 -0.624154 0.154154 +-10.00 -0.538409 0.080512 +-7.000 -0.481732 0.075544 +-5.000 -0.313564 0.031177 +-2.000 -0.002507 0.018085 +0.0000 0.210838 0.016733 +2.0000 0.422316 0.017475 +5.0000 0.727235 0.022779 +8.0000 0.990487 0.038041 +10.000 1.023327 0.079155 +12.000 1.014323 0.123481 +15.000 1.002321 0.213523 +17.000 0.965321 0.261254 +20.000 0.942346 0.312364 +25.000 0.925641 0.375215 +30.000 1.056059 0.616220 +35.000 1.086160 0.764234 +40.000 1.097267 0.923027 +50.000 1.046694 1.250085 +60.000 0.903101 1.564407 +70.000 0.665977 1.821230 +80.000 0.357959 1.994476 +90.000 0.008920 2.053167 +#Sec_22,alpha,cl,cd +-15.00 -0.624154 0.154154 +-10.00 -0.538409 0.080512 +-7.000 -0.481732 0.075544 +-5.000 -0.313564 0.031177 +-2.000 -0.002507 0.018085 +0.0000 0.210838 0.016733 +2.0000 0.422316 0.017475 +5.0000 0.727235 0.022779 +8.0000 0.990487 0.038041 +10.000 1.023327 0.079155 +12.000 1.014323 0.123481 +15.000 1.002321 0.213523 +17.000 0.965321 0.261254 +20.000 0.942346 0.312364 +25.000 0.925641 0.375215 +30.000 1.056059 0.616220 +35.000 1.086160 0.764234 +40.000 1.097267 0.923027 +50.000 1.046694 1.250085 +60.000 0.903101 1.564407 +70.000 0.665977 1.821230 +80.000 0.357959 1.994476 +90.000 0.008920 2.053167 diff --git a/TestCases/rans/actuatordisk_bem/readme.txt b/TestCases/rans/actuatordisk_bem/readme.txt new file mode 100644 index 00000000000..be9887fd9f4 --- /dev/null +++ b/TestCases/rans/actuatordisk_bem/readme.txt @@ -0,0 +1,15 @@ +Propeller data provided as the test case here is the propeller used in the studies of Sinnige et al. 2018 in their experimental studies. Isolated propeller geometry as .stp file and experimental results (J vs CT, J vs CP) are provided as supplementary materials along with the publication. + +The current test case corresponds to the four bladed propeller of diameter 0.237m in a freestream velocity (Vinf) of 40m/s, advance ratio of J=0.8, propeller blade angle at 0.75R is 23.9 degrees. + +The experimental thrust and power (Non-Dimensional) at J ~ 0.8 are as follows: + +J=Vinf/nD CT=Thrust/rho*n2*D4 CP=Power/rho*n3*D5 +0.7963 0.0953 0.1025 + + +Reference: +----------- +Sinnige, T., van Arnhem, N., Stokkermans, T. C. A., Eitelberg, G., Veldhuis, L. L. M., ``Wingtip-Mounted + Propellers: Aerodynamic Analysis of Interaction Effects and Comparison with Conventional Layout,'' + Journal of Aircraft, 2018. From d3eb65300ea538f97920a518187418e36630f7e3 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Thu, 28 Sep 2023 10:08:30 +0530 Subject: [PATCH 10/42] Update readme.txt Added dimensional values of Thrust and Torque which can be compared with the simulation output --- TestCases/rans/actuatordisk_bem/readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/TestCases/rans/actuatordisk_bem/readme.txt b/TestCases/rans/actuatordisk_bem/readme.txt index be9887fd9f4..82853c69a44 100644 --- a/TestCases/rans/actuatordisk_bem/readme.txt +++ b/TestCases/rans/actuatordisk_bem/readme.txt @@ -7,6 +7,7 @@ The experimental thrust and power (Non-Dimensional) at J ~ 0.8 are as follows: J=Vinf/nD CT=Thrust/rho*n2*D4 CP=Power/rho*n3*D5 0.7963 0.0953 0.1025 +The dimensional values are Thrust = 16.30 N and Torque = 0.6612 N-m. Reference: ----------- From 458dddd7a60247343933b6f5d2e1dbf896aaae84 Mon Sep 17 00:00:00 2001 From: tnv-nal Date: Thu, 28 Sep 2023 10:50:27 +0530 Subject: [PATCH 11/42] Update actuatordisk_bem.cfg Reduced number of iterations to 2000 --- TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index 45d2094f64b..130e0cda4e2 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -199,7 +199,7 @@ TIME_DISCRE_TURB= EULER_IMPLICIT % % --------------------------- CONVERGENCE PARAMETERS --------------------------% % Maximum number of iterations -ITER= 5000 +ITER= 2000 % % Convergence criteria (CAUCHY, RESIDUAL) %CONV_CRITERIA= RESIDUAL From c62e7cd40df81aeebaf9ba7005008d04d5656e2c Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Thu, 28 Sep 2023 15:39:16 +0530 Subject: [PATCH 12/42] corrections in comments, su2 style comments, whitespaces --- Common/include/CConfig.hpp | 54 ++++++++++-- Common/include/option_structure.inl | 2 - Common/src/CConfig.cpp | 8 +- SU2_CFD/include/solvers/CEulerSolver.hpp | 13 ++- SU2_CFD/include/solvers/prop_defs.hpp | 27 ++++++ SU2_CFD/src/solvers/CEulerSolver.cpp | 102 +++++++++++------------ subprojects/CoolProp | 1 - 7 files changed, 141 insertions(+), 66 deletions(-) delete mode 160000 subprojects/CoolProp diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index e50576ba2eb..5bb9daa5d3f 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -344,15 +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 power for actuator disk. */ - su2double *ActDiskOutlet_Torque_BEM; /*!< \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; - su2double **ActDisk_RotRate; /*!< \brief Value of the Rotation Rate */ - su2double BEM_blade_angle ; /*!< \brief Propeller blade angle */ - string BEM_prop_filename ; /*!< \brief Propeller blade angle */ - bool History_File_Append_Flag; /*!< \brief Flag to append history file */ + 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. */ @@ -6657,12 +6657,28 @@ class CConfig { su2double GetActDisk_PressJump(const string& val_marker, unsigned short val_index) const; /*! - * \brief Get the CG of the actuator disk. + * \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; } /*! @@ -8207,7 +8223,18 @@ 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; /*! @@ -8245,7 +8272,18 @@ 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; } /*! diff --git a/Common/include/option_structure.inl b/Common/include/option_structure.inl index c4592c56681..12c7340aafc 100644 --- a/Common/include/option_structure.inl +++ b/Common/include/option_structure.inl @@ -1772,7 +1772,6 @@ class COptionActDisk : public COptionBase { } }; -// { bem-vlad class COptionActDiskCentroid : public COptionBase { string name; // identifier for the option unsigned short & inlet_size; @@ -1866,7 +1865,6 @@ public: this->actdisk_zcg = NULL; } }; -// } bem-vlad class COptionWallFunction : public COptionBase { string name; // identifier for the option diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 07be649f1b8..17f534557c9 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -920,6 +920,7 @@ void CConfig::SetPointersNull() { ActDiskOutlet_TotalPressure = nullptr; ActDiskOutlet_GrossThrust = nullptr; ActDiskOutlet_Force = nullptr; ActDiskOutlet_Power = nullptr; ActDiskOutlet_Temperature = nullptr; ActDiskOutlet_TotalTemperature = nullptr; ActDiskOutlet_MassFlow = nullptr; + ActDiskOutlet_Thrust_BEM = nullptr; ActDiskOutlet_Torque_BEM = nullptr; @@ -1524,6 +1525,8 @@ void CConfig::SetConfig_Options() { addActDiskOption("MARKER_ACTDISK", 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); @@ -1654,10 +1657,11 @@ void CConfig::SetConfig_Options() { /* DESCRIPTION: Actuator disk double surface */ addBoolOption("ACTDISK_DOUBLE_SURFACE", ActDisk_DoubleSurface, false); - /* DESCRIPTION: History File Append */ + /* DESCRIPTION: Actuator disk BEM switch for history file appending.*/ addBoolOption("HISTORY_FILE_APPEND", History_File_Append_Flag, false); - /* DESCRIPTION: Propeller_Blade_angle */ + /* 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 */ diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 56d60fcf37c..22ae4b338a2 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -537,7 +537,16 @@ class CEulerSolver : public CFVMFlowSolverBase. + */ + #define BEM_MAXR 50 #define BEM_MAXALF 100 #define BEM_MAX_ITER 20 diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index aa7946b81c2..5efd95e9839 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -194,6 +194,8 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, AllocVectorOfVectors(nVertex, ActDisk_Fy); AllocVectorOfVectors(nVertex, ActDisk_Fz); + /*--- Actuator Disk BEM Fa, Fx, Fy and Fz allocations ---*/ + AllocVectorOfVectors(nVertex, ActDisk_Fa_BEM); AllocVectorOfVectors(nVertex, ActDisk_Fx_BEM); AllocVectorOfVectors(nVertex, ActDisk_Fy_BEM); @@ -203,11 +205,18 @@ CEulerSolver::CEulerSolver(CGeometry *geometry, CConfig *config, AllocVectorOfVectors(nVertex, ActDisk_DeltaP); + /*--- Store the value of rotation rate of the Actuator Disk for BEM ---*/ + AllocVectorOfVectors(nVertex, ActDisk_RotRate); + + /*--- Store the value of CG of the Actuator Disk for BEM ---*/ + AllocVectorOfVectors(nVertex, ActDisk_XCG); AllocVectorOfVectors(nVertex, ActDisk_YCG); AllocVectorOfVectors(nVertex, ActDisk_ZCG); + /*--- Store the value of DeltaP_r, Thrust_r and Torque_r at the Actuator Disk for BEM ---*/ + AllocVectorOfVectors(nVertex, ActDisk_DeltaP_r); AllocVectorOfVectors(nVertex, ActDisk_Thrust_r); AllocVectorOfVectors(nVertex, ActDisk_Torque_r); @@ -2836,9 +2845,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns Outlet_Force_Local[iMarker_Outlet] += Outlet_Force[iMarker]; Outlet_Power_Local[iMarker_Outlet] += Outlet_Power[iMarker]; Outlet_Area_Local[iMarker_Outlet] += Outlet_Area[iMarker]; - Outlet_DeltaP_Local[iMarker_Outlet] += Outlet_DeltaP[iMarker]; - Outlet_Thrust_Local[iMarker_Outlet] += Outlet_Thrust[iMarker]; - Outlet_Torque_Local[iMarker_Outlet] += Outlet_Torque[iMarker]; + Outlet_DeltaP_Local[iMarker_Outlet] += Outlet_DeltaP[iMarker]; + Outlet_Thrust_Local[iMarker_Outlet] += Outlet_Thrust[iMarker]; + Outlet_Torque_Local[iMarker_Outlet] += Outlet_Torque[iMarker]; } } @@ -3444,7 +3453,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns } -// { bem-vlad +// { actuatordisk-bem //.......function 'readsdata_' reads alpha, cl and cd values from the files........................ //float readsdata_(char *sec_filename,propeller_geom_struct *s_prop, propeller_section_struct *sprop_sec) void readsdata_(char *sec_filename,dpropeller_geom_struct *s_prop, dpropeller_section_struct *sprop_sec) @@ -3671,7 +3680,7 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro *Torque = Dtorq[0]*tem1; } else - { + { if (rad_p > r_tip) { *dp_at_r = 0.0; @@ -3705,6 +3714,7 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro } //---------------------------------------------------------------------- } +// } actuatordisk-bem void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output) { @@ -3771,15 +3781,15 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con } } } - if(InnerIter == 0) - { + if(InnerIter == 0) + { strcpy(section_prop_filename,config->GetBEM_prop_filename().c_str()); readsdata_(section_prop_filename,&s_prop,&sprop_sec); - } - /* Update the propeller load according to the modified flow field after every 40 inner iterations */ - if(InnerIter % 40 == 0){ - GenActDiskData_BEM_VLAD(geometry, solver_container, config, iMesh,s_prop,sprop_sec,Output); - } + } + /* Update the propeller load according to the modified flow field after every 40 inner iterations */ + if(InnerIter % 40 == 0){ + GenActDiskData_BEM_VLAD(geometry, solver_container, config, iMesh,s_prop,sprop_sec,Output); + } } /*--- Variable load distribution is in input file. ---*/ @@ -4387,7 +4397,6 @@ void CEulerSolver::ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_c } } -// { bem-vlad void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver_container,CConfig *config, unsigned short iMesh, dpropeller_geom_struct s_prop, dpropeller_section_struct &sprop_sec, bool Output) { unsigned short iDim, iMarker; @@ -4419,9 +4428,8 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); //Read Swirl params Omega_RPM = GetActDisk_RotRate(iMarker, iVertex); @@ -4452,18 +4460,17 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; Area = sqrt (Area); - for (iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = Normal[iDim]/Area; + for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim]/Area; - if (geometry->nodes->GetDomain(iPoint)) { - Coord = geometry->nodes->GetCoord(iPoint) ; - } + if (geometry->nodes->GetDomain(iPoint)) { + Coord = geometry->nodes->GetCoord(iPoint) ; + } - radius = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - radius += (Coord[iDim]-Origin[iDim])*(Coord[iDim]-Origin[iDim]); - radius_[iDim] = (Coord[iDim]-Origin[iDim]); - } + radius = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + radius += (Coord[iDim]-Origin[iDim])*(Coord[iDim]-Origin[iDim]); + radius_[iDim] = (Coord[iDim]-Origin[iDim]); + } radius = sqrt(radius); /*--- Current solution at this boundary node and jumps values ---*/ V_domain = nodes->GetPrimitive(iPoint); @@ -4474,7 +4481,7 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver for (iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim+1]*UnitNormal[iDim]; } RPM = abs(Omega_RPM); - rps = RPM/60.0; + rps = RPM/60.0; AD_J = Vel_FreeStream[0]/(rps*dia); rho = V_domain[nDim+2] ; T = V_domain[0] ; @@ -4491,40 +4498,38 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver loc_thrust += dp_at_r*Area; Target_Press_Jump = dp_at_r; Target_Temp_Jump = Target_Press_Jump/(rho*287.0); - - ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; - ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; - ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); - /* Non-dimensionalize the elemental load */ - dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); - //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); - dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); - /* Force radial load to 0 as there is no information of radial load from BEM */ - dCr_v = 0.0; - rad_v = radius/r_tip; - //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + + ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; + ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; + ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); + /* Non-dimensionalize the elemental load */ + dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); + //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); + dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); + /* Force radial load to 0 as there is no information of radial load from BEM */ + dCr_v = 0.0; + rad_v = radius/r_tip; + //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ // (pow(AD_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); - Fa = dp_at_r; + Fa = dp_at_r; Ft = (dCp_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ ((AD_J*PI_NUMBER*rad_v)*(AD_J*PI_NUMBER*rad_v))) / config->GetPressure_Ref(); Fr = (dCr_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ (pow(AD_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); - Fx = (Ft+Fr)*(radius_[0]/(radius)); + Fx = (Ft+Fr)*(radius_[0]/(radius)); Fy = (Ft+Fr)*(radius_[2]/(radius)); Fz = -(Ft+Fr)*(radius_[1]/(radius)); - ActDisk_Fa_BEM[iMarker][iVertex] = Fa; + ActDisk_Fa_BEM[iMarker][iVertex] = Fa; ActDisk_Fx_BEM[iMarker][iVertex] = Fx; ActDisk_Fy_BEM[iMarker][iVertex] = Fy; ActDisk_Fz_BEM[iMarker][iVertex] = Fz; - } -//--------------------------------------------------------------------------------------------------------------------------------------------------------- - } +//--------------------------------------------------------------- + } } } delete [] Normal; } -// } bem-vlad void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output) { @@ -8804,7 +8809,6 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver END_SU2_OMP_FOR } -// { bem-vlad void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker, bool val_inlet_surface) { @@ -9042,10 +9046,6 @@ void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con } } - - -// } bem-vlad - void CEulerSolver::PrintVerificationError(const CConfig *config) const { if ((rank != MASTER_NODE) || (MGLevel != MESH_0)) return; diff --git a/subprojects/CoolProp b/subprojects/CoolProp deleted file mode 160000 index bafdea1f39e..00000000000 --- a/subprojects/CoolProp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bafdea1f39ee873a6bb9833e3a21fe41f90b85e8 From 9ae8d28553e104d0fdcb02c728075a0f04f1eda4 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Thu, 28 Sep 2023 16:45:32 +0530 Subject: [PATCH 13/42] restore accidental rm of subprojects/CoolProp --- subprojects/CoolProp | 1 + 1 file changed, 1 insertion(+) create mode 160000 subprojects/CoolProp diff --git a/subprojects/CoolProp b/subprojects/CoolProp new file mode 160000 index 00000000000..0ce42fcf3bb --- /dev/null +++ b/subprojects/CoolProp @@ -0,0 +1 @@ +Subproject commit 0ce42fcf3bb2c373512bc825a4f0c1973a78f307 From 4c4e200c32bf3500e421eca9ddca0a34657a2733 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 29 Sep 2023 07:05:37 +0530 Subject: [PATCH 14/42] minor whitespaces --- SU2_CFD/include/solvers/prop_defs.hpp | 64 ++++---- SU2_CFD/src/solvers/CEulerSolver.cpp | 144 +++++++++--------- .../actuatordisk_bem/actuatordisk_bem.cfg | 12 +- .../prop_geom_alfclcd_data.txt | 2 +- TestCases/rans/actuatordisk_bem/readme.txt | 2 +- 5 files changed, 112 insertions(+), 112 deletions(-) diff --git a/SU2_CFD/include/solvers/prop_defs.hpp b/SU2_CFD/include/solvers/prop_defs.hpp index 7a4a6b9cbe8..c599606dce5 100644 --- a/SU2_CFD/include/solvers/prop_defs.hpp +++ b/SU2_CFD/include/solvers/prop_defs.hpp @@ -29,42 +29,42 @@ #define BEM_MAXALF 100 #define BEM_MAX_ITER 20 -typedef struct +typedef struct { - int nblades; - float dia; - float rhub; - float ang0_75; -} propeller_geom_struct; + int nblades; + float dia; + float rhub; + float ang0_75; +} propeller_geom_struct; -typedef struct +typedef struct { - int nblades; - su2double dia; - su2double rhub; - su2double ang0_75; -} dpropeller_geom_struct; + int nblades; + su2double dia; + su2double rhub; + su2double ang0_75; +} dpropeller_geom_struct; -typedef struct +typedef struct { - int nalf; - int nrad; - float r1[BEM_MAXR]; - float chord[BEM_MAXR]; - float setangle[BEM_MAXR]; - float alf[BEM_MAXALF][BEM_MAXR]; - float cl_arr[BEM_MAXALF][BEM_MAXR]; - float cd_arr[BEM_MAXALF][BEM_MAXR]; -} propeller_section_struct; + int nalf; + int nrad; + float r1[BEM_MAXR]; + float chord[BEM_MAXR]; + float setangle[BEM_MAXR]; + float alf[BEM_MAXALF][BEM_MAXR]; + float cl_arr[BEM_MAXALF][BEM_MAXR]; + float cd_arr[BEM_MAXALF][BEM_MAXR]; +} propeller_section_struct; -typedef struct +typedef struct { - int nalf; - int nrad; - su2double r1[BEM_MAXR]; - su2double chord[BEM_MAXR]; - su2double setangle[BEM_MAXR]; - su2double alf[BEM_MAXALF][BEM_MAXR]; - su2double cl_arr[BEM_MAXALF][BEM_MAXR]; - su2double cd_arr[BEM_MAXALF][BEM_MAXR]; -} dpropeller_section_struct; + int nalf; + int nrad; + su2double r1[BEM_MAXR]; + su2double chord[BEM_MAXR]; + su2double setangle[BEM_MAXR]; + su2double alf[BEM_MAXALF][BEM_MAXR]; + su2double cl_arr[BEM_MAXALF][BEM_MAXR]; + su2double cd_arr[BEM_MAXALF][BEM_MAXR]; +} dpropeller_section_struct; diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 5efd95e9839..2db165c63bf 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -876,7 +876,7 @@ void CEulerSolver::SetNondimensionalization(CConfig *config, unsigned short iMes auxFluidModel = new CPengRobinson(Gamma, config->GetGas_Constant(), config->GetPressure_Critical(), config->GetTemperature_Critical(), config->GetAcentric_Factor()); break; - + case DATADRIVEN_FLUID: auxFluidModel = new CDataDrivenFluid(config); @@ -3545,21 +3545,21 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro su2double delta_r[BEM_MAXR],a[BEM_MAXR],b[BEM_MAXR]; static su2double Dtorq[BEM_MAXR]; - su2double n,omega,a0,den; + su2double n,omega,a0,den; su2double ang_offset=0.0; char line[1024]; //........................................... - radtodeg = 180.0/M_PI; - dia = s_prop.dia; - r_hub = s_prop.rhub; + radtodeg = 180.0/M_PI; + dia = s_prop.dia; + r_hub = s_prop.rhub; r_tip = 0.5*dia ; - ang_offset = blade_angle - s_prop.ang0_75; + ang_offset = blade_angle - s_prop.ang0_75; //........................................... alpha_corr = 0.0; base_mach = 0.22 ; b_num = sqrt(1.0-base_mach*base_mach); - a0 = sqrt(1.4*287*T); + a0 = sqrt(1.4*287*T); //........................................... // //Change pitch by ang_offset @@ -3568,20 +3568,20 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro n = RPM/60.0; omega =n*2.0*M_PI; // - for (j=0; j < NR; j++) + for (j=0; j < NR; j++) { - if (j < 1) + if (j < 1) { delta_r[j] = sprop_sec->r1[j+1] - r_hub; } - else + else { - if (j < NR-1) + if (j < NR-1) { delta_r[j] = sprop_sec->r1[j+1] - sprop_sec->r1[j-1]; } else { delta_r[j] = r_tip - sprop_sec->r1[j-1]; } } - delta_r[j] *= 0.5; + delta_r[j] *= 0.5; } //-------------------------------------------------------- @@ -3589,7 +3589,7 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro torque=0.0; //Main Loop ------------------------------------------------------------- - for (j=0; j < NR; j++) + for (j=0; j < NR; j++) { b[j]=0.01; converged=0; @@ -3598,32 +3598,32 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro { V2=omega*sprop_sec->r1[j]*(1-b[j]); V0=V; -// +// phi=atan2(V0,V2); -// +// alpha=sprop_sec->setangle[j] + ang_offset-radtodeg*phi+alpha_corr; - rad = sprop_sec->r1[j] ; -// get cl, cd from lookup table - isec = j+1 ; + rad = sprop_sec->r1[j]; +// get cl, cd from lookup table + isec = j+1; get_clcd_(&isec,sprop_sec, &alpha, &cl, &cd) ; // ...................................... Vlocal=sqrt(V0*V0+V2*V2); - q = 0.5*rho*Vlocal*Vlocal ; - s_mach = Vlocal/a0; - cl_corr_fac = 1.0; - if (s_mach > base_mach) + q = 0.5*rho*Vlocal*Vlocal; + s_mach = Vlocal/a0; + cl_corr_fac = 1.0; + if (s_mach > base_mach) { - den = 1.0-s_mach*s_mach ; - if (den > 0.0) cl_corr_fac = b_num / sqrt(den); + den = 1.0-s_mach*s_mach; + if (den > 0.0) cl_corr_fac = b_num / sqrt(den); } -// ****************************** +// ****************************** cl *= cl_corr_fac ; -// ****************************** -// tip loss factor +// ****************************** +// tip loss factor r_dash = rad / r_tip+1.0e-5; c_phi = cos(phi) ; t_loss = 1.0; - if (r_dash > 0.90) + if (r_dash > 0.90) { t_loss = (2.0/M_PI)*acos(exp(-(1.0*s_prop.nblades*(1-r_dash)/(r_dash*c_phi)))) ; } @@ -3631,8 +3631,8 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro DtDr[j]=q*s_prop.nblades*sprop_sec->chord[j]*(cl*cos(phi)-cd*sin(phi)); DqDr=q*s_prop.nblades*sprop_sec->chord[j]*rad*(cd*cos(phi)+cl*sin(phi)); - DtDr[j] *= t_loss; - DqDr *= t_loss; + DtDr[j] *= t_loss; + DqDr *= t_loss; tem2=DqDr/(4.0*M_PI*rad*rad*rad*rho*V*omega); bnew=0.6*b[j]+0.4*tem2; @@ -3645,7 +3645,7 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro } if (bnew<0.1) b[j]=bnew; - n_iter++ ; + n_iter++ ; if (n_iter>BEM_MAX_ITER) { converged=1; @@ -3658,53 +3658,53 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro //End of Main Loop ------------------------------------------------------------- tem1 = rho*n*n*dia*dia*dia*dia; - tem2 = tem1*dia; + tem2 = tem1*dia; - *Thrust=thrust; + *Thrust=thrust; *Torque=2.0*M_PI* torque; *dp_av=2.0*M_PI* torque; - for (j=0; j < NR; j++) + for (j=0; j < NR; j++) { - DtDr[j] /= (2.0*M_PI*sprop_sec->r1[j]) ; + DtDr[j] /= (2.0*M_PI*sprop_sec->r1[j]) ; Dtorq[j] = Dtorq[j]; } if (rad_p < sprop_sec->r1[0]) { - tem2 = sprop_sec->r1[0] - r_hub ; - tem1 = (rad_p - r_hub)/tem2 ; - tem2 = 1.0 - tem1 ; - *dp_at_r = DtDr[0]*tem1; + tem2 = sprop_sec->r1[0] - r_hub; + tem1 = (rad_p - r_hub)/tem2; + tem2 = 1.0 - tem1; + *dp_at_r = DtDr[0]*tem1; *Torque = Dtorq[0]*tem1; } - else + else { if (rad_p > r_tip) { - *dp_at_r = 0.0; + *dp_at_r = 0.0; *Torque = 0.0; } - else + else { if (rad_p > sprop_sec->r1[NR-1]) { tem2 = r_tip - sprop_sec->r1[NR-1]; tem1 = (rad_p - sprop_sec->r1[NR-1])/tem2 ; - tem2 = 1.0 - tem1 ; - *dp_at_r = DtDr[NR-1]*tem2; + tem2 = 1.0 - tem1; + *dp_at_r = DtDr[NR-1]*tem2; *Torque = Dtorq[NR-1]*tem2; } - else + else { - for (j=0; j < NR-1; j++) + for (j=0; j < NR-1; j++) { - if ((sprop_sec->r1[j] < rad_p) && (sprop_sec->r1[j+1] >= rad_p)) + if ((sprop_sec->r1[j] < rad_p) && (sprop_sec->r1[j+1] >= rad_p)) { tem2 = sprop_sec->r1[j+1] - sprop_sec->r1[j]; tem1 = (rad_p - sprop_sec->r1[j])/tem2 ; - tem2 = 1.0 - tem1 ; + tem2 = 1.0 - tem1; *dp_at_r = DtDr[j]*tem2+DtDr[j+1]*tem1; *Torque = Dtorq[j]*tem2+Dtorq[j+1]*tem1; } @@ -4417,8 +4417,8 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver static su2double loc_Torque = 0.0,tot_Torque = 0.0; static su2double loc_thrust = 0.0,tot_thrust=0.0; static su2double tot_area = 0.0,tot_tq = 0.0; - dia = s_prop.dia; - r_hub = s_prop.rhub; + dia = s_prop.dia; + r_hub = s_prop.rhub; r_tip = 0.5*dia ; su2double Dens_FreeStream = config->GetDensity_FreeStream(); @@ -4463,7 +4463,7 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim]/Area; if (geometry->nodes->GetDomain(iPoint)) { - Coord = geometry->nodes->GetCoord(iPoint) ; + Coord = geometry->nodes->GetCoord(iPoint); } radius = 0.0; @@ -4475,29 +4475,29 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver /*--- Current solution at this boundary node and jumps values ---*/ V_domain = nodes->GetPrimitive(iPoint); //--------------------------------------------------------------- - if (abs(Omega_sw) > 1.0e-1) + if (abs(Omega_sw) > 1.0e-1) { - Vn = 0.0; + Vn = 0.0; for (iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim+1]*UnitNormal[iDim]; } RPM = abs(Omega_RPM); rps = RPM/60.0; AD_J = Vel_FreeStream[0]/(rps*dia); - rho = V_domain[nDim+2] ; - T = V_domain[0] ; - blade_angle = config->GetBEM_blade_angle(); + rho = V_domain[nDim+2]; + T = V_domain[0]; + blade_angle = config->GetBEM_blade_angle(); V = config->GetModVel_FreeStream(); - V = fabs(Vn); + V = fabs(Vn); bem_model_noa(s_prop,&sprop_sec, // Propeller properties radius,V,RPM,rho,T,blade_angle, // Input deltap_r,&Thrust,&Torque,&dp_av,&dp_at_r); // Output - tot_area += Area; - loc_Torque += Torque*Area; - tot_tq += dp_av; - loc_thrust += dp_at_r*Area; + tot_area += Area; + loc_Torque += Torque*Area; + tot_tq += dp_av; + loc_thrust += dp_at_r*Area; Target_Press_Jump = dp_at_r; - Target_Temp_Jump = Target_Press_Jump/(rho*287.0); + Target_Temp_Jump = Target_Press_Jump/(rho*287.0); ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; @@ -4506,7 +4506,7 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); - /* Force radial load to 0 as there is no information of radial load from BEM */ + /* Force radial load to 0 as there is no information of radial load from BEM */ dCr_v = 0.0; rad_v = radius/r_tip; //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ @@ -6113,7 +6113,7 @@ void CEulerSolver::PreprocessBC_Giles(CGeometry *geometry, CConfig *config, CNum { Velocity_i[iDim] = nodes->GetVelocity(iPoint,iDim); } - + ComputeTurboVelocity(Velocity_i, turboNormal, turboVelocity, marker_flag, config->GetKind_TurboMachinery(iZone)); if(nDim ==2){ @@ -8814,22 +8814,22 @@ void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*! * \function BC_ActDisk_BEM_VLAD - * \brief Actuator disk model with Blade Element Method (BEM) + * \brief Actuator disk model with Blade Element Method (BEM) * \author: Chandukrishna Y., T. N. Venkatesh and Josy Pullockara - * Institution: Computational and Theoretical Fluid Dynamics (CTFD), - * CSIR - National Aerospace Laboratories, Bangalore - * Academy of Scientific and Innovative Research, Ghaziabad - * \version 8.0.0 "Harrier" + * Institution: Computational and Theoretical Fluid Dynamics (CTFD), + * CSIR - National Aerospace Laboratories, Bangalore + * Academy of Scientific and Innovative Research, Ghaziabad + * \version 8.0.0 "Harrier" * First release date : September 26 2023 * modified on: * - * Section properties of the propeller given in an input file. + * Section properties of the propeller given in an input file. * Cl, Cd of propeller sections need to be generated earlier and saved in this file * Actuator disk data initialized in function SetActDisk_BCThrust. * Propeller load calculated with Blade Element Method - * Interpolated load at each point on the actuator disk is set in GenActDiskData_BEM_VLAD function + * Interpolated load at each point on the actuator disk is set in GenActDiskData_BEM_VLAD function * Rest calculations follows the Variable Load (BC_ActDisk_VariableLoad) approach - * + * */ unsigned short iDim; diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index 130e0cda4e2..09e594e32a6 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -33,7 +33,7 @@ RESTART_SOL= NO % % System of measurements (SI, US) % International system of units (SI): ( meters, kilograms, Kelvins, -% Newtons = kg m/s^2, Pascals = N/m^2, +% Newtons = kg m/s^2, Pascals = N/m^2, % Density = kg/m^3, Speed = m/s, % Equiv. Area = m^2 ) SYSTEM_MEASUREMENTS= SI @@ -103,16 +103,16 @@ ACTDISK_JUMP= DIFFERENCE % % Actuator disk boundary marker(s) with the following formats (NONE = no marker) % Variable Load: (inlet face marker, outlet face marker, -% 0.0, 0.0, RPM , 0.0, 0.0, RPM) Markers only effectively used. +% 0.0, 0.0, RPM , 0.0, 0.0, RPM) Markers only effectively used. % Change the sign of RPM to change the direction of rotation of the propeller MARKER_ACTDISK = ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 12715.2, 0.0, 0.0, 12715.2) %Actuator Disk CG -%(inlet face marker, outlet face marker, X_CG of inlet, Y_CG of inlet, Z_CG of inlet , -% X_CG of outlet, Y_CG of outlet, Z_CG of outlet), X_CG, Y_CG, Z_CG of both inlet and +%(inlet face marker, outlet face marker, X_CG of inlet, Y_CG of inlet, Z_CG of inlet , +% X_CG of outlet, Y_CG of outlet, Z_CG of outlet), X_CG, Y_CG, Z_CG of both inlet and % outlet markers should be same MARKER_ACTDISK_CG= ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 0.0, 0.0,0.0,0.0) % Input file containing the propeller section data and aerodynamic details of blade sections -BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt +BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt % Propeller blade angle (Degrees) at 0.75*Radius for the current calculation BEM_PROP_BLADE_ANGLE = 23.9 % @@ -148,7 +148,7 @@ CFL_ADAPT= NO % FORCE_X, FORCE_Y, FORCE_Z, THRUST, % TORQUE, TOTAL_HEATFLUX, % MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, +% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, % SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) % For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. OBJECTIVE_FUNCTION= DRAG diff --git a/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt b/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt index 97dbb803b84..8ee50cc1728 100644 --- a/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt +++ b/TestCases/rans/actuatordisk_bem/prop_geom_alfclcd_data.txt @@ -1,5 +1,5 @@ # Geometric parameters of propeller -4 : number of blades +4 : number of blades 0.237 : diameter (m) 0.01754 : radius of hub (m) 23.9 : angle at 75% radius, has to be consistent with section data diff --git a/TestCases/rans/actuatordisk_bem/readme.txt b/TestCases/rans/actuatordisk_bem/readme.txt index 82853c69a44..58d2abceca3 100644 --- a/TestCases/rans/actuatordisk_bem/readme.txt +++ b/TestCases/rans/actuatordisk_bem/readme.txt @@ -11,6 +11,6 @@ The dimensional values are Thrust = 16.30 N and Torque = 0.6612 N-m. Reference: ----------- -Sinnige, T., van Arnhem, N., Stokkermans, T. C. A., Eitelberg, G., Veldhuis, L. L. M., ``Wingtip-Mounted +Sinnige, T., van Arnhem, N., Stokkermans, T. C. A., Eitelberg, G., Veldhuis, L. L. M., ``Wingtip-Mounted Propellers: Aerodynamic Analysis of Interaction Effects and Comparison with Conventional Layout,'' Journal of Aircraft, 2018. From d46f79cbb1cf6883183907edb22138fc00851083 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 29 Sep 2023 07:06:39 +0530 Subject: [PATCH 15/42] TestCases/parallel_regression.py --- TestCases/parallel_regression.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index f26049592b8..7fe2cc40a55 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -486,6 +486,15 @@ def main(): propeller.timeout = 3200 test_list.append(propeller) + # Actuator disk BEM method for propeller + propeller = TestCase('actuatordisk_bem') + propeller.cfg_dir = "rans/actuatordisk_bem" + propeller.cfg_file = "actuatordisk_bem.cfg" + propeller.test_iter = 15 + propeller.test_vals = [4.4835e-01, -5.226958, -8.297197, 0, -0.004325, -0.565388] + propeller.timeout = 3200 + test_list.append(propeller) + ####################################### ### Axisymmetric Compressible RANS ### ####################################### From 8aa0e5e60536c8926da906a411702c8a4f7958af Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 29 Sep 2023 09:38:07 +0530 Subject: [PATCH 16/42] missed test case regression name --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 7fe2cc40a55..6ad9c4c3708 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -493,7 +493,7 @@ def main(): propeller.test_iter = 15 propeller.test_vals = [4.4835e-01, -5.226958, -8.297197, 0, -0.004325, -0.565388] propeller.timeout = 3200 - test_list.append(propeller) + test_list.append(actuatordisk_bem) ####################################### ### Axisymmetric Compressible RANS ### From 73fe4ad3c747924cfa4a5ac69e3b345dd345f675 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 29 Sep 2023 12:13:36 +0530 Subject: [PATCH 17/42] remove compiler warnings of unset, unused variabes --- SU2_CFD/src/solvers/CEulerSolver.cpp | 59 +++++++++++++--------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 2db165c63bf..ae390354c77 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -3456,46 +3456,46 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns // { actuatordisk-bem //.......function 'readsdata_' reads alpha, cl and cd values from the files........................ //float readsdata_(char *sec_filename,propeller_geom_struct *s_prop, propeller_section_struct *sprop_sec) -void readsdata_(char *sec_filename,dpropeller_geom_struct *s_prop, dpropeller_section_struct *sprop_sec) +char* readsdata_(char *sec_filename,dpropeller_geom_struct *s_prop, dpropeller_section_struct *sprop_sec) { int i,j,MAXRK,MAXALFK; char dummy[1024]; FILE *file_ang; int sect[BEM_MAXR]; + char* fgets_r=0; //.Read blade section data from file file_ang = fopen(sec_filename,"r"); // To be read from file - fgets(dummy,120,file_ang); + fgets_r = fgets(dummy,120,file_ang); // Skip header - fgets(dummy,120,file_ang); sscanf(dummy,"%d", &s_prop->nblades); - fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->dia); - fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->rhub); - fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->ang0_75); + fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%d", &s_prop->nblades); + fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->dia); + fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->rhub); + fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->ang0_75); //.Skip reading next line................................................. - fgets(dummy,120,file_ang); - fgets(dummy,120,file_ang); + fgets_r = fgets(dummy,120,file_ang); + fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%d%d",&MAXRK,&MAXALFK); sprop_sec-> nrad = MAXRK; sprop_sec-> nalf = MAXALFK; // - fgets(dummy,120,file_ang); + fgets_r = fgets(dummy,120,file_ang); for(i=0; i < MAXRK; i++) { - fgets(dummy,120,file_ang); + fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%d %lf %lf %lf",§[i],&sprop_sec->r1[i],&sprop_sec->chord[i],&sprop_sec->setangle[i]); } //.Read computed alpha v/s cl and cd from the file -// for(i=0; i < MAXRK; i++) { - fgets(dummy,128,file_ang); + fgets_r = fgets(dummy,128,file_ang); for(j=0; j < MAXALFK; j++) { - fgets(dummy,128,file_ang); + fgets_r = fgets(dummy,128,file_ang); sscanf(dummy,"%lf %lf %lf",&sprop_sec->alf[j][i],&sprop_sec->cl_arr[j][i],&sprop_sec->cd_arr[j][i]); } -} -// + } + return fgets_r; } @@ -3538,16 +3538,15 @@ void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *spro { int j,isec,converged,n_iter; int NR=sprop_sec->nrad; - su2double r_75,dia,r_hub,r_tip,alpha_corr,cl_corr_fac; + su2double dia,r_hub,r_tip,alpha_corr,cl_corr_fac; su2double base_mach,s_mach,b_num,thrust,torque; su2double r_dash,t_loss,c_phi,rad,phi,alpha,radtodeg; - su2double anew,bnew,V0,V2,cl,cd,Vlocal,DqDr,tem1,tem2,q; - su2double delta_r[BEM_MAXR],a[BEM_MAXR],b[BEM_MAXR]; + su2double bnew,V0,V2,cl,cd,Vlocal,DqDr,tem1,tem2,q; + su2double delta_r[BEM_MAXR],b[BEM_MAXR]; static su2double Dtorq[BEM_MAXR]; su2double n,omega,a0,den; su2double ang_offset=0.0; - char line[1024]; //........................................... radtodeg = 180.0/M_PI; @@ -4402,23 +4401,21 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver unsigned short iDim, iMarker; unsigned long iVertex, iPoint; string Marker_Tag; - int iRow, nRow, iEl; su2double Omega_sw=0.0,Omega_RPM=0.0,Origin[3]={0.0},radius_[3]={0.0}; static su2double omega_ref=0.0, Lref=0.0; - unsigned long InnerIter = config->GetInnerIter(); - static su2double RPM=0.0,blade_angle=0.0,dia=0.0,r_hub=0.0,r_tip=0.0,rps=0.0,radius=0.0; + static su2double RPM=0.0,blade_angle=0.0,dia=0.0,/*r_hub=0.0,*/r_tip=0.0,rps=0.0,radius=0.0; static su2double V=0.0,rho=0.0,T=0.0; - static su2double Thrust=0.0,Torque=0.0,dp_av=0.0,dp_av1=0.0,dp_at_r=0.0,dp_at_r_Vn=0.0; + static su2double Thrust=0.0,Torque=0.0,dp_av=0.0,/*dp_av1=0.0,*/dp_at_r=0.0; static su2double deltap_r[BEM_MAXR]={0.0}; static su2double AD_Axis[MAXNDIM] = {0.0}, AD_J=0.0; - static su2double Target_Press_Jump=0.0, Target_Temp_Jump=0.0,Area=0.0,UnitNormal[3]={0.0},Vn=0.0; - static su2double Fa=0.0,Ft=0.0,Fr=0.0,Fx=0.0,Fy=0.0,Fz=0.0,dCt_v=0.0,dCp_v=0.0,dCr_v=0.0,rad_v=0.0; - su2double *V_domain,*Coord; - static su2double loc_Torque = 0.0,tot_Torque = 0.0; - static su2double loc_thrust = 0.0,tot_thrust=0.0; + static su2double Target_Press_Jump=0.0, /*Target_Temp_Jump=0.0,*/Area=0.0,UnitNormal[3]={0.0},Vn=0.0; + static su2double Fa=0.0,Ft=0.0,Fr=0.0,Fx=0.0,Fy=0.0,Fz=0.0,/*dCt_v=0.0,*/dCp_v=0.0,dCr_v=0.0,rad_v=0.0; + su2double *V_domain=0, *Coord=0; + static su2double loc_Torque = 0.0; + static su2double loc_thrust = 0.0; static su2double tot_area = 0.0,tot_tq = 0.0; dia = s_prop.dia; - r_hub = s_prop.rhub; + // r_hub = s_prop.rhub; r_tip = 0.5*dia ; su2double Dens_FreeStream = config->GetDensity_FreeStream(); @@ -4497,13 +4494,13 @@ void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver tot_tq += dp_av; loc_thrust += dp_at_r*Area; Target_Press_Jump = dp_at_r; - Target_Temp_Jump = Target_Press_Jump/(rho*287.0); + // Target_Temp_Jump = Target_Press_Jump/(rho*287.0); ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); /* Non-dimensionalize the elemental load */ - dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); + //dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); /* Force radial load to 0 as there is no information of radial load from BEM */ From 345483020dd78650963a4df1f72b02be9536ef01 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 29 Sep 2023 15:02:16 +0530 Subject: [PATCH 18/42] Actuator disk BEM method for propellers feature currently not supported for incompressible or non-equilibrium model or axisymmetric flows. --- Common/src/CConfig.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 17f534557c9..aff893ada9b 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -4991,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) { From 5adffd027debba50312d5de299a07f30f90309d0 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 29 Sep 2023 20:14:51 +0530 Subject: [PATCH 19/42] BEM method related user input template in config_template.cfg --- config_template.cfg | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/config_template.cfg b/config_template.cfg index 811df18a014..e29e6a77626 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -923,8 +923,11 @@ MARKER_INLET= ( NONE ) % Inc. Mass Flow: ( outlet marker, mass flow target (kg/s), ... ) MARKER_OUTLET= ( NONE ) % +% Propeller blade element actuator disk double surface (inlet, outlet) boundary condition +ACTDISK_DOUBLE_SURFACE = NO +% % Actuator disk boundary type (VARIABLE_LOAD, VARIABLES_JUMP, BC_THRUST, -% DRAG_MINUS_THRUST) +% DRAG_MINUS_THRUST, BLADE_ELEMENT) ACTDISK_TYPE= VARIABLES_JUMP % % Actuator disk boundary marker(s) with the following formats (NONE = no marker) @@ -938,11 +941,25 @@ ACTDISK_TYPE= VARIABLES_JUMP % Drag-Thrust: ( inlet face marker, outlet face marker, % Takeoff Drag-Thrust (lbs), 0.0, Takeoff rev/min, % Cruise Drag-Thrust (lbs), 0.0, Cruise rev/min ) +% Blade element: ( inlet face marker, outlet face marker, +% Takeoff Drag-Thrust (lbs), 0.0, Takeoff rev/min, +% Cruise Drag-Thrust (lbs), 0.0, Cruise rev/min ) MARKER_ACTDISK= ( NONE ) % +% Blade element: ( inlet face marker, outlet face marker, +% X_CG of inlet, Y_CG of inlet, Z_CG of inlet, +% X_CG of outlet, Y_CG of outlet, Z_CG of outlet ) +MARKER_ACTDISK_CG= ( NONE ) +% % Actuator disk data input file name ACTDISK_FILENAME= actuatordisk.dat % +% Propeller blade element section and aerodynamic data input file name +BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt +% +% Propeller blade angle (degrees) at (0.75 * radius) +BEM_PROP_BLADE_ANGLE = 25.0 +% % Supersonic inlet boundary marker(s) (NONE = no marker) % Format: (inlet marker, temperature, static pressure, velocity_x, % velocity_y, velocity_z, ... ), i.e. primitive variables specified. From 047d7c4391e8c4c6e42ac1df8605d35cdcbd260f Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Thu, 12 Oct 2023 14:00:50 +0530 Subject: [PATCH 20/42] bem reorg: eliminate prop_defs.h, readsdata_(), bem_model_noa_() and get_clcd_() --- SU2_CFD/include/solvers/CEulerSolver.hpp | 15 +- SU2_CFD/include/solvers/prop_defs.hpp | 70 -- SU2_CFD/src/solvers/CEulerSolver.cpp | 845 ++++++++++++----------- 3 files changed, 461 insertions(+), 469 deletions(-) delete mode 100644 SU2_CFD/include/solvers/prop_defs.hpp diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 22ae4b338a2..373bc79ff38 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -29,7 +29,7 @@ #include "CFVMFlowSolverBase.hpp" #include "../variables/CEulerVariable.hpp" -#include "prop_defs.hpp" +//#include "prop_defs.hpp" /*! * \class CEulerSolver @@ -229,6 +229,17 @@ class CEulerSolver : public CFVMFlowSolverBase. - */ - -#define BEM_MAXR 50 -#define BEM_MAXALF 100 -#define BEM_MAX_ITER 20 - -typedef struct -{ - int nblades; - float dia; - float rhub; - float ang0_75; -} propeller_geom_struct; - -typedef struct -{ - int nblades; - su2double dia; - su2double rhub; - su2double ang0_75; -} dpropeller_geom_struct; - -typedef struct -{ - int nalf; - int nrad; - float r1[BEM_MAXR]; - float chord[BEM_MAXR]; - float setangle[BEM_MAXR]; - float alf[BEM_MAXALF][BEM_MAXR]; - float cl_arr[BEM_MAXALF][BEM_MAXR]; - float cd_arr[BEM_MAXALF][BEM_MAXR]; -} propeller_section_struct; - -typedef struct -{ - int nalf; - int nrad; - su2double r1[BEM_MAXR]; - su2double chord[BEM_MAXR]; - su2double setangle[BEM_MAXR]; - su2double alf[BEM_MAXALF][BEM_MAXR]; - su2double cl_arr[BEM_MAXALF][BEM_MAXR]; - su2double cd_arr[BEM_MAXALF][BEM_MAXR]; -} dpropeller_section_struct; diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index ae390354c77..e529d40a529 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -3453,268 +3453,6 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns } -// { actuatordisk-bem -//.......function 'readsdata_' reads alpha, cl and cd values from the files........................ -//float readsdata_(char *sec_filename,propeller_geom_struct *s_prop, propeller_section_struct *sprop_sec) -char* readsdata_(char *sec_filename,dpropeller_geom_struct *s_prop, dpropeller_section_struct *sprop_sec) -{ - int i,j,MAXRK,MAXALFK; - char dummy[1024]; - FILE *file_ang; - int sect[BEM_MAXR]; - char* fgets_r=0; -//.Read blade section data from file - file_ang = fopen(sec_filename,"r"); -// To be read from file - fgets_r = fgets(dummy,120,file_ang); -// Skip header - fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%d", &s_prop->nblades); - fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->dia); - fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->rhub); - fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->ang0_75); -//.Skip reading next line................................................. - fgets_r = fgets(dummy,120,file_ang); - fgets_r = fgets(dummy,120,file_ang); - sscanf(dummy,"%d%d",&MAXRK,&MAXALFK); - sprop_sec-> nrad = MAXRK; - sprop_sec-> nalf = MAXALFK; -// - fgets_r = fgets(dummy,120,file_ang); - for(i=0; i < MAXRK; i++) - { - fgets_r = fgets(dummy,120,file_ang); - sscanf(dummy,"%d %lf %lf %lf",§[i],&sprop_sec->r1[i],&sprop_sec->chord[i],&sprop_sec->setangle[i]); - } -//.Read computed alpha v/s cl and cd from the file - for(i=0; i < MAXRK; i++) - { - fgets_r = fgets(dummy,128,file_ang); - for(j=0; j < MAXALFK; j++) - { - fgets_r = fgets(dummy,128,file_ang); - sscanf(dummy,"%lf %lf %lf",&sprop_sec->alf[j][i],&sprop_sec->cl_arr[j][i],&sprop_sec->cd_arr[j][i]); - } - } - return fgets_r; -} - - -void get_clcd_(int *isec,dpropeller_section_struct *sprop_sec,su2double *alpha,su2double *cl,su2double *cd) -{ - int i,salf=0; - su2double fact; - -//.interpolating values of cl and cd for given alpha..................................................... - if(*alpha >= sprop_sec->alf[salf][*isec-1] && *alpha <= sprop_sec->alf[sprop_sec->nalf-1][*isec-1]) - { - for(i=0;i < sprop_sec->nalf-1; i++) - { - if(*alpha>=sprop_sec->alf[i][*isec-1] && *alpha <= sprop_sec->alf[i+1][*isec-1]) - { - fact=(*alpha-sprop_sec->alf[i][*isec-1])/(sprop_sec->alf[i+1][*isec-1]-sprop_sec->alf[i][*isec-1]); - *cl=sprop_sec->cl_arr[i][*isec-1] + fact*(sprop_sec->cl_arr[i+1][*isec-1] - sprop_sec->cl_arr[i][*isec-1]); - *cd=sprop_sec->cd_arr[i][*isec-1] + fact*(sprop_sec->cd_arr[i+1][*isec-1] - sprop_sec->cd_arr[i][*isec-1]); - } - } - } - else - { - if(*alpha < sprop_sec->alf[salf][*isec-1]) - { - *cl=sprop_sec->cl_arr[0][*isec-1]; - *cd=sprop_sec->cd_arr[0][*isec-1]; - } - if(*alpha > sprop_sec->alf[sprop_sec->nalf-1][*isec-1]) - { - *cl=sprop_sec->cl_arr[sprop_sec->nalf-1][*isec-1]; - *cd=sprop_sec->cd_arr[sprop_sec->nalf-1][*isec-1]; - } - } -} - -//------------------------------------------------------------------------------------------ -//-------------------------------------------------------------------------------------- -void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *sprop_sec,su2double rad_p,su2double V, su2double RPM, su2double rho, su2double T, su2double blade_angle,su2double DtDr[], su2double *Thrust, su2double *Torque, su2double *dp_av,su2double *dp_at_r) -{ - int j,isec,converged,n_iter; - int NR=sprop_sec->nrad; - su2double dia,r_hub,r_tip,alpha_corr,cl_corr_fac; - su2double base_mach,s_mach,b_num,thrust,torque; - su2double r_dash,t_loss,c_phi,rad,phi,alpha,radtodeg; - su2double bnew,V0,V2,cl,cd,Vlocal,DqDr,tem1,tem2,q; - su2double delta_r[BEM_MAXR],b[BEM_MAXR]; - static su2double Dtorq[BEM_MAXR]; - - su2double n,omega,a0,den; - su2double ang_offset=0.0; - -//........................................... - radtodeg = 180.0/M_PI; - dia = s_prop.dia; - r_hub = s_prop.rhub; - r_tip = 0.5*dia ; - ang_offset = blade_angle - s_prop.ang0_75; -//........................................... - alpha_corr = 0.0; - base_mach = 0.22 ; - b_num = sqrt(1.0-base_mach*base_mach); - a0 = sqrt(1.4*287*T); -//........................................... -// -//Change pitch by ang_offset -//and calculate delta_r for integration by trapezoidal rule - - n = RPM/60.0; - omega =n*2.0*M_PI; -// - for (j=0; j < NR; j++) - { - - if (j < 1) - { delta_r[j] = sprop_sec->r1[j+1] - r_hub; } - else - { - if (j < NR-1) - { delta_r[j] = sprop_sec->r1[j+1] - sprop_sec->r1[j-1]; } - else - { delta_r[j] = r_tip - sprop_sec->r1[j-1]; } - } - - delta_r[j] *= 0.5; - } -//-------------------------------------------------------- - - thrust=0.0; - torque=0.0; - -//Main Loop ------------------------------------------------------------- - for (j=0; j < NR; j++) - { - b[j]=0.01; - converged=0; - n_iter=1; - while (converged==0) - { - V2=omega*sprop_sec->r1[j]*(1-b[j]); - V0=V; -// - phi=atan2(V0,V2); -// - alpha=sprop_sec->setangle[j] + ang_offset-radtodeg*phi+alpha_corr; - rad = sprop_sec->r1[j]; -// get cl, cd from lookup table - isec = j+1; - get_clcd_(&isec,sprop_sec, &alpha, &cl, &cd) ; -// ...................................... - Vlocal=sqrt(V0*V0+V2*V2); - q = 0.5*rho*Vlocal*Vlocal; - s_mach = Vlocal/a0; - cl_corr_fac = 1.0; - if (s_mach > base_mach) - { - den = 1.0-s_mach*s_mach; - if (den > 0.0) cl_corr_fac = b_num / sqrt(den); - } -// ****************************** - cl *= cl_corr_fac ; -// ****************************** -// tip loss factor - r_dash = rad / r_tip+1.0e-5; - c_phi = cos(phi) ; - t_loss = 1.0; - if (r_dash > 0.90) - { - t_loss = (2.0/M_PI)*acos(exp(-(1.0*s_prop.nblades*(1-r_dash)/(r_dash*c_phi)))) ; - } - - DtDr[j]=q*s_prop.nblades*sprop_sec->chord[j]*(cl*cos(phi)-cd*sin(phi)); - DqDr=q*s_prop.nblades*sprop_sec->chord[j]*rad*(cd*cos(phi)+cl*sin(phi)); - - DtDr[j] *= t_loss; - DqDr *= t_loss; - - tem2=DqDr/(4.0*M_PI*rad*rad*rad*rho*V*omega); - bnew=0.6*b[j]+0.4*tem2; -// - if (bnew > 0.9) bnew = 0.9; - - if (fabs(bnew-b[j])<1.0e-5) - { - converged=1; - } - if (bnew<0.1) - b[j]=bnew; - n_iter++ ; - if (n_iter>BEM_MAX_ITER) - { - converged=1; - } - } // while loop - thrust=thrust+DtDr[j]*delta_r[j]; - torque=torque+DqDr*delta_r[j]; - Dtorq[j] = DqDr; - } // j loop -//End of Main Loop ------------------------------------------------------------- - - tem1 = rho*n*n*dia*dia*dia*dia; - tem2 = tem1*dia; - - - *Thrust=thrust; - *Torque=2.0*M_PI* torque; - *dp_av=2.0*M_PI* torque; - - for (j=0; j < NR; j++) - { - DtDr[j] /= (2.0*M_PI*sprop_sec->r1[j]) ; - Dtorq[j] = Dtorq[j]; - } - - if (rad_p < sprop_sec->r1[0]) - { - tem2 = sprop_sec->r1[0] - r_hub; - tem1 = (rad_p - r_hub)/tem2; - tem2 = 1.0 - tem1; - *dp_at_r = DtDr[0]*tem1; - *Torque = Dtorq[0]*tem1; - } - else - { - if (rad_p > r_tip) - { - *dp_at_r = 0.0; - *Torque = 0.0; - } - else - { - if (rad_p > sprop_sec->r1[NR-1]) - { - tem2 = r_tip - sprop_sec->r1[NR-1]; - tem1 = (rad_p - sprop_sec->r1[NR-1])/tem2 ; - tem2 = 1.0 - tem1; - *dp_at_r = DtDr[NR-1]*tem2; - *Torque = Dtorq[NR-1]*tem2; - } - else - { - for (j=0; j < NR-1; j++) - { - if ((sprop_sec->r1[j] < rad_p) && (sprop_sec->r1[j+1] >= rad_p)) - { - tem2 = sprop_sec->r1[j+1] - sprop_sec->r1[j]; - tem1 = (rad_p - sprop_sec->r1[j])/tem2 ; - tem2 = 1.0 - tem1; - *dp_at_r = DtDr[j]*tem2+DtDr[j+1]*tem1; - *Torque = Dtorq[j]*tem2+Dtorq[j+1]*tem1; - } - } - } - }// r > r_tip - } -//---------------------------------------------------------------------- -} -// } actuatordisk-bem - void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output) { @@ -3745,11 +3483,11 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con su2double Fan_Poly_Eff = config->GetFan_Poly_Eff(); su2double PolyCoeff = 1.0/(1.0-((Gamma-1.0)/Gamma)/Fan_Poly_Eff); - static su2double AD_Omega= 0.0; - static su2double AD_XCG= 0.0,AD_YCG=0.0,AD_ZCG=0.0; - static dpropeller_geom_struct s_prop; - static dpropeller_section_struct sprop_sec; - char section_prop_filename[1024]; + static su2double ADBem_Omega= 0.0; + static su2double ADBem_XCG= 0.0,ADBem_YCG=0.0,ADBem_ZCG=0.0; +//static dpropeller_geom_struct s_prop; +//static dpropeller_section_struct sprop_sec; +//char section_prop_filename[1024]; RefDensity = Density_Inf; RefArea = config->GetRefArea(); @@ -3758,6 +3496,7 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con Factor = (0.5*RefDensity*RefArea*RefVel2); Ref = config->GetDensity_Ref() * config->GetVelocity_Ref() * config->GetVelocity_Ref() * 1.0 * 1.0; + /*--- Blade element distribution is in input file. ---*/ if (Kind_ActDisk == BLADE_ELEMENT) { for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { @@ -3765,30 +3504,30 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { Marker_Tag = config->GetMarker_All_TagBound(iMarker); - AD_Omega = config->GetActDisk_Omega(Marker_Tag, 0); - AD_XCG = config->GetActDisk_XCG(Marker_Tag, 0); - AD_YCG = config->GetActDisk_YCG(Marker_Tag, 0); - AD_ZCG = config->GetActDisk_ZCG(Marker_Tag, 0); + ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); + ADBem_XCG = config->GetActDisk_XCG(Marker_Tag, 0); + ADBem_YCG = config->GetActDisk_YCG(Marker_Tag, 0); + ADBem_ZCG = config->GetActDisk_ZCG(Marker_Tag, 0); for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); //SetActDisk_DeltaP(iMarker, iVertex, DeltaP); //SetActDisk_DeltaT(iMarker, iVertex, DeltaT); - SetActDisk_RotRate(iMarker, iVertex, AD_Omega); - SetActDisk_XCG(iMarker, iVertex, AD_XCG); - SetActDisk_YCG(iMarker, iVertex, AD_YCG); - SetActDisk_ZCG(iMarker, iVertex, AD_ZCG); + SetActDisk_RotRate(iMarker, iVertex, ADBem_Omega); + SetActDisk_XCG(iMarker, iVertex, ADBem_XCG); + SetActDisk_YCG(iMarker, iVertex, ADBem_YCG); + SetActDisk_ZCG(iMarker, iVertex, ADBem_ZCG); } } } - if(InnerIter == 0) - { - strcpy(section_prop_filename,config->GetBEM_prop_filename().c_str()); - readsdata_(section_prop_filename,&s_prop,&sprop_sec); - } - /* Update the propeller load according to the modified flow field after every 40 inner iterations */ - if(InnerIter % 40 == 0){ - GenActDiskData_BEM_VLAD(geometry, solver_container, config, iMesh,s_prop,sprop_sec,Output); - } +// if (InnerIter == 0) { +// strcpy(section_prop_filename,config->GetBEM_prop_filename().c_str()); +// readsdata_(section_prop_filename,&s_prop,&sprop_sec); +// } +// /* Update the propeller load according to the modified flow field after every 40 inner iterations */ +// if (InnerIter % 40 == 0){ +// GenActDiskData_BEM_VLAD(geometry, solver_container, config, iMesh,s_prop,sprop_sec,Output); +// } + SetActDisk_BEM_VLAD(geometry, solver_container, config, iMesh, Output); } /*--- Variable load distribution is in input file. ---*/ @@ -4396,136 +4135,450 @@ void CEulerSolver::ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_c } } -void CEulerSolver::GenActDiskData_BEM_VLAD(CGeometry *geometry, CSolver **solver_container,CConfig *config, unsigned short iMesh, dpropeller_geom_struct s_prop, dpropeller_section_struct &sprop_sec, bool Output) { +void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, + CConfig *config, unsigned short iMesh, bool Output) { - unsigned short iDim, iMarker; + /*--- ReadActDiskBem_InputFile (InnerIter == 0) ---*/ + unsigned short iDim, iMarker; unsigned long iVertex, iPoint; string Marker_Tag; - su2double Omega_sw=0.0,Omega_RPM=0.0,Origin[3]={0.0},radius_[3]={0.0}; - static su2double omega_ref=0.0, Lref=0.0; - static su2double RPM=0.0,blade_angle=0.0,dia=0.0,/*r_hub=0.0,*/r_tip=0.0,rps=0.0,radius=0.0; - static su2double V=0.0,rho=0.0,T=0.0; - static su2double Thrust=0.0,Torque=0.0,dp_av=0.0,/*dp_av1=0.0,*/dp_at_r=0.0; - static su2double deltap_r[BEM_MAXR]={0.0}; - static su2double AD_Axis[MAXNDIM] = {0.0}, AD_J=0.0; - static su2double Target_Press_Jump=0.0, /*Target_Temp_Jump=0.0,*/Area=0.0,UnitNormal[3]={0.0},Vn=0.0; - static su2double Fa=0.0,Ft=0.0,Fr=0.0,Fx=0.0,Fy=0.0,Fz=0.0,/*dCt_v=0.0,*/dCp_v=0.0,dCr_v=0.0,rad_v=0.0; + int iSection, iAlpha; + static int ADBem_NBlade=0, ADBem_NSection=0, ADBem_NAlpha=0; + static su2double ADBem_Diameter=0.0, ADBem_HubRadius=0.0, ADBem_Angle75R=0.0; + static std::vector i_v, radius_v, chord_v, angle75r_v; + static std::vector > alpha_m, cl_m, cd_m; + //su2double r_ = 0.0, r[MAXNDIM] = {0.0}, + su2double /*ADBem_Center[MAXNDIM] = {0.0},*/ ADBem_Axis[MAXNDIM] = {0.0}, /*ADBem_Radius = 0.0,*/ ADBem_J = 0.0; + //const su2double *P = nullptr; + + /*--- GenActDiskData_BEM_VLAD (InnerIter == 40) ---*/ + const int BEM_MAX_ITER = 20; + su2double Omega_sw=0.0, Omega_RPM=0.0, Origin[3]={0.0}, radius_[3]={0.0}; + static su2double omega_ref=0.0, Lref=0.0; + static su2double RPM=0.0, blade_angle=0.0, dia=0.0, /*r_hub=0.0, */r_tip=0.0, rps=0.0, radius=0.0; + static su2double V=0.0, rho=0.0, T=0.0; + static su2double /*Thrust=0.0,*/ Torque=0.0, dp_av=0.0, /*dp_av1=0.0, */dp_at_r=0.0; + static std::vector DtDr; // su2double deltap_r[BEM_MAXR]={0.0}; + static su2double Target_Press_Jump=0.0, /*Target_Temp_Jump=0.0, */Area=0.0, UnitNormal[3]={0.0}, Vn=0.0; + static su2double Fa=0.0, Ft=0.0, Fr=0.0, Fx=0.0, Fy=0.0, Fz=0.0, /*dCt_v=0.0, */dCp_v=0.0, dCr_v=0.0, rad_v=0.0; su2double *V_domain=0, *Coord=0; static su2double loc_Torque = 0.0; static su2double loc_thrust = 0.0; - static su2double tot_area = 0.0,tot_tq = 0.0; - dia = s_prop.dia; - // r_hub = s_prop.rhub; - r_tip = 0.5*dia ; + static su2double tot_area = 0.0, tot_tq = 0.0; + unsigned long InnerIter = config->GetInnerIter(); su2double Dens_FreeStream = config->GetDensity_FreeStream(); const su2double *Vel_FreeStream = config->GetVelocity_FreeStream(); - su2double *Normal = new su2double[nDim]; - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || - (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - - //Read Swirl params - Omega_RPM = GetActDisk_RotRate(iMarker, iVertex); - Origin[0] = GetActDisk_CGX(iMarker, iVertex) ; - Origin[1] = GetActDisk_CGY(iMarker, iVertex) ; - Origin[2] = GetActDisk_CGZ(iMarker, iVertex) ; - - omega_ref= config->GetOmega_Ref(); - Lref = config->GetLength_Ref(); - Omega_sw = Omega_RPM*(PI_NUMBER/30.0)/(omega_ref);//Swirl rate - Origin[0] = Origin[0]/Lref; - Origin[1] = Origin[1]/Lref; - Origin[2] = Origin[2]/Lref; -//---------------------------------------------------------------------- - /*--- Compute the distance to the center of the rotor ---*/ - - geometry->vertex[iMarker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - - /*Current version works only when propeller axis is aligned to horizontal*/ - AD_Axis[0] = 1.0; - AD_Axis[1] = 0.0; - AD_Axis[2] = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - ActDisk_Axis(iMarker, iDim) = AD_Axis[iDim]; + /*--- Input file provides force coefficients distributions along disk radius. + Initialization necessary only at initial iteration. ---*/ +////.......function 'readsdata_' reads alpha, cl and cd values from the files........................ +////float readsdata_(char *sec_filename,propeller_geom_struct *s_prop, propeller_section_struct *sprop_sec) +//char* readsdata_(char *sec_filename,dpropeller_geom_struct *s_prop, dpropeller_section_struct *sprop_sec) +//{ +// int i,j,MAXRK,MAXALFK; +// char dummy[1024]; +// FILE *file_ang; +// int sect[BEM_MAXR]; +// char* fgets_r=0; +////.Read blade section data from file +// file_ang = fopen(sec_filename,"r"); +//// To be read from file +// fgets_r = fgets(dummy,120,file_ang); +//// Skip header +// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%d", &s_prop->nblades); +// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->dia); +// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->rhub); +// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->ang0_75); +////.Skip reading next line................................................. +// fgets_r = fgets(dummy,120,file_ang); +// fgets_r = fgets(dummy,120,file_ang); +// sscanf(dummy,"%d%d",&MAXRK,&MAXALFK); +// sprop_sec-> nrad = MAXRK; +// sprop_sec-> nalf = MAXALFK; +//// +// fgets_r = fgets(dummy,120,file_ang); +// for(i=0; i < MAXRK; i++) +// { +// fgets_r = fgets(dummy,120,file_ang); +// sscanf(dummy,"%d %lf %lf %lf",§[i],&sprop_sec->r1[i],&sprop_sec->chord[i],&sprop_sec->setangle[i]); +// } +////.Read computed alpha v/s cl and cd from the file +// for(i=0; i < MAXRK; i++) +// { +// fgets_r = fgets(dummy,128,file_ang); +// for(j=0; j < MAXALFK; j++) +// { +// fgets_r = fgets(dummy,128,file_ang); +// sscanf(dummy,"%lf %lf %lf",&sprop_sec->alf[j][i],&sprop_sec->cl_arr[j][i],&sprop_sec->cd_arr[j][i]); +// } +// } +// return fgets_r; +//} + if (InnerIter == 0) { + /*--- Get the file name that contains the propeller data. ---*/ + string ActDiskBem_filename = config->GetBEM_prop_filename(); + ifstream ActDiskBem_file; + + /*--- Open the file that contains the propeller data. ---*/ + ActDiskBem_file.open(ActDiskBem_filename.data(), ios::in); + + /*--- Error message if the propeller data input file fails to open. ---*/ + if (ActDiskBem_file.fail()) SU2_MPI::Error("Unable to open Actuator Disk BEM Input File", CURRENT_FUNCTION); + + string text_line_appo; + + getline (ActDiskBem_file, text_line_appo); + /*--- Read and assign the value of the number of propeller blades. ---*/ + getline (ActDiskBem_file, text_line_appo); + istringstream NBlade_value(text_line_appo); + NBlade_value >> ADBem_NBlade; + + /*--- Read and assign the value of the propeller diameter. ---*/ + getline (ActDiskBem_file, text_line_appo); + istringstream Diameter_value(text_line_appo); + Diameter_value >> ADBem_Diameter; + + /*--- Read and assign the value of the propeller hub radius. ---*/ + getline (ActDiskBem_file, text_line_appo); + istringstream HubR_value(text_line_appo); + HubR_value >> ADBem_HubRadius; + + /*--- Read and assign the value of the blade angle at 75% of R. ---*/ + getline (ActDiskBem_file, text_line_appo); + istringstream Angle75R_value(text_line_appo); + Angle75R_value >> ADBem_Angle75R; + + getline (ActDiskBem_file, text_line_appo); + /*--- Read and assign the value of the number of radial propeller blade sections and alphas for each. ---*/ + getline (ActDiskBem_file, text_line_appo); + istringstream NSection_NAlpha_value(text_line_appo); + NSection_NAlpha_value >> ADBem_NSection >> ADBem_NAlpha; + + /*--- Assign the vector dimensions. ---*/ + i_v.resize(ADBem_NSection, 0.0); + radius_v.resize(ADBem_NSection, 0.0); + chord_v.resize(ADBem_NSection, 0.0); + angle75r_v.resize(ADBem_NSection, 0.0); + + getline (ActDiskBem_file, text_line_appo); + /*--- Read and assign the values of the propeller blade section's id, radius, chord, angle75R. ---*/ + for (iSection = 0; iSection < ADBem_NSection; iSection++) { + getline (ActDiskBem_file, text_line_appo); + istringstream sectionStream(text_line_appo); + sectionStream >> i_v[iSection] >> radius_v[iSection] >> chord_v[iSection] >> angle75r_v[iSection]; + } + + /*--- Assign the matrix dimensions. ---*/ + alpha_m.resize(ADBem_NAlpha, std::vector(ADBem_NSection, 0.0)); + cl_m.resize(ADBem_NAlpha, std::vector(ADBem_NSection, 0.0)); + cd_m.resize(ADBem_NAlpha, std::vector(ADBem_NSection, 0.0)); + + /*--- Read and assign the values for each of the propeller blade section's alpha, cl, cd. ---*/ + for (iSection = 0; iSection < ADBem_NSection; iSection++) { + getline (ActDiskBem_file, text_line_appo); + for (iAlpha = 0; iAlpha < ADBem_NAlpha; iAlpha++) { + getline (ActDiskBem_file, text_line_appo); + istringstream alphaStream(text_line_appo); + alphaStream >> alpha_m[iAlpha][iSection] >> cl_m[iAlpha][iSection] >> cd_m[iAlpha][iSection]; } - Area = 0.0; - for (iDim = 0; iDim < nDim; iDim++) Area += Normal[iDim]*Normal[iDim]; - Area = sqrt (Area); + } + } - for (iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim]/Area; + /*--- Update the propeller load according to the modified flow field after every 40 inner iterations. ---*/ + if (InnerIter % 40 == 0) { + dia = ADBem_Diameter; + // r_hub = s_prop.rhub; + r_tip = 0.5 * dia ; - if (geometry->nodes->GetDomain(iPoint)) { - Coord = geometry->nodes->GetCoord(iPoint); - } + su2double Normal[MAXNDIM]; + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || + (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - radius = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - radius += (Coord[iDim]-Origin[iDim])*(Coord[iDim]-Origin[iDim]); - radius_[iDim] = (Coord[iDim]-Origin[iDim]); - } - radius = sqrt(radius); - /*--- Current solution at this boundary node and jumps values ---*/ - V_domain = nodes->GetPrimitive(iPoint); -//--------------------------------------------------------------- - if (abs(Omega_sw) > 1.0e-1) + /*--- Read Swirl params. ---*/ + Omega_RPM = GetActDisk_RotRate(iMarker, iVertex); + Origin[0] = GetActDisk_CGX(iMarker, iVertex); + Origin[1] = GetActDisk_CGY(iMarker, iVertex); + Origin[2] = GetActDisk_CGZ(iMarker, iVertex); + + omega_ref= config->GetOmega_Ref(); + Lref = config->GetLength_Ref(); + Omega_sw = Omega_RPM*(PI_NUMBER/30.0) / (omega_ref); // Swirl rate + Origin[0] = Origin[0]/Lref; + Origin[1] = Origin[1]/Lref; + Origin[2] = Origin[2]/Lref; + + /*--- Compute the distance to the center of the rotor ---*/ + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + for (iDim = 0; iDim < nDim; iDim++) { Normal[iDim] = -Normal[iDim]; } + + /*--- Current version works only when propeller axis is aligned to horizontal. ---*/ + ADBem_Axis[0] = 1.0; + ADBem_Axis[1] = 0.0; + ADBem_Axis[2] = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; + } + Area = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { Area += Normal[iDim]*Normal[iDim]; } + Area = sqrt (Area); + + for (iDim = 0; iDim < nDim; iDim++) { UnitNormal[iDim] = Normal[iDim]/Area; } + + if (geometry->nodes->GetDomain(iPoint)) { + Coord = geometry->nodes->GetCoord(iPoint); + } + + radius = 0.0; + for (iDim = 0; iDim < nDim; iDim++){ + radius += (Coord[iDim]-Origin[iDim])*(Coord[iDim]-Origin[iDim]); + radius_[iDim] = (Coord[iDim]-Origin[iDim]); + } + radius = sqrt(radius); + + /*--- Current solution at this boundary node and jumps values ---*/ + V_domain = nodes->GetPrimitive(iPoint); + + if (abs(Omega_sw) > 1.0e-1) { + Vn = 0.0; + for (iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim+1]*UnitNormal[iDim]; } + + RPM = abs(Omega_RPM); + rps = RPM/60.0; + ADBem_J = Vel_FreeStream[0]/(rps*dia); + rho = V_domain[nDim+2]; + T = V_domain[0]; + blade_angle = config->GetBEM_blade_angle(); + V = config->GetModVel_FreeStream(); + V = fabs(Vn); +// bem_model_noa(s_prop,&sprop_sec, // Propeller properties +// radius,V,RPM,rho,T,blade_angle, // Input +// deltap_r,&Thrust,&Torque,&dp_av,&dp_at_r); // Output +// void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *sprop_sec,su2double rad_p,su2double V, su2double RPM, su2double rho, su2double T, su2double blade_angle,su2double DtDr[], su2double *Thrust, su2double *Torque, su2double *dp_av,su2double *dp_at_r) + /*--- bem_model_noa(). ---*/ { - Vn = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim+1]*UnitNormal[iDim]; } - - RPM = abs(Omega_RPM); - rps = RPM/60.0; - AD_J = Vel_FreeStream[0]/(rps*dia); - rho = V_domain[nDim+2]; - T = V_domain[0]; - blade_angle = config->GetBEM_blade_angle(); - V = config->GetModVel_FreeStream(); - V = fabs(Vn); - bem_model_noa(s_prop,&sprop_sec, // Propeller properties - radius,V,RPM,rho,T,blade_angle, // Input - deltap_r,&Thrust,&Torque,&dp_av,&dp_at_r); // Output - - tot_area += Area; - loc_Torque += Torque*Area; - tot_tq += dp_av; - loc_thrust += dp_at_r*Area; - Target_Press_Jump = dp_at_r; - // Target_Temp_Jump = Target_Press_Jump/(rho*287.0); - - ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; - ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; - ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); - /* Non-dimensionalize the elemental load */ - //dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); - //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); - dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); - /* Force radial load to 0 as there is no information of radial load from BEM */ - dCr_v = 0.0; - rad_v = radius/r_tip; - //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ - // (pow(AD_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); - Fa = dp_at_r; - Ft = (dCp_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ - ((AD_J*PI_NUMBER*rad_v)*(AD_J*PI_NUMBER*rad_v))) / config->GetPressure_Ref(); - Fr = (dCr_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ - (pow(AD_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); - Fx = (Ft+Fr)*(radius_[0]/(radius)); - Fy = (Ft+Fr)*(radius_[2]/(radius)); - Fz = -(Ft+Fr)*(radius_[1]/(radius)); - ActDisk_Fa_BEM[iMarker][iVertex] = Fa; - ActDisk_Fx_BEM[iMarker][iVertex] = Fx; - ActDisk_Fy_BEM[iMarker][iVertex] = Fy; - ActDisk_Fz_BEM[iMarker][iVertex] = Fz; + DtDr.resize(ADBem_NSection, 0.0); + + int s_prop_nblades = ADBem_NBlade; + int sprop_sec_nalf = ADBem_NAlpha; + int sprop_sec_nrad = ADBem_NSection; + std::vector& sprop_sec_r1 = radius_v; + std::vector& sprop_sec_chord = chord_v; + std::vector& sprop_sec_setangle = angle75r_v; + std::vector >& sprop_sec_alf = alpha_m; + std::vector >& sprop_sec_cl_arr = cl_m; + std::vector >& sprop_sec_cd_arr = cd_m; + + su2double rad_p = radius; + + int j, isec,converged, n_iter; + int NR = sprop_sec_nrad; + su2double dia, r_hub, r_tip, alpha_corr, cl_corr_fac; + su2double base_mach, s_mach, b_num, thrust, torque; + su2double r_dash, t_loss, c_phi, rad, phi, alpha, radtodeg; + su2double bnew, V0, V2, cl=0.0, cd=0.0, Vlocal, DqDr, tem1, tem2, q; + std::vector delta_r(ADBem_NSection, 0.0); + std::vector b(ADBem_NSection, 0.0); + static std::vector Dtorq(ADBem_NSection, 0.0); + + su2double n, omega, a0, den; + su2double ang_offset = 0.0; + + radtodeg = 180.0/M_PI; + dia = ADBem_Diameter; // s_prop.dia; + r_hub = ADBem_HubRadius; // s_prop.rhub; + r_tip = 0.5*dia ; + ang_offset = blade_angle - ADBem_Angle75R; // s_prop.ang0_75; + + alpha_corr = 0.0; + base_mach = 0.22 ; + b_num = sqrt(1.0-base_mach*base_mach); + a0 = sqrt(1.4*287*T); + /*--- Change pitch by ang_offset and calculate delta_r for integration by trapezoidal rule. ---*/ + n = RPM / 60.0; + omega = n*2.0*M_PI; + + for (j=0; j < NR; j++) { + if (j < 1) { delta_r[j] = sprop_sec_r1[j+1] - r_hub; } + else { + if (j < NR-1) { delta_r[j] = sprop_sec_r1[j+1] - sprop_sec_r1[j-1]; } + else { delta_r[j] = r_tip - sprop_sec_r1[j-1]; } + } + delta_r[j] *= 0.5; + } + + thrust = 0.0; + torque = 0.0; + + for (j=0; j < NR; j++) { + b[j] = 0.01; + converged = 0; + n_iter = 1; + while (converged == 0) { + V2 = omega*sprop_sec_r1[j]*(1-b[j]); + V0 = V; + + phi=atan2(V0,V2); + + alpha=sprop_sec_setangle[j] + ang_offset-radtodeg*phi+alpha_corr; + rad = sprop_sec_r1[j]; + /*--- get cl, cd from lookup table. ---*/ + isec = j+1; +// get_clcd_(&isec,sprop_sec, &alpha, &cl, &cd) ; +// void get_clcd_(int *isec,dpropeller_section_struct *sprop_sec,su2double *alpha,su2double *cl,su2double *cd) + { + int i, salf=0; + su2double fact; + + /*--- interpolating values of cl and cd for given alpha. ---*/ + if ( alpha >= sprop_sec_alf[salf][isec-1] + && alpha <= sprop_sec_alf[sprop_sec_nalf-1][isec-1]) { + for(i=0; i < sprop_sec_nalf-1; i++) { + if (alpha>=sprop_sec_alf[i][isec-1] && alpha <= sprop_sec_alf[i+1][isec-1]) { + fact = (alpha-sprop_sec_alf[i][isec-1]) + / (sprop_sec_alf[i+1][isec-1]-sprop_sec_alf[i][isec-1]); + cl = sprop_sec_cl_arr[i][isec-1] + + fact * (sprop_sec_cl_arr[i+1][isec-1] - sprop_sec_cl_arr[i][isec-1]); + cd = sprop_sec_cd_arr[i][isec-1] + + fact * (sprop_sec_cd_arr[i+1][isec-1] - sprop_sec_cd_arr[i][isec-1]); + } + } + } else { + if (alpha < sprop_sec_alf[salf][isec-1]) { + cl = sprop_sec_cl_arr[0][isec-1]; + cd = sprop_sec_cd_arr[0][isec-1]; + } + if (alpha > sprop_sec_alf[sprop_sec_nalf-1][isec-1]) { + cl = sprop_sec_cl_arr[sprop_sec_nalf-1][isec-1]; + cd = sprop_sec_cd_arr[sprop_sec_nalf-1][isec-1]; + } + } + } + + Vlocal = sqrt(V0*V0 + V2*V2); + q = 0.5 * rho * Vlocal * Vlocal; + s_mach = Vlocal / a0; + cl_corr_fac = 1.0; + if (s_mach > base_mach) { + den = 1.0-s_mach*s_mach; + if (den > 0.0) cl_corr_fac = b_num / sqrt(den); + } + cl *= cl_corr_fac; + + /*--- tip loss factor. ---*/ + r_dash = rad / r_tip+1.0e-5; + c_phi = cos(phi) ; + t_loss = 1.0; + if (r_dash > 0.90) { + t_loss = (2.0/M_PI) * acos(exp(-(1.0*s_prop_nblades*(1-r_dash)/(r_dash*c_phi)))) ; + } + + DtDr[j] = q * s_prop_nblades * sprop_sec_chord[j] * (cl*cos(phi) - cd*sin(phi)); + DqDr = q * s_prop_nblades * sprop_sec_chord[j] * rad * (cd*cos(phi) + cl*sin(phi)); + + DtDr[j] *= t_loss; + DqDr *= t_loss; + + tem2 = DqDr / (4.0*M_PI * rad*rad*rad * rho * V * omega); + bnew = 0.6 * b[j] + 0.4 * tem2; + if (bnew > 0.9) bnew = 0.9; + if (fabs(bnew-b[j]) < 1.0e-5) { + converged = 1; + } + if (bnew < 0.1) { b[j]=bnew; } + n_iter++ ; + if (n_iter > BEM_MAX_ITER) { + converged=1; + } + } + thrust=thrust+DtDr[j]*delta_r[j]; + torque=torque+DqDr*delta_r[j]; + Dtorq[j] = DqDr; + } + + tem1 = rho*n*n*dia*dia*dia*dia; + tem2 = tem1*dia; + + //Thrust=thrust; + Torque=2.0*M_PI* torque; + dp_av=2.0*M_PI* torque; + + for (j=0; j < NR; j++) { + DtDr[j] /= (2.0*M_PI * sprop_sec_r1[j]) ; + Dtorq[j] = Dtorq[j]; + } + + if (rad_p < sprop_sec_r1[0]) { + tem2 = sprop_sec_r1[0] - r_hub; + tem1 = (rad_p - r_hub)/tem2; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[0]*tem1; + Torque = Dtorq[0]*tem1; + } else { + if (rad_p > r_tip) { + dp_at_r = 0.0; + Torque = 0.0; + } else { + if (rad_p > sprop_sec_r1[NR-1]) { + tem2 = r_tip - sprop_sec_r1[NR-1]; + tem1 = (rad_p - sprop_sec_r1[NR-1])/tem2 ; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[NR-1]*tem2; + Torque = Dtorq[NR-1]*tem2; + } else { + for (j=0; j < NR-1; j++) { + if ((sprop_sec_r1[j] < rad_p) && (sprop_sec_r1[j+1] >= rad_p)) { + tem2 = sprop_sec_r1[j+1] - sprop_sec_r1[j]; + tem1 = (rad_p - sprop_sec_r1[j])/tem2 ; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[j]*tem2+DtDr[j+1]*tem1; + Torque = Dtorq[j]*tem2+Dtorq[j+1]*tem1; + } + } + } + } + } } -//--------------------------------------------------------------- + + tot_area += Area; + loc_Torque += Torque*Area; + tot_tq += dp_av; + loc_thrust += dp_at_r*Area; + Target_Press_Jump = dp_at_r; + // Target_Temp_Jump = Target_Press_Jump/(rho*287.0); + + ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; + ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; + ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); + /*--- Non-dimensionalize the elemental load. ---*/ + //dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); + //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); + dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); + /*--- Force radial load to 0 as there is no information of radial load from BEM. ---*/ + dCr_v = 0.0; + rad_v = radius/r_tip; + //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + // (pow(ADBem_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); + Fa = dp_at_r; + Ft = (dCp_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + ((ADBem_J*PI_NUMBER*rad_v)*(ADBem_J*PI_NUMBER*rad_v))) / config->GetPressure_Ref(); + Fr = (dCr_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ + (pow(ADBem_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); + Fx = (Ft+Fr)*(radius_[0]/(radius)); + Fy = (Ft+Fr)*(radius_[2]/(radius)); + Fz = -(Ft+Fr)*(radius_[1]/(radius)); + ActDisk_Fa_BEM[iMarker][iVertex] = Fa; + ActDisk_Fx_BEM[iMarker][iVertex] = Fx; + ActDisk_Fy_BEM[iMarker][iVertex] = Fy; + ActDisk_Fz_BEM[iMarker][iVertex] = Fz; + } + } } } - } - delete [] Normal; + } } void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, From 35afe87de509cf7e5e0988190782011a9d8c39e5 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 13 Oct 2023 11:31:17 +0530 Subject: [PATCH 21/42] bem reorg cleanup --- SU2_CFD/include/solvers/CEulerSolver.hpp | 1 - SU2_CFD/src/solvers/CEulerSolver.cpp | 84 ++++-------------------- 2 files changed, 14 insertions(+), 71 deletions(-) diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 373bc79ff38..d8eb4da36dd 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -29,7 +29,6 @@ #include "CFVMFlowSolverBase.hpp" #include "../variables/CEulerVariable.hpp" -//#include "prop_defs.hpp" /*! * \class CEulerSolver diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index e529d40a529..a9b474ab832 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -4138,7 +4138,7 @@ void CEulerSolver::ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_c void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, CConfig *config, unsigned short iMesh, bool Output) { - /*--- ReadActDiskBem_InputFile (InnerIter == 0) ---*/ + /*--- InputFile reading ---*/ unsigned short iDim, iMarker; unsigned long iVertex, iPoint; string Marker_Tag; @@ -4147,20 +4147,18 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con static su2double ADBem_Diameter=0.0, ADBem_HubRadius=0.0, ADBem_Angle75R=0.0; static std::vector i_v, radius_v, chord_v, angle75r_v; static std::vector > alpha_m, cl_m, cd_m; - //su2double r_ = 0.0, r[MAXNDIM] = {0.0}, - su2double /*ADBem_Center[MAXNDIM] = {0.0},*/ ADBem_Axis[MAXNDIM] = {0.0}, /*ADBem_Radius = 0.0,*/ ADBem_J = 0.0; - //const su2double *P = nullptr; + su2double ADBem_Axis[MAXNDIM] = {0.0}, ADBem_J = 0.0; - /*--- GenActDiskData_BEM_VLAD (InnerIter == 40) ---*/ + /*--- BEM VLAD ---*/ const int BEM_MAX_ITER = 20; su2double Omega_sw=0.0, Omega_RPM=0.0, Origin[3]={0.0}, radius_[3]={0.0}; static su2double omega_ref=0.0, Lref=0.0; - static su2double RPM=0.0, blade_angle=0.0, dia=0.0, /*r_hub=0.0, */r_tip=0.0, rps=0.0, radius=0.0; + static su2double RPM=0.0, blade_angle=0.0, dia=0.0, r_tip=0.0, rps=0.0, radius=0.0; static su2double V=0.0, rho=0.0, T=0.0; - static su2double /*Thrust=0.0,*/ Torque=0.0, dp_av=0.0, /*dp_av1=0.0, */dp_at_r=0.0; - static std::vector DtDr; // su2double deltap_r[BEM_MAXR]={0.0}; - static su2double Target_Press_Jump=0.0, /*Target_Temp_Jump=0.0, */Area=0.0, UnitNormal[3]={0.0}, Vn=0.0; - static su2double Fa=0.0, Ft=0.0, Fr=0.0, Fx=0.0, Fy=0.0, Fz=0.0, /*dCt_v=0.0, */dCp_v=0.0, dCr_v=0.0, rad_v=0.0; + static su2double Torque=0.0, dp_av=0.0, dp_at_r=0.0; + static std::vector DtDr; + static su2double Target_Press_Jump=0.0, Area=0.0, UnitNormal[3]={0.0}, Vn=0.0; + static su2double Fa=0.0, Ft=0.0, Fr=0.0, Fx=0.0, Fy=0.0, Fz=0.0, dCp_v=0.0, dCr_v=0.0, rad_v=0.0; su2double *V_domain=0, *Coord=0; static su2double loc_Torque = 0.0; static su2double loc_thrust = 0.0; @@ -4172,49 +4170,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- Input file provides force coefficients distributions along disk radius. Initialization necessary only at initial iteration. ---*/ -////.......function 'readsdata_' reads alpha, cl and cd values from the files........................ -////float readsdata_(char *sec_filename,propeller_geom_struct *s_prop, propeller_section_struct *sprop_sec) -//char* readsdata_(char *sec_filename,dpropeller_geom_struct *s_prop, dpropeller_section_struct *sprop_sec) -//{ -// int i,j,MAXRK,MAXALFK; -// char dummy[1024]; -// FILE *file_ang; -// int sect[BEM_MAXR]; -// char* fgets_r=0; -////.Read blade section data from file -// file_ang = fopen(sec_filename,"r"); -//// To be read from file -// fgets_r = fgets(dummy,120,file_ang); -//// Skip header -// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%d", &s_prop->nblades); -// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->dia); -// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->rhub); -// fgets_r = fgets(dummy,120,file_ang); sscanf(dummy,"%lf", &s_prop->ang0_75); -////.Skip reading next line................................................. -// fgets_r = fgets(dummy,120,file_ang); -// fgets_r = fgets(dummy,120,file_ang); -// sscanf(dummy,"%d%d",&MAXRK,&MAXALFK); -// sprop_sec-> nrad = MAXRK; -// sprop_sec-> nalf = MAXALFK; -//// -// fgets_r = fgets(dummy,120,file_ang); -// for(i=0; i < MAXRK; i++) -// { -// fgets_r = fgets(dummy,120,file_ang); -// sscanf(dummy,"%d %lf %lf %lf",§[i],&sprop_sec->r1[i],&sprop_sec->chord[i],&sprop_sec->setangle[i]); -// } -////.Read computed alpha v/s cl and cd from the file -// for(i=0; i < MAXRK; i++) -// { -// fgets_r = fgets(dummy,128,file_ang); -// for(j=0; j < MAXALFK; j++) -// { -// fgets_r = fgets(dummy,128,file_ang); -// sscanf(dummy,"%lf %lf %lf",&sprop_sec->alf[j][i],&sprop_sec->cl_arr[j][i],&sprop_sec->cd_arr[j][i]); -// } -// } -// return fgets_r; -//} if (InnerIter == 0) { /*--- Get the file name that contains the propeller data. ---*/ string ActDiskBem_filename = config->GetBEM_prop_filename(); @@ -4288,7 +4243,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- Update the propeller load according to the modified flow field after every 40 inner iterations. ---*/ if (InnerIter % 40 == 0) { dia = ADBem_Diameter; - // r_hub = s_prop.rhub; r_tip = 0.5 * dia ; su2double Normal[MAXNDIM]; @@ -4354,11 +4308,8 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con blade_angle = config->GetBEM_blade_angle(); V = config->GetModVel_FreeStream(); V = fabs(Vn); -// bem_model_noa(s_prop,&sprop_sec, // Propeller properties -// radius,V,RPM,rho,T,blade_angle, // Input -// deltap_r,&Thrust,&Torque,&dp_av,&dp_at_r); // Output -// void bem_model_noa(dpropeller_geom_struct s_prop,dpropeller_section_struct *sprop_sec,su2double rad_p,su2double V, su2double RPM, su2double rho, su2double T, su2double blade_angle,su2double DtDr[], su2double *Thrust, su2double *Torque, su2double *dp_av,su2double *dp_at_r) - /*--- bem_model_noa(). ---*/ + + /*--- BEM model without parameter 'a' (ref?) ---*/ { DtDr.resize(ADBem_NSection, 0.0); @@ -4388,10 +4339,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double ang_offset = 0.0; radtodeg = 180.0/M_PI; - dia = ADBem_Diameter; // s_prop.dia; - r_hub = ADBem_HubRadius; // s_prop.rhub; + dia = ADBem_Diameter; + r_hub = ADBem_HubRadius; r_tip = 0.5*dia ; - ang_offset = blade_angle - ADBem_Angle75R; // s_prop.ang0_75; + ang_offset = blade_angle - ADBem_Angle75R; alpha_corr = 0.0; base_mach = 0.22 ; @@ -4425,10 +4376,9 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con alpha=sprop_sec_setangle[j] + ang_offset-radtodeg*phi+alpha_corr; rad = sprop_sec_r1[j]; + /*--- get cl, cd from lookup table. ---*/ isec = j+1; -// get_clcd_(&isec,sprop_sec, &alpha, &cl, &cd) ; -// void get_clcd_(int *isec,dpropeller_section_struct *sprop_sec,su2double *alpha,su2double *cl,su2double *cd) { int i, salf=0; su2double fact; @@ -4502,7 +4452,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con tem1 = rho*n*n*dia*dia*dia*dia; tem2 = tem1*dia; - //Thrust=thrust; Torque=2.0*M_PI* torque; dp_av=2.0*M_PI* torque; @@ -4548,20 +4497,15 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con tot_tq += dp_av; loc_thrust += dp_at_r*Area; Target_Press_Jump = dp_at_r; - // Target_Temp_Jump = Target_Press_Jump/(rho*287.0); ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); /*--- Non-dimensionalize the elemental load. ---*/ - //dCt_v = dp_at_r*(r_tip/(rho*rps*rps*pow(dia,4))); - //dCp_v = Torque*((2*M_PI*r_tip)/(rho*rps*rps*pow(dia,5))); dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); /*--- Force radial load to 0 as there is no information of radial load from BEM. ---*/ dCr_v = 0.0; rad_v = radius/r_tip; - //Fa = (dCt_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ - // (pow(ADBem_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); Fa = dp_at_r; Ft = (dCp_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ ((ADBem_J*PI_NUMBER*rad_v)*(ADBem_J*PI_NUMBER*rad_v))) / config->GetPressure_Ref(); From 9ef05a7b550e10c738f4114052708e3c3a375293 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 13 Oct 2023 12:22:13 +0530 Subject: [PATCH 22/42] cleanup based on review and reorg --- Common/include/option_structure.inl | 94 ------------------- SU2_CFD/src/solvers/CEulerSolver.cpp | 12 +-- .../actuatordisk_bem/actuatordisk_bem.cfg | 6 +- 3 files changed, 3 insertions(+), 109 deletions(-) diff --git a/Common/include/option_structure.inl b/Common/include/option_structure.inl index 12c7340aafc..ce94055fca5 100644 --- a/Common/include/option_structure.inl +++ b/Common/include/option_structure.inl @@ -1772,100 +1772,6 @@ class COptionActDisk : public COptionBase { } }; -class COptionActDiskCentroid : public COptionBase { - 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 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]; - this->marker_outlet = new string[this->outlet_size]; - - 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; diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index a9b474ab832..935b5414d0e 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -3519,14 +3519,6 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con } } } -// if (InnerIter == 0) { -// strcpy(section_prop_filename,config->GetBEM_prop_filename().c_str()); -// readsdata_(section_prop_filename,&s_prop,&sprop_sec); -// } -// /* Update the propeller load according to the modified flow field after every 40 inner iterations */ -// if (InnerIter % 40 == 0){ -// GenActDiskData_BEM_VLAD(geometry, solver_container, config, iMesh,s_prop,sprop_sec,Output); -// } SetActDisk_BEM_VLAD(geometry, solver_container, config, iMesh, Output); } @@ -8821,7 +8813,7 @@ void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con * Cl, Cd of propeller sections need to be generated earlier and saved in this file * Actuator disk data initialized in function SetActDisk_BCThrust. * Propeller load calculated with Blade Element Method - * Interpolated load at each point on the actuator disk is set in GenActDiskData_BEM_VLAD function + * Interpolated load at each point on the actuator disk is set in SetActDisk_BEM_VLAD function * Rest calculations follows the Variable Load (BC_ActDisk_VariableLoad) approach * */ @@ -8845,7 +8837,7 @@ void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); const auto Gas_Constant = config->GetGas_ConstantND(); - const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST);// || (config->GetKind_Turb_Model() == TURB_MODEL::SST_SUST); + const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); /*--- Get the actuator disk center and axis coordinates for the current marker. ---*/ for (iDim = 0; iDim < nDim; iDim++){ diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index 09e594e32a6..d64dba58ff4 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -13,13 +13,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %----------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION -------------------------% -% Solver type (EULER, NAVIER_STOKES, RANS, -% INC_EULER, INC_NAVIER_STOKES, INC_RANS -% FEM_EULER, FEM_NAVIER_STOKES, FEM_RANS, FEM_LES, -% HEAT_EQUATION_FVM, ELASTICITY) SOLVER= RANS % -% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP, SST_SUST) +% Specify turbulence model (NONE, SA, SST) KIND_TURB_MODEL= SA % % Turbulence intensity at freestream From 6f3b45ea4c43bf676853e873ba9c115a19077a33 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Mon, 16 Oct 2023 16:18:53 +0530 Subject: [PATCH 23/42] combined ActDisk_{X,Y,Z}CG into ActDisk_CG[3] --- Common/include/CConfig.hpp | 28 +++++---- Common/src/CConfig.cpp | 12 +++- SU2_CFD/include/solvers/CEulerSolver.hpp | 66 ++++++++++---------- SU2_CFD/src/solvers/CEulerSolver.cpp | 76 ++++++++++++------------ externals/codi | 2 +- 5 files changed, 101 insertions(+), 83 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 5bb9daa5d3f..ea147f2f64d 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -348,7 +348,8 @@ class CConfig { 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_XCG, **ActDisk_YCG, **ActDisk_ZCG; /*!< \brief Specified CG for actuator disk.*/ + su2double **ActDisk_CG[3]; /*!< \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.*/ @@ -6656,20 +6657,25 @@ 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 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 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 ZCG of the actuator disk. + * \brief Get the CG of the actuator disk. */ - su2double GetActDisk_ZCG(string val_marker, unsigned short val_index) const; + su2double GetActDisk_CG(unsigned short iDim, string val_marker, unsigned short val_index) const; + /*! * \brief Get the blade angle of the propeller. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index aff893ada9b..738a215abd1 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1529,7 +1529,8 @@ void CConfig::SetConfig_Options() { /*!\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); +// ActDisk_XCG, ActDisk_YCG, ActDisk_ZCG); + ActDisk_CG[0], ActDisk_CG[1], ActDisk_CG[2]); /*!\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")); @@ -8694,6 +8695,7 @@ 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++) @@ -8717,6 +8719,14 @@ su2double CConfig::GetActDisk_ZCG(string val_marker, unsigned short val_value) c (Marker_ActDiskOutlet[iMarker_ActDisk] == val_marker)) break; return ActDisk_ZCG[iMarker_ActDisk][val_value]; } +*/ +su2double CConfig::GetActDisk_CG(unsigned short iDim, 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_CG[iDim][iMarker_ActDisk][val_value]; +} su2double CConfig::GetActDisk_TempJump(const string& val_marker, unsigned short val_value) const { unsigned short iMarker_ActDisk; diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index d8eb4da36dd..b09243cd0e1 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -69,9 +69,9 @@ class CEulerSolver : public CFVMFlowSolverBase > ActDisk_Thrust_r; /*!< \brief Value of the Delta P. */ vector > ActDisk_Torque_r; /*!< \brief Value of the Delta P. */ vector > ActDisk_RotRate; /*!< \brief Value of the Rotation Rate. */ - vector > ActDisk_XCG; - vector > ActDisk_YCG; - vector > ActDisk_ZCG; +//vector > ActDisk_XCG; +//vector > ActDisk_YCG; +//vector > ActDisk_ZCG; vector > ActDisk_DeltaT; /*!< \brief Value of the Delta T. */ su2activevector @@ -1037,36 +1037,36 @@ class CEulerSolver : public CFVMFlowSolverBaseGetFan_Poly_Eff(); su2double PolyCoeff = 1.0/(1.0-((Gamma-1.0)/Gamma)/Fan_Poly_Eff); - static su2double ADBem_Omega= 0.0; - static su2double ADBem_XCG= 0.0,ADBem_YCG=0.0,ADBem_ZCG=0.0; -//static dpropeller_geom_struct s_prop; -//static dpropeller_section_struct sprop_sec; -//char section_prop_filename[1024]; - RefDensity = Density_Inf; RefArea = config->GetRefArea(); RefVel2 = 0.0; for (iDim = 0; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim]*Velocity_Inf[iDim]; @@ -3498,27 +3492,6 @@ void CEulerSolver::SetActDisk_BCThrust(CGeometry *geometry, CSolver **solver_con /*--- Blade element distribution is in input file. ---*/ if (Kind_ActDisk == BLADE_ELEMENT) { - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - - if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || - (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - - Marker_Tag = config->GetMarker_All_TagBound(iMarker); - ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); - ADBem_XCG = config->GetActDisk_XCG(Marker_Tag, 0); - ADBem_YCG = config->GetActDisk_YCG(Marker_Tag, 0); - ADBem_ZCG = config->GetActDisk_ZCG(Marker_Tag, 0); - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - //SetActDisk_DeltaP(iMarker, iVertex, DeltaP); - //SetActDisk_DeltaT(iMarker, iVertex, DeltaT); - SetActDisk_RotRate(iMarker, iVertex, ADBem_Omega); - SetActDisk_XCG(iMarker, iVertex, ADBem_XCG); - SetActDisk_YCG(iMarker, iVertex, ADBem_YCG); - SetActDisk_ZCG(iMarker, iVertex, ADBem_ZCG); - } - } - } SetActDisk_BEM_VLAD(geometry, solver_container, config, iMesh, Output); } @@ -4141,6 +4114,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con static std::vector > alpha_m, cl_m, cd_m; su2double ADBem_Axis[MAXNDIM] = {0.0}, ADBem_J = 0.0; + static su2double ADBem_Omega= 0.0; +//static su2double ADBem_XCG= 0.0, ADBem_YCG=0.0, ADBem_ZCG=0.0; + static su2double ADBem_CG[MAXNDIM] = {0.0, 0.0, 0.0}; + /*--- BEM VLAD ---*/ const int BEM_MAX_ITER = 20; su2double Omega_sw=0.0, Omega_RPM=0.0, Origin[3]={0.0}, radius_[3]={0.0}; @@ -4160,6 +4137,31 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double Dens_FreeStream = config->GetDensity_FreeStream(); const su2double *Vel_FreeStream = config->GetVelocity_FreeStream(); + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + + if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || + (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { + + Marker_Tag = config->GetMarker_All_TagBound(iMarker); + ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); + //ADBem_XCG = config->GetActDisk_XCG(Marker_Tag, 0); + //ADBem_YCG = config->GetActDisk_YCG(Marker_Tag, 0); + //ADBem_ZCG = config->GetActDisk_ZCG(Marker_Tag, 0); + for (iDim=0; iDim < nDim; iDim++){ + ADBem_CG[iDim] = config->GetActDisk_CG(iDim, Marker_Tag, 0); + } + /* + for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + SetActDisk_RotRate(iMarker, iVertex, ADBem_Omega); + SetActDisk_XCG(iMarker, iVertex, ADBem_XCG); + SetActDisk_YCG(iMarker, iVertex, ADBem_YCG); + SetActDisk_ZCG(iMarker, iVertex, ADBem_ZCG); + } + */ + } + } + /*--- Input file provides force coefficients distributions along disk radius. Initialization necessary only at initial iteration. ---*/ if (InnerIter == 0) { @@ -4245,10 +4247,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); /*--- Read Swirl params. ---*/ - Omega_RPM = GetActDisk_RotRate(iMarker, iVertex); - Origin[0] = GetActDisk_CGX(iMarker, iVertex); - Origin[1] = GetActDisk_CGY(iMarker, iVertex); - Origin[2] = GetActDisk_CGZ(iMarker, iVertex); + Omega_RPM = ADBem_Omega; // GetActDisk_RotRate(iMarker, iVertex); + Origin[0] = ADBem_CG[0]; // GetActDisk_CGX(iMarker, iVertex); + Origin[1] = ADBem_CG[1]; // GetActDisk_CGY(iMarker, iVertex); + Origin[2] = ADBem_CG[2]; // GetActDisk_CGZ(iMarker, iVertex); omega_ref= config->GetOmega_Ref(); Lref = config->GetLength_Ref(); @@ -4319,10 +4321,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con int j, isec,converged, n_iter; int NR = sprop_sec_nrad; - su2double dia, r_hub, r_tip, alpha_corr, cl_corr_fac; + su2double r_hub, alpha_corr, cl_corr_fac; su2double base_mach, s_mach, b_num, thrust, torque; su2double r_dash, t_loss, c_phi, rad, phi, alpha, radtodeg; - su2double bnew, V0, V2, cl=0.0, cd=0.0, Vlocal, DqDr, tem1, tem2, q; + su2double bnew, V0, V2, cl=0.0, cd=0.0, Vlocal, DqDr=0.0, tem1, tem2, q; std::vector delta_r(ADBem_NSection, 0.0); std::vector b(ADBem_NSection, 0.0); static std::vector Dtorq(ADBem_NSection, 0.0); diff --git a/externals/codi b/externals/codi index eee1b5eea2d..8ee822a9b0b 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2 +Subproject commit 8ee822a9b0bb8235a2494467b774e27fb64ff14f From 5b678067ec9f660e7d08b278da8b0e244510efb6 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Mon, 16 Oct 2023 21:30:45 +0530 Subject: [PATCH 24/42] ActDisk_CG cleanup --- Common/include/CConfig.hpp | 16 ---------------- Common/src/CConfig.cpp | 26 -------------------------- SU2_CFD/src/solvers/CEulerSolver.cpp | 4 ---- 3 files changed, 46 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index ea147f2f64d..74fc04d6f7a 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -348,7 +348,6 @@ class CConfig { 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_CG[3]; /*!< \brief Specified CG for actuator disk.*/ su2double **ActDisk_RotRate; /*!< \brief Value of the Rotation Rate.*/ su2double BEM_blade_angle ; /*!< \brief Propeller blade angle.*/ @@ -6657,26 +6656,11 @@ 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 CG of the actuator disk. */ su2double GetActDisk_CG(unsigned short iDim, string val_marker, unsigned short val_index) const; - /*! * \brief Get the blade angle of the propeller. */ diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 738a215abd1..b8489f1ff23 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1529,7 +1529,6 @@ void CConfig::SetConfig_Options() { /*!\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); ActDisk_CG[0], ActDisk_CG[1], ActDisk_CG[2]); /*!\brief ACTDISK_FILENAME \n DESCRIPTION: Input file for a specified actuator disk (w/ extension) \n DEFAULT: actdiskinput.dat \ingroup Config*/ @@ -8695,31 +8694,6 @@ 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 { - 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_CG(unsigned short iDim, string val_marker, unsigned short val_value) const { unsigned short iMarker_ActDisk; for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskInlet; iMarker_ActDisk++) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 8dbfd602130..829af2fe572 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -4115,7 +4115,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double ADBem_Axis[MAXNDIM] = {0.0}, ADBem_J = 0.0; static su2double ADBem_Omega= 0.0; -//static su2double ADBem_XCG= 0.0, ADBem_YCG=0.0, ADBem_ZCG=0.0; static su2double ADBem_CG[MAXNDIM] = {0.0, 0.0, 0.0}; /*--- BEM VLAD ---*/ @@ -4144,9 +4143,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con Marker_Tag = config->GetMarker_All_TagBound(iMarker); ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); - //ADBem_XCG = config->GetActDisk_XCG(Marker_Tag, 0); - //ADBem_YCG = config->GetActDisk_YCG(Marker_Tag, 0); - //ADBem_ZCG = config->GetActDisk_ZCG(Marker_Tag, 0); for (iDim=0; iDim < nDim; iDim++){ ADBem_CG[iDim] = config->GetActDisk_CG(iDim, Marker_Tag, 0); } From 3b49e16b762c5c4f9d8fd328d587a9edf8dfe191 Mon Sep 17 00:00:00 2001 From: Y Chandukrishna Date: Wed, 18 Oct 2023 23:06:27 +0530 Subject: [PATCH 25/42] ActDisk axis, BEM minimal code --- Common/include/CConfig.hpp | 6 + Common/src/CConfig.cpp | 13 + SU2_CFD/include/solvers/CEulerSolver.hpp | 38 +- SU2_CFD/src/solvers/CEulerSolver.cpp | 516 +++++++++--------- .../actuatordisk_bem/actuatordisk_bem.cfg | 5 + 5 files changed, 307 insertions(+), 271 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index 74fc04d6f7a..a4cd84b7a48 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -349,6 +349,7 @@ class CConfig { su2double **ActDisk_PressJump, **ActDisk_TempJump, **ActDisk_Omega; /*!< \brief Specified deltas for actuator disk.*/ su2double **ActDisk_CG[3]; /*!< \brief Specified CG for actuator disk.*/ + su2double **ActDisk_Axis_BEM[3]; /*!< \brief Specified axis 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.*/ @@ -6661,6 +6662,11 @@ class CConfig { */ su2double GetActDisk_CG(unsigned short iDim, string val_marker, unsigned short val_index) const; + /*! + * \brief Get the axis of the actuator disk with Blade Element Method. + */ + su2double GetActDisk_Axis_BEM(unsigned short iDim, string val_marker, unsigned short val_index) const; + /*! * \brief Get the blade angle of the propeller. */ diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index b8489f1ff23..d23546dbc69 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1531,6 +1531,11 @@ void CConfig::SetConfig_Options() { nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet, ActDisk_CG[0], ActDisk_CG[1], ActDisk_CG[2]); + /*!\brief MARKER_ACTDISK_CG\n DESCRIPTION: Actuator disk axis for blade element momentum (BEM) method. \ingroup Config*/ + addActDiskOption("MARKER_ACTDISK_AXIS", + nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet, + ActDisk_Axis_BEM[0], ActDisk_Axis_BEM[1], ActDisk_Axis_BEM[2]); + /*!\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")); @@ -8702,6 +8707,14 @@ su2double CConfig::GetActDisk_CG(unsigned short iDim, string val_marker, unsigne return ActDisk_CG[iDim][iMarker_ActDisk][val_value]; } +su2double CConfig::GetActDisk_Axis_BEM(unsigned short iDim, 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_Axis_BEM[iDim][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++) diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index b09243cd0e1..c6397f3e0ab 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -546,25 +546,25 @@ class CEulerSolver : public CFVMFlowSolverBasevertex[iMarker][iVertex]->GetNormal(Normal); for (iDim = 0; iDim < nDim; iDim++) { Normal[iDim] = -Normal[iDim]; } - /*--- Current version works only when propeller axis is aligned to horizontal. ---*/ - ADBem_Axis[0] = 1.0; - ADBem_Axis[1] = 0.0; - ADBem_Axis[2] = 0.0; + /*--- Get propeller axis from config file. ---*/ + //ADBem_Axis[0] = 1.0; + //ADBem_Axis[1] = 0.0; + //ADBem_Axis[2] = 0.0; + for (iDim=0; iDim < nDim; iDim++){ + ADBem_Axis[iDim] = config->GetActDisk_Axis_BEM(iDim, Marker_Tag, 0); + } for (iDim = 0; iDim < nDim; iDim++){ ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; } @@ -8121,12 +8124,12 @@ void CEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_contai unsigned short Kind_ActDisk = config->GetKind_ActDisk(); - if(Kind_ActDisk == VARIABLE_LOAD){ + if(Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT){ BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } - else if(Kind_ActDisk == BLADE_ELEMENT){ - BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); - } + //else if(Kind_ActDisk == BLADE_ELEMENT){ + // BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); + //} else{ BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } @@ -8138,12 +8141,12 @@ void CEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_conta unsigned short Kind_ActDisk = config->GetKind_ActDisk(); - if(Kind_ActDisk == VARIABLE_LOAD){ + if(Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT){ BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } - else if(Kind_ActDisk == BLADE_ELEMENT){ - BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); - } + //else if(Kind_ActDisk == BLADE_ELEMENT){ + // BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); + //} else{ BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } @@ -8599,6 +8602,8 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver const auto Gas_Constant = config->GetGas_ConstantND(); const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); + unsigned short Kind_ActDisk = config->GetKind_ActDisk(); + /*--- Get the actuator disk center and axis coordinates for the current marker. ---*/ for (iDim = 0; iDim < nDim; iDim++){ Prop_Axis[iDim] = ActDisk_Axis(val_marker, iDim); @@ -8633,10 +8638,17 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver /*--- Get the values of Fa (axial force per unit area), Fx, Fy and Fz (x, y and z components of the tangential and radial forces per unit area resultant). ---*/ - Fa = ActDisk_Fa[val_marker][iVertex]; - Fx = ActDisk_Fx[val_marker][iVertex]; - Fy = ActDisk_Fy[val_marker][iVertex]; - Fz = ActDisk_Fz[val_marker][iVertex]; + if (Kind_ActDisk == BLADE_ELEMENT) { + Fa = ActDisk_Fa_BEM[val_marker][iVertex]; + Fx = ActDisk_Fx_BEM[val_marker][iVertex]; + Fy = ActDisk_Fy_BEM[val_marker][iVertex]; + Fz = ActDisk_Fz_BEM[val_marker][iVertex]; + } else { /*--- default (Kind_ActDisk == VARIABLE_LOAD) ---*/ + Fa = ActDisk_Fa[val_marker][iVertex]; + Fx = ActDisk_Fx[val_marker][iVertex]; + Fy = ActDisk_Fy[val_marker][iVertex]; + Fz = ActDisk_Fz[val_marker][iVertex]; + } /*--- Get the primitive variables and the extrapolated variables. ---*/ if (val_inlet_surface){ @@ -8793,242 +8805,242 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver END_SU2_OMP_FOR } -void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, - CConfig *config, unsigned short val_marker, bool val_inlet_surface) { - - /*! - * \function BC_ActDisk_BEM_VLAD - * \brief Actuator disk model with Blade Element Method (BEM) - * \author: Chandukrishna Y., T. N. Venkatesh and Josy Pullockara - * Institution: Computational and Theoretical Fluid Dynamics (CTFD), - * CSIR - National Aerospace Laboratories, Bangalore - * Academy of Scientific and Innovative Research, Ghaziabad - * \version 8.0.0 "Harrier" - * First release date : September 26 2023 - * modified on: - * - * Section properties of the propeller given in an input file. - * Cl, Cd of propeller sections need to be generated earlier and saved in this file - * Actuator disk data initialized in function SetActDisk_BCThrust. - * Propeller load calculated with Blade Element Method - * Interpolated load at each point on the actuator disk is set in SetActDisk_BEM_VLAD function - * Rest calculations follows the Variable Load (BC_ActDisk_VariableLoad) approach - * - */ - - unsigned short iDim; - unsigned long iVertex, iPoint, GlobalIndex_donor, GlobalIndex; - su2double Pressure, Velocity[MAXNDIM], - Velocity2, Entropy, Density, Energy, Riemann, Vn, SoundSpeed, Vn_Inlet, - Area, UnitNormal[MAXNDIM] = {0.0}, *V_outlet, *V_domain, *V_inlet; - - su2double Pressure_out, Density_out, - Pressure_in, Density_in; - - su2double Prop_Axis[MAXNDIM]; - su2double Fa, Fx, Fy, Fz; - su2double u_in, v_in, w_in, u_out, v_out, w_out, uJ, vJ, wJ; - su2double Temperature_out, H_in, H_out; - su2double FQ, Q_out, Density_Disk; - su2double SoSextr, Vnextr[MAXNDIM], Vnextr_, RiemannExtr, QdMnorm[MAXNDIM], QdMnorm2, appo2, SoS_out; - su2double Normal[MAXNDIM]; - - const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); - const auto Gas_Constant = config->GetGas_ConstantND(); - const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); - - /*--- Get the actuator disk center and axis coordinates for the current marker. ---*/ - for (iDim = 0; iDim < nDim; iDim++){ - Prop_Axis[iDim] = ActDisk_Axis(val_marker, iDim); - } - - /*--- Loop over all the vertices on this boundary marker. ---*/ - SU2_OMP_FOR_DYN(OMP_MIN_SIZE) - for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { - - iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint); - GlobalIndex_donor = GetDonorGlobalIndex(val_marker, iVertex); - - /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ - - if ((geometry->nodes->GetDomain(iPoint)) && - (GlobalIndex != GlobalIndex_donor)) { - - /*--- Normal vector for this vertex (negative for outward convention) ---*/ - - geometry->vertex[val_marker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; - conv_numerics->SetNormal(Normal); - - Area = GeometryToolbox::Norm(nDim, Normal); - for (iDim = 0; iDim < nDim; iDim++) - UnitNormal[iDim] = Normal[iDim]/Area; - - /*--- Current solution at this boundary node. ---*/ - - V_domain = nodes->GetPrimitive(iPoint); - - /*--- Get the values of Fa (axial force per unit area), Fx, Fy and Fz (x, y and z components of the tangential and - radial forces per unit area resultant). ---*/ - Fa = ActDisk_Fa_BEM[val_marker][iVertex]; - Fx = ActDisk_Fx_BEM[val_marker][iVertex]; - Fy = ActDisk_Fy_BEM[val_marker][iVertex]; - Fz = ActDisk_Fz_BEM[val_marker][iVertex]; - - /*--- Get the primitive variables and the extrapolated variables. ---*/ - if (val_inlet_surface){ - V_inlet = nodes->GetPrimitive(iPoint); - V_outlet = DonorPrimVar[val_marker][iVertex];} - else{ - V_outlet = nodes->GetPrimitive(iPoint); - V_inlet = DonorPrimVar[val_marker][iVertex];} - - /*--- u, v and w are the three momentum components. ---*/ - Pressure_out = V_outlet[nDim+1]; - Density_out = V_outlet[nDim+2]; - u_out = V_outlet[1]*V_outlet[nDim+2]; - v_out = V_outlet[2]*V_outlet[nDim+2]; - w_out = V_outlet[3]*V_outlet[nDim+2]; - - Pressure_in = V_inlet[nDim+1]; - Density_in = V_inlet[nDim+2]; - u_in = V_inlet[1]*Density_in; - v_in = V_inlet[2]*Density_in; - w_in = V_inlet[3]*Density_in; - H_in = V_inlet[nDim+3]*Density_in; - - /*--- Density on the disk is computed as an everage value between the inlet and outlet values. ---*/ - Density_Disk = 0.5*(Density_in + Density_out); - - /*--- Computation of the normal momentum flowing through the disk. ---*/ - Q_out = 0.5*((u_in + u_out)*Prop_Axis[0] + (v_in + v_out)*Prop_Axis[1] + (w_in + w_out)*Prop_Axis[2]); - - FQ = Q_out/Density_Disk; - - /*--- Computation of the momentum jumps due to the tnagential and radial forces per unit area. ---*/ - if (FQ < EPS){ - uJ = 0.0; - vJ = 0.0; - wJ = 0.0;} - else{ - uJ = Fx/FQ; - vJ = Fy/FQ; - wJ = Fz/FQ;} - - if (val_inlet_surface) { - /*--- Build the fictitious intlet state based on characteristics. - Retrieve the specified back pressure for this inlet ---*/ - - Density = V_domain[nDim+2]; - Velocity2 = 0.0; Vn = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = V_domain[iDim+1]; - Velocity2 += Velocity[iDim]*Velocity[iDim]; - Vn += Velocity[iDim]*UnitNormal[iDim]; - } - Pressure = V_domain[nDim+1]; - SoundSpeed = sqrt(Gamma*Pressure/Density); - - Entropy = Pressure*pow(1.0/Density, Gamma); - Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One; - - /*--- Compute the new fictious state at the outlet ---*/ - - Pressure = Pressure_out - Fa; - Density = pow(Pressure/Entropy,1.0/Gamma); - SoundSpeed = sqrt(Gamma*Pressure/Density); - Vn_Inlet = Riemann - 2.0*SoundSpeed/Gamma_Minus_One; - - Velocity2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { - Velocity[iDim] = Velocity[iDim] + (Vn_Inlet-Vn)*UnitNormal[iDim]; - Velocity2 += Velocity[iDim]*Velocity[iDim]; - } - Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; - if (tkeNeeded) Energy += GetTke_Inf(); - - /*--- Conservative variables, using the derived quantities ---*/ - - V_inlet[0] = Pressure / ( Gas_Constant * Density); - for (iDim = 0; iDim < nDim; iDim++) V_inlet[iDim+1] = Velocity[iDim]; - V_inlet[nDim+1] = Pressure; - V_inlet[nDim+2] = Density; - V_inlet[nDim+3] = Energy + Pressure/Density; - V_inlet[nDim+4] = SoundSpeed; - conv_numerics->SetPrimitive(V_domain, V_inlet); - } - else { - /*--- Acoustic Riemann invariant extrapolation form the interior domain. ---*/ - SoSextr = V_domain[nDim+4]; - - Vnextr_ = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - Vnextr[iDim] = V_domain[iDim+1]*Prop_Axis[iDim]; - Vnextr_ += Vnextr[iDim]*Vnextr[iDim]; - } - Vnextr_ = sqrt(max(0.0,Vnextr_)); - RiemannExtr = Vnextr_ - ((2*SoSextr)/(Gamma_Minus_One)); - - /*--- Assigning the momentum in tangential direction jump and the pressure jump. ---*/ - Velocity[0] = u_in + uJ; - Velocity[1] = v_in + vJ; - Velocity[2] = w_in + wJ; - Pressure_out = Pressure_in + Fa; - - /*--- Computation of the momentum normal to the disk plane. ---*/ - QdMnorm[0] = u_in*Prop_Axis[0]; - QdMnorm[1] = v_in*Prop_Axis[1]; - QdMnorm[2] = w_in*Prop_Axis[2]; - - QdMnorm2 = 0.0; - for (iDim = 0; iDim < nDim; iDim++) QdMnorm2 += QdMnorm[iDim]*QdMnorm[iDim]; - - /*--- Resolving the second grade equation for the density. ---*/ - appo2 = -((2*sqrt(QdMnorm2)*RiemannExtr)+((4*Gamma*Pressure_out)/(pow(Gamma_Minus_One,2)))); - Density_out = (-appo2+sqrt(max(0.0,pow(appo2,2)-4*QdMnorm2*pow(RiemannExtr,2))))/(2*pow(RiemannExtr,2)); - - Velocity2 = 0; - for (iDim = 0; iDim < nDim; iDim++) Velocity2 += (Velocity[iDim]*Velocity[iDim]); - - /*--- Computation of the enthalpy, total energy, temperature and speed of sound. ---*/ - H_out = H_in/Density_in + Fa/Density_out; - Energy = H_out - Pressure_out/Density_out; - if (tkeNeeded) Energy += GetTke_Inf(); - Temperature_out = (Energy-0.5*Velocity2/(pow(Density_out,2)))*(Gamma_Minus_One/Gas_Constant); - - SoS_out = sqrt(Gamma*Gas_Constant*Temperature_out); - - /*--- Set the primitive variables. ---*/ - V_outlet[0] = Temperature_out; - for (iDim = 0; iDim < nDim; iDim++) - V_outlet[iDim+1] = Velocity[iDim]/Density_out; - V_outlet[nDim+1] = Pressure_out; - V_outlet[nDim+2] = Density_out; - V_outlet[nDim+3] = H_out; - V_outlet[nDim+4] = SoS_out; - conv_numerics->SetPrimitive(V_domain, V_outlet); - } - - /*--- Grid Movement (NOT TESTED!)---*/ - - if (dynamic_grid) - conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); - - /*--- Compute the residual using an upwind scheme ---*/ - - auto residual = conv_numerics->ComputeResidual(config); - - /*--- Update residual value ---*/ - - LinSysRes.AddBlock(iPoint, residual); - - /*--- Jacobian contribution for implicit integration ---*/ - - if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); - } - } -} +//void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, +// CConfig *config, unsigned short val_marker, bool val_inlet_surface) { +// +// /*! +// * \function BC_ActDisk_BEM_VLAD +// * \brief Actuator disk model with Blade Element Method (BEM) +// * \author: Chandukrishna Y., T. N. Venkatesh and Josy Pullockara +// * Institution: Computational and Theoretical Fluid Dynamics (CTFD), +// * CSIR - National Aerospace Laboratories, Bangalore +// * Academy of Scientific and Innovative Research, Ghaziabad +// * \version 8.0.0 "Harrier" +// * First release date : September 26 2023 +// * modified on: +// * +// * Section properties of the propeller given in an input file. +// * Cl, Cd of propeller sections need to be generated earlier and saved in this file +// * Actuator disk data initialized in function SetActDisk_BCThrust. +// * Propeller load calculated with Blade Element Method +// * Interpolated load at each point on the actuator disk is set in SetActDisk_BEM_VLAD function +// * Rest calculations follows the Variable Load (BC_ActDisk_VariableLoad) approach +// * +// */ +// +// unsigned short iDim; +// unsigned long iVertex, iPoint, GlobalIndex_donor, GlobalIndex; +// su2double Pressure, Velocity[MAXNDIM], +// Velocity2, Entropy, Density, Energy, Riemann, Vn, SoundSpeed, Vn_Inlet, +// Area, UnitNormal[MAXNDIM] = {0.0}, *V_outlet, *V_domain, *V_inlet; +// +// su2double Pressure_out, Density_out, +// Pressure_in, Density_in; +// +// su2double Prop_Axis[MAXNDIM]; +// su2double Fa, Fx, Fy, Fz; +// su2double u_in, v_in, w_in, u_out, v_out, w_out, uJ, vJ, wJ; +// su2double Temperature_out, H_in, H_out; +// su2double FQ, Q_out, Density_Disk; +// su2double SoSextr, Vnextr[MAXNDIM], Vnextr_, RiemannExtr, QdMnorm[MAXNDIM], QdMnorm2, appo2, SoS_out; +// su2double Normal[MAXNDIM]; +// +// const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); +// const auto Gas_Constant = config->GetGas_ConstantND(); +// const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); +// +// /*--- Get the actuator disk center and axis coordinates for the current marker. ---*/ +// for (iDim = 0; iDim < nDim; iDim++){ +// Prop_Axis[iDim] = ActDisk_Axis(val_marker, iDim); +// } +// +// /*--- Loop over all the vertices on this boundary marker. ---*/ +// SU2_OMP_FOR_DYN(OMP_MIN_SIZE) +// for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { +// +// iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); +// GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint); +// GlobalIndex_donor = GetDonorGlobalIndex(val_marker, iVertex); +// +// /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ +// +// if ((geometry->nodes->GetDomain(iPoint)) && +// (GlobalIndex != GlobalIndex_donor)) { +// +// /*--- Normal vector for this vertex (negative for outward convention) ---*/ +// +// geometry->vertex[val_marker][iVertex]->GetNormal(Normal); +// for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; +// conv_numerics->SetNormal(Normal); +// +// Area = GeometryToolbox::Norm(nDim, Normal); +// for (iDim = 0; iDim < nDim; iDim++) +// UnitNormal[iDim] = Normal[iDim]/Area; +// +// /*--- Current solution at this boundary node. ---*/ +// +// V_domain = nodes->GetPrimitive(iPoint); +// +// /*--- Get the values of Fa (axial force per unit area), Fx, Fy and Fz (x, y and z components of the tangential and +// radial forces per unit area resultant). ---*/ +// Fa = ActDisk_Fa_BEM[val_marker][iVertex]; +// Fx = ActDisk_Fx_BEM[val_marker][iVertex]; +// Fy = ActDisk_Fy_BEM[val_marker][iVertex]; +// Fz = ActDisk_Fz_BEM[val_marker][iVertex]; +// +// /*--- Get the primitive variables and the extrapolated variables. ---*/ +// if (val_inlet_surface){ +// V_inlet = nodes->GetPrimitive(iPoint); +// V_outlet = DonorPrimVar[val_marker][iVertex];} +// else{ +// V_outlet = nodes->GetPrimitive(iPoint); +// V_inlet = DonorPrimVar[val_marker][iVertex];} +// +// /*--- u, v and w are the three momentum components. ---*/ +// Pressure_out = V_outlet[nDim+1]; +// Density_out = V_outlet[nDim+2]; +// u_out = V_outlet[1]*V_outlet[nDim+2]; +// v_out = V_outlet[2]*V_outlet[nDim+2]; +// w_out = V_outlet[3]*V_outlet[nDim+2]; +// +// Pressure_in = V_inlet[nDim+1]; +// Density_in = V_inlet[nDim+2]; +// u_in = V_inlet[1]*Density_in; +// v_in = V_inlet[2]*Density_in; +// w_in = V_inlet[3]*Density_in; +// H_in = V_inlet[nDim+3]*Density_in; +// +// /*--- Density on the disk is computed as an everage value between the inlet and outlet values. ---*/ +// Density_Disk = 0.5*(Density_in + Density_out); +// +// /*--- Computation of the normal momentum flowing through the disk. ---*/ +// Q_out = 0.5*((u_in + u_out)*Prop_Axis[0] + (v_in + v_out)*Prop_Axis[1] + (w_in + w_out)*Prop_Axis[2]); +// +// FQ = Q_out/Density_Disk; +// +// /*--- Computation of the momentum jumps due to the tnagential and radial forces per unit area. ---*/ +// if (FQ < EPS){ +// uJ = 0.0; +// vJ = 0.0; +// wJ = 0.0;} +// else{ +// uJ = Fx/FQ; +// vJ = Fy/FQ; +// wJ = Fz/FQ;} +// +// if (val_inlet_surface) { +// /*--- Build the fictitious intlet state based on characteristics. +// Retrieve the specified back pressure for this inlet ---*/ +// +// Density = V_domain[nDim+2]; +// Velocity2 = 0.0; Vn = 0.0; +// for (iDim = 0; iDim < nDim; iDim++) { +// Velocity[iDim] = V_domain[iDim+1]; +// Velocity2 += Velocity[iDim]*Velocity[iDim]; +// Vn += Velocity[iDim]*UnitNormal[iDim]; +// } +// Pressure = V_domain[nDim+1]; +// SoundSpeed = sqrt(Gamma*Pressure/Density); +// +// Entropy = Pressure*pow(1.0/Density, Gamma); +// Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One; +// +// /*--- Compute the new fictious state at the outlet ---*/ +// +// Pressure = Pressure_out - Fa; +// Density = pow(Pressure/Entropy,1.0/Gamma); +// SoundSpeed = sqrt(Gamma*Pressure/Density); +// Vn_Inlet = Riemann - 2.0*SoundSpeed/Gamma_Minus_One; +// +// Velocity2 = 0.0; +// for (iDim = 0; iDim < nDim; iDim++) { +// Velocity[iDim] = Velocity[iDim] + (Vn_Inlet-Vn)*UnitNormal[iDim]; +// Velocity2 += Velocity[iDim]*Velocity[iDim]; +// } +// Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; +// if (tkeNeeded) Energy += GetTke_Inf(); +// +// /*--- Conservative variables, using the derived quantities ---*/ +// +// V_inlet[0] = Pressure / ( Gas_Constant * Density); +// for (iDim = 0; iDim < nDim; iDim++) V_inlet[iDim+1] = Velocity[iDim]; +// V_inlet[nDim+1] = Pressure; +// V_inlet[nDim+2] = Density; +// V_inlet[nDim+3] = Energy + Pressure/Density; +// V_inlet[nDim+4] = SoundSpeed; +// conv_numerics->SetPrimitive(V_domain, V_inlet); +// } +// else { +// /*--- Acoustic Riemann invariant extrapolation form the interior domain. ---*/ +// SoSextr = V_domain[nDim+4]; +// +// Vnextr_ = 0.0; +// for (iDim = 0; iDim < nDim; iDim++){ +// Vnextr[iDim] = V_domain[iDim+1]*Prop_Axis[iDim]; +// Vnextr_ += Vnextr[iDim]*Vnextr[iDim]; +// } +// Vnextr_ = sqrt(max(0.0,Vnextr_)); +// RiemannExtr = Vnextr_ - ((2*SoSextr)/(Gamma_Minus_One)); +// +// /*--- Assigning the momentum in tangential direction jump and the pressure jump. ---*/ +// Velocity[0] = u_in + uJ; +// Velocity[1] = v_in + vJ; +// Velocity[2] = w_in + wJ; +// Pressure_out = Pressure_in + Fa; +// +// /*--- Computation of the momentum normal to the disk plane. ---*/ +// QdMnorm[0] = u_in*Prop_Axis[0]; +// QdMnorm[1] = v_in*Prop_Axis[1]; +// QdMnorm[2] = w_in*Prop_Axis[2]; +// +// QdMnorm2 = 0.0; +// for (iDim = 0; iDim < nDim; iDim++) QdMnorm2 += QdMnorm[iDim]*QdMnorm[iDim]; +// +// /*--- Resolving the second grade equation for the density. ---*/ +// appo2 = -((2*sqrt(QdMnorm2)*RiemannExtr)+((4*Gamma*Pressure_out)/(pow(Gamma_Minus_One,2)))); +// Density_out = (-appo2+sqrt(max(0.0,pow(appo2,2)-4*QdMnorm2*pow(RiemannExtr,2))))/(2*pow(RiemannExtr,2)); +// +// Velocity2 = 0; +// for (iDim = 0; iDim < nDim; iDim++) Velocity2 += (Velocity[iDim]*Velocity[iDim]); +// +// /*--- Computation of the enthalpy, total energy, temperature and speed of sound. ---*/ +// H_out = H_in/Density_in + Fa/Density_out; +// Energy = H_out - Pressure_out/Density_out; +// if (tkeNeeded) Energy += GetTke_Inf(); +// Temperature_out = (Energy-0.5*Velocity2/(pow(Density_out,2)))*(Gamma_Minus_One/Gas_Constant); +// +// SoS_out = sqrt(Gamma*Gas_Constant*Temperature_out); +// +// /*--- Set the primitive variables. ---*/ +// V_outlet[0] = Temperature_out; +// for (iDim = 0; iDim < nDim; iDim++) +// V_outlet[iDim+1] = Velocity[iDim]/Density_out; +// V_outlet[nDim+1] = Pressure_out; +// V_outlet[nDim+2] = Density_out; +// V_outlet[nDim+3] = H_out; +// V_outlet[nDim+4] = SoS_out; +// conv_numerics->SetPrimitive(V_domain, V_outlet); +// } +// +// /*--- Grid Movement (NOT TESTED!)---*/ +// +// if (dynamic_grid) +// conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); +// +// /*--- Compute the residual using an upwind scheme ---*/ +// +// auto residual = conv_numerics->ComputeResidual(config); +// +// /*--- Update residual value ---*/ +// +// LinSysRes.AddBlock(iPoint, residual); +// +// /*--- Jacobian contribution for implicit integration ---*/ +// +// if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); +// } +// } +//} void CEulerSolver::PrintVerificationError(const CConfig *config) const { diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index d64dba58ff4..07be1b9a3f7 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -107,6 +107,11 @@ MARKER_ACTDISK = ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 12715.2, 0.0, 0.0, 12715. % X_CG of outlet, Y_CG of outlet, Z_CG of outlet), X_CG, Y_CG, Z_CG of both inlet and % outlet markers should be same MARKER_ACTDISK_CG= ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 0.0, 0.0,0.0,0.0) +%Actuator Disk Axis +%(inlet face marker, outlet face marker, +% axis_x, axis_y, axis_z of inlet, axis_x, axis_y, axis_z of outlet), +% axis of both inlet and outlet markers should be same +MARKER_ACTDISK_AXIS= ( ACTDISK_IN, ACTDISK_OUT , 1.0, 0.0, 0.0, 1.0,0.0,0.0) % Input file containing the propeller section data and aerodynamic details of blade sections BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt % Propeller blade angle (Degrees) at 0.75*Radius for the current calculation From 59c825817f154acf0cb01f645cf3cf2205557e8c Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sat, 21 Oct 2023 20:42:33 +0530 Subject: [PATCH 26/42] config options for CG and Axis, other minor cleanup --- Common/include/CConfig.hpp | 38 ++- Common/include/option_structure.inl | 100 ++++++ Common/src/CConfig.cpp | 70 +++-- SU2_CFD/include/solvers/CEulerSolver.hpp | 32 +- SU2_CFD/src/solvers/CEulerSolver.cpp | 297 +++--------------- .../actuatordisk_bem/actuatordisk_bem.cfg | 4 +- config_template.cfg | 7 +- 7 files changed, 219 insertions(+), 329 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index a4cd84b7a48..f60eb8f8fa0 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -184,6 +184,8 @@ class CConfig { nMarker_NearFieldBound, /*!< \brief Number of near field boundary markers. */ nMarker_ActDiskInlet, /*!< \brief Number of actuator disk inlet markers. */ nMarker_ActDiskOutlet, /*!< \brief Number of actuator disk outlet markers. */ + nMarker_ActDiskBemInlet, /*!< \brief Number of actuator disk BEM inlet markers. */ + nMarker_ActDiskBemOutlet, /*!< \brief Number of actuator disk BEM outlet markers. */ nMarker_Deform_Mesh_Sym_Plane, /*!< \brief Number of markers with symmetric deformation */ nMarker_Deform_Mesh, /*!< \brief Number of deformable markers at the boundary. */ nMarker_Fluid_Load, /*!< \brief Number of markers in which the flow load is computed/employed. */ @@ -242,6 +244,8 @@ class CConfig { *Marker_CHTInterface, /*!< \brief Conjugate heat transfer interface markers. */ *Marker_ActDiskInlet, /*!< \brief Actuator disk inlet markers. */ *Marker_ActDiskOutlet, /*!< \brief Actuator disk outlet markers. */ + *Marker_ActDiskBemInlet, /*!< \brief Actuator disk BEM inlet markers. */ + *Marker_ActDiskBemOutlet, /*!< \brief Actuator disk BEM outlet markers. */ *Marker_Inlet, /*!< \brief Inlet flow markers. */ *Marker_Inlet_Species, /*!< \brief Inlet species markers. */ *Marker_Inlet_Turb, /*!< \brief Inlet turbulent markers. */ @@ -348,9 +352,9 @@ class CConfig { 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_CG[3]; /*!< \brief Specified CG for actuator disk.*/ - su2double **ActDisk_Axis_BEM[3]; /*!< \brief Specified axis for actuator disk.*/ - su2double **ActDisk_RotRate; /*!< \brief Value of the Rotation Rate.*/ +//su2double **ActDisk_RotRate; /*!< \brief Value of the Rotation Rate.*/ + su2double **ActDiskBem_CG[3]; /*!< \brief Specified center for actuator disk BEM.*/ + su2double **ActDiskBem_Axis[3]; /*!< \brief Specified axis for actuator disk BEM.*/ 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.*/ @@ -1373,6 +1377,10 @@ class CConfig { unsigned short & nMarker_ActDiskInlet, unsigned short & nMarker_ActDiskOutlet, string* & Marker_ActDiskInlet, string* & Marker_ActDiskOutlet, su2double** & ActDisk_PressJump, su2double** & ActDisk_TempJump, su2double** & ActDisk_Omega); + void addActDiskBemOption(const string & name, + unsigned short & nMarker_ActDiskBemInlet, unsigned short & nMarker_ActDiskBemOutlet, string* & Marker_ActDiskBemInlet, string* & Marker_ActDiskBemOutlet, + su2double** & ActDiskBem_X, su2double** & ActDiskBem_Y, su2double** & ActDiskBem_Z); + void addWallFunctionOption(const string &name, unsigned short &list_size, string* &string_field, WALL_FUNCTIONS* &val_Kind_WF, unsigned short** &val_IntInfo_WF, su2double** &val_DoubleInfo_WF); @@ -6658,34 +6666,34 @@ class CConfig { su2double GetActDisk_PressJump(const string& val_marker, unsigned short val_index) const; /*! - * \brief Get the CG of the actuator disk. + * \brief Get the thrust corffient of the actuator disk. */ - su2double GetActDisk_CG(unsigned short iDim, string val_marker, unsigned short val_index) const; + su2double GetActDisk_TempJump(const string& val_marker, unsigned short val_index) const; /*! - * \brief Get the axis of the actuator disk with Blade Element Method. + * \brief Get the rev / min of the actuator disk. */ - su2double GetActDisk_Axis_BEM(unsigned short iDim, string val_marker, unsigned short val_index) const; + su2double GetActDisk_Omega(const string& val_marker, unsigned short val_index) const; /*! - * \brief Get the blade angle of the propeller. + * \brief Get the Center of the actuator disk. */ - su2double GetBEM_blade_angle(void) { return BEM_blade_angle; } + su2double GetActDiskBem_CG(unsigned short iDim, string val_marker, unsigned short val_index) const; /*! - * \brief Get the filename of the propeller. + * \brief Get the axis of the actuator disk with Blade Element Method. */ - string GetBEM_prop_filename(void) { return BEM_prop_filename; } + su2double GetActDiskBem_Axis(unsigned short iDim, string val_marker, unsigned short val_index) const; /*! - * \brief Get the thrust corffient of the actuator disk. + * \brief Get the blade angle of the propeller. */ - su2double GetActDisk_TempJump(const string& val_marker, unsigned short val_index) const; + su2double GetBEM_blade_angle(void) { return BEM_blade_angle; } /*! - * \brief Get the rev / min of the actuator disk. + * \brief Get the filename of the propeller. */ - su2double GetActDisk_Omega(const string& val_marker, unsigned short val_index) const; + string GetBEM_prop_filename(void) { return BEM_prop_filename; } /*! * \brief Get Actuator Disk Outlet for boundary val_marker (actuator disk inlet). diff --git a/Common/include/option_structure.inl b/Common/include/option_structure.inl index ce94055fca5..8bd9644b42a 100644 --- a/Common/include/option_structure.inl +++ b/Common/include/option_structure.inl @@ -1772,6 +1772,106 @@ class COptionActDisk : public COptionBase { } }; +class COptionActDiskBem : public COptionBase { + string name; // identifier for the option + unsigned short& inlet_size; + unsigned short& outlet_size; + string*& marker_inlet; + string*& marker_outlet; + su2double**& dir_x; + su2double**& dir_y; + su2double**& dir_z; + + public: + COptionActDiskBem(const string name, unsigned short& nMarker_ActDiskInlet, unsigned short& nMarker_ActDiskOutlet, + string*& Marker_ActDiskInlet, string*& Marker_ActDiskOutlet, + su2double**& ActDiskBem_X, su2double**& ActDiskBem_Y, su2double**& ActDiskBem_Z) + : inlet_size(nMarker_ActDiskInlet), + outlet_size(nMarker_ActDiskOutlet), + marker_inlet(Marker_ActDiskInlet), + marker_outlet(Marker_ActDiskOutlet), + dir_x(ActDiskBem_X), + dir_y(ActDiskBem_Y), + dir_z(ActDiskBem_Z) { + this->name = name; + } + + ~COptionActDiskBem() override{}; + string SetValue(const vector& option_value) override { + COptionBase::SetValue(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]; + this->marker_outlet = new string[this->outlet_size]; + + this->dir_x = new su2double*[this->inlet_size]; + this->dir_y = new su2double*[this->inlet_size]; + this->dir_z = new su2double*[this->inlet_size]; + for (int i = 0; i < this->inlet_size; i++) { + this->dir_x[i] = new su2double[2]; + this->dir_y[i] = new su2double[2]; + this->dir_z[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->dir_x[i][0])) { + return badValue(tname, this->name); + } + istringstream ss_2nd(option_value[mod_num * i + 3]); + if (!(ss_2nd >> this->dir_y[i][0])) { + return badValue(tname, this->name); + } + istringstream ss_3rd(option_value[mod_num * i + 4]); + if (!(ss_3rd >> this->dir_z[i][0])) { + return badValue(tname, this->name); + } + istringstream ss_4th(option_value[mod_num * i + 5]); + if (!(ss_4th >> this->dir_x[i][1])) { + return badValue(tname, this->name); + } + istringstream ss_5th(option_value[mod_num * i + 6]); + if (!(ss_5th >> this->dir_y[i][1])) { + return badValue(tname, this->name); + } + istringstream ss_6th(option_value[mod_num * i + 7]); + if (!(ss_6th >> this->dir_z[i][1])) { + return badValue(tname, this->name); + } + } + return ""; + } + void SetDefault() override { + this->inlet_size = 0; + this->outlet_size = 0; + this->marker_inlet = nullptr; + this->marker_outlet = nullptr; + this->dir_x = nullptr; + this->dir_y = nullptr; + this->dir_z = nullptr; + } +}; + class COptionWallFunction : public COptionBase { string name; // identifier for the option unsigned short& nMarkers; diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index d23546dbc69..b21f896c7df 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -557,6 +557,17 @@ void CConfig::addActDiskOption(const string & name, unsigned short & nMarker_Act option_map.insert(pair(name, val)); } +void CConfig::addActDiskBemOption(const string & name, + unsigned short & nMarker_ActDiskBemInlet, unsigned short & nMarker_ActDiskBemOutlet, + string* & Marker_ActDiskBemInlet, string* & Marker_ActDiskBemOutlet, + su2double** & ActDiskBem_X, su2double** & ActDiskBem_Y, su2double** & ActDiskBem_Z) { + assert(option_map.find(name) == option_map.end()); + all_options.insert(pair(name, true)); + COptionBase* val = new COptionActDiskBem(name, nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, + ActDiskBem_X, ActDiskBem_Y, ActDiskBem_Z); + option_map.insert(pair(name, val)); +} + void CConfig::addWallFunctionOption(const string &name, unsigned short &list_size, string* &string_field, WALL_FUNCTIONS* &val_Kind_WF, unsigned short** &val_IntInfo_WF, su2double** &val_DoubleInfo_WF) { @@ -1526,15 +1537,15 @@ 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_CG[0], ActDisk_CG[1], ActDisk_CG[2]); + /*!\brief MARKER_ACTDISK_BEM_CG\n DESCRIPTION: Actuator disk CG for blade element momentum (BEM) method. \ingroup Config*/ + addActDiskBemOption("MARKER_ACTDISK_BEM_CG", + nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, + ActDiskBem_CG[0], ActDiskBem_CG[1], ActDiskBem_CG[2]); - /*!\brief MARKER_ACTDISK_CG\n DESCRIPTION: Actuator disk axis for blade element momentum (BEM) method. \ingroup Config*/ - addActDiskOption("MARKER_ACTDISK_AXIS", - nMarker_ActDiskInlet, nMarker_ActDiskOutlet, Marker_ActDiskInlet, Marker_ActDiskOutlet, - ActDisk_Axis_BEM[0], ActDisk_Axis_BEM[1], ActDisk_Axis_BEM[2]); + /*!\brief MARKER_ACTDISK_BEM_AXIS\n DESCRIPTION: Actuator disk axis for blade element momentum (BEM) method. \ingroup Config*/ + addActDiskBemOption("MARKER_ACTDISK_BEM_AXIS", + nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, + ActDiskBem_Axis[0], ActDiskBem_Axis[1], ActDiskBem_Axis[2]); /*!\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")); @@ -5560,7 +5571,9 @@ void CConfig::SetMarkers(SU2_COMPONENT val_software) { nMarker_Supersonic_Inlet + nMarker_Supersonic_Outlet + nMarker_Displacement + nMarker_Load + nMarker_FlowLoad + nMarker_Custom + nMarker_Damper + nMarker_Fluid_Load + nMarker_Clamped + nMarker_Load_Sine + nMarker_Load_Dir + nMarker_Disp_Dir + - nMarker_ActDiskInlet + nMarker_ActDiskOutlet + nMarker_ZoneInterface; + nMarker_ActDiskInlet + nMarker_ActDiskOutlet + + nMarker_ActDiskBemInlet + nMarker_ActDiskBemOutlet + + nMarker_ZoneInterface; /*--- Add the possible send/receive domains ---*/ @@ -7634,6 +7647,13 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { } } + if (nMarker_ActDiskOutlet != 0) { + if (GetKind_ActDisk() == BLADE_ELEMENT) { + cout << endl << "Actuator disk with blade element momentum (BEM) method." << endl; + cout << "Actuator disk BEM method propeller data read from file: " << GetBEM_prop_filename() << endl; + } + } + } bool CConfig::TokenizeString(string & str, string & option_name, @@ -8127,8 +8147,8 @@ CConfig::~CConfig() { delete[] ActDiskOutlet_Force; delete[] ActDiskOutlet_Power; - delete[] ActDiskOutlet_Thrust_BEM; - delete[] ActDiskOutlet_Torque_BEM; + delete[] ActDiskOutlet_Thrust_BEM; + delete[] ActDiskOutlet_Torque_BEM; delete[] Outlet_MassFlow; delete[] Outlet_Density; @@ -8699,36 +8719,36 @@ su2double CConfig::GetActDisk_PressJump(const string& val_marker, unsigned short return ActDisk_PressJump[iMarker_ActDisk][val_value]; } -su2double CConfig::GetActDisk_CG(unsigned short iDim, string val_marker, unsigned short val_value) const { +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++) if ((Marker_ActDiskInlet[iMarker_ActDisk] == val_marker) || (Marker_ActDiskOutlet[iMarker_ActDisk] == val_marker)) break; - return ActDisk_CG[iDim][iMarker_ActDisk][val_value]; + return ActDisk_TempJump[iMarker_ActDisk][val_value];; } -su2double CConfig::GetActDisk_Axis_BEM(unsigned short iDim, string val_marker, unsigned short val_value) const { +su2double CConfig::GetActDisk_Omega(const 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_Axis_BEM[iDim][iMarker_ActDisk][val_value]; + return ActDisk_Omega[iMarker_ActDisk][val_value];; } -su2double CConfig::GetActDisk_TempJump(const string& val_marker, unsigned short val_value) const { +su2double CConfig::GetActDiskBem_CG(unsigned short iDim, 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_TempJump[iMarker_ActDisk][val_value];; + for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskBemInlet; iMarker_ActDisk++) + if ((Marker_ActDiskBemInlet[iMarker_ActDisk] == val_marker) || + (Marker_ActDiskBemOutlet[iMarker_ActDisk] == val_marker)) break; + return ActDiskBem_CG[iDim][iMarker_ActDisk][val_value]; } -su2double CConfig::GetActDisk_Omega(const string& val_marker, unsigned short val_value) const { +su2double CConfig::GetActDiskBem_Axis(unsigned short iDim, 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_Omega[iMarker_ActDisk][val_value];; + for (iMarker_ActDisk = 0; iMarker_ActDisk < nMarker_ActDiskBemInlet; iMarker_ActDisk++) + if ((Marker_ActDiskBemInlet[iMarker_ActDisk] == val_marker) || + (Marker_ActDiskBemOutlet[iMarker_ActDisk] == val_marker)) break; + return ActDiskBem_Axis[iDim][iMarker_ActDisk][val_value]; } su2double CConfig::GetOutlet_MassFlow(const string& val_marker) const { diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index c6397f3e0ab..b722c16aa86 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -68,7 +68,7 @@ class CEulerSolver : public CFVMFlowSolverBase > ActDisk_DeltaP_r; /*!< \brief Value of the Delta P. */ vector > ActDisk_Thrust_r; /*!< \brief Value of the Delta P. */ vector > ActDisk_Torque_r; /*!< \brief Value of the Delta P. */ - vector > ActDisk_RotRate; /*!< \brief Value of the Rotation Rate. */ +//vector > ActDisk_RotRate; /*!< \brief Value of the Rotation Rate. */ //vector > ActDisk_XCG; //vector > ActDisk_YCG; //vector > ActDisk_ZCG; @@ -83,10 +83,10 @@ class CEulerSolver : public CFVMFlowSolverBase > ActDisk_Fx; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ vector > ActDisk_Fy; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ vector > ActDisk_Fz; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ - vector > ActDisk_Fa_BEM; /*!< \brief Value of the actuator disk Axial Force per Unit Area. */ - vector > ActDisk_Fx_BEM; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ - vector > ActDisk_Fy_BEM; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ - vector > ActDisk_Fz_BEM; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fa_BEM; /*!< \brief Value of the actuator disk Axial Force per Unit Area. */ + vector > ActDisk_Fx_BEM; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fy_BEM; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */ + vector > ActDisk_Fz_BEM; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */ su2double Total_CL_Prev = 0.0, /*!< \brief Total lift coefficient for all the boundaries (fixed lift mode). */ @@ -229,6 +229,7 @@ class CEulerSolver : public CFVMFlowSolverBaseGetMarker_All_TagBound(iMarker); ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); for (iDim=0; iDim < nDim; iDim++){ - ADBem_CG[iDim] = config->GetActDisk_CG(iDim, Marker_Tag, 0); + ADBem_CG[iDim] = config->GetActDiskBem_CG(iDim, Marker_Tag, 0); } /* for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { @@ -4264,7 +4284,7 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con //ADBem_Axis[1] = 0.0; //ADBem_Axis[2] = 0.0; for (iDim=0; iDim < nDim; iDim++){ - ADBem_Axis[iDim] = config->GetActDisk_Axis_BEM(iDim, Marker_Tag, 0); + ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); } for (iDim = 0; iDim < nDim; iDim++){ ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; @@ -4302,21 +4322,21 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con V = config->GetModVel_FreeStream(); V = fabs(Vn); - /*--- BEM model without parameter 'a' (ref?) ---*/ + /*--- BEM model without parameter 'a' (ref?) ---*/ { DtDr.resize(ADBem_NSection, 0.0); int s_prop_nblades = ADBem_NBlade; - int sprop_sec_nalf = ADBem_NAlpha; - int sprop_sec_nrad = ADBem_NSection; - std::vector& sprop_sec_r1 = radius_v; - std::vector& sprop_sec_chord = chord_v; - std::vector& sprop_sec_setangle = angle75r_v; - std::vector >& sprop_sec_alf = alpha_m; - std::vector >& sprop_sec_cl_arr = cl_m; - std::vector >& sprop_sec_cd_arr = cd_m; + int sprop_sec_nalf = ADBem_NAlpha; + int sprop_sec_nrad = ADBem_NSection; + std::vector& sprop_sec_r1 = radius_v; + std::vector& sprop_sec_chord = chord_v; + std::vector& sprop_sec_setangle = angle75r_v; + std::vector >& sprop_sec_alf = alpha_m; + std::vector >& sprop_sec_cl_arr = cl_m; + std::vector >& sprop_sec_cd_arr = cd_m; - su2double rad_p = radius; + su2double rad_p = radius; int j, isec,converged, n_iter; int NR = sprop_sec_nrad; @@ -4324,8 +4344,8 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double base_mach, s_mach, b_num, thrust, torque; su2double r_dash, t_loss, c_phi, rad, phi, alpha, radtodeg; su2double bnew, V0, V2, cl=0.0, cd=0.0, Vlocal, DqDr=0.0, tem1, tem2, q; - std::vector delta_r(ADBem_NSection, 0.0); - std::vector b(ADBem_NSection, 0.0); + std::vector delta_r(ADBem_NSection, 0.0); + std::vector b(ADBem_NSection, 0.0); static std::vector Dtorq(ADBem_NSection, 0.0); su2double n, omega, a0, den; @@ -8127,9 +8147,6 @@ void CEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_contai if(Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT){ BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } - //else if(Kind_ActDisk == BLADE_ELEMENT){ - // BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); - //} else{ BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } @@ -8144,9 +8161,6 @@ void CEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_conta if(Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT){ BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } - //else if(Kind_ActDisk == BLADE_ELEMENT){ - // BC_ActDisk_BEM_VLAD(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); - //} else{ BC_ActDisk(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } @@ -8805,243 +8819,6 @@ void CEulerSolver::BC_ActDisk_VariableLoad(CGeometry *geometry, CSolver **solver END_SU2_OMP_FOR } -//void CEulerSolver::BC_ActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, -// CConfig *config, unsigned short val_marker, bool val_inlet_surface) { -// -// /*! -// * \function BC_ActDisk_BEM_VLAD -// * \brief Actuator disk model with Blade Element Method (BEM) -// * \author: Chandukrishna Y., T. N. Venkatesh and Josy Pullockara -// * Institution: Computational and Theoretical Fluid Dynamics (CTFD), -// * CSIR - National Aerospace Laboratories, Bangalore -// * Academy of Scientific and Innovative Research, Ghaziabad -// * \version 8.0.0 "Harrier" -// * First release date : September 26 2023 -// * modified on: -// * -// * Section properties of the propeller given in an input file. -// * Cl, Cd of propeller sections need to be generated earlier and saved in this file -// * Actuator disk data initialized in function SetActDisk_BCThrust. -// * Propeller load calculated with Blade Element Method -// * Interpolated load at each point on the actuator disk is set in SetActDisk_BEM_VLAD function -// * Rest calculations follows the Variable Load (BC_ActDisk_VariableLoad) approach -// * -// */ -// -// unsigned short iDim; -// unsigned long iVertex, iPoint, GlobalIndex_donor, GlobalIndex; -// su2double Pressure, Velocity[MAXNDIM], -// Velocity2, Entropy, Density, Energy, Riemann, Vn, SoundSpeed, Vn_Inlet, -// Area, UnitNormal[MAXNDIM] = {0.0}, *V_outlet, *V_domain, *V_inlet; -// -// su2double Pressure_out, Density_out, -// Pressure_in, Density_in; -// -// su2double Prop_Axis[MAXNDIM]; -// su2double Fa, Fx, Fy, Fz; -// su2double u_in, v_in, w_in, u_out, v_out, w_out, uJ, vJ, wJ; -// su2double Temperature_out, H_in, H_out; -// su2double FQ, Q_out, Density_Disk; -// su2double SoSextr, Vnextr[MAXNDIM], Vnextr_, RiemannExtr, QdMnorm[MAXNDIM], QdMnorm2, appo2, SoS_out; -// su2double Normal[MAXNDIM]; -// -// const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); -// const auto Gas_Constant = config->GetGas_ConstantND(); -// const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); -// -// /*--- Get the actuator disk center and axis coordinates for the current marker. ---*/ -// for (iDim = 0; iDim < nDim; iDim++){ -// Prop_Axis[iDim] = ActDisk_Axis(val_marker, iDim); -// } -// -// /*--- Loop over all the vertices on this boundary marker. ---*/ -// SU2_OMP_FOR_DYN(OMP_MIN_SIZE) -// for (iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { -// -// iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); -// GlobalIndex = geometry->nodes->GetGlobalIndex(iPoint); -// GlobalIndex_donor = GetDonorGlobalIndex(val_marker, iVertex); -// -// /*--- Check if the node belongs to the domain (i.e., not a halo node) ---*/ -// -// if ((geometry->nodes->GetDomain(iPoint)) && -// (GlobalIndex != GlobalIndex_donor)) { -// -// /*--- Normal vector for this vertex (negative for outward convention) ---*/ -// -// geometry->vertex[val_marker][iVertex]->GetNormal(Normal); -// for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim]; -// conv_numerics->SetNormal(Normal); -// -// Area = GeometryToolbox::Norm(nDim, Normal); -// for (iDim = 0; iDim < nDim; iDim++) -// UnitNormal[iDim] = Normal[iDim]/Area; -// -// /*--- Current solution at this boundary node. ---*/ -// -// V_domain = nodes->GetPrimitive(iPoint); -// -// /*--- Get the values of Fa (axial force per unit area), Fx, Fy and Fz (x, y and z components of the tangential and -// radial forces per unit area resultant). ---*/ -// Fa = ActDisk_Fa_BEM[val_marker][iVertex]; -// Fx = ActDisk_Fx_BEM[val_marker][iVertex]; -// Fy = ActDisk_Fy_BEM[val_marker][iVertex]; -// Fz = ActDisk_Fz_BEM[val_marker][iVertex]; -// -// /*--- Get the primitive variables and the extrapolated variables. ---*/ -// if (val_inlet_surface){ -// V_inlet = nodes->GetPrimitive(iPoint); -// V_outlet = DonorPrimVar[val_marker][iVertex];} -// else{ -// V_outlet = nodes->GetPrimitive(iPoint); -// V_inlet = DonorPrimVar[val_marker][iVertex];} -// -// /*--- u, v and w are the three momentum components. ---*/ -// Pressure_out = V_outlet[nDim+1]; -// Density_out = V_outlet[nDim+2]; -// u_out = V_outlet[1]*V_outlet[nDim+2]; -// v_out = V_outlet[2]*V_outlet[nDim+2]; -// w_out = V_outlet[3]*V_outlet[nDim+2]; -// -// Pressure_in = V_inlet[nDim+1]; -// Density_in = V_inlet[nDim+2]; -// u_in = V_inlet[1]*Density_in; -// v_in = V_inlet[2]*Density_in; -// w_in = V_inlet[3]*Density_in; -// H_in = V_inlet[nDim+3]*Density_in; -// -// /*--- Density on the disk is computed as an everage value between the inlet and outlet values. ---*/ -// Density_Disk = 0.5*(Density_in + Density_out); -// -// /*--- Computation of the normal momentum flowing through the disk. ---*/ -// Q_out = 0.5*((u_in + u_out)*Prop_Axis[0] + (v_in + v_out)*Prop_Axis[1] + (w_in + w_out)*Prop_Axis[2]); -// -// FQ = Q_out/Density_Disk; -// -// /*--- Computation of the momentum jumps due to the tnagential and radial forces per unit area. ---*/ -// if (FQ < EPS){ -// uJ = 0.0; -// vJ = 0.0; -// wJ = 0.0;} -// else{ -// uJ = Fx/FQ; -// vJ = Fy/FQ; -// wJ = Fz/FQ;} -// -// if (val_inlet_surface) { -// /*--- Build the fictitious intlet state based on characteristics. -// Retrieve the specified back pressure for this inlet ---*/ -// -// Density = V_domain[nDim+2]; -// Velocity2 = 0.0; Vn = 0.0; -// for (iDim = 0; iDim < nDim; iDim++) { -// Velocity[iDim] = V_domain[iDim+1]; -// Velocity2 += Velocity[iDim]*Velocity[iDim]; -// Vn += Velocity[iDim]*UnitNormal[iDim]; -// } -// Pressure = V_domain[nDim+1]; -// SoundSpeed = sqrt(Gamma*Pressure/Density); -// -// Entropy = Pressure*pow(1.0/Density, Gamma); -// Riemann = Vn + 2.0*SoundSpeed/Gamma_Minus_One; -// -// /*--- Compute the new fictious state at the outlet ---*/ -// -// Pressure = Pressure_out - Fa; -// Density = pow(Pressure/Entropy,1.0/Gamma); -// SoundSpeed = sqrt(Gamma*Pressure/Density); -// Vn_Inlet = Riemann - 2.0*SoundSpeed/Gamma_Minus_One; -// -// Velocity2 = 0.0; -// for (iDim = 0; iDim < nDim; iDim++) { -// Velocity[iDim] = Velocity[iDim] + (Vn_Inlet-Vn)*UnitNormal[iDim]; -// Velocity2 += Velocity[iDim]*Velocity[iDim]; -// } -// Energy = Pressure/(Density*Gamma_Minus_One) + 0.5*Velocity2; -// if (tkeNeeded) Energy += GetTke_Inf(); -// -// /*--- Conservative variables, using the derived quantities ---*/ -// -// V_inlet[0] = Pressure / ( Gas_Constant * Density); -// for (iDim = 0; iDim < nDim; iDim++) V_inlet[iDim+1] = Velocity[iDim]; -// V_inlet[nDim+1] = Pressure; -// V_inlet[nDim+2] = Density; -// V_inlet[nDim+3] = Energy + Pressure/Density; -// V_inlet[nDim+4] = SoundSpeed; -// conv_numerics->SetPrimitive(V_domain, V_inlet); -// } -// else { -// /*--- Acoustic Riemann invariant extrapolation form the interior domain. ---*/ -// SoSextr = V_domain[nDim+4]; -// -// Vnextr_ = 0.0; -// for (iDim = 0; iDim < nDim; iDim++){ -// Vnextr[iDim] = V_domain[iDim+1]*Prop_Axis[iDim]; -// Vnextr_ += Vnextr[iDim]*Vnextr[iDim]; -// } -// Vnextr_ = sqrt(max(0.0,Vnextr_)); -// RiemannExtr = Vnextr_ - ((2*SoSextr)/(Gamma_Minus_One)); -// -// /*--- Assigning the momentum in tangential direction jump and the pressure jump. ---*/ -// Velocity[0] = u_in + uJ; -// Velocity[1] = v_in + vJ; -// Velocity[2] = w_in + wJ; -// Pressure_out = Pressure_in + Fa; -// -// /*--- Computation of the momentum normal to the disk plane. ---*/ -// QdMnorm[0] = u_in*Prop_Axis[0]; -// QdMnorm[1] = v_in*Prop_Axis[1]; -// QdMnorm[2] = w_in*Prop_Axis[2]; -// -// QdMnorm2 = 0.0; -// for (iDim = 0; iDim < nDim; iDim++) QdMnorm2 += QdMnorm[iDim]*QdMnorm[iDim]; -// -// /*--- Resolving the second grade equation for the density. ---*/ -// appo2 = -((2*sqrt(QdMnorm2)*RiemannExtr)+((4*Gamma*Pressure_out)/(pow(Gamma_Minus_One,2)))); -// Density_out = (-appo2+sqrt(max(0.0,pow(appo2,2)-4*QdMnorm2*pow(RiemannExtr,2))))/(2*pow(RiemannExtr,2)); -// -// Velocity2 = 0; -// for (iDim = 0; iDim < nDim; iDim++) Velocity2 += (Velocity[iDim]*Velocity[iDim]); -// -// /*--- Computation of the enthalpy, total energy, temperature and speed of sound. ---*/ -// H_out = H_in/Density_in + Fa/Density_out; -// Energy = H_out - Pressure_out/Density_out; -// if (tkeNeeded) Energy += GetTke_Inf(); -// Temperature_out = (Energy-0.5*Velocity2/(pow(Density_out,2)))*(Gamma_Minus_One/Gas_Constant); -// -// SoS_out = sqrt(Gamma*Gas_Constant*Temperature_out); -// -// /*--- Set the primitive variables. ---*/ -// V_outlet[0] = Temperature_out; -// for (iDim = 0; iDim < nDim; iDim++) -// V_outlet[iDim+1] = Velocity[iDim]/Density_out; -// V_outlet[nDim+1] = Pressure_out; -// V_outlet[nDim+2] = Density_out; -// V_outlet[nDim+3] = H_out; -// V_outlet[nDim+4] = SoS_out; -// conv_numerics->SetPrimitive(V_domain, V_outlet); -// } -// -// /*--- Grid Movement (NOT TESTED!)---*/ -// -// if (dynamic_grid) -// conv_numerics->SetGridVel(geometry->nodes->GetGridVel(iPoint), geometry->nodes->GetGridVel(iPoint)); -// -// /*--- Compute the residual using an upwind scheme ---*/ -// -// auto residual = conv_numerics->ComputeResidual(config); -// -// /*--- Update residual value ---*/ -// -// LinSysRes.AddBlock(iPoint, residual); -// -// /*--- Jacobian contribution for implicit integration ---*/ -// -// if (implicit) Jacobian.AddBlock2Diag(iPoint, residual.jacobian_i); -// } -// } -//} - void CEulerSolver::PrintVerificationError(const CConfig *config) const { if ((rank != MASTER_NODE) || (MGLevel != MESH_0)) return; diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index 07be1b9a3f7..c372a22f735 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -106,12 +106,12 @@ MARKER_ACTDISK = ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 12715.2, 0.0, 0.0, 12715. %(inlet face marker, outlet face marker, X_CG of inlet, Y_CG of inlet, Z_CG of inlet , % X_CG of outlet, Y_CG of outlet, Z_CG of outlet), X_CG, Y_CG, Z_CG of both inlet and % outlet markers should be same -MARKER_ACTDISK_CG= ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 0.0, 0.0,0.0,0.0) +MARKER_ACTDISK_BEM_CG= ( ACTDISK_IN, ACTDISK_OUT, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ) %Actuator Disk Axis %(inlet face marker, outlet face marker, % axis_x, axis_y, axis_z of inlet, axis_x, axis_y, axis_z of outlet), % axis of both inlet and outlet markers should be same -MARKER_ACTDISK_AXIS= ( ACTDISK_IN, ACTDISK_OUT , 1.0, 0.0, 0.0, 1.0,0.0,0.0) +MARKER_ACTDISK_BEM_AXIS= ( ACTDISK_IN, ACTDISK_OUT, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 ) % Input file containing the propeller section data and aerodynamic details of blade sections BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt % Propeller blade angle (Degrees) at 0.75*Radius for the current calculation diff --git a/config_template.cfg b/config_template.cfg index e29e6a77626..7bba2009560 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -949,7 +949,12 @@ MARKER_ACTDISK= ( NONE ) % Blade element: ( inlet face marker, outlet face marker, % X_CG of inlet, Y_CG of inlet, Z_CG of inlet, % X_CG of outlet, Y_CG of outlet, Z_CG of outlet ) -MARKER_ACTDISK_CG= ( NONE ) +MARKER_ACTDISK_BEM_CG= ( NONE ) +% +% Blade element: ( inlet face marker, outlet face marker, +% X_Axis of inlet, Y_Axis of inlet, Z_Axis of inlet, +% X_Axis of outlet, Y_Axis of outlet, Z_Axis of outlet ) +MARKER_ACTDISK_BEM_AXIS= ( NONE ) % % Actuator disk data input file name ACTDISK_FILENAME= actuatordisk.dat From 64591088ec411bb19a0cff9a161dd81de67eac9a Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sun, 22 Oct 2023 00:11:46 +0530 Subject: [PATCH 27/42] static RPM,CG,Axis set from config once. Other minor cleanup --- Common/include/CConfig.hpp | 1 - SU2_CFD/include/solvers/CEulerSolver.hpp | 35 ----------- SU2_CFD/src/solvers/CEulerSolver.cpp | 74 +++++++++--------------- 3 files changed, 27 insertions(+), 83 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index f60eb8f8fa0..c24d4b375f4 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -352,7 +352,6 @@ class CConfig { 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_RotRate; /*!< \brief Value of the Rotation Rate.*/ su2double **ActDiskBem_CG[3]; /*!< \brief Specified center for actuator disk BEM.*/ su2double **ActDiskBem_Axis[3]; /*!< \brief Specified axis for actuator disk BEM.*/ su2double BEM_blade_angle ; /*!< \brief Propeller blade angle.*/ diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index b722c16aa86..586c9c788c5 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -68,10 +68,6 @@ class CEulerSolver : public CFVMFlowSolverBase > ActDisk_DeltaP_r; /*!< \brief Value of the Delta P. */ vector > ActDisk_Thrust_r; /*!< \brief Value of the Delta P. */ vector > ActDisk_Torque_r; /*!< \brief Value of the Delta P. */ -//vector > ActDisk_RotRate; /*!< \brief Value of the Rotation Rate. */ -//vector > ActDisk_XCG; -//vector > ActDisk_YCG; -//vector > ActDisk_ZCG; vector > ActDisk_DeltaT; /*!< \brief Value of the Delta T. */ su2activevector @@ -1017,37 +1013,6 @@ class CEulerSolver : public CFVMFlowSolverBaseGetVelocity_Ref() / 550.0 << "." << endl; } - cout<GetActDiskOutlet_Thrust_BEM(Outlet_TagBound) <<" "<<"Torque_BEM(N-m).: "<< config->GetActDiskOutlet_Torque_BEM(Outlet_TagBound)<GetKind_ActDisk() == BLADE_ELEMENT) { + cout << setprecision(5); + cout << "Thrust_BEM (N): " << config->GetActDiskOutlet_Thrust_BEM(Outlet_TagBound) << ". "; + cout << "Torque_BEM (N-m): " << config->GetActDiskOutlet_Torque_BEM(Outlet_TagBound) << "." << endl; + } } } @@ -4132,10 +4126,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con static su2double ADBem_Diameter=0.0, ADBem_HubRadius=0.0, ADBem_Angle75R=0.0; static std::vector i_v, radius_v, chord_v, angle75r_v; static std::vector > alpha_m, cl_m, cd_m; - su2double ADBem_Axis[MAXNDIM] = {0.0}, ADBem_J = 0.0; - static su2double ADBem_Omega= 0.0; + static su2double ADBem_Omega = 0.0; static su2double ADBem_CG[MAXNDIM] = {0.0, 0.0, 0.0}; + static su2double ADBem_Axis[MAXNDIM] = {0.0}, ADBem_J = 0.0; /*--- BEM VLAD ---*/ const int BEM_MAX_ITER = 20; @@ -4156,31 +4150,24 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double Dens_FreeStream = config->GetDensity_FreeStream(); const su2double *Vel_FreeStream = config->GetVelocity_FreeStream(); - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + /*--- Input file provides force coefficients distributions along disk radius. + Initialization necessary only at initial iteration. ---*/ + if (InnerIter == 0) { + /*--- Get the RPM, CG and Axis from config. ---*/ + for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || - (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { + if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || + (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - Marker_Tag = config->GetMarker_All_TagBound(iMarker); - ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); - for (iDim=0; iDim < nDim; iDim++){ - ADBem_CG[iDim] = config->GetActDiskBem_CG(iDim, Marker_Tag, 0); - } - /* - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - SetActDisk_RotRate(iMarker, iVertex, ADBem_Omega); - SetActDisk_XCG(iMarker, iVertex, ADBem_XCG); - SetActDisk_YCG(iMarker, iVertex, ADBem_YCG); - SetActDisk_ZCG(iMarker, iVertex, ADBem_ZCG); + Marker_Tag = config->GetMarker_All_TagBound(iMarker); + ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); + for (iDim=0; iDim < nDim; iDim++){ + ADBem_CG[iDim] = config->GetActDiskBem_CG(iDim, Marker_Tag, 0); + ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); + } } - */ } - } - /*--- Input file provides force coefficients distributions along disk radius. - Initialization necessary only at initial iteration. ---*/ - if (InnerIter == 0) { /*--- Get the file name that contains the propeller data. ---*/ string ActDiskBem_filename = config->GetBEM_prop_filename(); ifstream ActDiskBem_file; @@ -4263,29 +4250,22 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); /*--- Read Swirl params. ---*/ - Omega_RPM = ADBem_Omega; // GetActDisk_RotRate(iMarker, iVertex); - Origin[0] = ADBem_CG[0]; // GetActDisk_CGX(iMarker, iVertex); - Origin[1] = ADBem_CG[1]; // GetActDisk_CGY(iMarker, iVertex); - Origin[2] = ADBem_CG[2]; // GetActDisk_CGZ(iMarker, iVertex); - + Omega_RPM = ADBem_Omega; omega_ref= config->GetOmega_Ref(); Lref = config->GetLength_Ref(); Omega_sw = Omega_RPM*(PI_NUMBER/30.0) / (omega_ref); // Swirl rate - Origin[0] = Origin[0]/Lref; - Origin[1] = Origin[1]/Lref; - Origin[2] = Origin[2]/Lref; + + /*--- Center of the rotor ---*/ + for (iDim = 0; iDim < nDim; iDim++) { Origin[iDim] = ADBem_CG[iDim] / Lref; } /*--- Compute the distance to the center of the rotor ---*/ geometry->vertex[iMarker][iVertex]->GetNormal(Normal); for (iDim = 0; iDim < nDim; iDim++) { Normal[iDim] = -Normal[iDim]; } /*--- Get propeller axis from config file. ---*/ - //ADBem_Axis[0] = 1.0; - //ADBem_Axis[1] = 0.0; - //ADBem_Axis[2] = 0.0; - for (iDim=0; iDim < nDim; iDim++){ - ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); - } + //for (iDim=0; iDim < nDim; iDim++){ + // ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); + //} for (iDim = 0; iDim < nDim; iDim++){ ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; } From 7cae4a4df75a353e4a5df466da8a55140fab6007 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sun, 22 Oct 2023 12:26:50 +0530 Subject: [PATCH 28/42] clang-format --- Common/include/CConfig.hpp | 14 +- Common/src/CConfig.cpp | 19 +- SU2_CFD/include/solvers/CEulerSolver.hpp | 6 +- SU2_CFD/src/solvers/CEulerSolver.cpp | 336 ++++++++++++----------- TestCases/parallel_regression.py | 2 +- 5 files changed, 198 insertions(+), 179 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index c24d4b375f4..a9fe9b4b710 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -1376,9 +1376,9 @@ class CConfig { unsigned short & nMarker_ActDiskInlet, unsigned short & nMarker_ActDiskOutlet, string* & Marker_ActDiskInlet, string* & Marker_ActDiskOutlet, su2double** & ActDisk_PressJump, su2double** & ActDisk_TempJump, su2double** & ActDisk_Omega); - void addActDiskBemOption(const string & name, - unsigned short & nMarker_ActDiskBemInlet, unsigned short & nMarker_ActDiskBemOutlet, string* & Marker_ActDiskBemInlet, string* & Marker_ActDiskBemOutlet, - su2double** & ActDiskBem_X, su2double** & ActDiskBem_Y, su2double** & ActDiskBem_Z); + void addActDiskBemOption(const string& name, + unsigned short& nMarker_ActDiskBemInlet, unsigned short& nMarker_ActDiskBemOutlet, string*& Marker_ActDiskBemInlet, string*& Marker_ActDiskBemOutlet, + su2double**& ActDiskBem_X, su2double**& ActDiskBem_Y, su2double**& ActDiskBem_Z); void addWallFunctionOption(const string &name, unsigned short &list_size, string* &string_field, WALL_FUNCTIONS* &val_Kind_WF, @@ -8280,14 +8280,18 @@ class CConfig { * \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; } + 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; } + 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. diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index b21f896c7df..eb64f51ddf9 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -557,13 +557,15 @@ void CConfig::addActDiskOption(const string & name, unsigned short & nMarker_Act option_map.insert(pair(name, val)); } -void CConfig::addActDiskBemOption(const string & name, - unsigned short & nMarker_ActDiskBemInlet, unsigned short & nMarker_ActDiskBemOutlet, - string* & Marker_ActDiskBemInlet, string* & Marker_ActDiskBemOutlet, - su2double** & ActDiskBem_X, su2double** & ActDiskBem_Y, su2double** & ActDiskBem_Z) { +void CConfig::addActDiskBemOption(const string& name, + unsigned short& nMarker_ActDiskBemInlet, unsigned short& nMarker_ActDiskBemOutlet, + string*& Marker_ActDiskBemInlet, string*& Marker_ActDiskBemOutlet, + su2double**& ActDiskBem_X, su2double**& ActDiskBem_Y, su2double**& ActDiskBem_Z) { assert(option_map.find(name) == option_map.end()); all_options.insert(pair(name, true)); - COptionBase* val = new COptionActDiskBem(name, nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, + COptionBase* val = new COptionActDiskBem(name, + nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, + Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, ActDiskBem_X, ActDiskBem_Y, ActDiskBem_Z); option_map.insert(pair(name, val)); } @@ -1678,7 +1680,7 @@ void CConfig::SetConfig_Options() { /* 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")); + 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); @@ -5728,8 +5730,8 @@ 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] (); + 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]; @@ -7653,7 +7655,6 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) { cout << "Actuator disk BEM method propeller data read from file: " << GetBEM_prop_filename() << endl; } } - } bool CConfig::TokenizeString(string & str, string & option_name, diff --git a/SU2_CFD/include/solvers/CEulerSolver.hpp b/SU2_CFD/include/solvers/CEulerSolver.hpp index 586c9c788c5..63f82f3fa7e 100644 --- a/SU2_CFD/include/solvers/CEulerSolver.hpp +++ b/SU2_CFD/include/solvers/CEulerSolver.hpp @@ -65,9 +65,9 @@ class CEulerSolver : public CFVMFlowSolverBase > DonorGlobalIndex; /*!< \brief Value of the donor global index. */ vector DonorPrimVar; /*!< \brief Value of the donor variables at each boundary. */ vector > ActDisk_DeltaP; /*!< \brief Value of the Delta P. */ - vector > ActDisk_DeltaP_r; /*!< \brief Value of the Delta P. */ - vector > ActDisk_Thrust_r; /*!< \brief Value of the Delta P. */ - vector > ActDisk_Torque_r; /*!< \brief Value of the Delta P. */ + vector > ActDisk_DeltaP_r; /*!< \brief Value of the DeltaP_r. */ + vector > ActDisk_Thrust_r; /*!< \brief Value of the Thrust_r. */ + vector > ActDisk_Torque_r; /*!< \brief Value of the Torque_r. */ vector > ActDisk_DeltaT; /*!< \brief Value of the Delta T. */ su2activevector diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 7f22e2a2f78..3f263d9e375 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -2527,7 +2527,7 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns Velocity2, Density, Area, SoundSpeed, TotalPressure, Vel_Infty2, RamDrag, TotalTemperature, VelocityJet, Vel_Infty, MaxPressure, MinPressure, MFR, InfVel2; - su2double DeltaPressure=0.0, DeltaThrust=0.0, DeltaTorque=0.0; + su2double DeltaPressure = 0.0, DeltaThrust = 0.0, DeltaTorque = 0.0; unsigned short iMarker_Inlet, iMarker_Outlet, nMarker_Inlet, nMarker_Outlet; string Inlet_TagBound, Outlet_TagBound; su2double DeltaPress = 0.0, DeltaTemp = 0.0, TotalPressRatio = 0.0, TotalTempRatio = 0.0, StaticPressRatio = 0.0, StaticTempRatio = 0.0, @@ -2706,9 +2706,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns Outlet_Area[iMarker] += Area; Outlet_GrossThrust[iMarker] += GrossThrust; Outlet_Power[iMarker] += MassFlow*Cp*TotalTemperature; - Outlet_DeltaP[iMarker] += DeltaPressure*Area; - Outlet_Thrust[iMarker] += DeltaThrust*Area; - Outlet_Torque[iMarker] += DeltaTorque*Area; + Outlet_DeltaP[iMarker] += DeltaPressure * Area; + Outlet_Thrust[iMarker] += DeltaThrust * Area; + Outlet_Torque[iMarker] += DeltaTorque * Area; su2double Outlet_ForceX = -(Pressure - Pressure_Inf)*Vector[0] -MassFlow*Velocity[0]; su2double Outlet_ForceY = -(Pressure - Pressure_Inf)*Vector[1] -MassFlow*Velocity[1]; @@ -3338,10 +3338,10 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns cout << setprecision(1) << Power * Ref * config->GetVelocity_Ref() / 550.0 << "." << endl; } - if (config->GetKind_ActDisk() == BLADE_ELEMENT) { + if (config->GetKind_ActDisk() == BLADE_ELEMENT) { cout << setprecision(5); cout << "Thrust_BEM (N): " << config->GetActDiskOutlet_Thrust_BEM(Outlet_TagBound) << ". "; - cout << "Torque_BEM (N-m): " << config->GetActDiskOutlet_Torque_BEM(Outlet_TagBound) << "." << endl; + cout << "Torque_BEM (N-m): " << config->GetActDiskOutlet_Torque_BEM(Outlet_TagBound) << "." << endl; } } @@ -4095,7 +4095,7 @@ void CEulerSolver::ReadActDisk_InputFile(CGeometry *geometry, CSolver **solver_c } void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_container, - CConfig *config, unsigned short iMesh, bool Output) { + CConfig *config, unsigned short iMesh, bool Output) { /*! * \function SetActDisk_BEM_VLAD @@ -4122,8 +4122,8 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con unsigned long iVertex, iPoint; string Marker_Tag; int iSection, iAlpha; - static int ADBem_NBlade=0, ADBem_NSection=0, ADBem_NAlpha=0; - static su2double ADBem_Diameter=0.0, ADBem_HubRadius=0.0, ADBem_Angle75R=0.0; + static int ADBem_NBlade = 0, ADBem_NSection = 0, ADBem_NAlpha = 0; + static su2double ADBem_Diameter = 0.0, ADBem_HubRadius = 0.0, ADBem_Angle75R = 0.0; static std::vector i_v, radius_v, chord_v, angle75r_v; static std::vector > alpha_m, cl_m, cd_m; @@ -4133,22 +4133,22 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- BEM VLAD ---*/ const int BEM_MAX_ITER = 20; - su2double Omega_sw=0.0, Omega_RPM=0.0, Origin[3]={0.0}, radius_[3]={0.0}; - static su2double omega_ref=0.0, Lref=0.0; - static su2double RPM=0.0, blade_angle=0.0, dia=0.0, r_tip=0.0, rps=0.0, radius=0.0; - static su2double V=0.0, rho=0.0, T=0.0; - static su2double Torque=0.0, dp_av=0.0, dp_at_r=0.0; + su2double Omega_sw = 0.0, Omega_RPM = 0.0, Origin[3] = {0.0}, radius_[3] = {0.0}; + static su2double omega_ref = 0.0, Lref = 0.0; + static su2double RPM = 0.0, blade_angle = 0.0, dia = 0.0, r_tip = 0.0, rps = 0.0, radius = 0.0; + static su2double V = 0.0, rho = 0.0, T = 0.0; + static su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; static std::vector DtDr; - static su2double Target_Press_Jump=0.0, Area=0.0, UnitNormal[3]={0.0}, Vn=0.0; - static su2double Fa=0.0, Ft=0.0, Fr=0.0, Fx=0.0, Fy=0.0, Fz=0.0, dCp_v=0.0, dCr_v=0.0, rad_v=0.0; - su2double *V_domain=0, *Coord=0; + static su2double Target_Press_Jump = 0.0, Area = 0.0, UnitNormal[3] = {0.0}, Vn = 0.0; + static su2double Fa = 0.0, Ft = 0.0, Fr = 0.0, Fx = 0.0, Fy = 0.0, Fz = 0.0, dCp_v = 0.0, dCr_v = 0.0, rad_v = 0.0; + su2double *V_domain = 0, *Coord = 0; static su2double loc_Torque = 0.0; static su2double loc_thrust = 0.0; static su2double tot_area = 0.0, tot_tq = 0.0; unsigned long InnerIter = config->GetInnerIter(); su2double Dens_FreeStream = config->GetDensity_FreeStream(); - const su2double *Vel_FreeStream = config->GetVelocity_FreeStream(); + const su2double* Vel_FreeStream = config->GetVelocity_FreeStream(); /*--- Input file provides force coefficients distributions along disk radius. Initialization necessary only at initial iteration. ---*/ @@ -4161,7 +4161,7 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con Marker_Tag = config->GetMarker_All_TagBound(iMarker); ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); - for (iDim=0; iDim < nDim; iDim++){ + for (iDim = 0; iDim < nDim; iDim++) { ADBem_CG[iDim] = config->GetActDiskBem_CG(iDim, Marker_Tag, 0); ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); } @@ -4180,30 +4180,30 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con string text_line_appo; - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); /*--- Read and assign the value of the number of propeller blades. ---*/ - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); istringstream NBlade_value(text_line_appo); NBlade_value >> ADBem_NBlade; /*--- Read and assign the value of the propeller diameter. ---*/ - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); istringstream Diameter_value(text_line_appo); Diameter_value >> ADBem_Diameter; /*--- Read and assign the value of the propeller hub radius. ---*/ - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); istringstream HubR_value(text_line_appo); HubR_value >> ADBem_HubRadius; /*--- Read and assign the value of the blade angle at 75% of R. ---*/ - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); istringstream Angle75R_value(text_line_appo); Angle75R_value >> ADBem_Angle75R; - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); /*--- Read and assign the value of the number of radial propeller blade sections and alphas for each. ---*/ - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); istringstream NSection_NAlpha_value(text_line_appo); NSection_NAlpha_value >> ADBem_NSection >> ADBem_NAlpha; @@ -4213,10 +4213,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con chord_v.resize(ADBem_NSection, 0.0); angle75r_v.resize(ADBem_NSection, 0.0); - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); /*--- Read and assign the values of the propeller blade section's id, radius, chord, angle75R. ---*/ for (iSection = 0; iSection < ADBem_NSection; iSection++) { - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); istringstream sectionStream(text_line_appo); sectionStream >> i_v[iSection] >> radius_v[iSection] >> chord_v[iSection] >> angle75r_v[iSection]; } @@ -4228,11 +4228,11 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- Read and assign the values for each of the propeller blade section's alpha, cl, cd. ---*/ for (iSection = 0; iSection < ADBem_NSection; iSection++) { - getline (ActDiskBem_file, text_line_appo); + getline(ActDiskBem_file, text_line_appo); for (iAlpha = 0; iAlpha < ADBem_NAlpha; iAlpha++) { - getline (ActDiskBem_file, text_line_appo); - istringstream alphaStream(text_line_appo); - alphaStream >> alpha_m[iAlpha][iSection] >> cl_m[iAlpha][iSection] >> cd_m[iAlpha][iSection]; + getline(ActDiskBem_file, text_line_appo); + istringstream alphaStream(text_line_appo); + alphaStream >> alpha_m[iAlpha][iSection] >> cl_m[iAlpha][iSection] >> cd_m[iAlpha][iSection]; } } } @@ -4240,7 +4240,7 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- Update the propeller load according to the modified flow field after every 40 inner iterations. ---*/ if (InnerIter % 40 == 0) { dia = ADBem_Diameter; - r_tip = 0.5 * dia ; + r_tip = 0.5 * dia; su2double Normal[MAXNDIM]; for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { @@ -4251,38 +4251,43 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- Read Swirl params. ---*/ Omega_RPM = ADBem_Omega; - omega_ref= config->GetOmega_Ref(); + omega_ref = config->GetOmega_Ref(); Lref = config->GetLength_Ref(); - Omega_sw = Omega_RPM*(PI_NUMBER/30.0) / (omega_ref); // Swirl rate + Omega_sw = Omega_RPM * (PI_NUMBER / 30.0) / (omega_ref); // Swirl rate /*--- Center of the rotor ---*/ - for (iDim = 0; iDim < nDim; iDim++) { Origin[iDim] = ADBem_CG[iDim] / Lref; } + for (iDim = 0; iDim < nDim; iDim++) { + Origin[iDim] = ADBem_CG[iDim] / Lref; + } /*--- Compute the distance to the center of the rotor ---*/ geometry->vertex[iMarker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) { Normal[iDim] = -Normal[iDim]; } + for (iDim = 0; iDim < nDim; iDim++) { + Normal[iDim] = -Normal[iDim]; + } /*--- Get propeller axis from config file. ---*/ - //for (iDim=0; iDim < nDim; iDim++){ - // ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); - //} for (iDim = 0; iDim < nDim; iDim++){ ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; } Area = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { Area += Normal[iDim]*Normal[iDim]; } - Area = sqrt (Area); - - for (iDim = 0; iDim < nDim; iDim++) { UnitNormal[iDim] = Normal[iDim]/Area; } - + for (iDim = 0; iDim < nDim; iDim++) { + Area += Normal[iDim] * Normal[iDim]; + } + Area = sqrt(Area); + + for (iDim = 0; iDim < nDim; iDim++) { + UnitNormal[iDim] = Normal[iDim] / Area; + } + if (geometry->nodes->GetDomain(iPoint)) { Coord = geometry->nodes->GetCoord(iPoint); } - + radius = 0.0; - for (iDim = 0; iDim < nDim; iDim++){ - radius += (Coord[iDim]-Origin[iDim])*(Coord[iDim]-Origin[iDim]); - radius_[iDim] = (Coord[iDim]-Origin[iDim]); + for (iDim = 0; iDim < nDim; iDim++) { + radius += (Coord[iDim] - Origin[iDim]) * (Coord[iDim] - Origin[iDim]); + radius_[iDim] = (Coord[iDim] - Origin[iDim]); } radius = sqrt(radius); @@ -4291,13 +4296,15 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con if (abs(Omega_sw) > 1.0e-1) { Vn = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim+1]*UnitNormal[iDim]; } + for (iDim = 0; iDim < nDim; iDim++) { + Vn += V_domain[iDim + 1] * UnitNormal[iDim]; + } RPM = abs(Omega_RPM); - rps = RPM/60.0; - ADBem_J = Vel_FreeStream[0]/(rps*dia); - rho = V_domain[nDim+2]; - T = V_domain[0]; + rps = RPM / 60.0; + ADBem_J = Vel_FreeStream[0] / (rps * dia); + rho = V_domain[nDim + 2]; + T = V_domain[0]; blade_angle = config->GetBEM_blade_angle(); V = config->GetModVel_FreeStream(); V = fabs(Vn); @@ -4318,166 +4325,172 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double rad_p = radius; - int j, isec,converged, n_iter; + int j, isec, converged, n_iter; int NR = sprop_sec_nrad; su2double r_hub, alpha_corr, cl_corr_fac; su2double base_mach, s_mach, b_num, thrust, torque; su2double r_dash, t_loss, c_phi, rad, phi, alpha, radtodeg; - su2double bnew, V0, V2, cl=0.0, cd=0.0, Vlocal, DqDr=0.0, tem1, tem2, q; + su2double bnew, V0, V2, cl = 0.0, cd = 0.0, Vlocal, DqDr = 0.0, tem1, tem2, q; std::vector delta_r(ADBem_NSection, 0.0); std::vector b(ADBem_NSection, 0.0); static std::vector Dtorq(ADBem_NSection, 0.0); - + su2double n, omega, a0, den; su2double ang_offset = 0.0; - - radtodeg = 180.0/M_PI; + + radtodeg = 180.0 / M_PI; dia = ADBem_Diameter; r_hub = ADBem_HubRadius; - r_tip = 0.5*dia ; + r_tip = 0.5 * dia; ang_offset = blade_angle - ADBem_Angle75R; - alpha_corr = 0.0; - base_mach = 0.22 ; - b_num = sqrt(1.0-base_mach*base_mach); - a0 = sqrt(1.4*287*T); + alpha_corr = 0.0; + base_mach = 0.22; + b_num = sqrt(1.0 - base_mach * base_mach); + a0 = sqrt(1.4 * 287 * T); /*--- Change pitch by ang_offset and calculate delta_r for integration by trapezoidal rule. ---*/ n = RPM / 60.0; - omega = n*2.0*M_PI; + omega = n * 2.0 * M_PI; - for (j=0; j < NR; j++) { - if (j < 1) { delta_r[j] = sprop_sec_r1[j+1] - r_hub; } - else { - if (j < NR-1) { delta_r[j] = sprop_sec_r1[j+1] - sprop_sec_r1[j-1]; } - else { delta_r[j] = r_tip - sprop_sec_r1[j-1]; } + for (j = 0; j < NR; j++) { + if (j < 1) { + delta_r[j] = sprop_sec_r1[j + 1] - r_hub; + } else { + if (j < NR - 1) { + delta_r[j] = sprop_sec_r1[j + 1] - sprop_sec_r1[j - 1]; + } else { + delta_r[j] = r_tip - sprop_sec_r1[j - 1]; + } } delta_r[j] *= 0.5; } thrust = 0.0; torque = 0.0; - - for (j=0; j < NR; j++) { + + for (j = 0; j < NR; j++) { b[j] = 0.01; converged = 0; n_iter = 1; while (converged == 0) { - V2 = omega*sprop_sec_r1[j]*(1-b[j]); + V2 = omega * sprop_sec_r1[j] * (1 - b[j]); V0 = V; - phi=atan2(V0,V2); + phi = atan2(V0, V2); - alpha=sprop_sec_setangle[j] + ang_offset-radtodeg*phi+alpha_corr; + alpha = sprop_sec_setangle[j] + ang_offset - radtodeg * phi + alpha_corr; rad = sprop_sec_r1[j]; /*--- get cl, cd from lookup table. ---*/ - isec = j+1; + isec = j + 1; { - int i, salf=0; - su2double fact; - - /*--- interpolating values of cl and cd for given alpha. ---*/ - if ( alpha >= sprop_sec_alf[salf][isec-1] - && alpha <= sprop_sec_alf[sprop_sec_nalf-1][isec-1]) { - for(i=0; i < sprop_sec_nalf-1; i++) { - if (alpha>=sprop_sec_alf[i][isec-1] && alpha <= sprop_sec_alf[i+1][isec-1]) { - fact = (alpha-sprop_sec_alf[i][isec-1]) - / (sprop_sec_alf[i+1][isec-1]-sprop_sec_alf[i][isec-1]); - cl = sprop_sec_cl_arr[i][isec-1] - + fact * (sprop_sec_cl_arr[i+1][isec-1] - sprop_sec_cl_arr[i][isec-1]); - cd = sprop_sec_cd_arr[i][isec-1] - + fact * (sprop_sec_cd_arr[i+1][isec-1] - sprop_sec_cd_arr[i][isec-1]); - } - } - } else { - if (alpha < sprop_sec_alf[salf][isec-1]) { - cl = sprop_sec_cl_arr[0][isec-1]; - cd = sprop_sec_cd_arr[0][isec-1]; - } - if (alpha > sprop_sec_alf[sprop_sec_nalf-1][isec-1]) { - cl = sprop_sec_cl_arr[sprop_sec_nalf-1][isec-1]; - cd = sprop_sec_cd_arr[sprop_sec_nalf-1][isec-1]; - } - } + int i, salf = 0; + su2double fact; + + /*--- interpolating values of cl and cd for given alpha. ---*/ + if (alpha >= sprop_sec_alf[salf][isec - 1] && + alpha <= sprop_sec_alf[sprop_sec_nalf - 1][isec - 1]) { + for (i = 0; i < sprop_sec_nalf - 1; i++) { + if (alpha >= sprop_sec_alf[i][isec - 1] && alpha <= sprop_sec_alf[i + 1][isec - 1]) { + fact = (alpha - sprop_sec_alf[i][isec - 1]) + / (sprop_sec_alf[i + 1][isec - 1] - sprop_sec_alf[i][isec - 1]); + cl = sprop_sec_cl_arr[i][isec - 1] + + fact * (sprop_sec_cl_arr[i + 1][isec - 1] - sprop_sec_cl_arr[i][isec - 1]); + cd = sprop_sec_cd_arr[i][isec - 1] + + fact * (sprop_sec_cd_arr[i + 1][isec - 1] - sprop_sec_cd_arr[i][isec - 1]); + } + } + } else { + if (alpha < sprop_sec_alf[salf][isec - 1]) { + cl = sprop_sec_cl_arr[0][isec - 1]; + cd = sprop_sec_cd_arr[0][isec - 1]; + } + if (alpha > sprop_sec_alf[sprop_sec_nalf - 1][isec - 1]) { + cl = sprop_sec_cl_arr[sprop_sec_nalf - 1][isec - 1]; + cd = sprop_sec_cd_arr[sprop_sec_nalf - 1][isec - 1]; + } + } } - Vlocal = sqrt(V0*V0 + V2*V2); + Vlocal = sqrt(V0 * V0 + V2 * V2); q = 0.5 * rho * Vlocal * Vlocal; s_mach = Vlocal / a0; cl_corr_fac = 1.0; if (s_mach > base_mach) { - den = 1.0-s_mach*s_mach; + den = 1.0 - s_mach * s_mach; if (den > 0.0) cl_corr_fac = b_num / sqrt(den); } cl *= cl_corr_fac; /*--- tip loss factor. ---*/ - r_dash = rad / r_tip+1.0e-5; - c_phi = cos(phi) ; + r_dash = rad / r_tip + 1.0e-5; + c_phi = cos(phi); t_loss = 1.0; if (r_dash > 0.90) { - t_loss = (2.0/M_PI) * acos(exp(-(1.0*s_prop_nblades*(1-r_dash)/(r_dash*c_phi)))) ; + t_loss = (2.0 / M_PI) * acos(exp(-(1.0 * s_prop_nblades * (1 - r_dash) / (r_dash * c_phi)))); } - - DtDr[j] = q * s_prop_nblades * sprop_sec_chord[j] * (cl*cos(phi) - cd*sin(phi)); - DqDr = q * s_prop_nblades * sprop_sec_chord[j] * rad * (cd*cos(phi) + cl*sin(phi)); - + + DtDr[j] = q * s_prop_nblades * sprop_sec_chord[j] * (cl * cos(phi) - cd * sin(phi)); + DqDr = q * s_prop_nblades * sprop_sec_chord[j] * rad * (cd * cos(phi) + cl * sin(phi)); + DtDr[j] *= t_loss; DqDr *= t_loss; - - tem2 = DqDr / (4.0*M_PI * rad*rad*rad * rho * V * omega); + + tem2 = DqDr / (4.0 * M_PI * rad * rad * rad * rho * V * omega); bnew = 0.6 * b[j] + 0.4 * tem2; - if (bnew > 0.9) bnew = 0.9; - if (fabs(bnew-b[j]) < 1.0e-5) { - converged = 1; + if (bnew > 0.9) bnew = 0.9; + if (fabs(bnew - b[j]) < 1.0e-5) { + converged = 1; + } + if (bnew < 0.1) { + b[j] = bnew; } - if (bnew < 0.1) { b[j]=bnew; } - n_iter++ ; + n_iter++; if (n_iter > BEM_MAX_ITER) { - converged=1; + converged = 1; } } - thrust=thrust+DtDr[j]*delta_r[j]; - torque=torque+DqDr*delta_r[j]; + thrust = thrust + DtDr[j] * delta_r[j]; + torque = torque + DqDr * delta_r[j]; Dtorq[j] = DqDr; } - - tem1 = rho*n*n*dia*dia*dia*dia; - tem2 = tem1*dia; - - Torque=2.0*M_PI* torque; - dp_av=2.0*M_PI* torque; - - for (j=0; j < NR; j++) { - DtDr[j] /= (2.0*M_PI * sprop_sec_r1[j]) ; + + tem1 = rho * n * n * dia * dia * dia * dia; + tem2 = tem1 * dia; + + Torque = 2.0 * M_PI * torque; + dp_av = 2.0 * M_PI * torque; + + for (j = 0; j < NR; j++) { + DtDr[j] /= (2.0 * M_PI * sprop_sec_r1[j]); Dtorq[j] = Dtorq[j]; } - + if (rad_p < sprop_sec_r1[0]) { - tem2 = sprop_sec_r1[0] - r_hub; - tem1 = (rad_p - r_hub)/tem2; + tem2 = sprop_sec_r1[0] - r_hub; + tem1 = (rad_p - r_hub) / tem2; tem2 = 1.0 - tem1; - dp_at_r = DtDr[0]*tem1; - Torque = Dtorq[0]*tem1; + dp_at_r = DtDr[0] * tem1; + Torque = Dtorq[0] * tem1; } else { if (rad_p > r_tip) { dp_at_r = 0.0; Torque = 0.0; } else { - if (rad_p > sprop_sec_r1[NR-1]) { - tem2 = r_tip - sprop_sec_r1[NR-1]; - tem1 = (rad_p - sprop_sec_r1[NR-1])/tem2 ; + if (rad_p > sprop_sec_r1[NR - 1]) { + tem2 = r_tip - sprop_sec_r1[NR - 1]; + tem1 = (rad_p - sprop_sec_r1[NR - 1]) / tem2; tem2 = 1.0 - tem1; - dp_at_r = DtDr[NR-1]*tem2; - Torque = Dtorq[NR-1]*tem2; + dp_at_r = DtDr[NR - 1] * tem2; + Torque = Dtorq[NR - 1] * tem2; } else { - for (j=0; j < NR-1; j++) { - if ((sprop_sec_r1[j] < rad_p) && (sprop_sec_r1[j+1] >= rad_p)) { - tem2 = sprop_sec_r1[j+1] - sprop_sec_r1[j]; - tem1 = (rad_p - sprop_sec_r1[j])/tem2 ; - tem2 = 1.0 - tem1; - dp_at_r = DtDr[j]*tem2+DtDr[j+1]*tem1; - Torque = Dtorq[j]*tem2+Dtorq[j+1]*tem1; + for (j = 0; j < NR - 1; j++) { + if ((sprop_sec_r1[j] < rad_p) && (sprop_sec_r1[j + 1] >= rad_p)) { + tem2 = sprop_sec_r1[j + 1] - sprop_sec_r1[j]; + tem1 = (rad_p - sprop_sec_r1[j]) / tem2; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[j] * tem2 + DtDr[j + 1] * tem1; + Torque = Dtorq[j] * tem2 + Dtorq[j + 1] * tem1; } } } @@ -4486,27 +4499,28 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con } tot_area += Area; - loc_Torque += Torque*Area; + loc_Torque += Torque * Area; tot_tq += dp_av; - loc_thrust += dp_at_r*Area; + loc_thrust += dp_at_r * Area; Target_Press_Jump = dp_at_r; ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; - ActDisk_Torque_r[iMarker][iVertex] = Torque/(2*M_PI*radius); + ActDisk_Torque_r[iMarker][iVertex] = Torque / (2 * M_PI * radius); /*--- Non-dimensionalize the elemental load. ---*/ - dCp_v = Torque*((Omega_sw*r_tip)/(rho*rps*rps*rps*pow(dia,5))); + dCp_v = Torque * ((Omega_sw * r_tip) / (rho * rps * rps * rps * pow(dia, 5))); /*--- Force radial load to 0 as there is no information of radial load from BEM. ---*/ dCr_v = 0.0; - rad_v = radius/r_tip; + rad_v = radius / r_tip; Fa = dp_at_r; - Ft = (dCp_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ - ((ADBem_J*PI_NUMBER*rad_v)*(ADBem_J*PI_NUMBER*rad_v))) / config->GetPressure_Ref(); - Fr = (dCr_v*(2*Dens_FreeStream*pow(Vel_FreeStream[0],2))/ - (pow(ADBem_J,2)*PI_NUMBER*rad_v)) / config->GetPressure_Ref(); - Fx = (Ft+Fr)*(radius_[0]/(radius)); - Fy = (Ft+Fr)*(radius_[2]/(radius)); - Fz = -(Ft+Fr)*(radius_[1]/(radius)); + Ft = (dCp_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / + ((ADBem_J * PI_NUMBER * rad_v) * (ADBem_J * PI_NUMBER * rad_v))) / + config->GetPressure_Ref(); + Fr = (dCr_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / (pow(ADBem_J, 2) * PI_NUMBER * rad_v)) / + config->GetPressure_Ref(); + Fx = (Ft + Fr) * (radius_[0] / (radius)); + Fy = (Ft + Fr) * (radius_[2] / (radius)); + Fz = -(Ft + Fr) * (radius_[1] / (radius)); ActDisk_Fa_BEM[iMarker][iVertex] = Fa; ActDisk_Fx_BEM[iMarker][iVertex] = Fx; ActDisk_Fy_BEM[iMarker][iVertex] = Fy; @@ -8124,7 +8138,7 @@ void CEulerSolver::BC_ActDisk_Inlet(CGeometry *geometry, CSolver **solver_contai unsigned short Kind_ActDisk = config->GetKind_ActDisk(); - if(Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT){ + if (Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT) { BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, true); } else{ @@ -8138,7 +8152,7 @@ void CEulerSolver::BC_ActDisk_Outlet(CGeometry *geometry, CSolver **solver_conta unsigned short Kind_ActDisk = config->GetKind_ActDisk(); - if(Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT){ + if (Kind_ActDisk == VARIABLE_LOAD || Kind_ActDisk == BLADE_ELEMENT) { BC_ActDisk_VariableLoad(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker, false); } else{ diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 6ad9c4c3708..8c4203a45e3 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -491,7 +491,7 @@ def main(): propeller.cfg_dir = "rans/actuatordisk_bem" propeller.cfg_file = "actuatordisk_bem.cfg" propeller.test_iter = 15 - propeller.test_vals = [4.4835e-01, -5.226958, -8.297197, 0, -0.004325, -0.565388] + propeller.test_vals = [3.3764e-01, -5.226958, -8.297197, 0, -0.004325, -0.565388] propeller.timeout = 3200 test_list.append(actuatordisk_bem) From 98562a4bf66db0a5bb29cc4d5a231e47542efff7 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Wed, 25 Oct 2023 14:44:13 +0530 Subject: [PATCH 29/42] accidental change of externals/codi/ subprojects/CoolProp/ checked out from develop branch --- externals/codi | 2 +- subprojects/CoolProp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/externals/codi b/externals/codi index 8ee822a9b0b..eee1b5eea2d 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 8ee822a9b0bb8235a2494467b774e27fb64ff14f +Subproject commit eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2 diff --git a/subprojects/CoolProp b/subprojects/CoolProp index 0ce42fcf3bb..a14412559e5 160000 --- a/subprojects/CoolProp +++ b/subprojects/CoolProp @@ -1 +1 @@ -Subproject commit 0ce42fcf3bb2c373512bc825a4f0c1973a78f307 +Subproject commit a14412559e523e762ddee9dd68b8250343ef941f From a4b8bdd2c12354b9c1454a79b7cdd0f38fc4b08b Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" <119933136+josy-nal@users.noreply.github.com> Date: Thu, 2 Nov 2023 07:57:56 +0530 Subject: [PATCH 30/42] Update Common/include/CConfig.hpp Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> --- Common/include/CConfig.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index a9fe9b4b710..c9bfb36669b 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -6687,12 +6687,12 @@ class CConfig { /*! * \brief Get the blade angle of the propeller. */ - su2double GetBEM_blade_angle(void) { return BEM_blade_angle; } + su2double GetBEM_blade_angle(void) const { return BEM_blade_angle; } /*! * \brief Get the filename of the propeller. */ - string GetBEM_prop_filename(void) { return BEM_prop_filename; } + const string& GetBEM_prop_filename(void) const { return BEM_prop_filename; } /*! * \brief Get Actuator Disk Outlet for boundary val_marker (actuator disk inlet). From 81eb4910f959deaa9ed505b6d2fee83845d428ea Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Fri, 3 Nov 2023 09:52:37 +0530 Subject: [PATCH 31/42] eliminate class COptionActDiskBem --- Common/include/option_structure.inl | 100 ---------------------------- Common/src/CConfig.cpp | 8 +-- 2 files changed, 4 insertions(+), 104 deletions(-) diff --git a/Common/include/option_structure.inl b/Common/include/option_structure.inl index 8bd9644b42a..ce94055fca5 100644 --- a/Common/include/option_structure.inl +++ b/Common/include/option_structure.inl @@ -1772,106 +1772,6 @@ class COptionActDisk : public COptionBase { } }; -class COptionActDiskBem : public COptionBase { - string name; // identifier for the option - unsigned short& inlet_size; - unsigned short& outlet_size; - string*& marker_inlet; - string*& marker_outlet; - su2double**& dir_x; - su2double**& dir_y; - su2double**& dir_z; - - public: - COptionActDiskBem(const string name, unsigned short& nMarker_ActDiskInlet, unsigned short& nMarker_ActDiskOutlet, - string*& Marker_ActDiskInlet, string*& Marker_ActDiskOutlet, - su2double**& ActDiskBem_X, su2double**& ActDiskBem_Y, su2double**& ActDiskBem_Z) - : inlet_size(nMarker_ActDiskInlet), - outlet_size(nMarker_ActDiskOutlet), - marker_inlet(Marker_ActDiskInlet), - marker_outlet(Marker_ActDiskOutlet), - dir_x(ActDiskBem_X), - dir_y(ActDiskBem_Y), - dir_z(ActDiskBem_Z) { - this->name = name; - } - - ~COptionActDiskBem() override{}; - string SetValue(const vector& option_value) override { - COptionBase::SetValue(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]; - this->marker_outlet = new string[this->outlet_size]; - - this->dir_x = new su2double*[this->inlet_size]; - this->dir_y = new su2double*[this->inlet_size]; - this->dir_z = new su2double*[this->inlet_size]; - for (int i = 0; i < this->inlet_size; i++) { - this->dir_x[i] = new su2double[2]; - this->dir_y[i] = new su2double[2]; - this->dir_z[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->dir_x[i][0])) { - return badValue(tname, this->name); - } - istringstream ss_2nd(option_value[mod_num * i + 3]); - if (!(ss_2nd >> this->dir_y[i][0])) { - return badValue(tname, this->name); - } - istringstream ss_3rd(option_value[mod_num * i + 4]); - if (!(ss_3rd >> this->dir_z[i][0])) { - return badValue(tname, this->name); - } - istringstream ss_4th(option_value[mod_num * i + 5]); - if (!(ss_4th >> this->dir_x[i][1])) { - return badValue(tname, this->name); - } - istringstream ss_5th(option_value[mod_num * i + 6]); - if (!(ss_5th >> this->dir_y[i][1])) { - return badValue(tname, this->name); - } - istringstream ss_6th(option_value[mod_num * i + 7]); - if (!(ss_6th >> this->dir_z[i][1])) { - return badValue(tname, this->name); - } - } - return ""; - } - void SetDefault() override { - this->inlet_size = 0; - this->outlet_size = 0; - this->marker_inlet = nullptr; - this->marker_outlet = nullptr; - this->dir_x = nullptr; - this->dir_y = nullptr; - this->dir_z = nullptr; - } -}; - class COptionWallFunction : public COptionBase { string name; // identifier for the option unsigned short& nMarkers; diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index eb64f51ddf9..959c97e886d 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -563,10 +563,10 @@ void CConfig::addActDiskBemOption(const string& name, su2double**& ActDiskBem_X, su2double**& ActDiskBem_Y, su2double**& ActDiskBem_Z) { assert(option_map.find(name) == option_map.end()); all_options.insert(pair(name, true)); - COptionBase* val = new COptionActDiskBem(name, - nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, - Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, - ActDiskBem_X, ActDiskBem_Y, ActDiskBem_Z); + COptionBase* val = new COptionActDisk(name, + nMarker_ActDiskBemInlet, nMarker_ActDiskBemOutlet, + Marker_ActDiskBemInlet, Marker_ActDiskBemOutlet, + ActDiskBem_X, ActDiskBem_Y, ActDiskBem_Z); option_map.insert(pair(name, val)); } From 842232cf0595c7028e654886c05cc98198158f10 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sat, 4 Nov 2023 08:21:25 +0530 Subject: [PATCH 32/42] add BEM_FREQ option. move local variables in place. --- Common/include/CConfig.hpp | 14 +- Common/src/CConfig.cpp | 2 + SU2_CFD/src/solvers/CEulerSolver.cpp | 158 ++++++++++-------- .../actuatordisk_bem/actuatordisk_bem.cfg | 2 + config_template.cfg | 3 + 5 files changed, 101 insertions(+), 78 deletions(-) diff --git a/Common/include/CConfig.hpp b/Common/include/CConfig.hpp index c9bfb36669b..da11f902606 100644 --- a/Common/include/CConfig.hpp +++ b/Common/include/CConfig.hpp @@ -354,8 +354,9 @@ class CConfig { **ActDisk_TempJump, **ActDisk_Omega; /*!< \brief Specified deltas for actuator disk.*/ su2double **ActDiskBem_CG[3]; /*!< \brief Specified center for actuator disk BEM.*/ su2double **ActDiskBem_Axis[3]; /*!< \brief Specified axis for actuator disk BEM.*/ - su2double BEM_blade_angle ; /*!< \brief Propeller blade angle.*/ - string BEM_prop_filename ; /*!< \brief Propeller filename.*/ + su2double BEM_blade_angle; /*!< \brief Propeller blade angle.*/ + string BEM_prop_filename; /*!< \brief Propeller filename.*/ + unsigned short ActDiskBem_Frequency; /*!< \brief Frequency of updating actuator disk with BEM. */ 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. */ @@ -6675,15 +6676,20 @@ class CConfig { su2double GetActDisk_Omega(const string& val_marker, unsigned short val_index) const; /*! - * \brief Get the Center of the actuator disk. + * \brief Get the Center of the actuator disk with BEM. */ su2double GetActDiskBem_CG(unsigned short iDim, string val_marker, unsigned short val_index) const; /*! - * \brief Get the axis of the actuator disk with Blade Element Method. + * \brief Get the axis of the actuator disk with BEM. */ su2double GetActDiskBem_Axis(unsigned short iDim, string val_marker, unsigned short val_index) const; + /*! + * \brief Get the frequency of updating the actuator disk with BEM. + */ + const unsigned short& GetActDiskBem_Frequency(void) const { return ActDiskBem_Frequency; } + /*! * \brief Get the blade angle of the propeller. */ diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index 959c97e886d..a34902142cf 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -1681,6 +1681,8 @@ void CConfig::SetConfig_Options() { 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: Frequency for updating actuator disk with BEM.*/ + addUnsignedShortOption("BEM_FREQ", ActDiskBem_Frequency, 40); /* DESCRIPTION: Only half engine is in the computational grid */ addBoolOption("ENGINE_HALF_MODEL", Engine_HalfModel, false); diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 3f263d9e375..1f9dd8e81db 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -4118,10 +4118,10 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con */ /*--- InputFile reading ---*/ - unsigned short iDim, iMarker; - unsigned long iVertex, iPoint; - string Marker_Tag; - int iSection, iAlpha; +//unsigned short iDim, iMarker; +//unsigned long iVertex, iPoint; +//string Marker_Tag; +//int iSection, iAlpha; static int ADBem_NBlade = 0, ADBem_NSection = 0, ADBem_NAlpha = 0; static su2double ADBem_Diameter = 0.0, ADBem_HubRadius = 0.0, ADBem_Angle75R = 0.0; static std::vector i_v, radius_v, chord_v, angle75r_v; @@ -4130,43 +4130,46 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con static su2double ADBem_Omega = 0.0; static su2double ADBem_CG[MAXNDIM] = {0.0, 0.0, 0.0}; static su2double ADBem_Axis[MAXNDIM] = {0.0}, ADBem_J = 0.0; + static unsigned short ADBem_Frequency = 0; /*--- BEM VLAD ---*/ const int BEM_MAX_ITER = 20; - su2double Omega_sw = 0.0, Omega_RPM = 0.0, Origin[3] = {0.0}, radius_[3] = {0.0}; - static su2double omega_ref = 0.0, Lref = 0.0; - static su2double RPM = 0.0, blade_angle = 0.0, dia = 0.0, r_tip = 0.0, rps = 0.0, radius = 0.0; - static su2double V = 0.0, rho = 0.0, T = 0.0; - static su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; - static std::vector DtDr; - static su2double Target_Press_Jump = 0.0, Area = 0.0, UnitNormal[3] = {0.0}, Vn = 0.0; - static su2double Fa = 0.0, Ft = 0.0, Fr = 0.0, Fx = 0.0, Fy = 0.0, Fz = 0.0, dCp_v = 0.0, dCr_v = 0.0, rad_v = 0.0; - su2double *V_domain = 0, *Coord = 0; - static su2double loc_Torque = 0.0; - static su2double loc_thrust = 0.0; - static su2double tot_area = 0.0, tot_tq = 0.0; +//su2double Omega_sw = 0.0, Omega_RPM = 0.0, Origin[3] = {0.0}, radius_[3] = {0.0}; +//static su2double omega_ref = 0.0, Lref = 0.0; +//static su2double RPM = 0.0, blade_angle = 0.0, dia = 0.0, r_tip = 0.0, rps = 0.0, radius = 0.0; +//static su2double V = 0.0, rho = 0.0, T = 0.0; +//static su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; +//static std::vector DtDr; +//static su2double Target_Press_Jump = 0.0, Area = 0.0, UnitNormal[3] = {0.0}, Vn = 0.0; +//static su2double Fa = 0.0, Ft = 0.0, Fr = 0.0, Fx = 0.0, Fy = 0.0, Fz = 0.0, dCp_v = 0.0, dCr_v = 0.0, rad_v = 0.0; +//su2double *V_domain = 0, *Coord = 0; +//static su2double loc_Torque = 0.0; +//static su2double loc_thrust = 0.0; +//static su2double tot_area = 0.0, tot_tq = 0.0; unsigned long InnerIter = config->GetInnerIter(); su2double Dens_FreeStream = config->GetDensity_FreeStream(); const su2double* Vel_FreeStream = config->GetVelocity_FreeStream(); /*--- Input file provides force coefficients distributions along disk radius. - Initialization necessary only at initial iteration. ---*/ - if (InnerIter == 0) { - /*--- Get the RPM, CG and Axis from config. ---*/ - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + Initialization necessary only at initial iteration (InnerIter == 0) + when the tables (radius_v, chord_v, ...) are empty. ---*/ + if (radius_v.empty()) { + /*--- Get the RPM, CG, Axis and Frequency from config. ---*/ + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - Marker_Tag = config->GetMarker_All_TagBound(iMarker); + const string Marker_Tag = config->GetMarker_All_TagBound(iMarker); ADBem_Omega = config->GetActDisk_Omega(Marker_Tag, 0); - for (iDim = 0; iDim < nDim; iDim++) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { ADBem_CG[iDim] = config->GetActDiskBem_CG(iDim, Marker_Tag, 0); ADBem_Axis[iDim] = config->GetActDiskBem_Axis(iDim, Marker_Tag, 0); } } } + ADBem_Frequency = config->GetActDiskBem_Frequency(); /*--- Get the file name that contains the propeller data. ---*/ string ActDiskBem_filename = config->GetBEM_prop_filename(); @@ -4215,7 +4218,7 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con getline(ActDiskBem_file, text_line_appo); /*--- Read and assign the values of the propeller blade section's id, radius, chord, angle75R. ---*/ - for (iSection = 0; iSection < ADBem_NSection; iSection++) { + for (int iSection = 0; iSection < ADBem_NSection; iSection++) { getline(ActDiskBem_file, text_line_appo); istringstream sectionStream(text_line_appo); sectionStream >> i_v[iSection] >> radius_v[iSection] >> chord_v[iSection] >> angle75r_v[iSection]; @@ -4227,9 +4230,9 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con cd_m.resize(ADBem_NAlpha, std::vector(ADBem_NSection, 0.0)); /*--- Read and assign the values for each of the propeller blade section's alpha, cl, cd. ---*/ - for (iSection = 0; iSection < ADBem_NSection; iSection++) { + for (int iSection = 0; iSection < ADBem_NSection; iSection++) { getline(ActDiskBem_file, text_line_appo); - for (iAlpha = 0; iAlpha < ADBem_NAlpha; iAlpha++) { + for (int iAlpha = 0; iAlpha < ADBem_NAlpha; iAlpha++) { getline(ActDiskBem_file, text_line_appo); istringstream alphaStream(text_line_appo); alphaStream >> alpha_m[iAlpha][iSection] >> cl_m[iAlpha][iSection] >> cd_m[iAlpha][iSection]; @@ -4237,81 +4240,89 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con } } - /*--- Update the propeller load according to the modified flow field after every 40 inner iterations. ---*/ - if (InnerIter % 40 == 0) { - dia = ADBem_Diameter; - r_tip = 0.5 * dia; + /*--- Update the propeller load according to the modified flow field after every ADBem_Frequency inner iterations. ---*/ + if (InnerIter % ADBem_Frequency != 0) return; + const su2double dia = ADBem_Diameter; + const su2double r_tip = 0.5 * dia; + su2double loc_Torque = 0.0; + su2double loc_thrust = 0.0; + su2double tot_area = 0.0, tot_tq = 0.0; su2double Normal[MAXNDIM]; - for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + for (unsigned long iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + const unsigned long iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); /*--- Read Swirl params. ---*/ - Omega_RPM = ADBem_Omega; - omega_ref = config->GetOmega_Ref(); - Lref = config->GetLength_Ref(); - Omega_sw = Omega_RPM * (PI_NUMBER / 30.0) / (omega_ref); // Swirl rate + const su2double Omega_RPM = ADBem_Omega; + const su2double omega_ref = config->GetOmega_Ref(); + const su2double Lref = config->GetLength_Ref(); + const su2double Omega_sw = Omega_RPM * (PI_NUMBER / 30.0) / (omega_ref); // Swirl rate /*--- Center of the rotor ---*/ - for (iDim = 0; iDim < nDim; iDim++) { + su2double Origin[3] = {0.0, 0.0, 0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { Origin[iDim] = ADBem_CG[iDim] / Lref; } /*--- Compute the distance to the center of the rotor ---*/ geometry->vertex[iMarker][iVertex]->GetNormal(Normal); - for (iDim = 0; iDim < nDim; iDim++) { + for (unsigned short iDim = 0; iDim < nDim; iDim++) { Normal[iDim] = -Normal[iDim]; } /*--- Get propeller axis from config file. ---*/ - for (iDim = 0; iDim < nDim; iDim++){ + for (unsigned short iDim = 0; iDim < nDim; iDim++){ ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; } - Area = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { + su2double Area = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { Area += Normal[iDim] * Normal[iDim]; } Area = sqrt(Area); - for (iDim = 0; iDim < nDim; iDim++) { + su2double UnitNormal[3] = {0.0, 0.0, 0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { UnitNormal[iDim] = Normal[iDim] / Area; } - if (geometry->nodes->GetDomain(iPoint)) { - Coord = geometry->nodes->GetCoord(iPoint); - } + const su2double* Coord = geometry->nodes->GetCoord(iPoint); + //if (geometry->nodes->GetDomain(iPoint)) { + // Coord = geometry->nodes->GetCoord(iPoint); + //} - radius = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { + su2double radius = 0.0; + su2double radius_[3] = {0.0, 0.0, 0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { radius += (Coord[iDim] - Origin[iDim]) * (Coord[iDim] - Origin[iDim]); radius_[iDim] = (Coord[iDim] - Origin[iDim]); } radius = sqrt(radius); /*--- Current solution at this boundary node and jumps values ---*/ - V_domain = nodes->GetPrimitive(iPoint); + const su2double* V_domain = nodes->GetPrimitive(iPoint); if (abs(Omega_sw) > 1.0e-1) { - Vn = 0.0; - for (iDim = 0; iDim < nDim; iDim++) { + su2double Vn = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { Vn += V_domain[iDim + 1] * UnitNormal[iDim]; } - RPM = abs(Omega_RPM); - rps = RPM / 60.0; + const su2double RPM = abs(Omega_RPM); + const su2double rps = RPM / 60.0; ADBem_J = Vel_FreeStream[0] / (rps * dia); - rho = V_domain[nDim + 2]; - T = V_domain[0]; - blade_angle = config->GetBEM_blade_angle(); - V = config->GetModVel_FreeStream(); - V = fabs(Vn); + const su2double rho = V_domain[nDim + 2]; + const su2double T = V_domain[0]; + const su2double blade_angle = config->GetBEM_blade_angle(); + //const su2double V = config->GetModVel_FreeStream(); + const su2double V = fabs(Vn); /*--- BEM model without parameter 'a' (ref?) ---*/ + su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; { - DtDr.resize(ADBem_NSection, 0.0); + std::vector DtDr(ADBem_NSection, 0.0); int s_prop_nblades = ADBem_NBlade; int sprop_sec_nalf = ADBem_NAlpha; @@ -4339,9 +4350,9 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double ang_offset = 0.0; radtodeg = 180.0 / M_PI; - dia = ADBem_Diameter; + const su2double dia = ADBem_Diameter; r_hub = ADBem_HubRadius; - r_tip = 0.5 * dia; + const su2double r_tip = 0.5 * dia; ang_offset = blade_angle - ADBem_Angle75R; alpha_corr = 0.0; @@ -4502,25 +4513,25 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con loc_Torque += Torque * Area; tot_tq += dp_av; loc_thrust += dp_at_r * Area; - Target_Press_Jump = dp_at_r; + const su2double Target_Press_Jump = dp_at_r; ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; ActDisk_Torque_r[iMarker][iVertex] = Torque / (2 * M_PI * radius); /*--- Non-dimensionalize the elemental load. ---*/ - dCp_v = Torque * ((Omega_sw * r_tip) / (rho * rps * rps * rps * pow(dia, 5))); + const su2double dCp_v = Torque * ((Omega_sw * r_tip) / (rho * rps * rps * rps * pow(dia, 5))); /*--- Force radial load to 0 as there is no information of radial load from BEM. ---*/ - dCr_v = 0.0; - rad_v = radius / r_tip; - Fa = dp_at_r; - Ft = (dCp_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / - ((ADBem_J * PI_NUMBER * rad_v) * (ADBem_J * PI_NUMBER * rad_v))) / - config->GetPressure_Ref(); - Fr = (dCr_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / (pow(ADBem_J, 2) * PI_NUMBER * rad_v)) / - config->GetPressure_Ref(); - Fx = (Ft + Fr) * (radius_[0] / (radius)); - Fy = (Ft + Fr) * (radius_[2] / (radius)); - Fz = -(Ft + Fr) * (radius_[1] / (radius)); + const su2double dCr_v = 0.0; + const su2double rad_v = radius / r_tip; + const su2double Fa = dp_at_r; + const su2double Ft = (dCp_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / + ((ADBem_J * PI_NUMBER * rad_v) * (ADBem_J * PI_NUMBER * rad_v))) / + config->GetPressure_Ref(); + const su2double Fr = (dCr_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / + (pow(ADBem_J, 2) * PI_NUMBER * rad_v)) / config->GetPressure_Ref(); + const su2double Fx = (Ft + Fr) * (radius_[0] / (radius)); + const su2double Fy = (Ft + Fr) * (radius_[2] / (radius)); + const su2double Fz = -(Ft + Fr) * (radius_[1] / (radius)); ActDisk_Fa_BEM[iMarker][iVertex] = Fa; ActDisk_Fx_BEM[iMarker][iVertex] = Fx; ActDisk_Fy_BEM[iMarker][iVertex] = Fy; @@ -4529,7 +4540,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con } } } - } } void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index c372a22f735..fe548b4e284 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -116,6 +116,8 @@ MARKER_ACTDISK_BEM_AXIS= ( ACTDISK_IN, ACTDISK_OUT, 1.0, 0.0, 0.0, 1.0, 0.0, 0. BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt % Propeller blade angle (Degrees) at 0.75*Radius for the current calculation BEM_PROP_BLADE_ANGLE = 23.9 +% BEM calculation frequency +BEM_FREQ = 40 % % Far-field boundary marker(s) (NONE = no marker) MARKER_FAR= ( Farfield ) diff --git a/config_template.cfg b/config_template.cfg index 7bba2009560..774d55875e8 100644 --- a/config_template.cfg +++ b/config_template.cfg @@ -965,6 +965,9 @@ BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt % Propeller blade angle (degrees) at (0.75 * radius) BEM_PROP_BLADE_ANGLE = 25.0 % +% BEM calculation frequency +BEM_FREQ = 40 +% % Supersonic inlet boundary marker(s) (NONE = no marker) % Format: (inlet marker, temperature, static pressure, velocity_x, % velocity_y, velocity_z, ... ), i.e. primitive variables specified. From dda8ca0a6ebd05b4e6f653bb6d0c57ab962e7800 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sat, 4 Nov 2023 08:31:26 +0530 Subject: [PATCH 33/42] comment and indentation cleanup --- SU2_CFD/src/solvers/CEulerSolver.cpp | 531 +++++++++++++-------------- 1 file changed, 256 insertions(+), 275 deletions(-) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index 1f9dd8e81db..c0a1b2f853a 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -4118,10 +4118,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con */ /*--- InputFile reading ---*/ -//unsigned short iDim, iMarker; -//unsigned long iVertex, iPoint; -//string Marker_Tag; -//int iSection, iAlpha; static int ADBem_NBlade = 0, ADBem_NSection = 0, ADBem_NAlpha = 0; static su2double ADBem_Diameter = 0.0, ADBem_HubRadius = 0.0, ADBem_Angle75R = 0.0; static std::vector i_v, radius_v, chord_v, angle75r_v; @@ -4134,18 +4130,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- BEM VLAD ---*/ const int BEM_MAX_ITER = 20; -//su2double Omega_sw = 0.0, Omega_RPM = 0.0, Origin[3] = {0.0}, radius_[3] = {0.0}; -//static su2double omega_ref = 0.0, Lref = 0.0; -//static su2double RPM = 0.0, blade_angle = 0.0, dia = 0.0, r_tip = 0.0, rps = 0.0, radius = 0.0; -//static su2double V = 0.0, rho = 0.0, T = 0.0; -//static su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; -//static std::vector DtDr; -//static su2double Target_Press_Jump = 0.0, Area = 0.0, UnitNormal[3] = {0.0}, Vn = 0.0; -//static su2double Fa = 0.0, Ft = 0.0, Fr = 0.0, Fx = 0.0, Fy = 0.0, Fz = 0.0, dCp_v = 0.0, dCr_v = 0.0, rad_v = 0.0; -//su2double *V_domain = 0, *Coord = 0; -//static su2double loc_Torque = 0.0; -//static su2double loc_thrust = 0.0; -//static su2double tot_area = 0.0, tot_tq = 0.0; unsigned long InnerIter = config->GetInnerIter(); su2double Dens_FreeStream = config->GetDensity_FreeStream(); @@ -4242,304 +4226,301 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con /*--- Update the propeller load according to the modified flow field after every ADBem_Frequency inner iterations. ---*/ if (InnerIter % ADBem_Frequency != 0) return; - const su2double dia = ADBem_Diameter; - const su2double r_tip = 0.5 * dia; - su2double loc_Torque = 0.0; - su2double loc_thrust = 0.0; - su2double tot_area = 0.0, tot_tq = 0.0; + const su2double dia = ADBem_Diameter; + const su2double r_tip = 0.5 * dia; + su2double loc_Torque = 0.0; + su2double loc_thrust = 0.0; + su2double tot_area = 0.0, tot_tq = 0.0; - su2double Normal[MAXNDIM]; - for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { - if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || - (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { - for (unsigned long iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { - const unsigned long iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); + su2double Normal[MAXNDIM]; + for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { + if ((config->GetMarker_All_KindBC(iMarker) == ACTDISK_INLET) || + (config->GetMarker_All_KindBC(iMarker) == ACTDISK_OUTLET)) { + for (unsigned long iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) { + const unsigned long iPoint = geometry->vertex[iMarker][iVertex]->GetNode(); - /*--- Read Swirl params. ---*/ - const su2double Omega_RPM = ADBem_Omega; - const su2double omega_ref = config->GetOmega_Ref(); - const su2double Lref = config->GetLength_Ref(); - const su2double Omega_sw = Omega_RPM * (PI_NUMBER / 30.0) / (omega_ref); // Swirl rate + /*--- Read Swirl params. ---*/ + const su2double Omega_RPM = ADBem_Omega; + const su2double omega_ref = config->GetOmega_Ref(); + const su2double Lref = config->GetLength_Ref(); + const su2double Omega_sw = Omega_RPM * (PI_NUMBER / 30.0) / (omega_ref); // Swirl rate - /*--- Center of the rotor ---*/ - su2double Origin[3] = {0.0, 0.0, 0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Origin[iDim] = ADBem_CG[iDim] / Lref; - } + /*--- Center of the rotor ---*/ + su2double Origin[3] = {0.0, 0.0, 0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Origin[iDim] = ADBem_CG[iDim] / Lref; + } - /*--- Compute the distance to the center of the rotor ---*/ - geometry->vertex[iMarker][iVertex]->GetNormal(Normal); - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Normal[iDim] = -Normal[iDim]; - } + /*--- Compute the distance to the center of the rotor ---*/ + geometry->vertex[iMarker][iVertex]->GetNormal(Normal); + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Normal[iDim] = -Normal[iDim]; + } - /*--- Get propeller axis from config file. ---*/ - for (unsigned short iDim = 0; iDim < nDim; iDim++){ - ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; - } - su2double Area = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Area += Normal[iDim] * Normal[iDim]; - } - Area = sqrt(Area); + /*--- Get propeller axis from config file. ---*/ + for (unsigned short iDim = 0; iDim < nDim; iDim++){ + ActDisk_Axis(iMarker, iDim) = ADBem_Axis[iDim]; + } + su2double Area = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Area += Normal[iDim] * Normal[iDim]; + } + Area = sqrt(Area); - su2double UnitNormal[3] = {0.0, 0.0, 0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - UnitNormal[iDim] = Normal[iDim] / Area; - } + su2double UnitNormal[3] = {0.0, 0.0, 0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + UnitNormal[iDim] = Normal[iDim] / Area; + } - const su2double* Coord = geometry->nodes->GetCoord(iPoint); - //if (geometry->nodes->GetDomain(iPoint)) { - // Coord = geometry->nodes->GetCoord(iPoint); - //} + const su2double* Coord = geometry->nodes->GetCoord(iPoint); - su2double radius = 0.0; - su2double radius_[3] = {0.0, 0.0, 0.0}; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - radius += (Coord[iDim] - Origin[iDim]) * (Coord[iDim] - Origin[iDim]); - radius_[iDim] = (Coord[iDim] - Origin[iDim]); - } - radius = sqrt(radius); + su2double radius = 0.0; + su2double radius_[3] = {0.0, 0.0, 0.0}; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + radius += (Coord[iDim] - Origin[iDim]) * (Coord[iDim] - Origin[iDim]); + radius_[iDim] = (Coord[iDim] - Origin[iDim]); + } + radius = sqrt(radius); - /*--- Current solution at this boundary node and jumps values ---*/ - const su2double* V_domain = nodes->GetPrimitive(iPoint); + /*--- Current solution at this boundary node and jumps values ---*/ + const su2double* V_domain = nodes->GetPrimitive(iPoint); - if (abs(Omega_sw) > 1.0e-1) { - su2double Vn = 0.0; - for (unsigned short iDim = 0; iDim < nDim; iDim++) { - Vn += V_domain[iDim + 1] * UnitNormal[iDim]; - } + if (abs(Omega_sw) > 1.0e-1) { + su2double Vn = 0.0; + for (unsigned short iDim = 0; iDim < nDim; iDim++) { + Vn += V_domain[iDim + 1] * UnitNormal[iDim]; + } - const su2double RPM = abs(Omega_RPM); - const su2double rps = RPM / 60.0; - ADBem_J = Vel_FreeStream[0] / (rps * dia); - const su2double rho = V_domain[nDim + 2]; - const su2double T = V_domain[0]; - const su2double blade_angle = config->GetBEM_blade_angle(); - //const su2double V = config->GetModVel_FreeStream(); - const su2double V = fabs(Vn); - - /*--- BEM model without parameter 'a' (ref?) ---*/ - su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; - { - std::vector DtDr(ADBem_NSection, 0.0); - - int s_prop_nblades = ADBem_NBlade; - int sprop_sec_nalf = ADBem_NAlpha; - int sprop_sec_nrad = ADBem_NSection; - std::vector& sprop_sec_r1 = radius_v; - std::vector& sprop_sec_chord = chord_v; - std::vector& sprop_sec_setangle = angle75r_v; - std::vector >& sprop_sec_alf = alpha_m; - std::vector >& sprop_sec_cl_arr = cl_m; - std::vector >& sprop_sec_cd_arr = cd_m; - - su2double rad_p = radius; - - int j, isec, converged, n_iter; - int NR = sprop_sec_nrad; - su2double r_hub, alpha_corr, cl_corr_fac; - su2double base_mach, s_mach, b_num, thrust, torque; - su2double r_dash, t_loss, c_phi, rad, phi, alpha, radtodeg; - su2double bnew, V0, V2, cl = 0.0, cd = 0.0, Vlocal, DqDr = 0.0, tem1, tem2, q; - std::vector delta_r(ADBem_NSection, 0.0); - std::vector b(ADBem_NSection, 0.0); - static std::vector Dtorq(ADBem_NSection, 0.0); - - su2double n, omega, a0, den; - su2double ang_offset = 0.0; - - radtodeg = 180.0 / M_PI; - const su2double dia = ADBem_Diameter; - r_hub = ADBem_HubRadius; - const su2double r_tip = 0.5 * dia; - ang_offset = blade_angle - ADBem_Angle75R; - - alpha_corr = 0.0; - base_mach = 0.22; - b_num = sqrt(1.0 - base_mach * base_mach); - a0 = sqrt(1.4 * 287 * T); - /*--- Change pitch by ang_offset and calculate delta_r for integration by trapezoidal rule. ---*/ - n = RPM / 60.0; - omega = n * 2.0 * M_PI; - - for (j = 0; j < NR; j++) { - if (j < 1) { - delta_r[j] = sprop_sec_r1[j + 1] - r_hub; + const su2double RPM = abs(Omega_RPM); + const su2double rps = RPM / 60.0; + ADBem_J = Vel_FreeStream[0] / (rps * dia); + const su2double rho = V_domain[nDim + 2]; + const su2double T = V_domain[0]; + const su2double blade_angle = config->GetBEM_blade_angle(); + //const su2double V = config->GetModVel_FreeStream(); + const su2double V = fabs(Vn); + + /*--- BEM model without parameter 'a' (ref?) ---*/ + su2double Torque = 0.0, dp_av = 0.0, dp_at_r = 0.0; + { + std::vector DtDr(ADBem_NSection, 0.0); + + int s_prop_nblades = ADBem_NBlade; + int sprop_sec_nalf = ADBem_NAlpha; + int sprop_sec_nrad = ADBem_NSection; + std::vector& sprop_sec_r1 = radius_v; + std::vector& sprop_sec_chord = chord_v; + std::vector& sprop_sec_setangle = angle75r_v; + std::vector >& sprop_sec_alf = alpha_m; + std::vector >& sprop_sec_cl_arr = cl_m; + std::vector >& sprop_sec_cd_arr = cd_m; + + su2double rad_p = radius; + + int j, isec, converged, n_iter; + int NR = sprop_sec_nrad; + su2double r_hub, alpha_corr, cl_corr_fac; + su2double base_mach, s_mach, b_num, thrust, torque; + su2double r_dash, t_loss, c_phi, rad, phi, alpha, radtodeg; + su2double bnew, V0, V2, cl = 0.0, cd = 0.0, Vlocal, DqDr = 0.0, tem1, tem2, q; + std::vector delta_r(ADBem_NSection, 0.0); + std::vector b(ADBem_NSection, 0.0); + static std::vector Dtorq(ADBem_NSection, 0.0); + + su2double n, omega, a0, den; + su2double ang_offset = 0.0; + + radtodeg = 180.0 / M_PI; + const su2double dia = ADBem_Diameter; + r_hub = ADBem_HubRadius; + const su2double r_tip = 0.5 * dia; + ang_offset = blade_angle - ADBem_Angle75R; + + alpha_corr = 0.0; + base_mach = 0.22; + b_num = sqrt(1.0 - base_mach * base_mach); + a0 = sqrt(1.4 * 287 * T); + /*--- Change pitch by ang_offset and calculate delta_r for integration by trapezoidal rule. ---*/ + n = RPM / 60.0; + omega = n * 2.0 * M_PI; + + for (j = 0; j < NR; j++) { + if (j < 1) { + delta_r[j] = sprop_sec_r1[j + 1] - r_hub; + } else { + if (j < NR - 1) { + delta_r[j] = sprop_sec_r1[j + 1] - sprop_sec_r1[j - 1]; } else { - if (j < NR - 1) { - delta_r[j] = sprop_sec_r1[j + 1] - sprop_sec_r1[j - 1]; - } else { - delta_r[j] = r_tip - sprop_sec_r1[j - 1]; - } + delta_r[j] = r_tip - sprop_sec_r1[j - 1]; } - delta_r[j] *= 0.5; } + delta_r[j] *= 0.5; + } - thrust = 0.0; - torque = 0.0; - - for (j = 0; j < NR; j++) { - b[j] = 0.01; - converged = 0; - n_iter = 1; - while (converged == 0) { - V2 = omega * sprop_sec_r1[j] * (1 - b[j]); - V0 = V; - - phi = atan2(V0, V2); - - alpha = sprop_sec_setangle[j] + ang_offset - radtodeg * phi + alpha_corr; - rad = sprop_sec_r1[j]; - - /*--- get cl, cd from lookup table. ---*/ - isec = j + 1; - { - int i, salf = 0; - su2double fact; - - /*--- interpolating values of cl and cd for given alpha. ---*/ - if (alpha >= sprop_sec_alf[salf][isec - 1] && - alpha <= sprop_sec_alf[sprop_sec_nalf - 1][isec - 1]) { - for (i = 0; i < sprop_sec_nalf - 1; i++) { - if (alpha >= sprop_sec_alf[i][isec - 1] && alpha <= sprop_sec_alf[i + 1][isec - 1]) { - fact = (alpha - sprop_sec_alf[i][isec - 1]) - / (sprop_sec_alf[i + 1][isec - 1] - sprop_sec_alf[i][isec - 1]); - cl = sprop_sec_cl_arr[i][isec - 1] - + fact * (sprop_sec_cl_arr[i + 1][isec - 1] - sprop_sec_cl_arr[i][isec - 1]); - cd = sprop_sec_cd_arr[i][isec - 1] - + fact * (sprop_sec_cd_arr[i + 1][isec - 1] - sprop_sec_cd_arr[i][isec - 1]); - } - } - } else { - if (alpha < sprop_sec_alf[salf][isec - 1]) { - cl = sprop_sec_cl_arr[0][isec - 1]; - cd = sprop_sec_cd_arr[0][isec - 1]; - } - if (alpha > sprop_sec_alf[sprop_sec_nalf - 1][isec - 1]) { - cl = sprop_sec_cl_arr[sprop_sec_nalf - 1][isec - 1]; - cd = sprop_sec_cd_arr[sprop_sec_nalf - 1][isec - 1]; + thrust = 0.0; + torque = 0.0; + + for (j = 0; j < NR; j++) { + b[j] = 0.01; + converged = 0; + n_iter = 1; + while (converged == 0) { + V2 = omega * sprop_sec_r1[j] * (1 - b[j]); + V0 = V; + + phi = atan2(V0, V2); + + alpha = sprop_sec_setangle[j] + ang_offset - radtodeg * phi + alpha_corr; + rad = sprop_sec_r1[j]; + + /*--- get cl, cd from lookup table. ---*/ + isec = j + 1; + { + int i, salf = 0; + su2double fact; + + /*--- interpolating values of cl and cd for given alpha. ---*/ + if (alpha >= sprop_sec_alf[salf][isec - 1] && + alpha <= sprop_sec_alf[sprop_sec_nalf - 1][isec - 1]) { + for (i = 0; i < sprop_sec_nalf - 1; i++) { + if (alpha >= sprop_sec_alf[i][isec - 1] && alpha <= sprop_sec_alf[i + 1][isec - 1]) { + fact = (alpha - sprop_sec_alf[i][isec - 1]) + / (sprop_sec_alf[i + 1][isec - 1] - sprop_sec_alf[i][isec - 1]); + cl = sprop_sec_cl_arr[i][isec - 1] + + fact * (sprop_sec_cl_arr[i + 1][isec - 1] - sprop_sec_cl_arr[i][isec - 1]); + cd = sprop_sec_cd_arr[i][isec - 1] + + fact * (sprop_sec_cd_arr[i + 1][isec - 1] - sprop_sec_cd_arr[i][isec - 1]); } } + } else { + if (alpha < sprop_sec_alf[salf][isec - 1]) { + cl = sprop_sec_cl_arr[0][isec - 1]; + cd = sprop_sec_cd_arr[0][isec - 1]; + } + if (alpha > sprop_sec_alf[sprop_sec_nalf - 1][isec - 1]) { + cl = sprop_sec_cl_arr[sprop_sec_nalf - 1][isec - 1]; + cd = sprop_sec_cd_arr[sprop_sec_nalf - 1][isec - 1]; + } } + } - Vlocal = sqrt(V0 * V0 + V2 * V2); - q = 0.5 * rho * Vlocal * Vlocal; - s_mach = Vlocal / a0; - cl_corr_fac = 1.0; - if (s_mach > base_mach) { - den = 1.0 - s_mach * s_mach; - if (den > 0.0) cl_corr_fac = b_num / sqrt(den); - } - cl *= cl_corr_fac; - - /*--- tip loss factor. ---*/ - r_dash = rad / r_tip + 1.0e-5; - c_phi = cos(phi); - t_loss = 1.0; - if (r_dash > 0.90) { - t_loss = (2.0 / M_PI) * acos(exp(-(1.0 * s_prop_nblades * (1 - r_dash) / (r_dash * c_phi)))); - } + Vlocal = sqrt(V0 * V0 + V2 * V2); + q = 0.5 * rho * Vlocal * Vlocal; + s_mach = Vlocal / a0; + cl_corr_fac = 1.0; + if (s_mach > base_mach) { + den = 1.0 - s_mach * s_mach; + if (den > 0.0) cl_corr_fac = b_num / sqrt(den); + } + cl *= cl_corr_fac; + + /*--- tip loss factor. ---*/ + r_dash = rad / r_tip + 1.0e-5; + c_phi = cos(phi); + t_loss = 1.0; + if (r_dash > 0.90) { + t_loss = (2.0 / M_PI) * acos(exp(-(1.0 * s_prop_nblades * (1 - r_dash) / (r_dash * c_phi)))); + } - DtDr[j] = q * s_prop_nblades * sprop_sec_chord[j] * (cl * cos(phi) - cd * sin(phi)); - DqDr = q * s_prop_nblades * sprop_sec_chord[j] * rad * (cd * cos(phi) + cl * sin(phi)); + DtDr[j] = q * s_prop_nblades * sprop_sec_chord[j] * (cl * cos(phi) - cd * sin(phi)); + DqDr = q * s_prop_nblades * sprop_sec_chord[j] * rad * (cd * cos(phi) + cl * sin(phi)); - DtDr[j] *= t_loss; - DqDr *= t_loss; + DtDr[j] *= t_loss; + DqDr *= t_loss; - tem2 = DqDr / (4.0 * M_PI * rad * rad * rad * rho * V * omega); - bnew = 0.6 * b[j] + 0.4 * tem2; - if (bnew > 0.9) bnew = 0.9; - if (fabs(bnew - b[j]) < 1.0e-5) { - converged = 1; - } - if (bnew < 0.1) { - b[j] = bnew; - } - n_iter++; - if (n_iter > BEM_MAX_ITER) { - converged = 1; - } + tem2 = DqDr / (4.0 * M_PI * rad * rad * rad * rho * V * omega); + bnew = 0.6 * b[j] + 0.4 * tem2; + if (bnew > 0.9) bnew = 0.9; + if (fabs(bnew - b[j]) < 1.0e-5) { + converged = 1; + } + if (bnew < 0.1) { + b[j] = bnew; + } + n_iter++; + if (n_iter > BEM_MAX_ITER) { + converged = 1; } - thrust = thrust + DtDr[j] * delta_r[j]; - torque = torque + DqDr * delta_r[j]; - Dtorq[j] = DqDr; } + thrust = thrust + DtDr[j] * delta_r[j]; + torque = torque + DqDr * delta_r[j]; + Dtorq[j] = DqDr; + } - tem1 = rho * n * n * dia * dia * dia * dia; - tem2 = tem1 * dia; + tem1 = rho * n * n * dia * dia * dia * dia; + tem2 = tem1 * dia; - Torque = 2.0 * M_PI * torque; - dp_av = 2.0 * M_PI * torque; + Torque = 2.0 * M_PI * torque; + dp_av = 2.0 * M_PI * torque; - for (j = 0; j < NR; j++) { - DtDr[j] /= (2.0 * M_PI * sprop_sec_r1[j]); - Dtorq[j] = Dtorq[j]; - } + for (j = 0; j < NR; j++) { + DtDr[j] /= (2.0 * M_PI * sprop_sec_r1[j]); + Dtorq[j] = Dtorq[j]; + } - if (rad_p < sprop_sec_r1[0]) { - tem2 = sprop_sec_r1[0] - r_hub; - tem1 = (rad_p - r_hub) / tem2; - tem2 = 1.0 - tem1; - dp_at_r = DtDr[0] * tem1; - Torque = Dtorq[0] * tem1; + if (rad_p < sprop_sec_r1[0]) { + tem2 = sprop_sec_r1[0] - r_hub; + tem1 = (rad_p - r_hub) / tem2; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[0] * tem1; + Torque = Dtorq[0] * tem1; + } else { + if (rad_p > r_tip) { + dp_at_r = 0.0; + Torque = 0.0; } else { - if (rad_p > r_tip) { - dp_at_r = 0.0; - Torque = 0.0; + if (rad_p > sprop_sec_r1[NR - 1]) { + tem2 = r_tip - sprop_sec_r1[NR - 1]; + tem1 = (rad_p - sprop_sec_r1[NR - 1]) / tem2; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[NR - 1] * tem2; + Torque = Dtorq[NR - 1] * tem2; } else { - if (rad_p > sprop_sec_r1[NR - 1]) { - tem2 = r_tip - sprop_sec_r1[NR - 1]; - tem1 = (rad_p - sprop_sec_r1[NR - 1]) / tem2; - tem2 = 1.0 - tem1; - dp_at_r = DtDr[NR - 1] * tem2; - Torque = Dtorq[NR - 1] * tem2; - } else { - for (j = 0; j < NR - 1; j++) { - if ((sprop_sec_r1[j] < rad_p) && (sprop_sec_r1[j + 1] >= rad_p)) { - tem2 = sprop_sec_r1[j + 1] - sprop_sec_r1[j]; - tem1 = (rad_p - sprop_sec_r1[j]) / tem2; - tem2 = 1.0 - tem1; - dp_at_r = DtDr[j] * tem2 + DtDr[j + 1] * tem1; - Torque = Dtorq[j] * tem2 + Dtorq[j + 1] * tem1; - } + for (j = 0; j < NR - 1; j++) { + if ((sprop_sec_r1[j] < rad_p) && (sprop_sec_r1[j + 1] >= rad_p)) { + tem2 = sprop_sec_r1[j + 1] - sprop_sec_r1[j]; + tem1 = (rad_p - sprop_sec_r1[j]) / tem2; + tem2 = 1.0 - tem1; + dp_at_r = DtDr[j] * tem2 + DtDr[j + 1] * tem1; + Torque = Dtorq[j] * tem2 + Dtorq[j + 1] * tem1; } } } } } - - tot_area += Area; - loc_Torque += Torque * Area; - tot_tq += dp_av; - loc_thrust += dp_at_r * Area; - const su2double Target_Press_Jump = dp_at_r; - - ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; - ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; - ActDisk_Torque_r[iMarker][iVertex] = Torque / (2 * M_PI * radius); - /*--- Non-dimensionalize the elemental load. ---*/ - const su2double dCp_v = Torque * ((Omega_sw * r_tip) / (rho * rps * rps * rps * pow(dia, 5))); - /*--- Force radial load to 0 as there is no information of radial load from BEM. ---*/ - const su2double dCr_v = 0.0; - const su2double rad_v = radius / r_tip; - const su2double Fa = dp_at_r; - const su2double Ft = (dCp_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / - ((ADBem_J * PI_NUMBER * rad_v) * (ADBem_J * PI_NUMBER * rad_v))) / - config->GetPressure_Ref(); - const su2double Fr = (dCr_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / - (pow(ADBem_J, 2) * PI_NUMBER * rad_v)) / config->GetPressure_Ref(); - const su2double Fx = (Ft + Fr) * (radius_[0] / (radius)); - const su2double Fy = (Ft + Fr) * (radius_[2] / (radius)); - const su2double Fz = -(Ft + Fr) * (radius_[1] / (radius)); - ActDisk_Fa_BEM[iMarker][iVertex] = Fa; - ActDisk_Fx_BEM[iMarker][iVertex] = Fx; - ActDisk_Fy_BEM[iMarker][iVertex] = Fy; - ActDisk_Fz_BEM[iMarker][iVertex] = Fz; } + + tot_area += Area; + loc_Torque += Torque * Area; + tot_tq += dp_av; + loc_thrust += dp_at_r * Area; + const su2double Target_Press_Jump = dp_at_r; + + ActDisk_DeltaP_r[iMarker][iVertex] = Target_Press_Jump; + ActDisk_Thrust_r[iMarker][iVertex] = dp_at_r; + ActDisk_Torque_r[iMarker][iVertex] = Torque / (2 * M_PI * radius); + /*--- Non-dimensionalize the elemental load. ---*/ + const su2double dCp_v = Torque * ((Omega_sw * r_tip) / (rho * rps * rps * rps * pow(dia, 5))); + /*--- Force radial load to 0 as there is no information of radial load from BEM. ---*/ + const su2double dCr_v = 0.0; + const su2double rad_v = radius / r_tip; + const su2double Fa = dp_at_r; + const su2double Ft = (dCp_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / + ((ADBem_J * PI_NUMBER * rad_v) * (ADBem_J * PI_NUMBER * rad_v))) / + config->GetPressure_Ref(); + const su2double Fr = (dCr_v * (2 * Dens_FreeStream * pow(Vel_FreeStream[0], 2)) / + (pow(ADBem_J, 2) * PI_NUMBER * rad_v)) / config->GetPressure_Ref(); + const su2double Fx = (Ft + Fr) * (radius_[0] / (radius)); + const su2double Fy = (Ft + Fr) * (radius_[2] / (radius)); + const su2double Fz = -(Ft + Fr) * (radius_[1] / (radius)); + ActDisk_Fa_BEM[iMarker][iVertex] = Fa; + ActDisk_Fx_BEM[iMarker][iVertex] = Fx; + ActDisk_Fy_BEM[iMarker][iVertex] = Fy; + ActDisk_Fz_BEM[iMarker][iVertex] = Fz; } } } + } } void CEulerSolver::SetFarfield_AoA(CGeometry *geometry, CSolver **solver_container, From c5a4a3880bd74618ab3e2d12ff1213fe37dd0bc8 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sat, 4 Nov 2023 13:43:54 +0530 Subject: [PATCH 34/42] clear github warning --- SU2_CFD/src/solvers/CEulerSolver.cpp | 3 --- externals/codi | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index c0a1b2f853a..e82b1c2c893 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -4297,7 +4297,6 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con const su2double rho = V_domain[nDim + 2]; const su2double T = V_domain[0]; const su2double blade_angle = config->GetBEM_blade_angle(); - //const su2double V = config->GetModVel_FreeStream(); const su2double V = fabs(Vn); /*--- BEM model without parameter 'a' (ref?) ---*/ @@ -4331,9 +4330,7 @@ void CEulerSolver::SetActDisk_BEM_VLAD(CGeometry *geometry, CSolver **solver_con su2double ang_offset = 0.0; radtodeg = 180.0 / M_PI; - const su2double dia = ADBem_Diameter; r_hub = ADBem_HubRadius; - const su2double r_tip = 0.5 * dia; ang_offset = blade_angle - ADBem_Angle75R; alpha_corr = 0.0; diff --git a/externals/codi b/externals/codi index 0ad036f2c82..eee1b5eea2d 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit 0ad036f2c8254fa7b77180a443d99248c047c877 +Subproject commit eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2 From 81c1381e562ba03d38d03a21b8e6e7af388abe5c Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Sun, 5 Nov 2023 11:04:42 +0000 Subject: [PATCH 35/42] Update SU2_CFD/src/solvers/CEulerSolver.cpp --- SU2_CFD/src/solvers/CEulerSolver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/solvers/CEulerSolver.cpp b/SU2_CFD/src/solvers/CEulerSolver.cpp index e82b1c2c893..d10e84b2ea8 100644 --- a/SU2_CFD/src/solvers/CEulerSolver.cpp +++ b/SU2_CFD/src/solvers/CEulerSolver.cpp @@ -2888,9 +2888,9 @@ void CEulerSolver::GetPower_Properties(CGeometry *geometry, CConfig *config, uns SU2_MPI::Allreduce(Outlet_Force_Local, Outlet_Force_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(Outlet_Power_Local, Outlet_Power_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); SU2_MPI::Allreduce(Outlet_Area_Local, Outlet_Area_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); - SU2_MPI::Allreduce(Outlet_DeltaP_Local, Outlet_DeltaP_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Thrust_Local, Outlet_Thrust_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); - SU2_MPI::Allreduce(Outlet_Torque_Local, Outlet_Torque_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + SU2_MPI::Allreduce(Outlet_DeltaP_Local, Outlet_DeltaP_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Thrust_Local, Outlet_Thrust_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); + SU2_MPI::Allreduce(Outlet_Torque_Local, Outlet_Torque_Total, nMarker_Outlet, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); /*--- Compute the value of the average surface temperature and pressure and set the value in the config structure for future use ---*/ From e6280fb085ed0508520f239d935e51790514dc06 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sun, 5 Nov 2023 20:04:49 +0530 Subject: [PATCH 36/42] following instructions from @pcarruscag to revert accidental change in submodules externals/codi and subprojects/CoolProp --- externals/codi | 2 +- subprojects/CoolProp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/externals/codi b/externals/codi index eee1b5eea2d..0ad036f2c82 160000 --- a/externals/codi +++ b/externals/codi @@ -1 +1 @@ -Subproject commit eee1b5eea2ded8126c34c1415e3b9cf15a3e70f2 +Subproject commit 0ad036f2c8254fa7b77180a443d99248c047c877 diff --git a/subprojects/CoolProp b/subprojects/CoolProp index a14412559e5..bafdea1f39e 160000 --- a/subprojects/CoolProp +++ b/subprojects/CoolProp @@ -1 +1 @@ -Subproject commit a14412559e523e762ddee9dd68b8250343ef941f +Subproject commit bafdea1f39ee873a6bb9833e3a21fe41f90b85e8 From c4e264cf391291d6bfa7b568636dcbee6c4ae2c8 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Sun, 5 Nov 2023 20:31:19 +0530 Subject: [PATCH 37/42] TestCases .cfg file cleanup of all comments. --- .../actuatordisk_bem/actuatordisk_bem.cfg | 181 +++--------------- 1 file changed, 23 insertions(+), 158 deletions(-) diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index fe548b4e284..01cc8c24f76 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -6,251 +6,116 @@ % Institution: Computational and Theoretical Fluid Dynamics (CTFD), % % CSIR - National Aerospace Laboratories, Bangalore % % Academy of Scientific and Innovative Research, Ghaziabad % -% Comments : +% Comments : % % Date: 23/09/2023 % -% File Version 8.0.0 "Harrier" % +% File Version 8.0.0 "Harrier" % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %----------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION -------------------------% SOLVER= RANS -% -% Specify turbulence model (NONE, SA, SST) KIND_TURB_MODEL= SA -% -% Turbulence intensity at freestream %FREESTREAM_TURBULENCEINTENSITY=0.01 -% -% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) MATH_PROBLEM= DIRECT -% -% Restart solution (NO, YES) RESTART_SOL= NO -% -% System of measurements (SI, US) -% International system of units (SI): ( meters, kilograms, Kelvins, -% Newtons = kg m/s^2, Pascals = N/m^2, -% Density = kg/m^3, Speed = m/s, -% Equiv. Area = m^2 ) SYSTEM_MEASUREMENTS= SI + % -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% -% Mach number (non-dimensional, based on the free-stream values) MACH_NUMBER= 0.11617164 -% -% Angle of attack (degrees, only for compressible flows) AOA= 0.0 -% -% Side-slip angle (degrees, only for compressible flows) SIDESLIP_ANGLE= 0.0 -% -% Reynolds number (non-dimensional, based on the free-stream values) REYNOLDS_NUMBER= 0.62E6 -% -% Reynolds length (1 m, 1 inch by default) REYNOLDS_LENGTH= 0.237 -% FREESTREAM_TEMPERATURE= 295 -% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY). VISCOSITY_MODEL= CONSTANT_VISCOSITY -% -% Molecular Viscosity that would be constant (1.716E-5 by default) MU_CONSTANT= 1.84554E-5 -% -% Sutherland Viscosity Ref (1.716E-5 default value for AIR SI) MU_REF= 1.716E-5 -% -% Sutherland Temperature Ref (273.15 K default value for AIR SI) MU_T_REF= 273.15 -% -% Sutherland constant (110.4 default value for AIR SI) SUTHERLAND_CONSTANT= 110.4 % ---------------------- REFERENCE VALUE DEFINITION ---------------------------% -% Reference origin for moment computation (m or in) +% REF_ORIGIN_MOMENT_X = 0.0 REF_ORIGIN_MOMENT_Y = 0.0 REF_ORIGIN_MOMENT_Z = 0.0 -% -% Reference length for moment non-dimensional coefficients (m or in) REF_LENGTH= 1.0 -% -% Reference area for non-dimensional force coefficients (0 implies automatic -% calculation) (m^2 or in^2) REF_AREA= 0.04411429 -% -% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE, -% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE) REF_DIMENSIONALIZATION= DIMENSIONAL -% + % --------------- ENGINE AND ACTUATOR DISK SIMULATION -------------------------% -% Highlite area to compute MFR (1 in by default) -HIGHLITE_AREA= 0.04411429 % -% Engine nu factor (SA model). +HIGHLITE_AREA= 0.04411429 ENGINE_NU_FACTOR= 0.0 -% + % -------------------- BOUNDARY CONDITION DEFINITION --------------------------% -ACTDISK_DOUBLE_SURFACE = YES % -% Actuator disk boundary type (VARIABLE_LOAD, VARIABLES_JUMP, BC_THRUST, -% DRAG_MINUS_THRUST) +ACTDISK_DOUBLE_SURFACE = YES ACTDISK_TYPE= BLADE_ELEMENT ACTDISK_JUMP= DIFFERENCE -% -% Actuator disk boundary marker(s) with the following formats (NONE = no marker) -% Variable Load: (inlet face marker, outlet face marker, -% 0.0, 0.0, RPM , 0.0, 0.0, RPM) Markers only effectively used. -% Change the sign of RPM to change the direction of rotation of the propeller MARKER_ACTDISK = ( ACTDISK_IN, ACTDISK_OUT , 0.0, 0.0, 12715.2, 0.0, 0.0, 12715.2) -%Actuator Disk CG -%(inlet face marker, outlet face marker, X_CG of inlet, Y_CG of inlet, Z_CG of inlet , -% X_CG of outlet, Y_CG of outlet, Z_CG of outlet), X_CG, Y_CG, Z_CG of both inlet and -% outlet markers should be same MARKER_ACTDISK_BEM_CG= ( ACTDISK_IN, ACTDISK_OUT, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ) -%Actuator Disk Axis -%(inlet face marker, outlet face marker, -% axis_x, axis_y, axis_z of inlet, axis_x, axis_y, axis_z of outlet), -% axis of both inlet and outlet markers should be same MARKER_ACTDISK_BEM_AXIS= ( ACTDISK_IN, ACTDISK_OUT, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 ) -% Input file containing the propeller section data and aerodynamic details of blade sections BEM_PROP_FILENAME = prop_geom_alfclcd_data.txt -% Propeller blade angle (Degrees) at 0.75*Radius for the current calculation BEM_PROP_BLADE_ANGLE = 23.9 -% BEM calculation frequency BEM_FREQ = 40 -% -% Far-field boundary marker(s) (NONE = no marker) MARKER_FAR= ( Farfield ) -% + % ------------------------ SURFACES IDENTIFICATION ----------------------------% -% Marker(s) of the surface in the surface flow solution file -MARKER_PLOTTING = ( ACTDISK_IN, ACTDISK_OUT ) % -% Marker(s) of the surface where the non-dimensional coefficients are evaluated. +MARKER_PLOTTING = ( ACTDISK_IN, ACTDISK_OUT ) MARKER_MONITORING = ( ACTDISK_IN, ACTDISK_OUT ) -% -% Marker(s) of the surface that is going to be analyzed in detail (massflow, average pressure, distortion, etc) MARKER_ANALYZE = ( ACTDISK_IN, ACTDISK_OUT ) -% -% Method to compute the average value in MARKER_ANALYZE (AREA, MASSFLUX). MARKER_ANALYZE_AVERAGE = MASSFLUX -% + % ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------% -% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES) -NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES % -% CFL number (initial value for the adaptive CFL number) +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES CFL_NUMBER= 4.0 -% -% Adaptive CFL number (NO, YES) CFL_ADAPT= NO -% -% Objective function in gradient evaluation (DRAG, LIFT, SIDEFORCE, MOMENT_X, -% MOMENT_Y, MOMENT_Z, EFFICIENCY, BUFFET, -% EQUIVALENT_AREA, NEARFIELD_PRESSURE, -% FORCE_X, FORCE_Y, FORCE_Z, THRUST, -% TORQUE, TOTAL_HEATFLUX, -% MAXIMUM_HEATFLUX, INVERSE_DESIGN_PRESSURE, -% INVERSE_DESIGN_HEATFLUX, SURFACE_TOTAL_PRESSURE, -% SURFACE_MASSFLOW, SURFACE_STATIC_PRESSURE, SURFACE_MACH) -% For a weighted sum of objectives: separate by commas, add OBJECTIVE_WEIGHT and MARKER_MONITORING in matching order. OBJECTIVE_FUNCTION= DRAG -% + % ------------------------ LINEAR SOLVER DEFINITION ---------------------------% -% Linear solver or smoother for implicit formulations: -% BCGSTAB, FGMRES, RESTARTED_FGMRES, CONJUGATE_GRADIENT (self-adjoint problems only), SMOOTHER. -LINEAR_SOLVER= FGMRES % -% Preconditioner of the Krylov linear solver or type of smoother (ILU, LU_SGS, LINELET, JACOBI) +LINEAR_SOLVER= FGMRES LINEAR_SOLVER_PREC= ILU -% -% Minimum error of the linear solver for implicit formulations LINEAR_SOLVER_ERROR= 1E-12 -% -% Max number of iterations of the linear solver for the implicit formulation LINEAR_SOLVER_ITER= 3 -% -% Number of elements to apply the criteria CONV_CAUCHY_ELEMS= 1000 -% -% Epsilon to control the series convergence CONV_CAUCHY_EPS= 1E-10 -% + % -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% -% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP, -% AUSMPLUSUP2, HLLC, TURKEL_PREC, MSW, FDS, SLAU, SLAU2) +% CONV_NUM_METHOD_FLOW= ROE MUSCL_FLOW= YES -% -% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT) TIME_DISCRE_FLOW= EULER_IMPLICIT -% + % -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------% -% Convective numerical method (SCALAR_UPWIND) -CONV_NUM_METHOD_TURB= SCALAR_UPWIND % -% Monotonic Upwind Scheme for Conservation Laws (TVD) in the turbulence equations. -% Required for 2nd order upwind schemes (NO, YES) +CONV_NUM_METHOD_TURB= SCALAR_UPWIND MUSCL_TURB= NO -% -% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG, -% BARTH_JESPERSEN, VAN_ALBADA_EDGE) SLOPE_LIMITER_TURB= VENKATAKRISHNAN -% -% Time discretization (EULER_IMPLICIT) TIME_DISCRE_TURB= EULER_IMPLICIT -% + % --------------------------- CONVERGENCE PARAMETERS --------------------------% -% Maximum number of iterations -ITER= 2000 % -% Convergence criteria (CAUCHY, RESIDUAL) -%CONV_CRITERIA= RESIDUAL -% -% Min value of the residual (log10 of the residual) +ITER= 2000 CONV_RESIDUAL_MINVAL= -8 -% -% Start convergence criteria at iteration number CONV_STARTITER= 10 -% + % ------------------------- INPUT/OUTPUT INFORMATION --------------------------% -% Mesh input file -MESH_FILENAME= actuatordisk_bem.su2 % -% Mesh input file format (SU2, CGNS) +MESH_FILENAME= actuatordisk_bem.su2 MESH_FORMAT= SU2 -% -% Mesh output file MESH_OUT_FILENAME= mesh_out.su2 -% -% Restart flow input file SOLUTION_FILENAME= actuatordisk_bem.dat -% -% Output tabular file format (TECPLOT, CSV) TABULAR_FORMAT= CSV -OUTPUT_FILES= (RESTART, PARAVIEW, SURFACE_PARAVIEW) -% -% Output file convergence history (w/o extension) CONV_FILENAME= history_actuatordisk_bem -% -% Write the forces breakdown file option (NO, YES) +OUTPUT_FILES= (RESTART, PARAVIEW, SURFACE_PARAVIEW) WRT_FORCES_BREAKDOWN= YES -% -% Output file with the forces breakdown BREAKDOWN_FILENAME= forces_breakdown_actuatordisk_bem.dat -% -% Output file restart flow RESTART_FILENAME= restart_flow_actuatordisk_bem.dat -% -% Output file flow (w/o extension) variables VOLUME_FILENAME= flow_actuatordisk_bem -% -% Output file surface flow coefficient (w/o extension) SURFACE_FILENAME= surface_flow_actuatordisk_bem -% -% Writing solution file frequency OUTPUT_WRT_FREQ= 500 -% -% Screen output fields SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_DENSITY, RMS_NU_TILDE, NONPHYSICAL_POINTS, LIFT, DRAG) HISTORY_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG, AERO_COEFF) From b85ed3353ddedd801beab85e5219ff47dc6b02e5 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Wed, 8 Nov 2023 05:15:18 +0530 Subject: [PATCH 38/42] regression test fix --- TestCases/parallel_regression.py | 12 ++++++------ TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 8c4203a45e3..51c9671d836 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -487,12 +487,12 @@ def main(): test_list.append(propeller) # Actuator disk BEM method for propeller - propeller = TestCase('actuatordisk_bem') - propeller.cfg_dir = "rans/actuatordisk_bem" - propeller.cfg_file = "actuatordisk_bem.cfg" - propeller.test_iter = 15 - propeller.test_vals = [3.3764e-01, -5.226958, -8.297197, 0, -0.004325, -0.565388] - propeller.timeout = 3200 + actuatordisk_bem = TestCase('actuatordisk_bem') + actuatordisk_bem.cfg_dir = "rans/actuatordisk_bem" + actuatordisk_bem.cfg_file = "actuatordisk_bem.cfg" + actuatordisk_bem.test_iter = 15 + actuatordisk_bem.test_vals = [ -5.226958, -8.297197, -0.004325, -0.565388] + actuatordisk_bem.timeout = 3200 test_list.append(actuatordisk_bem) ####################################### diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index 01cc8c24f76..5a0419797a0 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -117,5 +117,6 @@ RESTART_FILENAME= restart_flow_actuatordisk_bem.dat VOLUME_FILENAME= flow_actuatordisk_bem SURFACE_FILENAME= surface_flow_actuatordisk_bem OUTPUT_WRT_FREQ= 500 -SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_DENSITY, RMS_NU_TILDE, NONPHYSICAL_POINTS, LIFT, DRAG) +%SCREEN_OUTPUT= (INNER_ITER, WALL_TIME, RMS_DENSITY, RMS_NU_TILDE, NONPHYSICAL_POINTS, LIFT, DRAG) +SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_NU_TILDE, LIFT, DRAG) HISTORY_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG, AERO_COEFF) From 89f72e3c8f55e23322d6639722eafc6bd50cb6b9 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Wed, 8 Nov 2023 05:24:48 +0530 Subject: [PATCH 39/42] codefactor fix --- TestCases/parallel_regression.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 51c9671d836..a5e0684ee33 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -487,12 +487,12 @@ def main(): test_list.append(propeller) # Actuator disk BEM method for propeller - actuatordisk_bem = TestCase('actuatordisk_bem') - actuatordisk_bem.cfg_dir = "rans/actuatordisk_bem" - actuatordisk_bem.cfg_file = "actuatordisk_bem.cfg" + actuatordisk_bem = TestCase('actuatordisk_bem') + actuatordisk_bem.cfg_dir = "rans/actuatordisk_bem" + actuatordisk_bem.cfg_file = "actuatordisk_bem.cfg" actuatordisk_bem.test_iter = 15 - actuatordisk_bem.test_vals = [ -5.226958, -8.297197, -0.004325, -0.565388] - actuatordisk_bem.timeout = 3200 + actuatordisk_bem.test_vals = [-5.226958, -8.297197, -0.004325, -0.565388] + actuatordisk_bem.timeout = 3200 test_list.append(actuatordisk_bem) ####################################### From 88811d3714efb7a654dc883b756f71d84bf2b501 Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Wed, 8 Nov 2023 07:58:07 -0800 Subject: [PATCH 40/42] Update TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg --- TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg index 5a0419797a0..cb74bf56621 100644 --- a/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg +++ b/TestCases/rans/actuatordisk_bem/actuatordisk_bem.cfg @@ -17,7 +17,7 @@ SOLVER= RANS KIND_TURB_MODEL= SA %FREESTREAM_TURBULENCEINTENSITY=0.01 MATH_PROBLEM= DIRECT -RESTART_SOL= NO +RESTART_SOL= YES SYSTEM_MEASUREMENTS= SI % -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------% From 470943e7fc91858827cee91305f07ede05982f53 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Wed, 8 Nov 2023 22:48:29 +0530 Subject: [PATCH 41/42] regression test_vals to reflect change RESTART_SOL=YES --- TestCases/parallel_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index a5e0684ee33..6f36ef4d8d5 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -491,7 +491,7 @@ def main(): actuatordisk_bem.cfg_dir = "rans/actuatordisk_bem" actuatordisk_bem.cfg_file = "actuatordisk_bem.cfg" actuatordisk_bem.test_iter = 15 - actuatordisk_bem.test_vals = [-5.226958, -8.297197, -0.004325, -0.565388] + actuatordisk_bem.test_vals = [-5.282249, -10.335140, 0.001383, -0.375718] actuatordisk_bem.timeout = 3200 test_list.append(actuatordisk_bem) From 1a068ae6bbc49143d4d09550428abe8867bf6d05 Mon Sep 17 00:00:00 2001 From: "Josy P. Pullockara" Date: Thu, 9 Nov 2023 05:27:21 +0530 Subject: [PATCH 42/42] higher rms[nu] tolerance --- TestCases/parallel_regression.py | 1 + 1 file changed, 1 insertion(+) diff --git a/TestCases/parallel_regression.py b/TestCases/parallel_regression.py index 6f36ef4d8d5..3278b46e737 100644 --- a/TestCases/parallel_regression.py +++ b/TestCases/parallel_regression.py @@ -493,6 +493,7 @@ def main(): actuatordisk_bem.test_iter = 15 actuatordisk_bem.test_vals = [-5.282249, -10.335140, 0.001383, -0.375718] actuatordisk_bem.timeout = 3200 + actuatordisk_bem.tol = 0.001 test_list.append(actuatordisk_bem) #######################################