Tutorial 5: Cut DNS field¶

Note

The complete code associated with this tutorial is available here.

This tutorial shows how to extract a sub-domain from a DNS dataset using the cut() method. After cutting the field, we load the resulting dataset as a new Field3D object and compare a representative midplane of a variable (here \(U_x\)) between the original and the cut domain.

Import modules and define data path¶

Imports and paths definition¶
import os
import aPriori as ap
from aPriori.DNS import Field3D
from aPriori import DNS
import json

directory = os.path.join('Lifted_H2_subdomain') # change this with your path to the data folder
T_path = os.path.join(directory,'data', 'T_K_id000.dat')
print(f"\nChecking the path \'{T_path}\' is correct...")
if not os.path.exists(T_path):
   print(f"The path '{T_path}' does not exist in your system. Downloading the dataset from Github...")
   ap.download(dataset='h2_lifted')

Cut the DNS field and compare midplanes¶

Cut the field and visualize original vs cut domain¶
# Load the full DNS field
DNS_field = Field3D(directory)

# Cut a sub-domain (example indices along x, y, z)
cut_field_name = DNS_field.cut([20, 20, 10])

# Load the cut field as a new Field3D object
DNS_field_cut = Field3D(cut_field_name)

# Compare the same variable on the z midplane
DNS_field.plot_z_midplane('U_X', vmin=100, vmax=280)
DNS_field_cut.plot_z_midplane('U_X', vmin=100, vmax=280)
../_images/tutorial_05_fig1.png

Figure 1 - \(U_x\) on the z midplane for the original DNS field.¶

../_images/tutorial_05_fig2.png

Figure 2 - \(U_x\) on the z midplane for the cut DNS field.¶