Field3D.compute_tau_r

Field3D.compute_tau_r(self, mode='Smag', save_tensor_components=True):


Description

Computes the anisotropic part of the residual stress tensor, denoted as τr\tau_r, for a given field in computational fluid dynamics simulations. The function can operate in two modes: 'Smag' and 'DNS'.

Parameters

  • ValueError: If the field is not a filtered field (i.e., self.filter_size == 1).

  • AttributeError: If required attributes (Cs, S_LES, DNS_folder_path) are not defined.

Raises

  • mode (str, optional): Mode of operation, either 'Smag' for the Smagorinsky model or 'DNS' for Direct Numerical Simulation data. Default is 'Smag'.

Returns

None

Workflow

  1. Initial Setup and Validation:

    • The function starts by updating the field and checking if the field is filtered.

    • If (self.filter_size == 1), it raises a (ValueError) because residual quantities computation only makes sense for filtered fields.

  2. Mode: 'Smag' (Smagorinsky Model):

    • Turbulent Viscosity:

      • Checks if the Smagorinsky constant ((Cs)) is defined. If not, it initializes (Cs) to 0.1.

      • Computes the turbulent viscosity ((\mu_t)) using: μt=(CsΔl)2SLES\mu_t = (Cs \cdot \Delta \cdot l)^2 \cdot S_{LES} where Δ\Delta is the filter size, ll is the grid size, and SLESS_{LES} is the strain rate at LES scale.

    • Anisotropic Residual Stress Tensor:

      • Initializes τr\tau_r as a zero matrix.

      • For each component ((i, j)) of the tensor:

        • Computes τijr=2μtSijLES\tau^r_{ij} = -2\mu_t S_{ij}^{LES} .

        • Adjusts for compressibility by subtracting the isotropic part (Siso)when(i=j)(S_{iso}) when (i = j).

        • Computes the squared components and accumulates them.

        • Saves the computed τijr\tau^r_{ij} to a file.

  3. Mode: 'DNS' (Direct Numerical Simulation):

    • DNS Data Setup:

      • Checks if the path to DNS data is defined.

      • Initializes a (DNS_field) object to read DNS data.

      • Determines the type of filter used (box or Gaussian).

    • Residual Kinetic Energy:

      • Computes residual kinetic energy ( K_r^{DNS} ) as: KrDNS=0.5(Ux2+Uy2+Uz2)DNS0.5(Ux2+Uy2+Uz2)K_r^{DNS} = 0.5 \left( U_x^2 + U_y^2 + U_z^2 \right)_{DNS} - 0.5 \left( U_x^2 + U_y^2 + U_z^2 \right)

      • Saves ( K_r^{DNS} ) to a file.

    • Anisotropic Residual Stress Tensor:

      • Initializes (\tau_r) as a zero matrix.

      • For each component (i,j)(i, j) of the tensor:

        • Computes the filtered product (UiUj)~DNS)\widetilde{(U_i U_j)}_{DNS})

        • Calculates τijr\tau^r_{ij} as: τijr=(UiUj)~DNSU~iU~jδij23KrDNS\tau^r_{ij} = \widetilde{(U_i U_j)}_{DNS} - \widetilde{U}_i \widetilde{U}_j - \delta_{ij} \frac{2}{3} K_r^{DNS}

        • Computes the squared components and accumulates them.

        • Saves the computed τijr\tau^r_{ij} to a file.

Last updated