Skip to content

Commit

Permalink
Single zone and Multizone implemented... Debugging multizone with Mix…
Browse files Browse the repository at this point in the history
…ing Plane under process. Turbine and Compressor calcualtion if statement added
  • Loading branch information
NAnand-TUD committed Mar 8, 2021
1 parent 90b1114 commit 121dd26
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 47 deletions.
8 changes: 7 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,14 +1357,20 @@ enum TURBOMACHINERY_TYPE {
CENTRIFUGAL = 2, /*!< \brief centrifugal turbomachinery. */
CENTRIPETAL = 3, /*!< \brief centripetal turbomachinery. */
CENTRIPETAL_AXIAL = 4, /*!< \brief mixed flow turbine. */
AXIAL_CENTRIFUGAL = 5 /*!< \brief mixed flow turbine. */
AXIAL_CENTRIFUGAL = 5, /*!< \brief mixed flow turbine. */
TURBINE = 6, /*!< \brief Turbine Performance. */
COMPRESSOR = 7, /*!< \brief Compressor Performance. */
PROPELLOR = 8 /*!< \brief Propellor Performance. */
};
static const MapType<string, TURBOMACHINERY_TYPE> TurboMachinery_Map = {
MakePair("AXIAL", AXIAL)
MakePair("CENTRIFUGAL", CENTRIFUGAL)
MakePair("CENTRIPETAL", CENTRIPETAL)
MakePair("CENTRIPETAL_AXIAL", CENTRIPETAL_AXIAL)
MakePair("AXIAL_CENTRIFUGAL", AXIAL_CENTRIFUGAL)
MakePair("TURBINE", TURBINE)
MakePair("COMPRESSOR", COMPRESSOR)
MakePair("PROPELLOR", PROPELLOR)
};

