# Thermodynamic LES average weighted by mass flux¶

## Description¶

This treatment computes the spatial and temporal mean of three LES quantities. The formula of the average is weighted by mass flux.

**This thermodynamic average is available for the mean flow and instantaneous
flow fields of unsteady flows.**

## Parameters¶

**base**:`Base`

The base on which the treatment will be applied.

**conservative**:`list(str)`

, default=*[‘rhou’, ‘rhouPtotal’, ‘rhouTtotal’, ‘alpha’]*Names of turbomachinery conservative variables. The order has to be respected:

first, the momentum in the

*x*direction,then the total pressure multiplied by the x-momentum,

then the total temperature multiplied by the x-momentum,

and finally the gyration angle (optional).

**cell_surface_var**:`str`

, default=*‘cell_volume’*Name of the surface variable of the mesh elements in the

`Instant`

. For instance, if the`antares.treatment.turbomachine.TreatmentThermoGeom`

has been called beforehand, then the variable is named ‘surface’.

## Preconditions¶

The treatment must be applied on a mono-zone **base** containing a 2D section
resulting from a cut with a revolution surface around the ‘\(x\)’-axis of
an axisymmetric configuration.
This `Zone`

may contain one `Instant`

(steady-state) or several of them (instantaneous solutions at several instants).

For **steady flows**, the input quantities should directly come from the solver’s
output. In fact, due to ergodicity, make sure that quantities involved are well
defined in the flow solution. For instance, for the AVBP solver,
the **run.params** file must contain at least the following options in the
**OUTPUT-CONTROL** section:

- ::
save_average = yes save_average.mode = packages save_average.packages = conservative save_average.packages = turbomachinery

For **unsteady flows**, the input **base** must contain several
`Instant`

. Every instant will be taken into account to
perform the time averaging.

The **conservative** variables must be available at nodes or cells.

## Postconditions¶

The input **base** is returned, extended with the attribute named ‘0D/MoyenneLES#Steady’.

This attribute is a dictionary with the following key:

**Ptotal**associated to the quantity \(\frac{< \overline{\rho u P_{total}} >}{< \overline{\rho u} >}\)

**Ttotal**associated to the quantity \(\frac{< \overline{\rho u T_{total}} >}{< \overline{\rho u} >}\)

**alpha**associated to the quantity \(< \overline{\alpha} >\)

where

\(<\phi(\vec{x},t)> = \frac{1}{S} \iint_S \phi(\vec{x},t).\vec{n} \ dS\)
with \(\vec{n}\) the normal vector to the surface **S** and,

\(\overline{\phi(\vec{x},t)} = \frac{1}{t_f - t_0} \int_{t_0}^{t_f} \phi(\vec{x},t) \ dt\) with \(t_0\) and \(t_f\) respectively the starting and ending times of the temporal averaging.

## Examples¶

We consider a LES solution averaged in time from the AVBP solver. Therefore,
the **conservative** variables are already in the **base** as
solver’s outputs with the names rhou, rhouPt and rhouTt.
If the turbomachinery package is used, the
**alpha** variable is also already computed under the name *angle_alpha*.

```
import antares
# if the surface variable is missing at cell centers
base.compute_cell_volume(coordinates=['x', 'y', 'z'])
myt = antares.Treatment('ThermoLES')
myt['base'] = base
myt['conservative'] = ['rhou', 'rhouPt', 'rhouTt', 'angle_alpha']
myt['cell_surface_var'] = 'cell_volume'
base = myt.execute()
```

We now consider several instantaneous LES solutions. Therefore,
**conservative** variables may not be in the solver’s outputs. However, they
must be in the **base**, hence here they are computed through
`antares.api.Base.Base.compute()`

.
However, **alpha** must be in the base if turbomachinery package is on.

```
import antares
# compute the missing variable
base.compute('rhou = rho*u')
base.compute('rhouPt = rhou*Ptotal')
base.compute('rhouTt = rhou*Ttotal')
myt = antares.Treatment('ThermoLES')
myt['base'] = base
myt['conservative'] = ['rhou', 'rhouPt', 'rhouTt', 'angle_alpha']
base = myt.execute()
```