Field3D.compute_residual_dissipation_rate
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 initializesCs
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:
DNS Mode:
Ensures the
DNS_folder_path
attribute is set, raising anAttributeError
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.
Smag Mode:
Checks if the
Cs
attribute is set, issuing a warning and initializingCs
to 0.1 if not.Ensures the
S_LES
attribute is set, raising anAttributeError
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.
Last updated