aPriori Documentation
  • 👋Welcome to aPriori
  • Getting started
    • What is aPriori?
    • Installation
    • Quickstart
  • Fundamentals and usage
    • aPriori Fundamentals
      • Data Formatting
      • Cut a 3D scalar
      • Filter a 3D scalar field
      • Initialize a DNS field
      • Data visualization
      • Cut a DNS field
      • Filter a DNS field
    • Machine Learning Tutorials
      • Data-Driven Closure for Turbulence-Chemistry interaction
      • Dynamic Data-Driven Smagorinky Closure for LES
  • API guide
    • Field3D
      • Field3D.build_attributes_list
      • Field3D.check_valid_attribute
      • Field3D.compute_chemical_timescale
      • Field3D.compute_kinetic_energy
      • Field3D.compute_mixing_timescale
      • Field3D.compute_residual_kinetic_energy
      • Field3D.compute_residual_dissipation_rate
      • Field3D.compute_reaction_rates
      • Field3D.compute_reaction_rates_batch
      • Field3D.compute_strain_rate
      • Field3D.compute_tau_r
      • Field3D.compute_velocity_module
      • Field3D.cut
      • Field3D.filter_favre
      • Field3D.filter
      • Field3D.find_path
      • Field3D.plot_x_midplane
      • Field3D.plot_y_midplane
      • Field3D.plot_z_midplane
      • Field3D.print_attributes
      • Field3D.update
    • Scalar3D
      • Scalar3D.is_light_mode
      • Scalar3D.reshape_3d
      • Scalar3D.reshape_column
      • Scalar3D.reshape_line
      • Scalar3D.cut
      • Scalar3D.filter_gauss
      • Scalar3D.plot_x_midplane
      • Scalar3D.plot_y_midplane
      • Scalar3D.plot_z_midplane
    • Mesh3D
  • BIBLIOGRAPHY
Powered by GitBook
On this page
  • Field3D.compute_residual_dissipation_rate(self, mode='Smag'):
  • Description
  • Parameters
  • Returns
  • Raises
  • Warning
  • Detailed Description
  1. API guide
  2. Field3D

Field3D.compute_residual_dissipation_rate

PreviousField3D.compute_residual_kinetic_energyNextField3D.compute_reaction_rates

Last updated 1 year ago

Field3D.compute_residual_dissipation_rate(self, mode='Smag'):


Description

This function computes the residual dissipation rate for a filtered velocity field, based on the specified mode: 'DNS' or 'Smag'. It requires that the field has been filtered and performs different calculations depending on the selected mode.

Parameters

  • mode (str, optional): The mode of operation. It can be either 'Smag' or 'DNS'. Defaults to 'Smag'.

    • 'Smag': Uses the Smagorinsky model to compute the residual dissipation rate.

    • 'DNS': Uses Direct Numerical Simulation data to compute the residual dissipation rate.

Returns

None:

The function does not return any values but saves the computed residual dissipation rate as a file in the main folder of the field.

Raises

  • ValueError:

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

    • If the filter type used is not 'box' or 'gauss'.

  • AttributeError:

    • If the 'DNS' mode is selected and the DNS_folder_path attribute is not set.

    • If the 'Smag' mode is selected and the S_LES attribute is not set.

Warning

  • If the 'Smag' mode is selected and the Cs attribute is not set, it initializes Cs to 0.1 by default.

Detailed Description

This function first updates the internal state of the field. It then checks the validity of the provided mode against the allowed modes stored in the variables dictionary.

If the field is not filtered (i.e., filter_size is 1), it raises a ValueError indicating that residual quantities can only be computed for filtered fields and provides instructions on how to filter the field.

Depending on the mode, the function performs different computations:

  1. DNS Mode:

    • Ensures the DNS_folder_path attribute is set, raising an AttributeError if not.

    • Loads the associated unfiltered DNS field.

    • Determines the filter type (either 'box' or 'gauss') used for the folder to ensure consistency.

    • Computes the anisotropic residual stress tensor and then the residual dissipation rate using the filtered DNS field and the LES strain rate.

    • Saves the computed residual dissipation rate to a file.

  2. Smag Mode:

    • Checks if the Cs attribute is set, issuing a warning and initializing Cs to 0.1 if not.

    • Ensures the S_LES attribute is set, raising an AttributeError if not.

    • Computes the residual dissipation rate using the Smagorinsky model.

    • Saves the computed residual dissipation rate to a file.

Finally, the function updates the internal state of the field again.