g3d.flow.placeholders package

Submodules

g3d.flow.placeholders.auxv module

Auxiliary variables - flow field data placeholder (AuxvField class definition)

class g3d.flow.placeholders.auxv.AuxvField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class AuxvField, extends class FlowDataPlaceHolder: primitive flow variables container

Attributes:
c

Speed of sound [m/s]

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

p

Pressure [Pa]

size

Placeholder size

t

Temperature [K]

tag

tag (string) used for identification

u

X-direction velocity [m/s]

v

Y-direction velocity [m/s]

variables

Defined container variables

w

Z-direction velocity [m/s]

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_Auxv(idx)

Extracts an instance of primitive variable object for specified cell index

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets primitive flow data arrays

get_arrays_with_ghosts()

Gets primitive flow data arrays including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

get_velocity_arrays()

Gets velocity data arrays

get_velocity_arrays_with_ghosts()

Gets velocity data arrays including ghost cell values

get_velocity_vector(idx)

Get velocity vector for cell with specified index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_Auxv(a)

Set array values from provided primitive variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(p, u, v, w, t, c)

Set data from provided arrays

set_from_auxv_field(a)

Copy data from another AuxvField object

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

set_variables(p, u, v, w, t, c[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

set_velocity_vector(idx, vel)

Set velocity vector for cell with specified index

setup(**kwargs)

Sets up container according to specifications

update(cons, gas[, verbose])

Calculates new flow data values based on provided input and updates placeholder arrays

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

property c: ndarray

Speed of sound [m/s]

Returns:

speed of sound array

Return type:

ndarray

get_Auxv(idx: int) → Auxv[source]

Extracts an instance of primitive variable object for specified cell index

Parameters:

idx (int :) – cell index

Returns:

primitive variable object

Return type:

Auxv

get_arrays() → Tuple[ndarray, ...][source]

Gets primitive flow data arrays

Returns:

data arrays (p, u, v, w, t, c)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets primitive flow data arrays including ghost cell values

Returns:

data arrays (p, u, v, w, t, c)

Return type:

tuple

get_velocity_arrays() → Tuple[ndarray, ...][source]

Gets velocity data arrays

Returns:

data arrays (u, v, w)

Return type:

tuple

get_velocity_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets velocity data arrays including ghost cell values

Returns:

data arrays (u, v, w)

Return type:

tuple

get_velocity_vector(idx: int) → ndarray[source]

Get velocity vector for cell with specified index

Parameters:

idx (int :) – cell index

Returns:

velocity vector (u, v, w)

Return type:

ndarray

property p: ndarray

Pressure [Pa]

Returns:

pressure array

Return type:

ndarray

set_from_Auxv(a: Auxv) → None[source]

Set array values from provided primitive variable object

Parameters:

a (Auxv :) – primitive variable object

set_from_arrays(p: ndarray, u: ndarray, v: ndarray, w: ndarray, t: ndarray, c: ndarray) → None[source]

Set data from provided arrays

Parameters:
  • p (ndarray :) – pressure data

  • u (ndarray :) – x-velocity data

  • v (ndarray :) – y-velocity data

  • w (ndarray :) – z-velocity data

  • t (ndarray :) – temperature data

  • c (ndarray :) – speed-of-sound data

set_from_auxv_field(a: AuxvField) → None[source]

Copy data from another AuxvField object

Parameters:

a (AuxvField :) – flow data source

set_variables(p: float | ndarray, u: float | ndarray, v: float | ndarray, w: float | ndarray, t: float | ndarray, c: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • p (float or ndarray :) – pressure value or array of values

  • u (float or ndarray :) – x-velocity value or array of values

  • v (float or ndarray :) – y-velocity value or array of values

  • w (float or ndarray :) – z-velocity value or array of values

  • t (float or ndarray :) – temperature value or array of values

  • c (float or ndarray :) – speed-of-sound value or array of values

  • idx (int :) – cell index (Default value = None)

set_velocity_vector(idx: int, vel: ndarray | list[float] | Tuple[float, ...])[source]

Set velocity vector for cell with specified index

Parameters:
  • idx (int :) – cell index

  • vel (ndarray, list, or tuple :) – velocity vector (u, v, w)

property t: ndarray

Temperature [K]

Returns:

temperature array

Return type:

ndarray

property u: ndarray

X-direction velocity [m/s]

Returns:

u velocity array

Return type:

ndarray

update(cons: ConsField, gas: Gas, verbose: bool = False) → None[source]

Calculates new flow data values based on provided input and updates placeholder arrays

Parameters:
  • cons (ConsField :) – conservative flow variables

  • gas (Gas :) – gas model

  • verbose (bool :) – in verbose mode, extreme values will be printed to stdout (Default value = False)

property v: ndarray

Y-direction velocity [m/s]

Returns:

v velocity array

Return type:

ndarray

property w: ndarray

Z-direction velocity [m/s]

Returns:

w velocity array

Return type:

ndarray

g3d.flow.placeholders.cons module

Conservative variables - flow field data placeholder (ConsField class definition)

class g3d.flow.placeholders.cons.ConsField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class ConsField, extends class FlowDataPlaceHolder: conservative flow variables container

Attributes:
et

Total energy [J/m^3]

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

ro

Density [kg/m^3]

ru

X-momentum [kg/(m^2 s)]

rv

Y-momentum [kg/(m^2 s)]

rw

Z-momentum [kg/(m^2 s)]

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

CellToNode(c)

Convert cell values to node values

GetNGhosts()

Gets number of allocated ghost cells

Interpolate(nodes, cells, node_cons)

Interpolate cell-centered flow field data to node-centered data

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_Cons(idx)

Extracts an instance of conservative variable object for specified cell index

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets conservative flow data arrays

get_arrays_with_ghosts()

Gets conservative flow data arrays including ghost cell values

get_by_index(idx)

Gets tuple of conservative variable values for cell with specified index

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_momentum_vector(idx)

Get momentum vector for cell with specified index

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_by_index_from_Cons(idx, c)

Set array values for cell with specified cell index from provided conservative variable object

set_from_Cons(c)

Set array values from provided conservative variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(ro, ru, rv, rw, et)

Set data from provided arrays

set_from_cons_field(c)

Copy data from provided conservative variables placeholder object

set_from_key_value(key, value)

Sets data from key-value pair input

set_momentum_vector(idx, r_vel)

Set momentum vector for cell with specified index

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(ro, ru, rv, rw, et[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

CellToNode(c: ConsField) → None[source]

Convert cell values to node values

Parameters:

c (ConsField :) – conservative variables container

Interpolate(nodes: Coordinates, cells: Coordinates, node_cons: ConsField) → None[source]

Interpolate cell-centered flow field data to node-centered data

Parameters:
  • nodes (Coordinates :) – node coordinates

  • cells (Coordinates :) – cell coordinates

  • node_cons (ConsField :) – node stored conservative variables

property et: ndarray

Total energy [J/m^3]

Returns:

total energy array

Return type:

ndarray

get_Cons(idx: int) → Cons[source]

Extracts an instance of conservative variable object for specified cell index

Parameters:

idx (int :) – cell index

Returns:

conservative variable object

Return type:

Cons

get_arrays() → Tuple[ndarray, ...][source]

Gets conservative flow data arrays

Returns:

data arrays (ro, ru, rv, rw, et)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets conservative flow data arrays including ghost cell values

Returns:

data arrays (ro, ru, rv, rw, et)

Return type:

tuple

get_by_index(idx: int) → Tuple[float, ...][source]

Gets tuple of conservative variable values for cell with specified index

Parameters:

idx (int :) – cell index

Returns:

conservative variable values (ro, ru, rv, rw, et)

Return type:

tuple

get_momentum_vector(idx: int) → ndarray[source]

Get momentum vector for cell with specified index

Parameters:

idx (int :) – cell index

Returns:

momentum vector (ru, rv, rw)

Return type:

ndarray

property ro: ndarray

Density [kg/m^3]

Returns:

density array

Return type:

ndarray

property ru: ndarray

X-momentum [kg/(m^2 s)]

Returns:

x-momentum array

Return type:

ndarray

property rv: ndarray

Y-momentum [kg/(m^2 s)]

Returns:

y-momentum array

Return type:

ndarray

property rw: ndarray

Z-momentum [kg/(m^2 s)]

Returns:

z-momentum array

Return type:

ndarray

set_by_index_from_Cons(idx: int, c: Cons) → None[source]

Set array values for cell with specified cell index from provided conservative variable object

Parameters:
  • idx (int :) – cell index

  • c (Cons :) – conservative variable object

set_from_Cons(c: Cons) → None[source]

Set array values from provided conservative variable object

Parameters:

c (Cons :) – conservative variable object

set_from_arrays(ro: ndarray, ru: ndarray, rv: ndarray, rw: ndarray, et: ndarray) → None[source]

Set data from provided arrays

Parameters:
  • ro (ndarray :) – density data

  • ru (ndarray :) – x-momentum data

  • rv (ndarray :) – y-momentum data

  • rw (ndarray :) – z-momentum data

  • et (ndarray :) – total energy data

set_from_cons_field(c: ConsField) → None[source]

Copy data from provided conservative variables placeholder object

Parameters:

c (ConsField :) – conservative variables container

set_momentum_vector(idx: int, r_vel: ndarray | list[float] | Tuple[float, ...]) → None[source]

Set momentum vector for cell with specified index

Parameters:
  • idx (int :) – cell index

  • r_vel (ndarray, list, or tuple :) – momentum vector (ru, rv, rw)

set_values(ro: float | ndarray, ru: float | ndarray, rv: float | ndarray, rw: float | ndarray, et: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • ro (float or ndarray :) – density value or array of values

  • ru (float or ndarray :) – x-momentum value or array of values

  • rv (float or ndarray :) – y-momentum value or array of values

  • rw (float or ndarray :) – z-momentum value or array of values

  • et (float or ndarray :) – total energy value or array of values

  • idx (int :) – cell index (Default value = None)

g3d.flow.placeholders.flowdata module

Generic flow field data placeholder (FlowDataPlaceHolder class definition)

class g3d.flow.placeholders.flowdata.FlowDataPlaceHolder(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Definition of class FlowDataPlaceHolder: a generic placeholder for field data

Attributes:
first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

AXPBY(A: float, B: float, Y: FlowDataPlaceHolder) → None[source]

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

Parameters:
  • A (float :) – scaling factor for vector X (scalar value)

  • B (float :) – scaling factor for vector Y (scalar value)

  • Y (FlowDataPlaceHolder :) – flow data container

AXPY(A: float, Y: FlowDataPlaceHolder) → None[source]

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

Parameters:
  • A (float :) – scaling factor for vector X (scalar value)

  • Y (FlowDataPlaceHolder :) – flow data container

GetNGhosts() → int[source]

Gets number of allocated ghost cells

Returns:

number of ghost cells

Return type:

int

WAXPY(A: float, X: FlowDataPlaceHolder, Y: FlowDataPlaceHolder) → None[source]

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

Parameters:
  • A (float :) – scaling factor for vector X (scalar value)

  • X (FlowDataPlaceHolder :) – flow data container

  • Y (FlowDataPlaceHolder :) – flow data container

backup() → None[source]

Copies data to backup arrays

copy(fd: FlowDataPlaceHolder) → None[source]

Copies data from prototype FlowDataPlaceHolder object

Parameters:

fd (FlowDataPlaceHolder :) – prototype FlowDataPlaceHolder object

copy_values(from_idx: int, to_idx: int) → None[source]

Copies from one array element to another

Parameters:
  • from_idx (int :) – data source cell index

  • to_idx (int :) – data destination cell index

de_allocate_placeholders() → None[source]

De allocates placeholders - nullifies all arrays

export(name: str, var: str = 'all') → dict[Any, Any][source]

Exports placeholder data to file (binary)

Parameters:
  • name (str :) – file name base

  • var (str :) – variable name (Default value = ‘all’)

property first: int

First index

Returns:

first index value

Return type:

int

get_array(var: str = 'var') → ndarray[source]

Get array for specified variable string

Parameters:

var (str :) – variable string (Default value = ‘var’)

get_array_with_ghosts(var: str = 'var') → ndarray[source]

Get array for specified variable string including ghost cell values

Parameters:

var (str :) – variable string (Default value = ‘var’)

get_extreme_value_array(value_type: str = 'max_val') → ndarray[source]

Gets array with calculated variable extreme values

Parameters:

value_type (str :) – type of extreme values (Default value = ‘max_val’)

get_extreme_values(var: str = 'all') → None[source]

Updates placeholder variables extreme values (min/max)

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_from_backup(reset_bak: bool = True) → None[source]

Restores data from backup arrays

Parameters:

reset_bak (bool :) – (Default value = True)

get_keys() → list[source]

Gets defined variable keys

Returns:

defined variable keys

Return type:

list

get_max_norm(var: str = 'all') → None[source]

Updates variable max norm values (max absolute values)

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_max_values(var: str = 'all') → None[source]

Updates placeholder max values

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_min_values(var: str = 'all') → None[source]

Updates placeholder min values

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_pointers() → list[ndarray][source]

Gets list of array pointers

Returns:

pointers to flow data arrays

Return type:

list[ndarray]

get_range() → Tuple[int, int][source]

Gets placeholder range (first, last)

Returns:

placeholder range (first, last)

Return type:

tuple

get_value(idx: int, var: str = 'var') → float[source]

Get variable value for specified cell index

Parameters:
  • idx (int :) – cell index

  • var (str :) – variable name (Default value = ‘var’)

import_data(name: str, var: str = 'all') → dict[Any, Any][source]

Imports placeholder data from file (binary)

Parameters:
  • name (str :) – file name base

  • var (str :) – variable name (Default value = ‘all’)

import_var_data_from_binary(f: BinaryIO, var: list[str] | str = 'all') → dict[Any, Any][source]

Imports variable data from binary file

Parameters:
  • f (BinaryIO :) – file handle

  • var (list[str] or str :) – variable name(s) (Default value = ‘all’)

Returns:

variables dict

Return type:

dict

initialize(val: float = 0.0, var: str = 'all') → None[source]

Initialize placeholder

Parameters:
  • val (float :) – variable value (Default value = 0.)

  • var (str :) – variable name (Default value = ‘all’)

is_allocated() → bool[source]

Placeholder allocation status

Returns:

allocation status

Return type:

bool

property last: int

Last index

Returns:

last index value

Return type:

int

property n_cells: int

Number of cells

Returns:

cell count

Return type:

int

property n_ghosts: int

Number of ghost cells

Returns:

ghost cell count

Return type:

int

property n_var: int

Number of variables

Returns:

variable count

Return type:

int

normalize_extreme_values(norm_values: list[float] | ndarray, value_type: str = 'max_val') → None[source]

Normalizes extreme values

Parameters:
  • norm_values (list[float] or ndarray :) – normalization values (variable specific values)

  • value_type (str :) – type of extreme value (Default value = ‘max_val’)

nullify() → None[source]

Nullifies all array elements for all defined variables

nullify_by_index(idx: int) → None[source]

Nullifies all variables for specified cell index

Parameters:

idx (int :) – cell index

point_wise_scale(sf: ndarray) → None[source]

Element data scaling using provided scaling factor array

Parameters:

sf (ndarray :) – scaling factors

print_extreme_value_locations() → None[source]

Prints extreme values including location to stdout

print_extreme_values(var: str | list[str] = 'all') → None[source]

Prints calculated extreme values to stdout

Parameters:

var (str or list[str] :) – variable name(s) (Default value = ‘all’)

print_extreme_values_by_type(value_type: str = 'max_val', var: str = 'all') → None[source]

Prints calculated extreme values by type to stdout

Parameters:
  • value_type (str :) – extreme value type (Default value = ‘max_val’)

  • var (str :) – variable name (Default value = ‘all’)

print_flow_data(idx: int) → None[source]

Prints stored variable information for specified cell index to stdout

Parameters:

idx (int :) – cell index

read_from_file(f: BinaryIO) → None[source]

Reads placeholder variable arrays from file (binary format)

Parameters:

f (BinaryIO :) – file handle (binary file)

scale(idx: int, sf: float) → None[source]

Scales all variable values for specified cell index

Parameters:
  • idx (int :) – cell index

  • sf (float :) – scale factor

set_from_array(from_array: ndarray, var: str = 'var')[source]

Set flow data for specified variable from array

Parameters:
  • from_array (ndarray :) – prototype data array

  • var (str :) – variable name (Default value = ‘var’)

set_from_key_value(key: str, value: Any) → bool[source]

Sets data from key-value pair input

Parameters:
  • key (str :) – keyword valid class-specific keywords: ‘size’, ‘n_cells’, ‘first’, ‘last’, ‘n_ghosts’, ‘backup_data’

  • value (Any :) – value corresponding to keyword

Returns:

status - True if key is found in list of valid keywords

Return type:

bool

set_value(idx: int, val: float, var: str = 'var') → None[source]

Sets variable value for specified cell index

Parameters:
  • idx (int :) – cell index

  • val (float :) – variable value

  • var (str :) – variable name (Default value = ‘var’)

setup(**kwargs: Any) → None[source]

Sets up container according to specifications

Parameters:

**kwargs (Any :) – keyword-value pair data, see :func:’set_from_key_value’

property size: int

Placeholder size

Returns:

length of arrays in placeholder

Return type:

int

property variables: dict[Any, Any]

Defined container variables

Returns:

list of variables and associated data

Return type:

dict

vector_scale(v: ndarray) → None[source]

Scales all variable values for all elements using specified scaling array

Parameters:

v (ndarray :) – scale factors for all cells

write_to_file(f: BinaryIO) → None[source]

Writes placeholder variable arrays to file (binary format)

Parameters:

f (BinaryIO :) – file handle (binary file)

g3d.flow.placeholders.fluxmolecule module

Flux molecule placeholder (FMP class definition)

class g3d.flow.placeholders.fluxmolecule.FMP(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Definition of class FMP: Flux Molecule Pointers - cell/node pointers and metrics data container

Attributes:
fctj

Face local j-direction multiplication factor

fctk

Face local k-direction multiplication factor

kc

Cell index pointers for flux molecule cells (12 per molecule)

kp

Node index pointers for flux molecule cells (12 per molecule)

s
return:

si
return:

size

Placeholder size

sl

Face area for all flux molecules (central molecule face)

sx
return:

sy
return:

sz
return:

tag

tag (string) used for identification

tmp

Temporary storage array

type

Placeholder type

voli

Inverse of flux molecule volume

y_norm

Wall-normal vector

Methods

allocate(**kwargs)

Allocates data storage arrays

allocate_tmp_arrays([N])

Allocates arrays for temporary data storage

check_cell_metrics(ic, check_sum)

Check cell metrics data

check_metrics(x, y, z)

Check flux molecule metrics data

copy(e)

copies data from specified entity input: entity example: copy(e)

get_conv_metrics([idx])

Get metrics data used for convective flux calculations for all flux molecules or for a specific flux molecule

get_diff_metrics([idx])

Get metrics data used for diffusive flux calculations for all flux molecules or for a specific flux molecule

get_factors([idx])

Gets weight factors for all defined flux molecules or a specific flux molecule.

get_pointers([idx])

Gets node and cell pointers for all defined flux molecules or a specific flux molecule.

get_tmp_storage([col])

Gets access to temporary storage array

get_wall_normal([idx])

Gets wall-normal for all flux molecules or for a specific flux molecule

print([idx])

Prints flux molecule data (dell pointers, node pointers, and weight factors) for all flux molecules or for a specific flux molecule

print_data([f])

Prints cell pointers, node pointers, and face metrics to file (or stdout)

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_data(idx, kp, kc, fctj, fctk)

Set flux molecule data (cell and node pointers and weight factors)

set_factors(idx, fctj, fctk)

Update flux molecule weight factors

set_from_key_value(key, value)

Sets data from key-value pair input

set_pointers(idx, kp, kc)

Populate cell and node pointers using provided arrays

update_block_interface_factors(idx, mim, ...)

Update flux molecule weight factors for mesh block interfaces

update_diff_metrics(x, y, z[, n_faces, ...])

Update flux molecule metrics data for diffusive flux calculations

update_factors(idx, mim, mip, mjm, mjp)

Update flux molecule weight factors

update_metrics(x, y, z)

Update flux molecule metrics data

update_symmetry_ghost_nodes(x, y, z)

Update geometric representation of symmetry plane ghost nodes (mirror nodes in symmetry plane)

update_wall_diff_metrics(x, y, z)

Update wall face diffusive flux metrics

allocate(**kwargs: Any) → None[source]

Allocates data storage arrays

Parameters:

**kwargs (Any :) – keyword-value pairs, see :func:’set_from_key_value’, optional input

allocate_tmp_arrays(N: int = 1) → None[source]

Allocates arrays for temporary data storage

Parameters:

N (int :) – number of tmp storage arrays (Default value = 1)

check_cell_metrics(ic: int, check_sum: ndarray)[source]

Check cell metrics data

Parameters:
  • ic (int :) – cell index

  • check_sum (ndarray :) – accumulated check sum

check_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]

Check flux molecule metrics data

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

property fctj: ndarray

Face local j-direction multiplication factor

Returns:

local j-direction factors for all placeholder faces

Return type:

ndarray

property fctk: ndarray

Face local k-direction multiplication factor

Returns:

local k-direction factors for all placeholder faces

Return type:

ndarray

get_conv_metrics(idx: int | None = None) → Tuple[float, float] | Tuple[ndarray, ndarray][source]

Get metrics data used for convective flux calculations for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

face area

Return type:

tuple

get_diff_metrics(idx: int | None = None) → Tuple[float, ...] | Tuple[ndarray, ...][source]

Get metrics data used for diffusive flux calculations for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

Return type:

tuple

get_factors(idx: int | None = None) → Tuple[float, float] | Tuple[ndarray, ndarray][source]

Gets weight factors for all defined flux molecules or a specific flux molecule.

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

weight factors in local j- and k-directions for all defined flux molecules in container or one specific flux molecule (if flux molecule index is provided)

Return type:

tuple

get_pointers(idx: int | None = None) → Tuple[ndarray, ndarray][source]

Gets node and cell pointers for all defined flux molecules or a specific flux molecule.

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

node and cell pointers for a single flux molecule (if index is specified) or for all defined flux molecules in container (kp, kc) where kp and kc both are arrays

Return type:

tuple

get_tmp_storage(col: int = 0) → ndarray[source]

Gets access to temporary storage array

Parameters:

col (int :) – column in temporary storage matrix (Default value = 0)

Returns:

temporary storage array

Return type:

ndarray

get_wall_normal(idx: int | None = None) → float | ndarray[source]

Gets wall-normal for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

wall-normal vector

Return type:

float or ndarray

property kc: ndarray

Cell index pointers for flux molecule cells (12 per molecule)

Returns:

cell pointers

Return type:

ndarray

property kp: ndarray

Node index pointers for flux molecule cells (12 per molecule)

Returns:

node pointers

Return type:

ndarray

print(idx: int | None = None) → None[source]

Prints flux molecule data (dell pointers, node pointers, and weight factors) for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

print_data(f: TextIO | None = None) → None[source]

Prints cell pointers, node pointers, and face metrics to file (or stdout)

Parameters:

f (TextIO :) – ascii file handle (Default value = None)

property s: ndarray

return:

set_data(idx: int, kp: ndarray | list[int], kc: ndarray | list[int], fctj: float, fctk: float) → None[source]

Set flux molecule data (cell and node pointers and weight factors)

See documentation of :func:’set_pointers’ and :func:’set_factors’

Parameters:
  • idx (int :) – flux molecule index

  • kp (ndarray or list[int] :) – node indices (12 nodes per molecule)

  • kc (ndarray or list[int] :) – cell indices (12 cells per molecule)

  • fctj (float :) – weight factor local j-direction

  • fctk (float :) – weight factor local k-direction

set_factors(idx: int, fctj: float, fctk: float) → None[source]

Update flux molecule weight factors

Weight factors are needed for calculation of cell face gradients and diffusive fluxes. The provided weight factors represents the flux molecule local j- and k-directions, respectively. The local i-direction of a flux molecule is always aligned with the center face normal (i.e. in the convective molecule direction)

Parameters:
  • idx (int :) – cell index

  • fctj (float :) – weight factor local j-direction

  • fctk (float :) – weight factor local k-direction

set_from_key_value(key: str, value: Any) → bool[source]

Sets data from key-value pair input

Parameters:
  • key (str :) – keyword valid class-specific keywords: ‘size’, ‘type’

  • value (Any :) – value corresponding to keyword

Returns:

status - True if key is found in list of valid keywords

Return type:

bool

set_pointers(idx: int, kp: ndarray | list[int], kc: ndarray | list[int]) → None[source]

Populate cell and node pointers using provided arrays

Parameters:
  • idx (int :) – face index

  • kp (ndarray or list[int] :) – node indices (12 nodes per molecule)

  • kc (ndarray or list[int] :) – cell indices (12 cells per molecule)

property si: ndarray

return:

property size: int

Placeholder size

Returns:

size

Return type:

int

property sl: ndarray

Face area for all flux molecules (central molecule face)

Returns:

face area array

Return type:

ndarray

property sx: ndarray

return:

property sy: ndarray

return:

property sz: ndarray

return:

property tmp: ndarray

Temporary storage array

Returns:

temporary storage array access

Return type:

ndarray

property type: Any

Placeholder type

Returns:

enum describing placeholder type

Return type:

FMPTypes

update_block_interface_factors(idx: int, mim: int, mip: int, mjm: int, mjp: int) → None[source]

Update flux molecule weight factors for mesh block interfaces

Parameters:
  • idx (int :) – flux molecule index

  • mim (int :) – number of flux molecule cells in negative local i-direction (0 at low-i boundary)

  • mip (int :) – number of flux molecule cells in positive local i-direction (0 at high-i boundary)

  • mjm (int :) – number of flux molecule cells in negative local j-direction (0 at low-j boundary)

  • mjp (int :) – number of flux molecule cells in positive local j-direction (0 at high-j boundary)

update_diff_metrics(x: ndarray, y: ndarray, z: ndarray, n_faces: int = 0, idx_start: int = 0) → None[source]

Update flux molecule metrics data for diffusive flux calculations

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

  • n_faces (int :) – number of faces (Default value = 0)

  • idx_start (int :) – index of first face (Default value = 0)

update_factors(idx: int, mim: int, mip: int, mjm: int, mjp: int) → None[source]

Update flux molecule weight factors

Parameters:
  • idx (int :) – flux molecule index

  • mim (int :) – number of flux molecule cells in negative local i-direction (0 at low-i boundary)

  • mip (int :) – number of flux molecule cells in positive local i-direction (0 at high-i boundary)

  • mjm (int :) – number of flux molecule cells in negative local j-direction (0 at low-j boundary)

  • mjp (int :) – number of flux molecule cells in positive local j-direction (0 at high-j boundary)

update_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]

Update flux molecule metrics data

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

update_symmetry_ghost_nodes(x: ndarray, y: ndarray, z: ndarray) → None[source]

Update geometric representation of symmetry plane ghost nodes (mirror nodes in symmetry plane)

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

update_wall_diff_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]

Update wall face diffusive flux metrics

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

property voli: ndarray

Inverse of flux molecule volume

Returns:

inverse volume array

Return type:

ndarray

property y_norm: ndarray

Wall-normal vector

Returns:

wall-normal vector (n_x, n_y, n_z)

Return type:

ndarray

class g3d.flow.placeholders.fluxmolecule.FMPArray[source]

Bases: object

Definition of class FMPArray: flux molecule placeholder container

Attributes:
FMPs

Flux molecule placeholder list

size

Storage size

Methods

add_FMP(**kwargs)

Adds flux molecule to container

allocate_FMPs([N, idx])

Allocates flux molecule placeholders in container - all flux molecules placeholders or one specific

check_FMP_cell_metrics(ic, check_sum)

check_FMP_metrics(x, y, z[, tag])

deallocate_FMPs()

Deallocates listed flux molecule placeholders

get_FMPs([idx])

get_max_FMP_size()

print_FMP_data([tag, f])

set_FMP_data(idx, face_idx, kp, kc, fctj, fctk)

set_FMP_tag(idx, tag)

update_FMP_diff_metrics(x, y, z)

update_FMP_metrics(x, y, z)

property FMPs: list

Flux molecule placeholder list

Returns:

list of allocated flux molecule placeholders

Return type:

list

add_FMP(**kwargs: Any) → None[source]

Adds flux molecule to container

Parameters:

**kwargs (Any :) – keyword-argument pairs will be forwarded to flux molecule placeholder (FMP) constructor see :func:’set_from_key_value’

allocate_FMPs(N: int = 0, idx: int | None = None) → None[source]

Allocates flux molecule placeholders in container - all flux molecules placeholders or one specific

Parameters:
  • N (int :) – flux molecule placeholder array length (Default value = 0)

  • idx (int :) – flux molecule placeholder index listed in this container (Default value = None)

check_FMP_cell_metrics(ic: int, check_sum: ndarray | list[float]) → None[source]
Parameters:
  • ic (int :) – param check_sum:

  • ic

  • check_sum (Union[ndarray :)

  • list[float]]

check_FMP_metrics(x: ndarray, y: ndarray, z: ndarray, tag: str = 'ALL') → None[source]
Parameters:
  • x (ndarray :) – param y:

  • z (ndarray :) – param tag:

  • x

  • y (ndarray :)

  • z

  • tag (str :) – (Default value = ‘ALL’)

deallocate_FMPs() → None[source]

Deallocates listed flux molecule placeholders

get_FMPs(idx: int | None = None) → list | FMP[source]
Parameters:
  • idx (int :) – return:

  • idx – (Default value = None)

get_max_FMP_size() → int[source]
Returns:

print_FMP_data(tag: str = 'ALL', f: TextIO | None = None) → None[source]
Parameters:
  • tag (str :) – param f:

  • tag – (Default value = ‘ALL’)

  • f (TextIO :) – (Default value = None)

set_FMP_data(idx: int, face_idx: int, kp: int, kc: int, fctj: float, fctk: float) → None[source]
Parameters:
  • idx (int :) – param face_idx:

  • kp (int :) – param kc:

  • fctj (float :) – param fctk:

  • idx

  • face_idx (int :)

  • kp

  • kc (int :)

  • fctj

  • fctk (float :)

set_FMP_tag(idx: int, tag: str) → None[source]
Parameters:
  • idx (int :) – param tag:

  • idx

  • tag (str :)

property size: int

Storage size

Returns:

size

Return type:

int

update_FMP_diff_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]
Parameters:
  • x (ndarray :) – param y:

  • z (ndarray :)

  • x

  • y (ndarray :)

  • z

update_FMP_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]
Parameters:
  • x (ndarray :) – param y:

  • z (ndarray :)

  • x

  • y (ndarray :)

  • z

g3d.flow.placeholders.matrixrow module

matrix building blocks - row entry, row, and rows placeholder (MatrixRowEntry, MatrixRow, MatrixRows class definition)

class g3d.flow.placeholders.matrixrow.MatrixRow(i: int = 0)[source]

Bases: object

Attributes:
idx
return:

size
return:

Methods

add_entry(col, coef)

add_to_diagonal(val)

get_coef(i)

get_col(i)

get_entries()

get_entry(i)

scale(f)

set_diagonal(coef)

nullify

print

sort

add_entry(col: int, coef: float) → None[source]
Parameters:
  • col

  • coef

Returns:

add_to_diagonal(val: float) → None[source]
Parameters:

val

get_coef(i: int) → float | None[source]
Parameters:

i

Returns:

get_col(i: int) → int[source]
Parameters:

i

Returns:

get_entries() → list[source]
Returns:

get_entry(i: int) → MatrixRowEntry | None[source]
Parameters:

i

Returns:

property idx: int

return:

nullify() → None[source]
print() → None[source]
scale(f: float) → None[source]
Parameters:

f

set_diagonal(coef: float) → None[source]
Parameters:

coef

Returns:

property size: int

return:

sort() → None[source]
class g3d.flow.placeholders.matrixrow.MatrixRowEntry(i: int = 0, val: float = 0.0)[source]

Bases: object

Attributes:
coef
return:

idx
return:

Methods

add(val)

scale(f)

nullify

print

add(val: float) → None[source]
Parameters:

val

property coef: float

return:

property idx: int

return:

nullify() → None[source]
print() → None[source]
scale(f: float) → None[source]
Parameters:

f

class g3d.flow.placeholders.matrixrow.MatrixRows[source]

Bases: object

Attributes:
size
return:

Methods

add_entry(idx, col, coef)

add_row([idx])

add_to_diagonals(val)

count_entries()

extract_vectors()

get_coef(ir, ic)

get_col(ir, ic)

get_entry(ir, ic)

get_matrix_dimensions()

get_row(ir)

get_rows()

scale(f)

set_diagonals(coef)

nullify

print

sort

add_entry(idx: int, col: int, coef: float) → None[source]
Parameters:
  • idx

  • col

  • coef

add_row(idx: int = 0) → MatrixRow[source]
Parameters:

idx

Returns:

add_to_diagonals(val: float) → None[source]
Parameters:

val

count_entries() → int[source]
Returns:

extract_vectors() → Tuple[ndarray, ndarray, ndarray][source]
Returns:

get_coef(ir: int, ic: int) → float | None[source]
Parameters:
  • ir

  • ic

Returns:

get_col(ir: int, ic: int) → int[source]
Parameters:
  • ir

  • ic

Returns:

get_entry(ir: int, ic: int) → MatrixRowEntry | None[source]
Parameters:
  • ir

  • ic

Returns:

get_matrix_dimensions() → Tuple[int, int][source]
Returns:

get_row(ir: int) → MatrixRow | None[source]
Parameters:

ir

Returns:

get_rows() → list[source]
Returns:

nullify() → None[source]
print() → None[source]
scale(f: float) → None[source]
Parameters:

f

set_diagonals(coef: float) → None[source]
Parameters:

coef

property size: int

return:

sort() → None[source]

g3d.flow.placeholders.post module

Postprocessing variables - flow field data placeholder (PostField class definition)

class g3d.flow.placeholders.post.PostField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class PostField, extends class FlowDataPlaceHolder: postprocessing variables container

Attributes:
M

Mach number []

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

p0

Total pressure [Pa]

s

Entropy [J/K]

size

Placeholder size

t0

Total temperature [K]

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets postprocessing flow data arrays

get_arrays_with_ghosts()

Gets postprocessing flow data arrays including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_Post(p)

Set array values from provided postprocessing variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(p0, t0, M, s)

Set data from provided arrays

set_from_key_value(key, value)

Sets data from key-value pair input

set_from_post_field(p)

Copy data from provided postprocessing variables placeholder object

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(p0, t0, M, s[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

setup(**kwargs)

Sets up container according to specifications

update(cons, auxv, gas[, verbose])

Calculates new flow data values based on provided input and updates placeholder arrays

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

property M: ndarray

Mach number []

Returns:

Mach number array

Return type:

ndarray

get_arrays() → Tuple[ndarray, ...][source]

Gets postprocessing flow data arrays

Returns:

data arrays (p0, t0, M, s)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets postprocessing flow data arrays including ghost cell values

Returns:

data arrays (p0, t0, M, s)

Return type:

tuple

property p0: ndarray

Total pressure [Pa]

Returns:

total pressure array

Return type:

ndarray

property s: ndarray

Entropy [J/K]

Returns:

entropy array

Return type:

ndarray

set_from_Post(p: Post) → None[source]

Set array values from provided postprocessing variable object

Parameters:

p (Post :) – postprocessing variable object

set_from_arrays(p0: ndarray, t0: ndarray, M: ndarray, s: ndarray) → None[source]

Set data from provided arrays

Parameters:
  • p0 (ndarray :) – density data

  • t0 (ndarray :) – x-momentum data

  • M (ndarray :) – y-momentum data

  • s (ndarray :) – z-momentum data

set_from_post_field(p: PostField) → None[source]

Copy data from provided postprocessing variables placeholder object

Parameters:

p (PostField :) – postprocessing variables container

set_values(p0: float | ndarray, t0: float | ndarray, M: float | ndarray, s: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • p0 (float or ndarray :) – total pressure value or array of values

  • t0 (float or ndarray :) – total temperature value or array of values

  • M (float or ndarray :) – Mach number value or array of values

  • s (float or ndarray :) – entropy value or array of values

  • idx (int :) – cell index (Default value = None)

property t0: ndarray

Total temperature [K]

Returns:

total temperature array

Return type:

ndarray

update(cons: ConsField, auxv: AuxvField, gas: Gas, verbose: bool = False) → None[source]

Calculates new flow data values based on provided input and updates placeholder arrays

Parameters:
  • cons (ConsField :) – conservative flow variables

  • auxv (AuxvField :) – primitive flow variables

  • gas (Gas :) – gas model

  • verbose (bool :) – in verbose mode, extreme values will be printed to stdout (Default value = False)

g3d.flow.placeholders.turb module

Turbulence model variables (static & dynamic) - flow field data placeholders

class g3d.flow.placeholders.turb.DynamicTurbulenceModelVariables(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class DynamicTurbulenceModel, extends class FlowDataPlaceHolder: dynamic turbulence model variables container

Attributes:
first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

visct

Turbulent viscosity [kg/(m s)]

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets turbulence model data arrays

get_arrays_with_ghosts()

Gets turbulence model data arrays including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

get_visct_array()

Gets turbulence viscosity array

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_Turb(t)

Set array values from provided turbulence model variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(visct)

Set data from provided arrays

set_from_key_value(key, value)

Sets data from key-value pair input

set_from_turb_field(t)

Copy data from provided turbulence model variables placeholder object

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(visct[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

get_arrays() → ndarray | Tuple[ndarray, ...][source]

Gets turbulence model data arrays

Returns:

data arrays (visct)

Return type:

tuple

get_arrays_with_ghosts() → ndarray | Tuple[ndarray, ...][source]

Gets turbulence model data arrays including ghost cell values

Returns:

data arrays (visct)

Return type:

tuple

get_visct_array() → ndarray[source]

Gets turbulence viscosity array

Returns:

turbulence viscosity array

Return type:

ndarray

set_from_Turb(t: Turb) → None[source]

Set array values from provided turbulence model variable object

Parameters:

t (Turb :) – turbulence model variable object

set_from_arrays(visct: ndarray) → None[source]

Set data from provided arrays

Parameters:

visct (ndarray :) – turbulence viscosity data

set_from_turb_field(t: DynamicTurbulenceModelVariables) → None[source]

Copy data from provided turbulence model variables placeholder object

Parameters:

t (DynamicTurbulenceModelVariables :) – dynamics turbulence model variables container

set_values(visct: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • visct (float or ndarray :) – turbulent viscosity value or array of values

  • idx (int :) – cell index (Default value = None)

property visct: ndarray

Turbulent viscosity [kg/(m s)]

Returns:

turbulent viscosity array

Return type:

ndarray

class g3d.flow.placeholders.turb.StaticTurbulenceModelVariables(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class StaticTurbulenceModel, extends class FlowDataPlaceHolder: static turbulence model variables container

Attributes:
first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

g3d.flow.placeholders.vgrad module

Velocity gradients - flow field data placeholder (VGradField class definition)

class g3d.flow.placeholders.vgrad.VGradField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class VGradField, extends class FlowDataPlaceHolder

Attributes:
dudx

Velocity gradient component

dudy

Velocity gradient component

dudz

Velocity gradient component

dvdx

Velocity gradient component

dvdy

Velocity gradient component

dvdz

Velocity gradient component

dwdx

Velocity gradient component

dwdy

Velocity gradient component

dwdz

Velocity gradient component

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

add_gradients(u, v, w, fmp[, StartIndex, ...])

Add face contribution to velocity gradient field

allocate_flux_molecule_placeholders([N])

Allocates flux molecule data placeholders

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_SijSij(idx)

Gets strain rate tensor product for specified cell index

get_VGrad(idx)

Gets velocity gradients for specified cell index

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets velocity gradient arrays

get_arrays_with_ghosts()

Gets velocity gradient arrays including ghost values

get_divergence(idx)

Extracts the divergence of the velocity field for specified cell index

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

get_vorticity(idx)

Extracts the vorticity vector for specified cell index

get_vorticity_magnitude(idx)

Calculates the vorticity magnitude for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_VGrad(vgrad)

Sets data from prototype VGrad object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(dudx, dudy, dudz, dvdx, ...)

Sets velocity gradient values from provided arrays

set_from_gradient_field(v)

Sets velocity gradient values from prototype VGradField object

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(dd[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided array

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

add_gradients(u: ndarray, v: ndarray, w: ndarray, fmp: FMP, StartIndex: int = 0, n_faces: int = 0, MODE: Any = GradientMode.AVERAGE) → None[source]

Add face contribution to velocity gradient field

Parameters:
  • u (ndarray :) – x-velocity vector

  • v (ndarray :) – y-velocity vector

  • w (ndarray :) – z-velocity vector

  • fmp (FMP :) – flux molecule pointer placeholder

  • StartIndex (int :) – first index (Default value = 0)

  • n_faces (int :) – number of faces (Default value = 0)

  • MODE (GradientMode :) – type of gradient calculation (Default value = GradientMode.AVERAGE)

allocate_flux_molecule_placeholders(N: int = 0) → None[source]

Allocates flux molecule data placeholders

Parameters:

N (int :) – number of faces (Default value = 0)

property dudx: ndarray

Velocity gradient component

Returns:

dudx array

Return type:

ndarray

property dudy: ndarray

Velocity gradient component

Returns:

dudy array

Return type:

ndarray

property dudz: ndarray

Velocity gradient component

Returns:

dudz array

Return type:

ndarray

property dvdx: ndarray

Velocity gradient component

Returns:

dvdx array

Return type:

ndarray

property dvdy: ndarray

Velocity gradient component

Returns:

dvdy array

Return type:

ndarray

property dvdz: ndarray

Velocity gradient component

Returns:

dvdz array

Return type:

ndarray

property dwdx: ndarray

Velocity gradient component

Returns:

dwdx array

Return type:

ndarray

property dwdy: ndarray

Velocity gradient component

Returns:

dwdy array

Return type:

ndarray

property dwdz: ndarray

Velocity gradient component

Returns:

dwdz array

Return type:

ndarray

get_SijSij(idx: int) → float[source]

Gets strain rate tensor product for specified cell index

Parameters:

idx (int :) – cell index

Returns:

SijSij

Return type:

float

get_VGrad(idx: int) → ndarray[source]

Gets velocity gradients for specified cell index

Parameters:

idx (int :) – cell index

get_arrays() → Tuple[ndarray, ...][source]

Gets velocity gradient arrays

Returns:

tuple of ndarray (dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets velocity gradient arrays including ghost values

Returns:

tuple of ndarray (dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

Return type:

tuple

get_divergence(idx: int) → float[source]

Extracts the divergence of the velocity field for specified cell index

Parameters:

idx (int :) – cell index

Returns:

divergence of velocity field

Return type:

float

get_vorticity(idx: int) → ndarray[source]

Extracts the vorticity vector for specified cell index

Parameters:

idx (int :) – cell index

Returns:

vorticity vector

Return type:

ndarray

get_vorticity_magnitude(idx: int) → float[source]

Calculates the vorticity magnitude for specified cell index

Parameters:

idx (int :) – cell index

Returns:

vorticity magnitude

Return type:

float

set_from_VGrad(vgrad: VGrad) → None[source]

Sets data from prototype VGrad object

Parameters:

vgrad (VGrad :) – instance of velocity gradient VGrad object

set_from_arrays(dudx: ndarray, dudy: ndarray, dudz: ndarray, dvdx: ndarray, dvdy: ndarray, dvdz: ndarray, dwdx: ndarray, dwdy: ndarray, dwdz: ndarray) → None[source]

Sets velocity gradient values from provided arrays

Parameters:
  • dudx (ndarray :) – dudx array

  • dudy (ndarray :) – dudy array

  • dudz (ndarray :) – dudz array

  • dvdx (ndarray :) – dvdx array

  • dvdy (ndarray :) – dvdy array

  • dvdz (ndarray :) – dvdz array

  • dwdx (ndarray :) – dwdx array

  • dwdy (ndarray :) – dwdy array

  • dwdz (ndarray :) – dwdz array

set_from_gradient_field(v: VGradField) → None[source]

Sets velocity gradient values from prototype VGradField object

Parameters:

v (VGradField :) – prototype VGradField object

set_values(dd: ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided array

Parameters:
  • dd (ndarray :) – velocity gradient array (3x3)

  • idx (int :) – cell index (Default value = None)

Module contents

g3d/flow/placeholders sub library

class g3d.flow.placeholders.AuxvField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class AuxvField, extends class FlowDataPlaceHolder: primitive flow variables container

Attributes:
c

Speed of sound [m/s]

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

p

Pressure [Pa]

size

Placeholder size

t

Temperature [K]

tag

tag (string) used for identification

u

X-direction velocity [m/s]

v

Y-direction velocity [m/s]

variables

Defined container variables

w

Z-direction velocity [m/s]

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_Auxv(idx)

Extracts an instance of primitive variable object for specified cell index

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets primitive flow data arrays

get_arrays_with_ghosts()

Gets primitive flow data arrays including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

get_velocity_arrays()

Gets velocity data arrays

get_velocity_arrays_with_ghosts()

Gets velocity data arrays including ghost cell values

get_velocity_vector(idx)

Get velocity vector for cell with specified index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_Auxv(a)

Set array values from provided primitive variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(p, u, v, w, t, c)

Set data from provided arrays

set_from_auxv_field(a)

Copy data from another AuxvField object

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

set_variables(p, u, v, w, t, c[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

set_velocity_vector(idx, vel)

Set velocity vector for cell with specified index

setup(**kwargs)

Sets up container according to specifications

update(cons, gas[, verbose])

Calculates new flow data values based on provided input and updates placeholder arrays

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

property c: ndarray

Speed of sound [m/s]

Returns:

speed of sound array

Return type:

ndarray

get_Auxv(idx: int) → Auxv[source]

Extracts an instance of primitive variable object for specified cell index

Parameters:

idx (int :) – cell index

Returns:

primitive variable object

Return type:

Auxv

get_arrays() → Tuple[ndarray, ...][source]

Gets primitive flow data arrays

Returns:

data arrays (p, u, v, w, t, c)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets primitive flow data arrays including ghost cell values

Returns:

data arrays (p, u, v, w, t, c)

Return type:

tuple

get_velocity_arrays() → Tuple[ndarray, ...][source]

Gets velocity data arrays

Returns:

data arrays (u, v, w)

Return type:

tuple

get_velocity_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets velocity data arrays including ghost cell values

Returns:

data arrays (u, v, w)

Return type:

tuple

get_velocity_vector(idx: int) → ndarray[source]

Get velocity vector for cell with specified index

Parameters:

idx (int :) – cell index

Returns:

velocity vector (u, v, w)

Return type:

ndarray

property p: ndarray

Pressure [Pa]

Returns:

pressure array

Return type:

ndarray

set_from_Auxv(a: Auxv) → None[source]

Set array values from provided primitive variable object

Parameters:

a (Auxv :) – primitive variable object

set_from_arrays(p: ndarray, u: ndarray, v: ndarray, w: ndarray, t: ndarray, c: ndarray) → None[source]

Set data from provided arrays

Parameters:
  • p (ndarray :) – pressure data

  • u (ndarray :) – x-velocity data

  • v (ndarray :) – y-velocity data

  • w (ndarray :) – z-velocity data

  • t (ndarray :) – temperature data

  • c (ndarray :) – speed-of-sound data

set_from_auxv_field(a: AuxvField) → None[source]

Copy data from another AuxvField object

Parameters:

a (AuxvField :) – flow data source

set_variables(p: float | ndarray, u: float | ndarray, v: float | ndarray, w: float | ndarray, t: float | ndarray, c: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • p (float or ndarray :) – pressure value or array of values

  • u (float or ndarray :) – x-velocity value or array of values

  • v (float or ndarray :) – y-velocity value or array of values

  • w (float or ndarray :) – z-velocity value or array of values

  • t (float or ndarray :) – temperature value or array of values

  • c (float or ndarray :) – speed-of-sound value or array of values

  • idx (int :) – cell index (Default value = None)

set_velocity_vector(idx: int, vel: ndarray | list[float] | Tuple[float, ...])[source]

Set velocity vector for cell with specified index

Parameters:
  • idx (int :) – cell index

  • vel (ndarray, list, or tuple :) – velocity vector (u, v, w)

property t: ndarray

Temperature [K]

Returns:

temperature array

Return type:

ndarray

property u: ndarray

X-direction velocity [m/s]

Returns:

u velocity array

Return type:

ndarray

update(cons: ConsField, gas: Gas, verbose: bool = False) → None[source]

Calculates new flow data values based on provided input and updates placeholder arrays

Parameters:
  • cons (ConsField :) – conservative flow variables

  • gas (Gas :) – gas model

  • verbose (bool :) – in verbose mode, extreme values will be printed to stdout (Default value = False)

property v: ndarray

Y-direction velocity [m/s]

Returns:

v velocity array

Return type:

ndarray

property w: ndarray

Z-direction velocity [m/s]

Returns:

w velocity array

Return type:

ndarray

class g3d.flow.placeholders.ConsField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class ConsField, extends class FlowDataPlaceHolder: conservative flow variables container

Attributes:
et

Total energy [J/m^3]

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

ro

Density [kg/m^3]

ru

X-momentum [kg/(m^2 s)]

rv

Y-momentum [kg/(m^2 s)]

rw

Z-momentum [kg/(m^2 s)]

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

CellToNode(c)

Convert cell values to node values

GetNGhosts()

Gets number of allocated ghost cells

Interpolate(nodes, cells, node_cons)

Interpolate cell-centered flow field data to node-centered data

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_Cons(idx)

Extracts an instance of conservative variable object for specified cell index

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets conservative flow data arrays

get_arrays_with_ghosts()

Gets conservative flow data arrays including ghost cell values

get_by_index(idx)

Gets tuple of conservative variable values for cell with specified index

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_momentum_vector(idx)

Get momentum vector for cell with specified index

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_by_index_from_Cons(idx, c)

Set array values for cell with specified cell index from provided conservative variable object

set_from_Cons(c)

Set array values from provided conservative variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(ro, ru, rv, rw, et)

Set data from provided arrays

set_from_cons_field(c)

Copy data from provided conservative variables placeholder object

set_from_key_value(key, value)

Sets data from key-value pair input

set_momentum_vector(idx, r_vel)

Set momentum vector for cell with specified index

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(ro, ru, rv, rw, et[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

CellToNode(c: ConsField) → None[source]

Convert cell values to node values

Parameters:

c (ConsField :) – conservative variables container

Interpolate(nodes: Coordinates, cells: Coordinates, node_cons: ConsField) → None[source]

Interpolate cell-centered flow field data to node-centered data

Parameters:
  • nodes (Coordinates :) – node coordinates

  • cells (Coordinates :) – cell coordinates

  • node_cons (ConsField :) – node stored conservative variables

property et: ndarray

Total energy [J/m^3]

Returns:

total energy array

Return type:

ndarray

get_Cons(idx: int) → Cons[source]

Extracts an instance of conservative variable object for specified cell index

Parameters:

idx (int :) – cell index

Returns:

conservative variable object

Return type:

Cons

get_arrays() → Tuple[ndarray, ...][source]

Gets conservative flow data arrays

Returns:

data arrays (ro, ru, rv, rw, et)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets conservative flow data arrays including ghost cell values

Returns:

data arrays (ro, ru, rv, rw, et)

Return type:

tuple

get_by_index(idx: int) → Tuple[float, ...][source]

Gets tuple of conservative variable values for cell with specified index

Parameters:

idx (int :) – cell index

Returns:

conservative variable values (ro, ru, rv, rw, et)

Return type:

tuple

get_momentum_vector(idx: int) → ndarray[source]

Get momentum vector for cell with specified index

Parameters:

idx (int :) – cell index

Returns:

momentum vector (ru, rv, rw)

Return type:

ndarray

property ro: ndarray

Density [kg/m^3]

Returns:

density array

Return type:

ndarray

property ru: ndarray

X-momentum [kg/(m^2 s)]

Returns:

x-momentum array

Return type:

ndarray

property rv: ndarray

Y-momentum [kg/(m^2 s)]

Returns:

y-momentum array

Return type:

ndarray

property rw: ndarray

Z-momentum [kg/(m^2 s)]

Returns:

z-momentum array

Return type:

ndarray

set_by_index_from_Cons(idx: int, c: Cons) → None[source]

Set array values for cell with specified cell index from provided conservative variable object

Parameters:
  • idx (int :) – cell index

  • c (Cons :) – conservative variable object

set_from_Cons(c: Cons) → None[source]

Set array values from provided conservative variable object

Parameters:

c (Cons :) – conservative variable object

set_from_arrays(ro: ndarray, ru: ndarray, rv: ndarray, rw: ndarray, et: ndarray) → None[source]

Set data from provided arrays

Parameters:
  • ro (ndarray :) – density data

  • ru (ndarray :) – x-momentum data

  • rv (ndarray :) – y-momentum data

  • rw (ndarray :) – z-momentum data

  • et (ndarray :) – total energy data

set_from_cons_field(c: ConsField) → None[source]

Copy data from provided conservative variables placeholder object

Parameters:

c (ConsField :) – conservative variables container

set_momentum_vector(idx: int, r_vel: ndarray | list[float] | Tuple[float, ...]) → None[source]

Set momentum vector for cell with specified index

Parameters:
  • idx (int :) – cell index

  • r_vel (ndarray, list, or tuple :) – momentum vector (ru, rv, rw)

set_values(ro: float | ndarray, ru: float | ndarray, rv: float | ndarray, rw: float | ndarray, et: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • ro (float or ndarray :) – density value or array of values

  • ru (float or ndarray :) – x-momentum value or array of values

  • rv (float or ndarray :) – y-momentum value or array of values

  • rw (float or ndarray :) – z-momentum value or array of values

  • et (float or ndarray :) – total energy value or array of values

  • idx (int :) – cell index (Default value = None)

class g3d.flow.placeholders.DynamicTurbulenceModelVariables(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class DynamicTurbulenceModel, extends class FlowDataPlaceHolder: dynamic turbulence model variables container

Attributes:
first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

visct

Turbulent viscosity [kg/(m s)]

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets turbulence model data arrays

get_arrays_with_ghosts()

Gets turbulence model data arrays including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

get_visct_array()

Gets turbulence viscosity array

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_Turb(t)

Set array values from provided turbulence model variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(visct)

Set data from provided arrays

set_from_key_value(key, value)

Sets data from key-value pair input

set_from_turb_field(t)

Copy data from provided turbulence model variables placeholder object

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(visct[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

get_arrays() → ndarray | Tuple[ndarray, ...][source]

Gets turbulence model data arrays

Returns:

data arrays (visct)

Return type:

tuple

get_arrays_with_ghosts() → ndarray | Tuple[ndarray, ...][source]

Gets turbulence model data arrays including ghost cell values

Returns:

data arrays (visct)

Return type:

tuple

get_visct_array() → ndarray[source]

Gets turbulence viscosity array

Returns:

turbulence viscosity array

Return type:

ndarray

set_from_Turb(t: Turb) → None[source]

Set array values from provided turbulence model variable object

Parameters:

t (Turb :) – turbulence model variable object

set_from_arrays(visct: ndarray) → None[source]

Set data from provided arrays

Parameters:

visct (ndarray :) – turbulence viscosity data

set_from_turb_field(t: DynamicTurbulenceModelVariables) → None[source]

Copy data from provided turbulence model variables placeholder object

Parameters:

t (DynamicTurbulenceModelVariables :) – dynamics turbulence model variables container

set_values(visct: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • visct (float or ndarray :) – turbulent viscosity value or array of values

  • idx (int :) – cell index (Default value = None)

property visct: ndarray

Turbulent viscosity [kg/(m s)]

Returns:

turbulent viscosity array

Return type:

ndarray

class g3d.flow.placeholders.FMP(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Definition of class FMP: Flux Molecule Pointers - cell/node pointers and metrics data container

Attributes:
fctj

Face local j-direction multiplication factor

fctk

Face local k-direction multiplication factor

kc

Cell index pointers for flux molecule cells (12 per molecule)

kp

Node index pointers for flux molecule cells (12 per molecule)

s
return:

si
return:

size

Placeholder size

sl

Face area for all flux molecules (central molecule face)

sx
return:

sy
return:

sz
return:

tag

tag (string) used for identification

tmp

Temporary storage array

type

Placeholder type

voli

Inverse of flux molecule volume

y_norm

Wall-normal vector

Methods

allocate(**kwargs)

Allocates data storage arrays

allocate_tmp_arrays([N])

Allocates arrays for temporary data storage

check_cell_metrics(ic, check_sum)

Check cell metrics data

check_metrics(x, y, z)

Check flux molecule metrics data

copy(e)

copies data from specified entity input: entity example: copy(e)

get_conv_metrics([idx])

Get metrics data used for convective flux calculations for all flux molecules or for a specific flux molecule

get_diff_metrics([idx])

Get metrics data used for diffusive flux calculations for all flux molecules or for a specific flux molecule

get_factors([idx])

Gets weight factors for all defined flux molecules or a specific flux molecule.

get_pointers([idx])

Gets node and cell pointers for all defined flux molecules or a specific flux molecule.

get_tmp_storage([col])

Gets access to temporary storage array

get_wall_normal([idx])

Gets wall-normal for all flux molecules or for a specific flux molecule

print([idx])

Prints flux molecule data (dell pointers, node pointers, and weight factors) for all flux molecules or for a specific flux molecule

print_data([f])

Prints cell pointers, node pointers, and face metrics to file (or stdout)

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_data(idx, kp, kc, fctj, fctk)

Set flux molecule data (cell and node pointers and weight factors)

set_factors(idx, fctj, fctk)

Update flux molecule weight factors

set_from_key_value(key, value)

Sets data from key-value pair input

set_pointers(idx, kp, kc)

Populate cell and node pointers using provided arrays

update_block_interface_factors(idx, mim, ...)

Update flux molecule weight factors for mesh block interfaces

update_diff_metrics(x, y, z[, n_faces, ...])

Update flux molecule metrics data for diffusive flux calculations

update_factors(idx, mim, mip, mjm, mjp)

Update flux molecule weight factors

update_metrics(x, y, z)

Update flux molecule metrics data

update_symmetry_ghost_nodes(x, y, z)

Update geometric representation of symmetry plane ghost nodes (mirror nodes in symmetry plane)

update_wall_diff_metrics(x, y, z)

Update wall face diffusive flux metrics

allocate(**kwargs: Any) → None[source]

Allocates data storage arrays

Parameters:

**kwargs (Any :) – keyword-value pairs, see :func:’set_from_key_value’, optional input

allocate_tmp_arrays(N: int = 1) → None[source]

Allocates arrays for temporary data storage

Parameters:

N (int :) – number of tmp storage arrays (Default value = 1)

check_cell_metrics(ic: int, check_sum: ndarray)[source]

Check cell metrics data

Parameters:
  • ic (int :) – cell index

  • check_sum (ndarray :) – accumulated check sum

check_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]

Check flux molecule metrics data

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

property fctj: ndarray

Face local j-direction multiplication factor

Returns:

local j-direction factors for all placeholder faces

Return type:

ndarray

property fctk: ndarray

Face local k-direction multiplication factor

Returns:

local k-direction factors for all placeholder faces

Return type:

ndarray

get_conv_metrics(idx: int | None = None) → Tuple[float, float] | Tuple[ndarray, ndarray][source]

Get metrics data used for convective flux calculations for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

face area

Return type:

tuple

get_diff_metrics(idx: int | None = None) → Tuple[float, ...] | Tuple[ndarray, ...][source]

Get metrics data used for diffusive flux calculations for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

Return type:

tuple

get_factors(idx: int | None = None) → Tuple[float, float] | Tuple[ndarray, ndarray][source]

Gets weight factors for all defined flux molecules or a specific flux molecule.

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

weight factors in local j- and k-directions for all defined flux molecules in container or one specific flux molecule (if flux molecule index is provided)

Return type:

tuple

get_pointers(idx: int | None = None) → Tuple[ndarray, ndarray][source]

Gets node and cell pointers for all defined flux molecules or a specific flux molecule.

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

node and cell pointers for a single flux molecule (if index is specified) or for all defined flux molecules in container (kp, kc) where kp and kc both are arrays

Return type:

tuple

get_tmp_storage(col: int = 0) → ndarray[source]

Gets access to temporary storage array

Parameters:

col (int :) – column in temporary storage matrix (Default value = 0)

Returns:

temporary storage array

Return type:

ndarray

get_wall_normal(idx: int | None = None) → float | ndarray[source]

Gets wall-normal for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

Returns:

wall-normal vector

Return type:

float or ndarray

property kc: ndarray

Cell index pointers for flux molecule cells (12 per molecule)

Returns:

cell pointers

Return type:

ndarray

property kp: ndarray

Node index pointers for flux molecule cells (12 per molecule)

Returns:

node pointers

Return type:

ndarray

print(idx: int | None = None) → None[source]

Prints flux molecule data (dell pointers, node pointers, and weight factors) for all flux molecules or for a specific flux molecule

Parameters:

idx (int :) – flux molecule index (Default value = None)

print_data(f: TextIO | None = None) → None[source]

Prints cell pointers, node pointers, and face metrics to file (or stdout)

Parameters:

f (TextIO :) – ascii file handle (Default value = None)

property s: ndarray

return:

set_data(idx: int, kp: ndarray | list[int], kc: ndarray | list[int], fctj: float, fctk: float) → None[source]

Set flux molecule data (cell and node pointers and weight factors)

See documentation of :func:’set_pointers’ and :func:’set_factors’

Parameters:
  • idx (int :) – flux molecule index

  • kp (ndarray or list[int] :) – node indices (12 nodes per molecule)

  • kc (ndarray or list[int] :) – cell indices (12 cells per molecule)

  • fctj (float :) – weight factor local j-direction

  • fctk (float :) – weight factor local k-direction

set_factors(idx: int, fctj: float, fctk: float) → None[source]

Update flux molecule weight factors

Weight factors are needed for calculation of cell face gradients and diffusive fluxes. The provided weight factors represents the flux molecule local j- and k-directions, respectively. The local i-direction of a flux molecule is always aligned with the center face normal (i.e. in the convective molecule direction)

Parameters:
  • idx (int :) – cell index

  • fctj (float :) – weight factor local j-direction

  • fctk (float :) – weight factor local k-direction

set_from_key_value(key: str, value: Any) → bool[source]

Sets data from key-value pair input

Parameters:
  • key (str :) – keyword valid class-specific keywords: ‘size’, ‘type’

  • value (Any :) – value corresponding to keyword

Returns:

status - True if key is found in list of valid keywords

Return type:

bool

set_pointers(idx: int, kp: ndarray | list[int], kc: ndarray | list[int]) → None[source]

Populate cell and node pointers using provided arrays

Parameters:
  • idx (int :) – face index

  • kp (ndarray or list[int] :) – node indices (12 nodes per molecule)

  • kc (ndarray or list[int] :) – cell indices (12 cells per molecule)

property si: ndarray

return:

property size: int

Placeholder size

Returns:

size

Return type:

int

property sl: ndarray

Face area for all flux molecules (central molecule face)

Returns:

face area array

Return type:

ndarray

property sx: ndarray

return:

property sy: ndarray

return:

property sz: ndarray

return:

property tmp: ndarray

Temporary storage array

Returns:

temporary storage array access

Return type:

ndarray

property type: Any

Placeholder type

Returns:

enum describing placeholder type

Return type:

FMPTypes

update_block_interface_factors(idx: int, mim: int, mip: int, mjm: int, mjp: int) → None[source]

Update flux molecule weight factors for mesh block interfaces

Parameters:
  • idx (int :) – flux molecule index

  • mim (int :) – number of flux molecule cells in negative local i-direction (0 at low-i boundary)

  • mip (int :) – number of flux molecule cells in positive local i-direction (0 at high-i boundary)

  • mjm (int :) – number of flux molecule cells in negative local j-direction (0 at low-j boundary)

  • mjp (int :) – number of flux molecule cells in positive local j-direction (0 at high-j boundary)

update_diff_metrics(x: ndarray, y: ndarray, z: ndarray, n_faces: int = 0, idx_start: int = 0) → None[source]

Update flux molecule metrics data for diffusive flux calculations

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

  • n_faces (int :) – number of faces (Default value = 0)

  • idx_start (int :) – index of first face (Default value = 0)

update_factors(idx: int, mim: int, mip: int, mjm: int, mjp: int) → None[source]

Update flux molecule weight factors

Parameters:
  • idx (int :) – flux molecule index

  • mim (int :) – number of flux molecule cells in negative local i-direction (0 at low-i boundary)

  • mip (int :) – number of flux molecule cells in positive local i-direction (0 at high-i boundary)

  • mjm (int :) – number of flux molecule cells in negative local j-direction (0 at low-j boundary)

  • mjp (int :) – number of flux molecule cells in positive local j-direction (0 at high-j boundary)

update_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]

Update flux molecule metrics data

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

update_symmetry_ghost_nodes(x: ndarray, y: ndarray, z: ndarray) → None[source]

Update geometric representation of symmetry plane ghost nodes (mirror nodes in symmetry plane)

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

update_wall_diff_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]

Update wall face diffusive flux metrics

Parameters:
  • x (ndarray :) – x-coordinate vector

  • y (ndarray :) – y-coordinate vector

  • z (ndarray :) – z-coordinate vector

property voli: ndarray

Inverse of flux molecule volume

Returns:

inverse volume array

Return type:

ndarray

property y_norm: ndarray

Wall-normal vector

Returns:

wall-normal vector (n_x, n_y, n_z)

Return type:

ndarray

class g3d.flow.placeholders.FMPArray[source]

Bases: object

Definition of class FMPArray: flux molecule placeholder container

Attributes:
FMPs

Flux molecule placeholder list

size

Storage size

Methods

add_FMP(**kwargs)

Adds flux molecule to container

allocate_FMPs([N, idx])

Allocates flux molecule placeholders in container - all flux molecules placeholders or one specific

check_FMP_cell_metrics(ic, check_sum)

check_FMP_metrics(x, y, z[, tag])

deallocate_FMPs()

Deallocates listed flux molecule placeholders

get_FMPs([idx])

get_max_FMP_size()

print_FMP_data([tag, f])

set_FMP_data(idx, face_idx, kp, kc, fctj, fctk)

set_FMP_tag(idx, tag)

update_FMP_diff_metrics(x, y, z)

update_FMP_metrics(x, y, z)

property FMPs: list

Flux molecule placeholder list

Returns:

list of allocated flux molecule placeholders

Return type:

list

add_FMP(**kwargs: Any) → None[source]

Adds flux molecule to container

Parameters:

**kwargs (Any :) – keyword-argument pairs will be forwarded to flux molecule placeholder (FMP) constructor see :func:’set_from_key_value’

allocate_FMPs(N: int = 0, idx: int | None = None) → None[source]

Allocates flux molecule placeholders in container - all flux molecules placeholders or one specific

Parameters:
  • N (int :) – flux molecule placeholder array length (Default value = 0)

  • idx (int :) – flux molecule placeholder index listed in this container (Default value = None)

check_FMP_cell_metrics(ic: int, check_sum: ndarray | list[float]) → None[source]
Parameters:
  • ic (int :) – param check_sum:

  • ic

  • check_sum (Union[ndarray :)

  • list[float]]

check_FMP_metrics(x: ndarray, y: ndarray, z: ndarray, tag: str = 'ALL') → None[source]
Parameters:
  • x (ndarray :) – param y:

  • z (ndarray :) – param tag:

  • x

  • y (ndarray :)

  • z

  • tag (str :) – (Default value = ‘ALL’)

deallocate_FMPs() → None[source]

Deallocates listed flux molecule placeholders

get_FMPs(idx: int | None = None) → list | FMP[source]
Parameters:
  • idx (int :) – return:

  • idx – (Default value = None)

get_max_FMP_size() → int[source]
Returns:

print_FMP_data(tag: str = 'ALL', f: TextIO | None = None) → None[source]
Parameters:
  • tag (str :) – param f:

  • tag – (Default value = ‘ALL’)

  • f (TextIO :) – (Default value = None)

set_FMP_data(idx: int, face_idx: int, kp: int, kc: int, fctj: float, fctk: float) → None[source]
Parameters:
  • idx (int :) – param face_idx:

  • kp (int :) – param kc:

  • fctj (float :) – param fctk:

  • idx

  • face_idx (int :)

  • kp

  • kc (int :)

  • fctj

  • fctk (float :)

set_FMP_tag(idx: int, tag: str) → None[source]
Parameters:
  • idx (int :) – param tag:

  • idx

  • tag (str :)

property size: int

Storage size

Returns:

size

Return type:

int

update_FMP_diff_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]
Parameters:
  • x (ndarray :) – param y:

  • z (ndarray :)

  • x

  • y (ndarray :)

  • z

update_FMP_metrics(x: ndarray, y: ndarray, z: ndarray) → None[source]
Parameters:
  • x (ndarray :) – param y:

  • z (ndarray :)

  • x

  • y (ndarray :)

  • z

class g3d.flow.placeholders.FlowDataPlaceHolder(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Definition of class FlowDataPlaceHolder: a generic placeholder for field data

Attributes:
first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

AXPBY(A: float, B: float, Y: FlowDataPlaceHolder) → None[source]

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

Parameters:
  • A (float :) – scaling factor for vector X (scalar value)

  • B (float :) – scaling factor for vector Y (scalar value)

  • Y (FlowDataPlaceHolder :) – flow data container

AXPY(A: float, Y: FlowDataPlaceHolder) → None[source]

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

Parameters:
  • A (float :) – scaling factor for vector X (scalar value)

  • Y (FlowDataPlaceHolder :) – flow data container

GetNGhosts() → int[source]

Gets number of allocated ghost cells

Returns:

number of ghost cells

Return type:

int

WAXPY(A: float, X: FlowDataPlaceHolder, Y: FlowDataPlaceHolder) → None[source]

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

Parameters:
  • A (float :) – scaling factor for vector X (scalar value)

  • X (FlowDataPlaceHolder :) – flow data container

  • Y (FlowDataPlaceHolder :) – flow data container

backup() → None[source]

Copies data to backup arrays

copy(fd: FlowDataPlaceHolder) → None[source]

Copies data from prototype FlowDataPlaceHolder object

Parameters:

fd (FlowDataPlaceHolder :) – prototype FlowDataPlaceHolder object

copy_values(from_idx: int, to_idx: int) → None[source]

Copies from one array element to another

Parameters:
  • from_idx (int :) – data source cell index

  • to_idx (int :) – data destination cell index

de_allocate_placeholders() → None[source]

De allocates placeholders - nullifies all arrays

export(name: str, var: str = 'all') → dict[Any, Any][source]

Exports placeholder data to file (binary)

Parameters:
  • name (str :) – file name base

  • var (str :) – variable name (Default value = ‘all’)

property first: int

First index

Returns:

first index value

Return type:

int

get_array(var: str = 'var') → ndarray[source]

Get array for specified variable string

Parameters:

var (str :) – variable string (Default value = ‘var’)

get_array_with_ghosts(var: str = 'var') → ndarray[source]

Get array for specified variable string including ghost cell values

Parameters:

var (str :) – variable string (Default value = ‘var’)

get_extreme_value_array(value_type: str = 'max_val') → ndarray[source]

Gets array with calculated variable extreme values

Parameters:

value_type (str :) – type of extreme values (Default value = ‘max_val’)

get_extreme_values(var: str = 'all') → None[source]

Updates placeholder variables extreme values (min/max)

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_from_backup(reset_bak: bool = True) → None[source]

Restores data from backup arrays

Parameters:

reset_bak (bool :) – (Default value = True)

get_keys() → list[source]

Gets defined variable keys

Returns:

defined variable keys

Return type:

list

get_max_norm(var: str = 'all') → None[source]

Updates variable max norm values (max absolute values)

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_max_values(var: str = 'all') → None[source]

Updates placeholder max values

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_min_values(var: str = 'all') → None[source]

Updates placeholder min values

Parameters:

var (str :) – variable name (Default value = ‘all’)

get_pointers() → list[ndarray][source]

Gets list of array pointers

Returns:

pointers to flow data arrays

Return type:

list[ndarray]

get_range() → Tuple[int, int][source]

Gets placeholder range (first, last)

Returns:

placeholder range (first, last)

Return type:

tuple

get_value(idx: int, var: str = 'var') → float[source]

Get variable value for specified cell index

Parameters:
  • idx (int :) – cell index

  • var (str :) – variable name (Default value = ‘var’)

import_data(name: str, var: str = 'all') → dict[Any, Any][source]

Imports placeholder data from file (binary)

Parameters:
  • name (str :) – file name base

  • var (str :) – variable name (Default value = ‘all’)

import_var_data_from_binary(f: BinaryIO, var: list[str] | str = 'all') → dict[Any, Any][source]

Imports variable data from binary file

Parameters:
  • f (BinaryIO :) – file handle

  • var (list[str] or str :) – variable name(s) (Default value = ‘all’)

Returns:

variables dict

Return type:

dict

initialize(val: float = 0.0, var: str = 'all') → None[source]

Initialize placeholder

Parameters:
  • val (float :) – variable value (Default value = 0.)

  • var (str :) – variable name (Default value = ‘all’)

is_allocated() → bool[source]

Placeholder allocation status

Returns:

allocation status

Return type:

bool

property last: int

Last index

Returns:

last index value

Return type:

int

property n_cells: int

Number of cells

Returns:

cell count

Return type:

int

property n_ghosts: int

Number of ghost cells

Returns:

ghost cell count

Return type:

int

property n_var: int

Number of variables

Returns:

variable count

Return type:

int

normalize_extreme_values(norm_values: list[float] | ndarray, value_type: str = 'max_val') → None[source]

Normalizes extreme values

Parameters:
  • norm_values (list[float] or ndarray :) – normalization values (variable specific values)

  • value_type (str :) – type of extreme value (Default value = ‘max_val’)

nullify() → None[source]

Nullifies all array elements for all defined variables

nullify_by_index(idx: int) → None[source]

Nullifies all variables for specified cell index

Parameters:

idx (int :) – cell index

point_wise_scale(sf: ndarray) → None[source]

Element data scaling using provided scaling factor array

Parameters:

sf (ndarray :) – scaling factors

print_extreme_value_locations() → None[source]

Prints extreme values including location to stdout

print_extreme_values(var: str | list[str] = 'all') → None[source]

Prints calculated extreme values to stdout

Parameters:

var (str or list[str] :) – variable name(s) (Default value = ‘all’)

print_extreme_values_by_type(value_type: str = 'max_val', var: str = 'all') → None[source]

Prints calculated extreme values by type to stdout

Parameters:
  • value_type (str :) – extreme value type (Default value = ‘max_val’)

  • var (str :) – variable name (Default value = ‘all’)

print_flow_data(idx: int) → None[source]

Prints stored variable information for specified cell index to stdout

Parameters:

idx (int :) – cell index

read_from_file(f: BinaryIO) → None[source]

Reads placeholder variable arrays from file (binary format)

Parameters:

f (BinaryIO :) – file handle (binary file)

scale(idx: int, sf: float) → None[source]

Scales all variable values for specified cell index

Parameters:
  • idx (int :) – cell index

  • sf (float :) – scale factor

set_from_array(from_array: ndarray, var: str = 'var')[source]

Set flow data for specified variable from array

Parameters:
  • from_array (ndarray :) – prototype data array

  • var (str :) – variable name (Default value = ‘var’)

set_from_key_value(key: str, value: Any) → bool[source]

Sets data from key-value pair input

Parameters:
  • key (str :) – keyword valid class-specific keywords: ‘size’, ‘n_cells’, ‘first’, ‘last’, ‘n_ghosts’, ‘backup_data’

  • value (Any :) – value corresponding to keyword

Returns:

status - True if key is found in list of valid keywords

Return type:

bool

set_value(idx: int, val: float, var: str = 'var') → None[source]

Sets variable value for specified cell index

Parameters:
  • idx (int :) – cell index

  • val (float :) – variable value

  • var (str :) – variable name (Default value = ‘var’)

setup(**kwargs: Any) → None[source]

Sets up container according to specifications

Parameters:

**kwargs (Any :) – keyword-value pair data, see :func:’set_from_key_value’

property size: int

Placeholder size

Returns:

length of arrays in placeholder

Return type:

int

property variables: dict[Any, Any]

Defined container variables

Returns:

list of variables and associated data

Return type:

dict

vector_scale(v: ndarray) → None[source]

Scales all variable values for all elements using specified scaling array

Parameters:

v (ndarray :) – scale factors for all cells

write_to_file(f: BinaryIO) → None[source]

Writes placeholder variable arrays to file (binary format)

Parameters:

f (BinaryIO :) – file handle (binary file)

class g3d.flow.placeholders.MatrixRow(i: int = 0)[source]

Bases: object

Attributes:
idx
return:

size
return:

Methods

add_entry(col, coef)

add_to_diagonal(val)

get_coef(i)

get_col(i)

get_entries()

get_entry(i)

scale(f)

set_diagonal(coef)

nullify

print

sort

add_entry(col: int, coef: float) → None[source]
Parameters:
  • col

  • coef

Returns:

add_to_diagonal(val: float) → None[source]
Parameters:

val

get_coef(i: int) → float | None[source]
Parameters:

i

Returns:

get_col(i: int) → int[source]
Parameters:

i

Returns:

get_entries() → list[source]
Returns:

get_entry(i: int) → MatrixRowEntry | None[source]
Parameters:

i

Returns:

property idx: int

return:

nullify() → None[source]
print() → None[source]
scale(f: float) → None[source]
Parameters:

f

set_diagonal(coef: float) → None[source]
Parameters:

coef

Returns:

property size: int

return:

sort() → None[source]
class g3d.flow.placeholders.MatrixRowEntry(i: int = 0, val: float = 0.0)[source]

Bases: object

Attributes:
coef
return:

idx
return:

Methods

add(val)

scale(f)

nullify

print

add(val: float) → None[source]
Parameters:

val

property coef: float

return:

property idx: int

return:

nullify() → None[source]
print() → None[source]
scale(f: float) → None[source]
Parameters:

f

class g3d.flow.placeholders.MatrixRows[source]

Bases: object

Attributes:
size
return:

Methods

add_entry(idx, col, coef)

add_row([idx])

add_to_diagonals(val)

count_entries()

extract_vectors()

get_coef(ir, ic)

get_col(ir, ic)

get_entry(ir, ic)

get_matrix_dimensions()

get_row(ir)

get_rows()

scale(f)

set_diagonals(coef)

nullify

print

sort

add_entry(idx: int, col: int, coef: float) → None[source]
Parameters:
  • idx

  • col

  • coef

add_row(idx: int = 0) → MatrixRow[source]
Parameters:

idx

Returns:

add_to_diagonals(val: float) → None[source]
Parameters:

val

count_entries() → int[source]
Returns:

extract_vectors() → Tuple[ndarray, ndarray, ndarray][source]
Returns:

get_coef(ir: int, ic: int) → float | None[source]
Parameters:
  • ir

  • ic

Returns:

get_col(ir: int, ic: int) → int[source]
Parameters:
  • ir

  • ic

Returns:

get_entry(ir: int, ic: int) → MatrixRowEntry | None[source]
Parameters:
  • ir

  • ic

Returns:

get_matrix_dimensions() → Tuple[int, int][source]
Returns:

get_row(ir: int) → MatrixRow | None[source]
Parameters:

ir

Returns:

get_rows() → list[source]
Returns:

nullify() → None[source]
print() → None[source]
scale(f: float) → None[source]
Parameters:

f

set_diagonals(coef: float) → None[source]
Parameters:

coef

property size: int

return:

sort() → None[source]
class g3d.flow.placeholders.PostField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class PostField, extends class FlowDataPlaceHolder: postprocessing variables container

Attributes:
M

Mach number []

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

p0

Total pressure [Pa]

s

Entropy [J/K]

size

Placeholder size

t0

Total temperature [K]

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets postprocessing flow data arrays

get_arrays_with_ghosts()

Gets postprocessing flow data arrays including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_Post(p)

Set array values from provided postprocessing variable object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(p0, t0, M, s)

Set data from provided arrays

set_from_key_value(key, value)

Sets data from key-value pair input

set_from_post_field(p)

Copy data from provided postprocessing variables placeholder object

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(p0, t0, M, s[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

setup(**kwargs)

Sets up container according to specifications

update(cons, auxv, gas[, verbose])

Calculates new flow data values based on provided input and updates placeholder arrays

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

property M: ndarray

Mach number []

Returns:

Mach number array

Return type:

ndarray

get_arrays() → Tuple[ndarray, ...][source]

Gets postprocessing flow data arrays

Returns:

data arrays (p0, t0, M, s)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets postprocessing flow data arrays including ghost cell values

Returns:

data arrays (p0, t0, M, s)

Return type:

tuple

property p0: ndarray

Total pressure [Pa]

Returns:

total pressure array

Return type:

ndarray

property s: ndarray

Entropy [J/K]

Returns:

entropy array

Return type:

ndarray

set_from_Post(p: Post) → None[source]

Set array values from provided postprocessing variable object

Parameters:

p (Post :) – postprocessing variable object

set_from_arrays(p0: ndarray, t0: ndarray, M: ndarray, s: ndarray) → None[source]

Set data from provided arrays

Parameters:
  • p0 (ndarray :) – density data

  • t0 (ndarray :) – x-momentum data

  • M (ndarray :) – y-momentum data

  • s (ndarray :) – z-momentum data

set_from_post_field(p: PostField) → None[source]

Copy data from provided postprocessing variables placeholder object

Parameters:

p (PostField :) – postprocessing variables container

set_values(p0: float | ndarray, t0: float | ndarray, M: float | ndarray, s: float | ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided arrays

Parameters:
  • p0 (float or ndarray :) – total pressure value or array of values

  • t0 (float or ndarray :) – total temperature value or array of values

  • M (float or ndarray :) – Mach number value or array of values

  • s (float or ndarray :) – entropy value or array of values

  • idx (int :) – cell index (Default value = None)

property t0: ndarray

Total temperature [K]

Returns:

total temperature array

Return type:

ndarray

update(cons: ConsField, auxv: AuxvField, gas: Gas, verbose: bool = False) → None[source]

Calculates new flow data values based on provided input and updates placeholder arrays

Parameters:
  • cons (ConsField :) – conservative flow variables

  • auxv (AuxvField :) – primitive flow variables

  • gas (Gas :) – gas model

  • verbose (bool :) – in verbose mode, extreme values will be printed to stdout (Default value = False)

class g3d.flow.placeholders.StaticTurbulenceModelVariables(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class StaticTurbulenceModel, extends class FlowDataPlaceHolder: static turbulence model variables container

Attributes:
first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

class g3d.flow.placeholders.VGradField(*args: Any, **kwargs: Any)[source]

Bases: FlowDataPlaceHolder

Definition of class VGradField, extends class FlowDataPlaceHolder

Attributes:
dudx

Velocity gradient component

dudy

Velocity gradient component

dudz

Velocity gradient component

dvdx

Velocity gradient component

dvdy

Velocity gradient component

dvdz

Velocity gradient component

dwdx

Velocity gradient component

dwdy

Velocity gradient component

dwdz

Velocity gradient component

first

First index

last

Last index

n_cells

Number of cells

n_ghosts

Number of ghost cells

n_var

Number of variables

size

Placeholder size

tag

tag (string) used for identification

variables

Defined container variables

Methods

AXPBY(A, B, Y)

Vector operation a * X + b * Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

AXPY(A, Y)

Vector operation a * X + Y where Y is an instance of FlowDataPlaceholder and X is this placeholder

GetNGhosts()

Gets number of allocated ghost cells

WAXPY(A, X, Y)

Vector operation W = a * X + Y where X and Y are instances of FlowDataPlaceholder and W is this placeholder

add_gradients(u, v, w, fmp[, StartIndex, ...])

Add face contribution to velocity gradient field

allocate_flux_molecule_placeholders([N])

Allocates flux molecule data placeholders

backup()

Copies data to backup arrays

copy(fd)

Copies data from prototype FlowDataPlaceHolder object

copy_values(from_idx, to_idx)

Copies from one array element to another

de_allocate_placeholders()

De allocates placeholders - nullifies all arrays

export(name[, var])

Exports placeholder data to file (binary)

get_SijSij(idx)

Gets strain rate tensor product for specified cell index

get_VGrad(idx)

Gets velocity gradients for specified cell index

get_array([var])

Get array for specified variable string

get_array_with_ghosts([var])

Get array for specified variable string including ghost cell values

get_arrays()

Gets velocity gradient arrays

get_arrays_with_ghosts()

Gets velocity gradient arrays including ghost values

get_divergence(idx)

Extracts the divergence of the velocity field for specified cell index

get_extreme_value_array([value_type])

Gets array with calculated variable extreme values

get_extreme_values([var])

Updates placeholder variables extreme values (min/max)

get_from_backup([reset_bak])

Restores data from backup arrays

get_keys()

Gets defined variable keys

get_max_norm([var])

Updates variable max norm values (max absolute values)

get_max_values([var])

Updates placeholder max values

get_min_values([var])

Updates placeholder min values

get_pointers()

Gets list of array pointers

get_range()

Gets placeholder range (first, last)

get_value(idx[, var])

Get variable value for specified cell index

get_vorticity(idx)

Extracts the vorticity vector for specified cell index

get_vorticity_magnitude(idx)

Calculates the vorticity magnitude for specified cell index

import_data(name[, var])

Imports placeholder data from file (binary)

import_var_data_from_binary(f[, var])

Imports variable data from binary file

initialize([val, var])

Initialize placeholder

is_allocated()

Placeholder allocation status

normalize_extreme_values(norm_values[, ...])

Normalizes extreme values

nullify()

Nullifies all array elements for all defined variables

nullify_by_index(idx)

Nullifies all variables for specified cell index

point_wise_scale(sf)

Element data scaling using provided scaling factor array

print()

prints entity data

print_extreme_value_locations()

Prints extreme values including location to stdout

print_extreme_values([var])

Prints calculated extreme values to stdout

print_extreme_values_by_type([value_type, var])

Prints calculated extreme values by type to stdout

print_flow_data(idx)

Prints stored variable information for specified cell index to stdout

read_from_file(f)

Reads placeholder variable arrays from file (binary format)

scale(idx, sf)

Scales all variable values for specified cell index

set(*args, **kwargs)

sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)

set_from_VGrad(vgrad)

Sets data from prototype VGrad object

set_from_array(from_array[, var])

Set flow data for specified variable from array

set_from_arrays(dudx, dudy, dudz, dvdx, ...)

Sets velocity gradient values from provided arrays

set_from_gradient_field(v)

Sets velocity gradient values from prototype VGradField object

set_from_key_value(key, value)

Sets data from key-value pair input

set_value(idx, val[, var])

Sets variable value for specified cell index

set_values(dd[, idx])

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided array

setup(**kwargs)

Sets up container according to specifications

vector_scale(v)

Scales all variable values for all elements using specified scaling array

write_to_file(f)

Writes placeholder variable arrays to file (binary format)

add_gradients(u: ndarray, v: ndarray, w: ndarray, fmp: FMP, StartIndex: int = 0, n_faces: int = 0, MODE: Any = GradientMode.AVERAGE) → None[source]

Add face contribution to velocity gradient field

Parameters:
  • u (ndarray :) – x-velocity vector

  • v (ndarray :) – y-velocity vector

  • w (ndarray :) – z-velocity vector

  • fmp (FMP :) – flux molecule pointer placeholder

  • StartIndex (int :) – first index (Default value = 0)

  • n_faces (int :) – number of faces (Default value = 0)

  • MODE (GradientMode :) – type of gradient calculation (Default value = GradientMode.AVERAGE)

allocate_flux_molecule_placeholders(N: int = 0) → None[source]

Allocates flux molecule data placeholders

Parameters:

N (int :) – number of faces (Default value = 0)

property dudx: ndarray

Velocity gradient component

Returns:

dudx array

Return type:

ndarray

property dudy: ndarray

Velocity gradient component

Returns:

dudy array

Return type:

ndarray

property dudz: ndarray

Velocity gradient component

Returns:

dudz array

Return type:

ndarray

property dvdx: ndarray

Velocity gradient component

Returns:

dvdx array

Return type:

ndarray

property dvdy: ndarray

Velocity gradient component

Returns:

dvdy array

Return type:

ndarray

property dvdz: ndarray

Velocity gradient component

Returns:

dvdz array

Return type:

ndarray

property dwdx: ndarray

Velocity gradient component

Returns:

dwdx array

Return type:

ndarray

property dwdy: ndarray

Velocity gradient component

Returns:

dwdy array

Return type:

ndarray

property dwdz: ndarray

Velocity gradient component

Returns:

dwdz array

Return type:

ndarray

get_SijSij(idx: int) → float[source]

Gets strain rate tensor product for specified cell index

Parameters:

idx (int :) – cell index

Returns:

SijSij

Return type:

float

get_VGrad(idx: int) → ndarray[source]

Gets velocity gradients for specified cell index

Parameters:

idx (int :) – cell index

get_arrays() → Tuple[ndarray, ...][source]

Gets velocity gradient arrays

Returns:

tuple of ndarray (dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

Return type:

tuple

get_arrays_with_ghosts() → Tuple[ndarray, ...][source]

Gets velocity gradient arrays including ghost values

Returns:

tuple of ndarray (dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz)

Return type:

tuple

get_divergence(idx: int) → float[source]

Extracts the divergence of the velocity field for specified cell index

Parameters:

idx (int :) – cell index

Returns:

divergence of velocity field

Return type:

float

get_vorticity(idx: int) → ndarray[source]

Extracts the vorticity vector for specified cell index

Parameters:

idx (int :) – cell index

Returns:

vorticity vector

Return type:

ndarray

get_vorticity_magnitude(idx: int) → float[source]

Calculates the vorticity magnitude for specified cell index

Parameters:

idx (int :) – cell index

Returns:

vorticity magnitude

Return type:

float

set_from_VGrad(vgrad: VGrad) → None[source]

Sets data from prototype VGrad object

Parameters:

vgrad (VGrad :) – instance of velocity gradient VGrad object

set_from_arrays(dudx: ndarray, dudy: ndarray, dudz: ndarray, dvdx: ndarray, dvdy: ndarray, dvdz: ndarray, dwdx: ndarray, dwdy: ndarray, dwdz: ndarray) → None[source]

Sets velocity gradient values from provided arrays

Parameters:
  • dudx (ndarray :) – dudx array

  • dudy (ndarray :) – dudy array

  • dudz (ndarray :) – dudz array

  • dvdx (ndarray :) – dvdx array

  • dvdy (ndarray :) – dvdy array

  • dvdz (ndarray :) – dvdz array

  • dwdx (ndarray :) – dwdx array

  • dwdy (ndarray :) – dwdy array

  • dwdz (ndarray :) – dwdz array

set_from_gradient_field(v: VGradField) → None[source]

Sets velocity gradient values from prototype VGradField object

Parameters:

v (VGradField :) – prototype VGradField object

set_values(dd: ndarray, idx: int | None = None) → None[source]

Sets array values for all cells or cell with specified cell index to a set of initial values or data from provided array

Parameters:
  • dd (ndarray :) – velocity gradient array (3x3)

  • idx (int :) – cell index (Default value = None)