/*!
Expand Down
26 changes: 13 additions & 13 deletions Common/src/geometry/CPhysicalGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5123,7 +5123,7 @@ unsigned short iMarker, jMarker, iMarkerTP, iSpan, jSpan, kSpan = 0;
jVertex = nodes->GetVertex(iPoint, jMarker);
if ((jVertex != -1) && (PeriodicBoundary == (val_iZone + 1))){
coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL:
valueSpan[nSpan_loc] = coord[2];
break;
Expand Down Expand Up @@ -5256,7 +5256,7 @@ unsigned short iMarker, jMarker, iMarkerTP, iSpan, jSpan, kSpan = 0;
jVertex = nodes->GetVertex(iPoint, jMarker);
if ((jVertex != -1) && (PeriodicBoundary == (val_iZone + 1))){
coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL: case CENTRIPETAL:
if (coord[2] < min) min = coord[2];
if (coord[2] > max) max = coord[2];
Expand Down Expand Up @@ -5434,7 +5434,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
jSpan = std::numeric_limits<unsigned short>::max();
coord = nodes->GetCoord(iPoint);

switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL: case CENTRIPETAL:
for(iSpan = 0; iSpan < nSpanWiseSections[marker_flag-1]; iSpan++){
if (dist > (abs(coord[2]-SpanWiseValue[marker_flag-1][iSpan]))){
Expand Down Expand Up @@ -5535,7 +5535,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
jSpan = std::numeric_limits<unsigned short>::max();

coord = nodes->GetCoord(iPoint);
switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL: case CENTRIPETAL:
for(iSpan = 0; iSpan < nSpanWiseSections[marker_flag-1]; iSpan++){
if (dist > (abs(coord[2]-SpanWiseValue[marker_flag-1][iSpan]))){
Expand Down Expand Up @@ -5627,7 +5627,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
/*--- find nodes at minimum pitch among all nodes---*/
if (coord[1]<min){
min = coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone * 2) == AXIAL){
MinAngularCoord[iMarker][iSpan] = coord[1];
}
else{
Expand All @@ -5641,7 +5641,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
if (coord[1]<minInt){
if(nodes->GetDomain(iPoint)){
minInt = coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone * 2) == AXIAL){
minIntAngPitch[iSpan] = coord[1];
}
else{
Expand All @@ -5654,7 +5654,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
if (coord[1]>max){
if(nodes->GetDomain(iPoint)){
max =coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone * 2) == AXIAL){
MaxAngularCoord[iMarker][iSpan] = coord[1];
}
else{
Expand All @@ -5674,7 +5674,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
checkAssign[iSpan][kSpanVertex] = true;
coord = nodes->GetCoord(ordered[iSpan][iSpanVertex]);
target = coord[1];
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone) == AXIAL){
if (nDim == 2 && config->GetKind_TurboMachinery(val_iZone * 2) == AXIAL){
angPitch[iSpan][iSpanVertex]=coord[1];
}
else{
Expand All @@ -5696,7 +5696,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
turbovertex[iMarker][iSpan][iInternalVertex]->SetOldVertex(oldVertex3D[iSpan][kSpanVertex]);
turbovertex[iMarker][iSpan][iInternalVertex]->SetAngularCoord(angPitch[iSpan][iSpanVertex]);
turbovertex[iMarker][iSpan][iInternalVertex]->SetDeltaAngularCoord(deltaAngPitch[iSpan][iSpanVertex]);
switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL:
Normal2 = 0.0;
for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
Expand Down Expand Up @@ -6051,7 +6051,7 @@ void CPhysicalGeometry::SetTurboVertex(CConfig *config, unsigned short val_iZone
myfile.width(20); myfile << y_loc[iSpan][iSpanVertex];
myfile.width(20); myfile << z_loc[iSpan][iSpanVertex];
myfile.width(20); myfile << radius;
if (nDim ==2 && config->GetKind_TurboMachinery(val_iZone)){
if (nDim ==2 && config->GetKind_TurboMachinery(val_iZone * 2)){
myfile.width(20); myfile << angCoord_loc[iSpan][iSpanVertex];
myfile.width(20); myfile << deltaAngCoord_loc[iSpan][iSpanVertex];
}
Expand Down Expand Up @@ -6119,7 +6119,7 @@ void CPhysicalGeometry::UpdateTurboVertex(CConfig *config, unsigned short val_iZ
iPoint = turbovertex[iMarker][iSpan][iSpanVertex]->GetNode();
coord = nodes->GetCoord(iPoint);
/*--- compute appropriate turbo normal ---*/
switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL:
Normal2 = 0.0;
for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
Expand Down Expand Up @@ -6363,7 +6363,7 @@ void CPhysicalGeometry::SetAvgTurboValue(CConfig *config, unsigned short val_iZo
for (iDim = 0; iDim < nDim; iDim++){
AverageGridVel[iMarker][iSpan][iDim] =TotalGridVel[iDim]/nTotVertexSpan[iMarker][iSpan];
}
switch (config->GetKind_TurboMachinery(val_iZone)){
switch (config->GetKind_TurboMachinery(val_iZone * 2)){
case CENTRIFUGAL:case CENTRIPETAL:
if (marker_flag == INFLOW ){
AverageTangGridVel[iMarker][iSpan]= -(AverageTurboNormal[iMarker][iSpan][0]*AverageGridVel[iMarker][iSpan][1]-AverageTurboNormal[iMarker][iSpan][1]*AverageGridVel[iMarker][iSpan][0]);
Expand Down Expand Up @@ -6619,7 +6619,7 @@ void CPhysicalGeometry::GatherInOutAverageValues(CConfig *config, bool allocate)

if (iSpan == nSpanWiseSections) {
config->SetFreeStreamTurboNormal(turboNormal);
if (config->GetKind_TurboMachinery(config->GetiZone()) == AXIAL && nDim == 2){
if (config->GetKind_TurboMachinery(config->GetiZone() * 2) == AXIAL && nDim == 2){
nBlades = 1/Pitch;
}
else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ class CCompressorBladePerformance : public CTurbomachineryBladePerformance {

};

class CPropellorBladePerformance : public CTurbomachineryBladePerformance {

public:
CPropellorBladePerformance(CFluidModel& fluidModel,
unsigned short nDim,
su2double areaIn,
su2double radiusIn,
su2double areaOut,
su2double radiusOut);

void ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) override;

};

class CTurbomachineryStagePerformance : CTurbomachineryBladePerformance {
protected:
su2double TotalStaticEfficiency, TotalTotalEfficiency, KineticEnergyLoss, TotalPressureLoss, EntropyGen, PressureRatio, EulerianWork;
Expand Down
7 changes: 4 additions & 3 deletions SU2_CFD/src/SU2_CFD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,10 @@ int main(int argc, char *argv[]) {

/*--- Turbomachinery problem. ---*/
//TODO: this is a temporary change
driver = new CSinglezoneDriver(config_file_name, nZone, MPICommunicator);
//driver = new CTurbomachineryDriver(config_file_name, nZone, MPICommunicator);

if (multizone)
driver = new CMultizoneDriver(config_file_name, nZone, MPICommunicator);
else
driver = new CSinglezoneDriver(config_file_name, nZone, MPICommunicator);
}
else {

Expand Down
6 changes: 6 additions & 0 deletions SU2_CFD/src/drivers/CMultizoneDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,12 @@ bool CMultizoneDriver::Transfer_Data(unsigned short donorZone, unsigned short ta
targetSolver = FEA_SOL;
break;
}
case MIXING_PLANE:
{
donorSolver = FLOW_SOL;
targetSolver = FLOW_SOL;
break;
}
case NO_TRANSFER:
case ZONES_ARE_EQUAL:
case NO_COMMON_INTERFACE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,42 @@ void CTurbineBladePerformance::ComputePerformance(const CTurbomachineryCombinedP
KineticEnergyLoss = 2 * (OutletState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2;
}

// CCompressorBladePerformance::CCompressorBladePerformance(unsigned short nDim, su2double area, su2double radius) : CTurbomachineryBladePerformance(nDim, area, radius){}
CCompressorBladePerformance::CCompressorBladePerformance(CFluidModel& fluidModel,
unsigned short nDim,
su2double areaIn,
su2double radiusIn,
su2double areaOut,
su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){}

void CCompressorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) {
/*--- Compute Inlet and Outlet state ---*/
InletState.ComputeState(FluidModel, primitives.GetInletPrimitiveState());
OutletState.ComputeState(FluidModel, primitives.GetOutletPrimitiveState());

/*--- Compute isentropic Outflow quantities ---*/
FluidModel.SetTDState_Ps(OutletState.GetPressure(), InletState.GetEntropy());
auto enthalpyOutIs = FluidModel.GetStaticEnergy() + OutletState.GetPressure() / FluidModel.GetDensity();
auto tangVel = primitives.GetOutletPrimitiveState().GetTangVelocity();
auto relVelOutIs2 = 2 * (OutletState.GetRothalpy() - enthalpyOutIs) + tangVel * tangVel;

/*--- Compute performance ---*/
EntropyGen = (OutletState.GetEntropy() - InletState.GetEntropy()); // / abs(InletState.GetEntropy() + 1);
EulerianWork = InletState.GetTotalEnthalpy() - OutletState.GetTotalEnthalpy();
TotalPressureLoss = (InletState.GetTotalRelPressure() - OutletState.GetTotalRelPressure()) /
(InletState.GetTotalRelPressure() - OutletState.GetPressure());
KineticEnergyLoss = 2 * (OutletState.GetEnthalpy() - enthalpyOutIs) / relVelOutIs2;
}

CPropellorBladePerformance::CPropellorBladePerformance(CFluidModel& fluidModel,
unsigned short nDim,
su2double areaIn,
su2double radiusIn,
su2double areaOut,
su2double radiusOut) : CTurbomachineryBladePerformance(fluidModel, nDim, areaIn, radiusIn, areaOut, radiusOut){}

void CPropellorBladePerformance::ComputePerformance(const CTurbomachineryCombinedPrimitiveStates &primitives) {

}

CTurbomachineryPerformance::CTurbomachineryPerformance(const CConfig& config,
const CGeometry& geometry,
Expand All @@ -155,9 +190,36 @@ CTurbomachineryPerformance::CTurbomachineryPerformance(const CConfig& config,
auto areaOut = geometry.GetSpanAreaOut(iBladeRow, iSpan);
auto radiusIn = geometry.GetTurboRadiusIn(iBladeRow, iSpan);
auto radiusOut = geometry.GetTurboRadiusOut(iBladeRow, iSpan);
auto bladePerformance = make_shared<CTurbineBladePerformance>(fluidModel, nDim, areaIn, radiusIn, areaOut,
radiusOut);
bladeSpanPerformances.push_back(bladePerformance);

// TODO: I have a feeling this should not be in such a for loop, to be discussed with Salvo (Nitish)
SU2_OMP_PARALLEL
{
const int thread = omp_get_thread_num();

/* Switch between the Turbomachinery Performance Kind */
switch (config.GetKind_TurboMachinery(1)) {

case TURBINE:
bladeSpanPerformances.push_back(make_shared<CTurbineBladePerformance>(fluidModel, nDim, areaIn, radiusIn, areaOut,
radiusOut));
break;

case COMPRESSOR:
bladeSpanPerformances.push_back(make_shared<CCompressorBladePerformance>(fluidModel, nDim, areaIn, radiusIn, areaOut,
radiusOut));
break;

case PROPELLOR:
bladeSpanPerformances.push_back(make_shared<CPropellorBladePerformance>(fluidModel, nDim, areaIn, radiusIn, areaOut,
radiusOut));
break;

default:
bladeSpanPerformances.push_back(make_shared<CTurbineBladePerformance>(fluidModel, nDim, areaIn, radiusIn, areaOut,
radiusOut));
break;
}
}
}
BladesPerformances.push_back(bladeSpanPerformances);
}
Expand Down
14 changes: 7 additions & 7 deletions SU2_CFD/src/output/COutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,7 +2195,7 @@ void COutput::SetTurboPerformance_Output(CGeometry *geometry,


// TODO: Summary Print is hard coded, CONFIG file option to be added
if(curInnerIter%10 == 0 && rank == MASTER_NODE){
if(curInnerIter%10 == 0 && rank == MASTER_NODE && false){
auto BladePerformance = solver_container[ZONE_0]->GetTurbomachineryPerformance()->GetBladesPerformances();

/*-- Table for Turbomachinery Performance Values --*/
Expand All @@ -2208,12 +2208,12 @@ void COutput::SetTurboPerformance_Output(CGeometry *geometry,
TurboInOut.PrintHeader();

// TODO: Error is assessing boundary state values.
TurboInOut << "Entropy" << BladePerformance.at(0).at(0)->GetInletState().GetEntropy() << BladePerformance.at(0).at(0)->GetOutletState().GetEntropy();
TurboInOut << "TotEnthalpy" << BladePerformance.at(0).at(0)->GetInletState().GetTotalEnthalpy() << BladePerformance.at(0).at(0)->GetOutletState().GetTotalEnthalpy();
TurboInOut << "TotPressure" << BladePerformance.at(0).at(0)->GetInletState().GetTotalPressure() << BladePerformance.at(0).at(0)->GetOutletState().GetTotalPressure();
TurboInOut << "Mass Flow" << BladePerformance.at(0).at(0)->GetInletState().GetMassFlow() << BladePerformance.at(0).at(0)->GetOutletState().GetMassFlow();
TurboInOut << "Mach No." << BladePerformance.at(0).at(0)->GetInletState().GetMachValue() << BladePerformance.at(0).at(0)->GetOutletState().GetMachValue();
TurboInOut << "Flow Angle" << BladePerformance.at(0).at(0)->GetInletState().GetAbsFlowAngle() << BladePerformance.at(0).at(0)->GetOutletState().GetAbsFlowAngle();
TurboInOut << "Entropy" << BladePerformance.at(0).at(0)->GetInletState().GetEntropy() << BladePerformance.at(0).at(0)->GetOutletState().GetEntropy();
TurboInOut << "TotEnthalpy" << BladePerformance.at(0).at(0)->GetInletState().GetTotalEnthalpy() << BladePerformance.at(0).at(0)->GetOutletState().GetTotalEnthalpy();
TurboInOut << "TotPressure" << BladePerformance.at(0).at(0)->GetInletState().GetTotalPressure() << BladePerformance.at(0).at(0)->GetOutletState().GetTotalPressure();
TurboInOut << "Mass Flow" << BladePerformance.at(0).at(0)->GetInletState().GetMassFlow() << BladePerformance.at(0).at(0)->GetOutletState().GetMassFlow();
TurboInOut << "Mach No." << BladePerformance.at(0).at(0)->GetInletState().GetMachValue() << BladePerformance.at(0).at(0)->GetOutletState().GetMachValue();
TurboInOut << "Flow Angle" << BladePerformance.at(0).at(0)->GetInletState().GetAbsFlowAngle()*180/PI_NUMBER << BladePerformance.at(0).at(0)->GetOutletState().GetAbsFlowAngle()*180/PI_NUMBER;
TurboInOut.PrintFooter();
cout<<TurboInOutTable.str();

Expand Down
Loading

0 comments on commit 121dd26

Please sign in to comment.