Field3D
Last updated
The Field3D
class encapsulates a 3D DNS simulation, allowing for operations such as data loading, filtering, and accessing various properties of the field. This class is central to handling the volumetric data of computational fluid dynamics simulations.
The field to use as input must be formatted as Blastnet's datasets: .
variables
: Dictionary containing variable names and their corresponding settings.
mesh
: Mesh3D object. See the class Mesh3D for more information.
__field_dimension
: Dimensionality of the field, always set to 3.
__init__(self, folder_path):
Constructor method to initialize a 3D field object.
Dynamic attributes: Scalar3D objects depending on the files contained in the main folder folder_path
, initializes various attributes as Scalar3D objects.
Example:
S_DNS
../data/DNS_DATA_TEST/data/S_DNS_s-1_id000.dat
P
../data/DNS_DATA_TEST/data/P_Pa_id000.dat
RHO
../data/DNS_DATA_TEST/data/RHO_kgm-3_id000.dat
...
...
build_attributes_list(self)
: Build lists of attribute names and corresponding file paths based on the configuration specified in variables_list
.
check_valid_attribute(self, input_attribute)
: Check if the input attribute is assigned to the Field3D object.
compute_chemical_timescale(self, mode='SFR', verbose=False)
: Computes the chemical timescale for the field, useful in Partially Stirred Reactor (PaSR) modeling.
compute_kinetic_energy(self)
: Computes the velocity module and saves it to a file.
compute_mixing_timescale(self, mode='Kolmo')
: Computes the mixing timescale for the field, useful for turbulence modeling.
compute_reaction_rates(self, n_chunks=5000)
: Computes the source terms for a given chemical reaction system using Arrhenius equation for the given kinetic mechanism.
compute_reaction_rates_batch(self, n_chunks=5000, tau_c='SFR', tau_m='Kolmo')
: Computes the source terms for a given chemical reaction system by integrating an ideal reactor in time.
compute_residual_kinetic_energy(self, mode='Yosh')
: Function to compute the residual kinetic energy.
compute_residual_dissipation_rate(self, mode='Smag')
: Computes the residual dissipation rate for a filtered velocity field.
compute_strain_rate(self, save_derivatives=False, save_tensor=True, verbose=False)
: Computes the strain rate of the velocity components (U, V, W) over a 3D mesh.
compute_tau_r(self, mode='Smag', save_tensor_components=True)
: Computes the anisotropic part of the residual stress tensor, denoted as (\tau_r).
compute_velocity_module(self)
: Computes the velocity module and saves it to a file.
cut(self, cut_size, mode='xyz')
: Cut a field into a section based on a specified cut size.
filter_favre(self, filter_size, filter_type='Gauss')
: Filter every scalar in the field object using Favre-averaging.
filter(self, filter_size, filter_type='Gauss')
: Filter every scalar in the field object.
find_path(self, attr)
: Finds a specified attribute in the attributes list and returns the corresponding element in the paths list.
plot_x_midplane(self, attribute)
: Plot the midplane along the x-axis for the specified attribute.
plot_y_midplane(self, attribute)
: Plot the midplane along the y-axis for the specified attribute.
plot_z_midplane(self, attribute)
: Plot the midplane along the z-axis for the specified attribute.
print_attributes(self)
: Prints the valid attributes of the class and their corresponding file paths.
update(self, verbose=False)
: Update the attributes of the class based on the existence of files in the specified data path.