turboflow.centrifugal_compressor.performance_analysis module

class turboflow.centrifugal_compressor.performance_analysis.CentrifugalCompressorProblem(geometry, simulation_options)[source]

Bases: NonlinearSystemProblem

Methods

get_initial_guess(initial_guess)

3 options:

get_vaned_diffuser_guess(guess, input)

Similar as vaneless diffuser Assume zero deviation at exit

get_vaneless_diffuser_guess(guess, input)

Guess constant alpha Simple correlation for static enthalpy loss coefficient

get_volute_guess(input)

Guess constant density Guess single velocity component at the exit

residual(x)

Evaluate the system of equations for given decision variables.

scale_values(variables[, to_normalized])

Convert values between normalized and real values.

update_boundary_conditions(operation_point)

Update the boundary conditions of the problem with the provided operation point.

get_heuristic_guess

get_impeller_guess

get_heuristic_guess(guess)[source]
get_impeller_guess(guess, input)[source]
get_initial_guess(initial_guess)[source]
3 options:
  1. Give guess of efficiency_tt and phi_out. Initial guess calculated heuristically

  2. Give bounds of efficiency_tt and phi_out, and a sample size. Initial guess calculated by the best

  3. Give complete set (real values)

get_vaned_diffuser_guess(guess, input)[source]

Similar as vaneless diffuser Assume zero deviation at exit

get_vaneless_diffuser_guess(guess, input)[source]

Guess constant alpha Simple correlation for static enthalpy loss coefficient

get_volute_guess(input)[source]

Guess constant density Guess single velocity component at the exit

residual(x)[source]

Evaluate the system of equations for given decision variables.

Parameters:
xarray-like

Vector of decision variables.

Returns:
array_like

Vector containing the values of the system of equations for the given decision variables.

scale_values(variables, to_normalized=True)[source]

Convert values between normalized and real values.

Parameters:
variables: dict

A dictionary containing values to be scaled.

to_real: bool

If True, scale to real values; if False, scale to normalized values.

Returns:
An array of values converted between scales.
update_boundary_conditions(operation_point)[source]

Update the boundary conditions of the problem with the provided operation point.

This method updates the boundary conditions attributes used to evaluate the turbine performance. It also initializes a Fluid object using the ‘fluid_name’ specified in the operation point. The method computes additional properties and reference values like stagnation properties at the inlet, exit static properties, spouting velocity, and reference mass flow rate. These are stored in the object’s internal state for further use in calculations.

Parameters:
operation_pointdict

A dictionary containing the boundary conditions defining the operation point.

Returns:
None

This method does not return a value but updates the internal state of the object.

turboflow.centrifugal_compressor.performance_analysis.SOLVER_MAP = {'hybr': "Powell's hybrid", 'lm': 'Lavenberg-Marquardt'}

Available solvers for performance analysis.

turboflow.centrifugal_compressor.performance_analysis.compute_performance(config, operation_points, stop_on_failure=False, export_results=False, out_dir='output', out_filename=None)[source]
turboflow.centrifugal_compressor.performance_analysis.compute_single_operation_point(operating_point, initial_guess, geometry, simulation_options, solver_options)[source]
turboflow.centrifugal_compressor.performance_analysis.export_results_excel(solver_container, out_dir, out_filename)[source]

Export results to excel file Each component has a distinct sheet in the excel file

turboflow.centrifugal_compressor.performance_analysis.find_closest_operation_point(current_op_point, operation_points, solution_data, solver_container)[source]

Find the solution vector and index of the closest operation point in the historical data.

Parameters:
current_op_pointdict

The current operation point we want to compare.

operation_pointslist of dict

A list of historical operation points to search through.

solution_datalist

A list of solution vectors corresponding to each operation point.

solver_containerlist

A list of solver objects corresponding to each operation point.

Returns:
tuple

A tuple containing the closest solution vector and the one-based index of the closest operation point.

turboflow.centrifugal_compressor.performance_analysis.generate_operation_points(operation_points)[source]

