#### Turbine Stator Report Template

COMMAND FILE:
  CFX Post Version = 11.0
END

! $dataDir = $ENV{CUE_LOCAL_DATA_DIR};
> readsession filename=$dataDir/PostReports/turboReportCommon.cse


#### Report Description

REPORT:
  REPORT PROPERTIES:
    Report Template Name = Turbine Stator Report
    Keywords = turbo, turbine, stator, nozzle
    Report Template Description = A report for a single domain gas or steam turbine stator (or nozzle) analysis.
  END
  PUBLISH:
    Default Report Name = Turbine Stator Report
    Report Path = ./TurbineStatorReport.htm
  END
END
TITLE PAGE:
  Report Title = Turbine Stator Report
END


#### Turbo Initialization

# Determine if solution contains TBR data (Fourier Storage)
! if ( objectExists('Velocity.Trnavg') ) {
!   my $error = 'Transient Blade Row data exists.  This report is not suitable for transient data.';
!   if (defined(&CUEPost::reportError)) { CUEPost::reportError($error) }
!   else { print $error, "\n" }
! }

!initTurbo();

! $isRotor = 0;

#### Get Domain Information


!getDomainInfo();
!setDomainTransform();


#### Define Expressions

!commonCEL();

LIBRARY:
  CEL:
    EXPRESSIONS:
      mfr = massFlow()@$regionInlet * numComponents
      Q in = numComponents * massFlow()@$regionInlet / rho in
      Q out = numComponents * -1 * massFlow()@$regionOutlet / rho out
# The following expressions are from Whitfield and Baines:
      Area Ratio = area()@$regionOutlet / area()@$regionInlet
      Loss Coefficient = (Pt in - Pt out) / ( Pt in - P in)
#      CPi = Sigma in - Sigma out / (Area Ratio)^2
#      CP = CPi - Loss Coefficient

!if( $solverEff )
!{
      hs in = massFlowAve(Isentropic Total Enthalpy)@$regionOutlet - (Pt in - P in)/rho in
!}
!else
!{
      cp ave = volumeAve(Specific Heat Capacity at Constant Pressure)@$domain
      cv ave = volumeAve(Specific Heat Capacity at Constant Volume)@$domain
      Rgas ave = cp ave - cv ave 
      Gamma ave = cp ave / cv ave
      Hs in to out = (Gamma ave/(Gamma ave - 1)) * Rgas ave * Tt in * ((Pt in/Pt out)^((Gamma ave - 1)/Gamma ave) - 1)
      hs in = H out - Hs in to out - (Pt in - P in)/rho in
!}

      Nozzle Eff = 100 * (H in - h in) / (H in - hs in)
    END
  END
END


#### User Variables


#### Results Tables


COMMENT:Tabulated Results
  Comment Heading = Tabulated Results
  Heading Level = 1
  Comment Text = \
  <p>The first table below gives a summary of the performance results for the turbine stator.  The second table lists the mass or area averaged solution variables and derived quantities computed at the inlet, leading edge (LE Cut), trailing edge (TE Cut) and outlet locations.  The flow angle Beta is relative to the meridional plane; a positive angle implies that the tangential velocity is the same direction as theta.</p>
END

!{
!  my @list = ('Mass Flow Rate', 'mfr', '%7.4f',
!              'Inlet Volume Flow Rate', 'Q0 in', '%7.4f',
!              'Area Ratio (A out / A in)', 'Area Ratio', '%7.4f',
!              'Total Pressure Loss Coefficient', 'Loss Coefficient', '%7.4f',
!              'Nozzle Efficiency %', 'Nozzle Eff', '%7.4f');

!  computedResultsTable( "Turbine Performance Results", @list );
!}

#### Summary Data Table


!summaryDataTable();


#### Blade Loading Chart


!shortheader1("Blade Loading Charts");

!bladeLoadingChart( "Blade Loading", "Pressure", $locSpanLow );
!bladeLoadingChart( "Blade Loading", "Pressure", $locSpanMid );
!bladeLoadingChart( "Blade Loading", "Pressure", $locSpanHigh );


