Following this exercise will clarify the main goal of the project. Here we will start using the class Field3D, which shows the full potential of the package in handling formatted DNS data.
The tutorials from now on are entirely based on formatted data. If you aim to run this tutorial on your laptop, please download the data folder from the aPriori with the funciton ap.download().
If you already downloaded the data, uou can just comment that line.
"""
Created on Fri May 24 14:10:20 2024
@author: lorenzo piu
"""
Import module and define data path
>>> import os
>>> import aPrioriDNS as ap
>>> import json
>>> ap.download
>>> directory = os.path.join('.','Lifted_H2_subdomain') # change this with your path to the data folder
>>> # Blastnet's data contain information about the shape of the field in the info.json file.
>>> # When initialized, the Field3D object will automatically read all the information,
>>> # so this time we don't need to worry about defining the shape
>>> # with open(os.path.join(directory,'info.json'), 'r') as file:
>>> # info = json.load(file)
>>> # DNS_shape = info['global']['Nxyz']
Initialize Field
If your data follows the Blastnet formatting, you should have nothing else to worry about than defining the correct relative path that takes from your script's folder to the folder where the DNS data are located on your system.
Now the object can access all the functionalities implemented. those will be covered in more detail in the next sections. With this object, we can easily access the data inside the folder, e.g.:
>>> DNS_field.T
<aPrioriDNS.DNS.Scalar3D at 0x14c36ab50>
gives as output a Scalar3D object associated with the temperature field, while
>>> DNS_field.U_Y._3D
Will return a numpy 3D array with the values associated with the Y component of velocity.
We can still use all the functionalities that we saw in the previous sections, so if we want to have an array with the filtered molar concentration of oxygen, it's sufficient to write: