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
  • aPriori.DNS.Field3D(self, folder_path):
  • Description
  • Attributes
  • Methods
  1. API guide

Field3D

PreviousDynamic Data-Driven Smagorinky Closure for LESNextField3D.build_attributes_list

Last updated 1 year ago

aPriori.DNS.Field3D(self, folder_path):


Description

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: .

Attributes

  • 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.

Methods

Constructor Method

__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:

Attribute
Path

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

...

...

Utility Methods

  • 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.

Blastnet Datasets