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.Scalar3D(self, shape, value=None, path=''):
  • Attributes
  • Methods
  • Notes
  • Examples
  1. API guide

Scalar3D

PreviousField3D.updateNextScalar3D.is_light_mode

Last updated 1 year ago

aPriori.DNS.Scalar3D(self, shape, value=None, path=''):


A class used to represent a 3D scalar field.

Attributes

  • shape : list

    A list of 3 integers representing the shape of the 3D field.

  • value : ndarray

    The values of the field, reshaped into a 3D array by default.

  • path : str

    The file path where the field data is stored.

  • Nx, Ny, Nz : int

    The dimensions of the field along the x, y, and z axes, respectively.

  • file_name : str

    The name of the file where the field data is stored.

  • file_id : str

    The ID of the file where the field data is stored.

  • filter_size : int

    The size of the filter used for processing the field data.

Methods

  • is_light_mode()

    Check if the field data is stored in memory or in a file.

  • reshape_3d()

    Reshape the field data into a 3D array.

  • reshape_column()

    Reshape the field data into a column vector.

  • reshape_line()

    Reshape the field data into a row vector.

  • cut(n_cut=1, mode='equal')

    Cuts the field data along the edges.

  • filter_gauss(delta, n_cut=0, mute=False)

    Filters the field data using a Gaussian filter.

  • plot_x_midplane(mesh, title='', colormap='viridis', vmin=None, vmax=None)

    Plots the field data on the x midplane.

  • plot_y_midplane(mesh, title='', colormap='viridis', vmin=None, vmax=None)

    Plots the field data on the y midplane.

  • plot_z_midplane(mesh, title='', colormap='viridis', vmin=None, vmax=None)

    Plots the field data on the z midplane.

Notes

The field data can be either in memory or in a file. If it's in a file, the file path, name, and ID are required. The reshape methods are used to change the shape of the field data for different purposes. The cut method is used to remove the edges of the field data. The filter_gauss method is used to smooth the field data. The plot methods are used to visualize the field data on different planes.

Examples

import numpy as np
scalar = Scalar3D(shape=[10, 10, 10], value=np.random.rand(1000))
print(field.is_light_mode())  # True
scalar.reshape_column()
print(field.value.shape)  # (1000, 1)
scalar.cut(n_cut=2)
print(field.value.shape)  # (8, 8, 8)
scalar.filter_gauss(delta=1)