Quickstart
The following tutorial is intended for users who want a quick introduction to basic operations with the library. For a more thorough understanding and detailed explanations, please refer to the comprehensive tutorials available at Fundamentals and Usage.
This section assumes you have already installed the library. If you haven't installed it yet, please refer to the previous page for instructions.
aPriori uses a formatting that is coherent with many simulations on Blastnet [1, 2]. If you'd like to work with a different case than the one provided here, you can download a dataset directly from their website. The current version of the package is just able to handle one timeframe, so make sure to download a case that contains a single timestep.
In alternative, in this tutorial we are going to use a built-in function to download a subset of this non-premixed hydrogen/air jet flame DNS, so no need to download anything to run the following code. The integral code of this tutorial is available at the Github page.
Dataset download
As a first step we are going to download the dataset. Figure 1 shows a representation of the subdomain used in this tutorial.

Run the following command to download the dataset:
This command should have downloaded from Github a folder with the following structure:

Visualization
After downloading the dataset, the following lines of code initialize a Field3D. After this, we can display the field leveraging the plotting utilities:
Output plots:


Compute reaction rates on DNS field
The reaction rates are computed using Cantera.
The method compute_reaction_rates() uses data chunking to allow large files to be read without causing memory issues. The optional input parameter n_chunks defines in how many chunks the files to be read and to be written are divided.
To compute the instantaneous rates the values of temperature, pressure, and species concentration are necessary. The chemical mechanism in the chem_thermo_tran directory is used to compute the rates in every cell.
After the computation, new files in the folder 'data/' will be saved to store the reaction rates, for example, the hydrogen reaction rate will be named 'RH2_DNS_kgm-3s-1_id000.dat'. The suffix DNS is used to distinguish the rates computed on the unfiltered grid to the ones computed on the filtered grid (that will be shown later on in the tutorial).
Output plots:


Filtering
The object's filtering function will create a secondary folder, with the same structure as the main folder containing the unfiltered data. The function returns a string with the folder name, that in this case is "Filter16FavreGauss". The filter size, the filter kernel (Box, Gaussian, etc...) are included in the folder name to define the filtering operation that was used to obtain the dataset. The word "Favre" appears in the folder's name if Favre filtering was used.
All the files contained in the data folder when the command is launched will be automatically filtered by the filtering function.
Output plots:

Model reaction rates on the filtered field
The filtered field is what in a priori validation is considered to resemble an LES snapshot. From those values, it is possible to model the unclosed quantities, and then compare them with the DNS benchmark values.
The simplest way to model the reaction rates is based on the so called Laminar Finite Rate (LFR) approximation. This approach directly computes the reaction rates from the filtered LES field:
Where:
represents the reaction rates,
is the computation of the instantaneous Arrhenius rates from the filtered temperature and the filtered species concentrations of species k, .
This code snippet computes and compares it with the filtered DNS values . For more complex modeling approaches, see section Machine Learning Tutorials at the paragraph 'Data-Driven Closure for Turbulence-Chemistry Interaction'.
Output plots:


Last updated