Heat Exchanger evaluation

A very basic heat exchanger class and a slightly better counter flow heat exchangers class is defined and functions to set their values and to calculate the change in properties along the heat exchanger are calculated using a boundary value problem solver. For the counterflow heat exchanger one shell and a number of inner tubes can be defined. One class is defined to read the input parameters from a YAML-File and to pass them to the heat excahnger class. The results are plotted and stored (also to an Excel file). Finally a run-script for the calculation is given as an example, which reads the data from the yaml-file, starts the heat-exchanger calculations and stores everything. The hex_run_script.py file should be a good starting point.

class components.heat_exchanger.heat_exchanger(fluids, mass_flows, pressures, enthalpies, UA=10, calc_type='const', name='HEX_0')
q_max(option=0)

Maximum possible heat transfer for an isobaric, adiabatic heat exchanger

Parameters

option (innteger, optional) – controls the output. The default is 0.

Returns

  • heatflow rate (float) – if option is 0.

  • also theoretical max. heatflorates of both fluids (numpy.array len(2))

  • the properties of both theoretical states

  • at the exit (T, p, h, v, s, q) (numpy.array (2,6)) – if option is 1

class components.heat_exchanger.counterflow_hex(fluids, mass_flows, pressures, enthalpies, length, diameters, U=10.0, no_tubes=1, no_points=100, props='REFPROP', compositions=[[1.0], [1.0]], calc_type='const', name='HEX_0', units=21)
bc(ha, hb)

two boundary conditions for bvp-solver (scipy.integrate) needed here: the enthalpies of the inner fluid at x=0 and the enthalpy of the outer fluid at the end of the heat exchanger at x=length

Parameters
  • ha (numpy array) – enthalpies of the inner fluid along the x-coordinate.

  • hb (numpy array) – enthalpies of the outer fluid along the x-coordinate.

Returns

the difference to the prescribed entrance conditions, should both get zero, if succesful.

Return type

numpy array of length 2

energy(x, h)

energy balance for solving the boundary value problem couples the energy changes of each fluid with the convective heat transfer between both fluids. At the moment the convection coefficient from the heat exchanger is used; this shall be evaluated later as a function of local heat exchanger parameters.

Parameters
  • x (float) – position in m.

  • h (numpy array length (2)) – specific enthalpies of the two fluids at the given position, each in J/kg.

Returns

dh – both changes in specific enthalpy in positive x-direction in J/(kg m).

Return type

numpy array length 2

exergy_entering()

Calculate the exergyflow rates of both fluids entering the heat exchanger. For exergy loss calculations and efficiencies.

Returns

ex – exergy flow rate in W.

Return type

float

he_bvp_solve()

solving the boundary volume problem (scipy) for the counter-flow heat exchanger

Returns

result

see scipy documentation, e.g. success (did it find a solution,

the x and y values)

Return type

dictionary

he_state(result, option=0, fname='hex_result')

After solving the bvp-Problem for the evaluation of all temperatures, enthalpies, entropies etc. along the counterflow heat exchanger and plotting T if option >1

Parameters
  • result (TYPE) – DESCRIPTION.

  • option (TYPE, optional) – DESCRIPTION. The default is 0.

  • fname (string) – filename (without ending for storing the figure and the numbers)

Returns

  • if success == True

  • states_0 numpy array – resolved state variables for the inner tube(s).

  • states_1 numpy array – resolved state variables for the outer tube.

  • ds float – entropy production rate of the heat exchanger (W/(K).

  • dh2 float – enthalpy change rate of the second fluid in the heat exchanger (W), equal to the heat flow rate.

class components.heat_exchanger.st_heat_exchanger_input(fluids, mass_flows, pressures, enthalpies, length, d_in, U, no_tubes, no_points, props, composition, calc_type='const', name='HEX_0', units=21)
all_out()

format the list output in such a way that it can be used as input for the counterflow heat exchanger. If the latter should be modified, this has to be modified too!

Returns

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

read_hex_file(out, all_out=False)

Reads an Excel File with information about heat exchangers, fluids etc. is used within carbatpy and the module heat_exchanger (see there for the specific output)

Parameters
  • fn (string) – name of an excel-file with at least 4 sheets as mentioned above, which list the variable names, values and further parameters and comments.

  • out (string) – only “HEXSimple” implemented so far, for the simple heat exchanger calculations with actual fluid properties in a counterflow configuration.

  • all_out (boolean) – if True a list with 4 Instances with variable names and values are returned together with all local variables (dictionaries) for usage in other modules.

Returns

if HEXSimple: a list with the required values for setting up the problem if (internally). if all_out is True, see above.

Return type

list

read_yaml()

read a yaml file

Parameters

fname (string, optional) – file name. The default is “out_fileN.yaml”.

Returns

neu – to be used as input.

Return type

instance of st_heat_exchanger_input

write_yaml(fname='st_hex_parameters_file.yaml')

Write a yaml file

Parameters

fname (string, optional) – file name. The default is “st_hex_parameters_file.yaml”.

Return type

None.