#### Streamwise Charts


!shortheader1("Streamwise Charts");

!streamwiseChart( "Streamwise Plot of Pt and P", 10, "Total Pressure", "Pt", "mass", "Pressure", "P", "area" );
!streamwiseChart( "Streamwise Plot of Tt and T", 10, "Total Temperature", "Tt", "mass", "Temperature", "T", "mass" );
!streamwiseChart( "Streamwise Plot of Mach Number", 10, "Mach Number", "M", "area" );
!streamwiseChart( "Streamwise Plot of Beta", 10, "Velocity Beta", "Beta", "area" );
!streamwiseChart( "Streamwise Plot of Static Entropy", 10, "Static Entropy", "s", "mass" );


#### Spanwise Charts


!shortheader1("Spanwise Charts");

!spanwiseChart( "Spanwise Plot of Beta", "at LE", $locStreamLE, 20, "Velocity Beta", "Beta", "area" );
!spanwiseChart( "Spanwise Plot of Mach Number", "at LE", $locStreamLE, 20, "Mach Number", "M", "area");
!spanwiseChart( "Spanwise Plot of Beta", "at TE", $locStreamTE, 20, "Velocity Beta", "Beta", "area" );
!spanwiseChart( "Spanwise Plot of Mach Number", "at TE", $locStreamTE, 20, "Mach Number", "M", "area" );
!spanwiseChart( "Spanwise Plot of Meridional Velocity", "at TE", $locStreamTE, 20, "Velocity Meridional", "Cm", "area" );


#### Blade Geometry Plots


!shortheader1("Blade Geometry Plots");

!bladeGeometryPlots();


#### Blade Mesh Plot


!shortheader1("Blade Mesh Plot");

!bladeMeshPlot( $locSpanMid );


#### Blade to Blade Plots


!shortheader1("Blade to Blade Plots");

###!bladetobladeContourPlot( "Total Pressure", "Ptr", $locSpanMid, 20 );

!bladetobladeContourPlot( "Mach Number", "M", $locSpanLow, 20 );
!bladetobladeContourPlot( "Mach Number", "M", $locSpanMid, 20 );
!bladetobladeContourPlot( "Mach Number", "M", $locSpanHigh, 20 );

!bladetobladeVectorPlot( $locSpanLow );
!bladetobladeVectorPlot( $locSpanMid );
!bladetobladeVectorPlot( $locSpanHigh );

!bladetobladeContourPlot( "Static Entropy", "s", $locSpanLow, 20 );
!bladetobladeContourPlot( "Static Entropy", "s", $locSpanMid, 20 );
!bladetobladeContourPlot( "Static Entropy", "s", $locSpanHigh, 20 );


#### Meridional Plots


!shortheader1("Meridional Plots");

!meridionalContourPlot( "Total Pressure", "Pt", 20 );
!meridionalContourPlot( "Pressure", "P", 20 );
!meridionalContourPlot( "Mach Number", "M rel", 20 );
!meridionalVectorPlot( "Velocity Meridional", "Cm");


#### Circumferential Plots


!shortheader1("Circumferential Plots");

!circContourPlot( "Total Pressure", "Pt", $locStreamLE, "Blade LE", 20, -1 );
!circContourPlot( "Mach Number", "M", $locStreamLE, "Blade LE", 20, -1 );
!circContourPlot( "Static Entropy", "s", $locStreamLE, "Blade LE", 20, -1 );
!circContourPlot( "Total Pressure", "Pt", $locStreamTE, "Blade TE", 20, 1 );
!circContourPlot( "Mach Number", "M rel", $locStreamTE, "Blade TE", 20, 1 );
!circContourPlot( "Static Entropy", "s", $locStreamTE, "Blade TE", 20, 1 );


#### 3D Streamline Plots


!shortheader1("Streamline Plot");

!circStreamPlot( $locStreamTE, "Blade TE" );


#### End


# Set view to blade geometry view
>setViewportView cmd=set, view=/VIEW:Blade Geometry Isometric 3D View, viewport=1
>centerview 1