Generates a list of dictionaries representing all possible combinations of operation points from a given input. If the input is a dictionary with ranges, it generates all combinations; if it’s a list or array, it directly returns the operation points.

Parameters:
- operation_points (dict or list/np.ndarray): A dictionary with parameter names as

keys and lists of parameter values as values, or a precomputed list of operation points.

Returns:
  • operation_points (list of dict): A list of dictionaries, each representing

    a unique combination of parameters from the performance map.

turboflow.centrifugal_compressor.performance_analysis.get_operation_point_distance(point_1, point_2, delta=1e-08)[source]

Calculate the normalized distance between two operation points, with special consideration for angle measurements and prevention of division by zero for very small values.

Parameters:
point_1dict

First operation point with numeric values.

point_2dict

Second operation point with numeric values.

deltafloat, optional

A small constant to prevent division by zero. Default is 1e-8.

Returns:
float

The calculated normalized distance.

turboflow.centrifugal_compressor.performance_analysis.handle_failure(point_index, error, stop_on_failure)[source]
turboflow.centrifugal_compressor.performance_analysis.latin_hypercube_sampling(bounds, n_samples)[source]

Generates samples using Latin Hypercube Sampling.

Parameters: bounds (list of tuples): A list of (min, max) bounds for each variable. n_samples (int): The number of samples to generate.

Returns: np.ndarray: An array of shape (n_samples, n_variables) containing the samples.

turboflow.centrifugal_compressor.performance_analysis.print_boundary_conditions(BC)[source]

Print the boundary conditions.

This function prints the boundary conditions in a formatted manner. It takes a dictionary BC containing the following keys:

  • fluid_name (str): Name of the fluid.

  • alpha_in (float): Flow angle at inlet in degrees.

  • T0_in (float): Total temperature at inlet in Kelvin.

  • p0_in (float): Total pressure at inlet in Pascal.

  • mass_flow_rate (float): Static pressure at outlet in Pascal.

  • omega (float): Angular speed in radians per second.

Parameters:
BCdict

A dictionary containing the boundary conditions.

turboflow.centrifugal_compressor.performance_analysis.print_operation_points(operation_points)[source]

Prints a summary table of operation points scheduled for simulation.

This function takes a list of operation point dictionaries, formats them according to predefined specifications, applies unit conversions where necessary, and prints them in a neatly aligned table with headers and units.

Parameters:
- operation_points (list of dict): A list where each dictionary contains

key-value pairs representing operation parameters and their corresponding values.

Notes

  • This function assumes that all necessary keys exist within each operation point dictionary.

  • The function directly prints the output; it does not return any value.

  • Unit conversions are hardcoded and specific to known parameters.

  • If the units of the parameters change or if different parameters are added, the unit conversion logic and field_specs need to be updated accordingly.

turboflow.centrifugal_compressor.performance_analysis.print_simulation_summary(solvers)[source]

Print a formatted footer summarizing the performance of all operation points.

This function processes a list of solver objects to provide a summary of the performance analysis calculations. It calculates and displays the number of successful points and a summary of simulation tme statistics. Additionally, it lists the indices of failed operation points, if any.

The function is robust against solvers that failed and lack certain attributes like ‘elapsed_time’. In such cases, these solvers are included in the count of failed operation points, but not in the calculation time statistics.

Parameters:
solverslist

A list of solver objects. Each solver object should contain attributes related to the calculation of an operation point, such as ‘elapsed_time’ and the ‘solution’ status.

turboflow.centrifugal_compressor.performance_analysis.validate_operation_point(op_point)[source]

Validates that an operation point has exactly the required fields: ‘fluid_name’, ‘p0_in’, ‘T0_in’, ‘mass_flow_rate’, ‘alpha_in’, ‘omega’.

Parameters:
op_point: dict

A dictionary representing an operation point.

Returns:
ValueError: If the dictionary does not contain the required fields or contains extra fields.