g3d.flow.geo package
Submodules
g3d.flow.geo.mesh module
Mesh class definition (FVM mesh placeholder)
- class g3d.flow.geo.mesh.Mesh(*args: Any, **kwargs: Any)[source]
Bases:
GridMesh class definition, extends class Grid
- Attributes:
blocks- return:
mtrGrid metrics object
n_blocks- return:
n_cells- return:
n_nodes- return:
nodes- return:
tagtag (string) used for identification
Methods
add_BC(bc, **kwargs)add_Block(ni[, nj, nk])add_IO(io, **kwargs)add_Intf(faceA_def, faceB_def, **kwargs)add_smooth_face(face_def)add_smooth_face_glue(faceA_def, faceB_def)calculate_streamtube_normal(stn, x, y, z, kp, kc)Calculates stream-tube normals (used in quasi-three-dimensional mode)
cell_get_block(kc)cell_get_ijk(kc)check_bounds(kc, ldi, ldj)Check cell face bounds
check_bounds_block_interface(kca, ldia, ...)Checks block interface bounds
check_face_def(f[, face_type])Checks definition of provided face
check_volumes()copy(e)copies data from specified entity input: entity example: copy(e)
copy_Face(faceA_def, faceB_def)copy_X(im_to, l_to, im_from, l_from)copy_XYZ(im_to, l_to, im_from, l_from)copy_Y(im_to, l_to, im_from, l_from)copy_Z(im_to, l_to, im_from, l_from)export(*args, **kwargs)exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE)
export_connections([bcf])extract_face_pointers(f[, face_type])Extracts face pointers for specified mesh face
get_X(im[, lp])get_XYZ(im[, lp])get_Y(im[, lp])get_Z(im[, lp])get_area([idx])Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
Get cell centers for all cells
get_extreme_coordinates()get_inverse_volume([idx])Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
get_mesh_coordinates_from_pipe_data(q1d_pipe)Generates mesh coordinates from provided quasi-one-dimensional pipe object
get_streamtube_normal([idx])Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
get_volume([idx])Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()header(*args, **kwargs)prints a header with specified information input: info optional input: dashes (default='='), scrw (default=80), number of blank lines after dashes n_space (default=1) example: header(info='header info')
hline(*args, **kwargs)prints horizontal line optional input (kwargs): dashes (default='-'), scrw (default=80) example: hline(dashes='*', scrw=90)
import_mesh(*args, **kwargs)imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE), 'msh_file' -> filename, 'topo_file' -> filename
jobname_append(name)extends jobname with the specified string input: name example: jobname_append(name)
node_get_block(kp)node_get_ijk(kp)populate_face_coordinate_placeholders(im, b)print()prints entity data
scale(sf)set(*args, **kwargs)sets code parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(im, X[, lp])set_XYZ(im, X, Y, Z[, lp])set_Y(im, Y[, lp])set_Z(im, Z[, lp])set_from_key_value(key, value)sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'verbose', 'silent/quiet', 'jobname', 'working_directory', 'dimension', 'cuda', 'prof' example: set_from_key_value(key, value)
smooth([N])Updates quasi-one-dimensional metrics
Updates quasi-three-dimensional metrics
Updates metric data - cell volumes and face areas
allocate_arrays
fill
glue_blocks
nullify_boundary_lists
nullify_smooth_faces
plot_edges_XY
plot_edges_XZ
plot_edges_YZ
print_extreme_values
redefine_ghosts
- static calculate_streamtube_normal(stn: ndarray, x: ndarray, y: ndarray, z: ndarray, kp: list, kc: list) None[source]
Calculates stream-tube normals (used in quasi-three-dimensional mode)
- Parameters:
stn (ndarray :) – stream-tube normal array
x (ndarray :) – x-coordinate array
y (ndarray :) – y-coordinate array
z (ndarray :) – z-coordinate array
kp (list :) – node indices (list of ints)
kc (list :) – cell indices (list of ints)
- check_bounds(kc: int, ldi: int, ldj: int) Tuple[int, int, int, int][source]
Check cell face bounds
- Parameters:
kc (int :) – cell index
ldi (int :) – array index increment for one step in local i-direction
ldj (int :) – array index increment for one step in local j-direction
- Returns:
mim, mip, mjm, mjp
- Return type:
tuple
- check_bounds_block_interface(kca: int, ldia: int, ldja: int, kcb: int, ldib: int, ldjb: int) Tuple[int, int, int, int][source]
Checks block interface bounds
- Parameters:
kca (int) – cell index A-side
ldia (int) – index increment for one step in local i-direction (A-side)
ldja (int) – index increment for one step in local j-direction (A-side)
kcb (int) – cell index B-side
ldib (int) – index increment for one step in local i-direction (B-side)
ldjb (int) – index increment for one step in local j-direction (B-side)
- Returns:
mim, mip, mjm, mjp
- Return type:
tuple
- check_face_def(f: Face, face_type: Any = FaceType.A_SIDE) None[source]
Checks definition of provided face
- extract_face_pointers(f: Face, face_type: Any = FaceType.A_SIDE) Tuple[int, ...][source]
Extracts face pointers for specified mesh face
- get_area(idx: int | None = None) ndarray | float[source]
Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
average cell area or array of average cell areas
- Return type:
float or ndarray
- get_cell_centers() Tuple[ndarray, ...][source]
Get cell centers for all cells
- Returns:
cell center coordinate vectors (x, y, z)
- Return type:
tuple
- get_inverse_volume(idx: int | None = None) ndarray | float[source]
Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
inverse cell volume or array of inverse cell volumes
- Return type:
float or ndarray
- get_mesh_coordinates_from_pipe_data(q1d_pipe: Q1DPipe) None[source]
Generates mesh coordinates from provided quasi-one-dimensional pipe object
- Parameters:
q1d_pipe (Q1DPipe :) – instance of quasi-one-dimensional pipe object
- get_streamtube_normal(idx: int | None = None) ndarray | float[source]
Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
stream-tube normal or array of stream-tube normals
- Return type:
float or ndarray
- get_volume(idx: int | None = None) ndarray | float[source]
Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
cell volume or array of cell volumes
- Return type:
float or ndarray
g3d.flow.geo.metrics module
Metrics functions (Metrics class definition)
- class g3d.flow.geo.metrics.Metrics(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntityDefinition of class Metrics: placeholders and functions for grid metrics data
- Attributes:
areaAverage cell area placeholder
streamtube_normalStream-tube normal placeholder
tagtag (string) used for identification
volCell volumes placeholder
voliInverse cell volumes placeholder
Methods
allocate()Allocates metrics data arrays
copy(e)copies data from specified entity input: entity example: copy(e)
get_area([idx])Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
get_inverse_volume([idx])Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
get_streamtube_normal([idx])Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
get_volume([idx])Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
Sets the average cell area to zero for all cells
Sets the inverse cell volume to zero for all cells
Sets the stream-tube normal to (0., 0., 0.) for all cells
Sets the cell volume to zero for all cells
print()prints entity data
Prints min and max values
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_area(idx, val)Sets average cell area array value
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
set_inverse_volume(idx, val)Sets inverse cell volume array value
set_streamtube_normal(idx, x, y, z)Sets stream-tube normal array values (x, y, z)
set_volume(idx, val)Sets cell volume array value
Updates min and max values
- property area: ndarray
Average cell area placeholder
- Returns:
average cell area array
- Return type:
ndarray
- get_area(idx: int | None = None) float | ndarray[source]
Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
- Parameters:
idx (int) – cell index (Default value = None)
- Returns:
average cell area or array of average cell areas
- Return type:
float or ndarray
- get_inverse_volume(idx: int | None = None) float | ndarray[source]
Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
- Parameters:
idx (int) – cell index (Default value = None)
- Returns:
inverse cell volume or array of inverse cell volumes
- Return type:
float or ndarray
- get_streamtube_normal(idx: int | None = None) float | ndarray[source]
Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
- Parameters:
idx (int) – cell index (Default value = None)
- Returns:
stream-tube normal or array of stream-tube normals
- Return type:
float or ndarray
- get_volume(idx: int | None = None) float | ndarray[source]
Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
- Parameters:
idx (int :) – cell index (Default value = None)
- Returns:
cell volume or array of cell volumes
- Return type:
float or ndarray
- set_area(idx: int, val: float) None[source]
Sets average cell area array value
- Parameters:
idx (int) – cell index
val (float) – average cell area
- set_inverse_volume(idx: int, val: float) None[source]
Sets inverse cell volume array value
- Parameters:
idx (int) – cell index
val (float) – inverse cell volume
- set_streamtube_normal(idx: int, x: float, y: float, z: float) None[source]
Sets stream-tube normal array values (x, y, z)
- Parameters:
idx (int) – cell index
x (float) – stream-tube normal (x-component)
y (float) – stream-tube normal (y-component)
z (float) – stream-tube normal (z-component)
- set_volume(idx: int, val: float) None[source]
Sets cell volume array value
- Parameters:
idx (int) – cell index
val (float) – cell volume
- property streamtube_normal: ndarray
Stream-tube normal placeholder
- Returns:
stream-tube normal array
- Return type:
ndarray
- property vol: ndarray
Cell volumes placeholder
- Returns:
cell volume array
- Return type:
ndarray
- property voli: ndarray
Inverse cell volumes placeholder
- Returns:
inverse cell volume array
- Return type:
ndarray
g3d.flow.geo.q1dpipe module
Q1D Pipe placeholder (Q1DPipe class definition)
- class g3d.flow.geo.q1dpipe.Q1DPipe(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntityDefinition of class Q1DPipe: quasi-one-dimensional pipe definition container
- Attributes:
NC1Number of cells in region 1 - from inlet to throat or from inlet to interface
NC2Number of cells in region 2 - from interface/throat to local refinement or outlet
NC3Number of cells in region 3 - from local refinement to outlet
h1Domain inlet spacing (h1)
h2Domain outlet spacing (h2)
hiInterface spacing (hl)
hlLocal refinement spacing (hl)
htThroat spacing (ht)
left_end_BCLeft-end boundary condition
n_cellsTotal number of cells
pipe_typePipe type (‘CONSTANT_AREA_PIPE’, ‘TWO_REGION_PIPE’, ‘CONVERGENT_OR_DIVERGENT_PIPE’,
r1Domain inlet radius (r1)
r2Domain outlet radius (r2)
right_end_BCRight-end boundary condition
rtThroat radius (rt)
tagtag (string) used for identification
x1Domain inlet coordinate (x1)
x2Domain outlet coordinate (x2)
xiInterface coordinate (xi)
xlLocal refinement coordinate (xl)
xtThroat coordinate (xt)
Methods
copy(p)Copies data from prototype Q1DPipe object
Calculate node coordinates based on domain definition
Get arrays (X, R)
print()prints entity data
reset()Resets pipe definition to default condition
Sets all cell counts to zero
Reset array placeholders (x, R, delta)
Resets all spacing parameters (inlet, outlet, throat, interface, local refinement)
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
Set total cell count
set_from_key_value(key, value)Sets data from key-value pair input
Update cell counts from pipe definition
Calculate total domain length
Calculate throat coordinate unless specified (length / 3)
Calculate throat coordinate based on equidistant cells
- property NC1: int
Number of cells in region 1 - from inlet to throat or from inlet to interface
- Returns:
cell count (region 1)
- Return type:
int
- property NC2: int
Number of cells in region 2 - from interface/throat to local refinement or outlet
- Returns:
cell count (region 2)
- Return type:
int
- property NC3: int
Number of cells in region 3 - from local refinement to outlet
- Returns:
cell count (region 3)
- Return type:
int
- copy(p: Q1DPipe) None[source]
Copies data from prototype Q1DPipe object
- Parameters:
p (Q1DPipe :) – prototype quasi-one-dimensional pipe (Q1DPipe) object
- get_arrays() Tuple[ndarray, ndarray][source]
Get arrays (X, R)
- Returns:
axial coordinate (X) and radius (R) arrays
- Return type:
tuple
- property h1: float | int
Domain inlet spacing (h1)
- Returns:
defined inlet spacing value
- Return type:
float
- property h2: float | int
Domain outlet spacing (h2)
- Returns:
defined outlet spacing value
- Return type:
float
- property hi: float | int
Interface spacing (hl)
- Returns:
defined interface spacing value
- Return type:
float
- property hl: float | int
Local refinement spacing (hl)
- Returns:
defined local refinement spacing value
- Return type:
float
- property ht: float | int
Throat spacing (ht)
- Returns:
defined throat spacing value
- Return type:
float
- property left_end_BC: Any
Left-end boundary condition
- Returns:
defined left-end boundary condition
- Return type:
- property n_cells: int
Total number of cells
- Returns:
total cell count
- Return type:
int
- property pipe_type: Any
Pipe type (‘CONSTANT_AREA_PIPE’, ‘TWO_REGION_PIPE’, ‘CONVERGENT_OR_DIVERGENT_PIPE’, ‘CONVERGENT_DIVERGENT_PIPE’)
- Returns:
defined pipe type
- Return type:
- property r1: float
Domain inlet radius (r1)
- Returns:
defined inlet radius value
- Return type:
float
- property r2: float
Domain outlet radius (r2)
- Returns:
defined outlet radius value
- Return type:
float
- reset_spacing() None[source]
Resets all spacing parameters (inlet, outlet, throat, interface, local refinement)
- property right_end_BC: Any
Right-end boundary condition
- Returns:
defined right-end boundary condition
- Return type:
- property rt: float
Throat radius (rt)
- Returns:
defined throat radius value
- Return type:
float
- set_from_key_value(key: str, value: Any) bool[source]
Sets data from key-value pair input
- Parameters:
key (str :) – keyword
value (Any :) – value corresponding to keyword
- Returns:
status - True if key is found in list of valid keywords
- Return type:
bool
- update_throat_coordinate_uniform() None[source]
Calculate throat coordinate based on equidistant cells
- property x1: float
Domain inlet coordinate (x1)
- Returns:
defined inlet coordinate value
- Return type:
float
- property x2: float
Domain outlet coordinate (x2)
- Returns:
defined outlet coordinate value
- Return type:
float
- property xi: float
Interface coordinate (xi)
- Returns:
defined interface coordinate value
- Return type:
float
- property xl: float
Local refinement coordinate (xl)
- Returns:
defined local refinement coordinate value
- Return type:
float
- property xt: float
Throat coordinate (xt)
- Returns:
defined throat coordinate value
- Return type:
float
Module contents
g3d/flow/geo sub library
- class g3d.flow.geo.Mesh(*args: Any, **kwargs: Any)[source]
Bases:
GridMesh class definition, extends class Grid
- Attributes:
blocks- return:
mtrGrid metrics object
n_blocks- return:
n_cells- return:
n_nodes- return:
nodes- return:
tagtag (string) used for identification
Methods
add_BC(bc, **kwargs)add_Block(ni[, nj, nk])add_IO(io, **kwargs)add_Intf(faceA_def, faceB_def, **kwargs)add_smooth_face(face_def)add_smooth_face_glue(faceA_def, faceB_def)calculate_streamtube_normal(stn, x, y, z, kp, kc)Calculates stream-tube normals (used in quasi-three-dimensional mode)
cell_get_block(kc)cell_get_ijk(kc)check_bounds(kc, ldi, ldj)Check cell face bounds
check_bounds_block_interface(kca, ldia, ...)Checks block interface bounds
check_face_def(f[, face_type])Checks definition of provided face
check_volumes()copy(e)copies data from specified entity input: entity example: copy(e)
copy_Face(faceA_def, faceB_def)copy_X(im_to, l_to, im_from, l_from)copy_XYZ(im_to, l_to, im_from, l_from)copy_Y(im_to, l_to, im_from, l_from)copy_Z(im_to, l_to, im_from, l_from)export(*args, **kwargs)exports mesh to file :param args: arguments (BinaryFormat), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE)
export_connections([bcf])extract_face_pointers(f[, face_type])Extracts face pointers for specified mesh face
get_X(im[, lp])get_XYZ(im[, lp])get_Y(im[, lp])get_Z(im[, lp])get_area([idx])Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
Get cell centers for all cells
get_extreme_coordinates()get_inverse_volume([idx])Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
get_mesh_coordinates_from_pipe_data(q1d_pipe)Generates mesh coordinates from provided quasi-one-dimensional pipe object
get_streamtube_normal([idx])Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
get_volume([idx])Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
get_x_min_x_max()get_y_min_y_max()get_z_min_z_max()header(*args, **kwargs)prints a header with specified information input: info optional input: dashes (default='='), scrw (default=80), number of blank lines after dashes n_space (default=1) example: header(info='header info')
hline(*args, **kwargs)prints horizontal line optional input (kwargs): dashes (default='-'), scrw (default=80) example: hline(dashes='*', scrw=90)
import_mesh(*args, **kwargs)imports mesh from file :param args: arguments (BinaryFormat, file base name (str)), optional :param kwargs: keyword value pairs, optional valid key values: 'format' binary_format (defaults to BinaryFormat.NATIVE), 'msh_file' -> filename, 'topo_file' -> filename
jobname_append(name)extends jobname with the specified string input: name example: jobname_append(name)
node_get_block(kp)node_get_ijk(kp)populate_face_coordinate_placeholders(im, b)print()prints entity data
scale(sf)set(*args, **kwargs)sets code parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_X(im, X[, lp])set_XYZ(im, X, Y, Z[, lp])set_Y(im, Y[, lp])set_Z(im, Z[, lp])set_from_key_value(key, value)sets code parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'verbose', 'silent/quiet', 'jobname', 'working_directory', 'dimension', 'cuda', 'prof' example: set_from_key_value(key, value)
smooth([N])Updates quasi-one-dimensional metrics
Updates quasi-three-dimensional metrics
Updates metric data - cell volumes and face areas
allocate_arrays
fill
glue_blocks
nullify_boundary_lists
nullify_smooth_faces
plot_edges_XY
plot_edges_XZ
plot_edges_YZ
print_extreme_values
redefine_ghosts
- static calculate_streamtube_normal(stn: ndarray, x: ndarray, y: ndarray, z: ndarray, kp: list, kc: list) None[source]
Calculates stream-tube normals (used in quasi-three-dimensional mode)
- Parameters:
stn (ndarray :) – stream-tube normal array
x (ndarray :) – x-coordinate array
y (ndarray :) – y-coordinate array
z (ndarray :) – z-coordinate array
kp (list :) – node indices (list of ints)
kc (list :) – cell indices (list of ints)
- check_bounds(kc: int, ldi: int, ldj: int) Tuple[int, int, int, int][source]
Check cell face bounds
- Parameters:
kc (int :) – cell index
ldi (int :) – array index increment for one step in local i-direction
ldj (int :) – array index increment for one step in local j-direction
- Returns:
mim, mip, mjm, mjp
- Return type:
tuple
- check_bounds_block_interface(kca: int, ldia: int, ldja: int, kcb: int, ldib: int, ldjb: int) Tuple[int, int, int, int][source]
Checks block interface bounds
- Parameters:
kca (int) – cell index A-side
ldia (int) – index increment for one step in local i-direction (A-side)
ldja (int) – index increment for one step in local j-direction (A-side)
kcb (int) – cell index B-side
ldib (int) – index increment for one step in local i-direction (B-side)
ldjb (int) – index increment for one step in local j-direction (B-side)
- Returns:
mim, mip, mjm, mjp
- Return type:
tuple
- check_face_def(f: Face, face_type: Any = FaceType.A_SIDE) None[source]
Checks definition of provided face
- extract_face_pointers(f: Face, face_type: Any = FaceType.A_SIDE) Tuple[int, ...][source]
Extracts face pointers for specified mesh face
- get_area(idx: int | None = None) ndarray | float[source]
Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
average cell area or array of average cell areas
- Return type:
float or ndarray
- get_cell_centers() Tuple[ndarray, ...][source]
Get cell centers for all cells
- Returns:
cell center coordinate vectors (x, y, z)
- Return type:
tuple
- get_inverse_volume(idx: int | None = None) ndarray | float[source]
Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
inverse cell volume or array of inverse cell volumes
- Return type:
float or ndarray
- get_mesh_coordinates_from_pipe_data(q1d_pipe: Q1DPipe) None[source]
Generates mesh coordinates from provided quasi-one-dimensional pipe object
- Parameters:
q1d_pipe (Q1DPipe :) – instance of quasi-one-dimensional pipe object
- get_streamtube_normal(idx: int | None = None) ndarray | float[source]
Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
stream-tube normal or array of stream-tube normals
- Return type:
float or ndarray
- get_volume(idx: int | None = None) ndarray | float[source]
Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
- Parameters:
idx (int :) – cell index, optional (Default value = None)
- Returns:
cell volume or array of cell volumes
- Return type:
float or ndarray
- class g3d.flow.geo.Metrics(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntityDefinition of class Metrics: placeholders and functions for grid metrics data
- Attributes:
areaAverage cell area placeholder
streamtube_normalStream-tube normal placeholder
tagtag (string) used for identification
volCell volumes placeholder
voliInverse cell volumes placeholder
Methods
allocate()Allocates metrics data arrays
copy(e)copies data from specified entity input: entity example: copy(e)
get_area([idx])Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
get_inverse_volume([idx])Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
get_streamtube_normal([idx])Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
get_volume([idx])Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
Sets the average cell area to zero for all cells
Sets the inverse cell volume to zero for all cells
Sets the stream-tube normal to (0., 0., 0.) for all cells
Sets the cell volume to zero for all cells
print()prints entity data
Prints min and max values
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
set_area(idx, val)Sets average cell area array value
set_from_key_value(key, value)sets entity parameters from specified key => value data input: key, value valid keys for G3DCode base class: 'tag' example: set_from_key_value(key, value)
set_inverse_volume(idx, val)Sets inverse cell volume array value
set_streamtube_normal(idx, x, y, z)Sets stream-tube normal array values (x, y, z)
set_volume(idx, val)Sets cell volume array value
Updates min and max values
- property area: ndarray
Average cell area placeholder
- Returns:
average cell area array
- Return type:
ndarray
- get_area(idx: int | None = None) float | ndarray[source]
Gets average area for specific cell if cell index is specified otherwise all average cell areas are returned as an array
- Parameters:
idx (int) – cell index (Default value = None)
- Returns:
average cell area or array of average cell areas
- Return type:
float or ndarray
- get_inverse_volume(idx: int | None = None) float | ndarray[source]
Gets inverse volume for specific cell if cell index is specified otherwise all cell inverse volumes are returned as an array
- Parameters:
idx (int) – cell index (Default value = None)
- Returns:
inverse cell volume or array of inverse cell volumes
- Return type:
float or ndarray
- get_streamtube_normal(idx: int | None = None) float | ndarray[source]
Gets stream-tube normal for specific cell if cell index is specified otherwise all stream-tube normals are returned as an array
- Parameters:
idx (int) – cell index (Default value = None)
- Returns:
stream-tube normal or array of stream-tube normals
- Return type:
float or ndarray
- get_volume(idx: int | None = None) float | ndarray[source]
Gets volume for specific cell if cell index is specified otherwise all cell volumes are returned as an array
- Parameters:
idx (int :) – cell index (Default value = None)
- Returns:
cell volume or array of cell volumes
- Return type:
float or ndarray
- set_area(idx: int, val: float) None[source]
Sets average cell area array value
- Parameters:
idx (int) – cell index
val (float) – average cell area
- set_inverse_volume(idx: int, val: float) None[source]
Sets inverse cell volume array value
- Parameters:
idx (int) – cell index
val (float) – inverse cell volume
- set_streamtube_normal(idx: int, x: float, y: float, z: float) None[source]
Sets stream-tube normal array values (x, y, z)
- Parameters:
idx (int) – cell index
x (float) – stream-tube normal (x-component)
y (float) – stream-tube normal (y-component)
z (float) – stream-tube normal (z-component)
- set_volume(idx: int, val: float) None[source]
Sets cell volume array value
- Parameters:
idx (int) – cell index
val (float) – cell volume
- property streamtube_normal: ndarray
Stream-tube normal placeholder
- Returns:
stream-tube normal array
- Return type:
ndarray
- property vol: ndarray
Cell volumes placeholder
- Returns:
cell volume array
- Return type:
ndarray
- property voli: ndarray
Inverse cell volumes placeholder
- Returns:
inverse cell volume array
- Return type:
ndarray
- class g3d.flow.geo.Q1DPipe(*args: Any, **kwargs: Any)[source]
Bases:
G3DEntityDefinition of class Q1DPipe: quasi-one-dimensional pipe definition container
- Attributes:
NC1Number of cells in region 1 - from inlet to throat or from inlet to interface
NC2Number of cells in region 2 - from interface/throat to local refinement or outlet
NC3Number of cells in region 3 - from local refinement to outlet
h1Domain inlet spacing (h1)
h2Domain outlet spacing (h2)
hiInterface spacing (hl)
hlLocal refinement spacing (hl)
htThroat spacing (ht)
left_end_BCLeft-end boundary condition
n_cellsTotal number of cells
pipe_typePipe type (‘CONSTANT_AREA_PIPE’, ‘TWO_REGION_PIPE’, ‘CONVERGENT_OR_DIVERGENT_PIPE’,
r1Domain inlet radius (r1)
r2Domain outlet radius (r2)
right_end_BCRight-end boundary condition
rtThroat radius (rt)
tagtag (string) used for identification
x1Domain inlet coordinate (x1)
x2Domain outlet coordinate (x2)
xiInterface coordinate (xi)
xlLocal refinement coordinate (xl)
xtThroat coordinate (xt)
Methods
copy(p)Copies data from prototype Q1DPipe object
Calculate node coordinates based on domain definition
Get arrays (X, R)
print()prints entity data
reset()Resets pipe definition to default condition
Sets all cell counts to zero
Reset array placeholders (x, R, delta)
Resets all spacing parameters (inlet, outlet, throat, interface, local refinement)
set(*args, **kwargs)sets entity parameters according to specifications input: args, kwargs example: set(args, kwargs)
Set total cell count
set_from_key_value(key, value)Sets data from key-value pair input
Update cell counts from pipe definition
Calculate total domain length
Calculate throat coordinate unless specified (length / 3)
Calculate throat coordinate based on equidistant cells
- property NC1: int
Number of cells in region 1 - from inlet to throat or from inlet to interface
- Returns:
cell count (region 1)
- Return type:
int
- property NC2: int
Number of cells in region 2 - from interface/throat to local refinement or outlet
- Returns:
cell count (region 2)
- Return type:
int
- property NC3: int
Number of cells in region 3 - from local refinement to outlet
- Returns:
cell count (region 3)
- Return type:
int
- copy(p: Q1DPipe) None[source]
Copies data from prototype Q1DPipe object
- Parameters:
p (Q1DPipe :) – prototype quasi-one-dimensional pipe (Q1DPipe) object
- get_arrays() Tuple[ndarray, ndarray][source]
Get arrays (X, R)
- Returns:
axial coordinate (X) and radius (R) arrays
- Return type:
tuple
- property h1: float | int
Domain inlet spacing (h1)
- Returns:
defined inlet spacing value
- Return type:
float
- property h2: float | int
Domain outlet spacing (h2)
- Returns:
defined outlet spacing value
- Return type:
float
- property hi: float | int
Interface spacing (hl)
- Returns:
defined interface spacing value
- Return type:
float
- property hl: float | int
Local refinement spacing (hl)
- Returns:
defined local refinement spacing value
- Return type:
float
- property ht: float | int
Throat spacing (ht)
- Returns:
defined throat spacing value
- Return type:
float
- property left_end_BC: Any
Left-end boundary condition
- Returns:
defined left-end boundary condition
- Return type:
- property n_cells: int
Total number of cells
- Returns:
total cell count
- Return type:
int
- property pipe_type: Any
Pipe type (‘CONSTANT_AREA_PIPE’, ‘TWO_REGION_PIPE’, ‘CONVERGENT_OR_DIVERGENT_PIPE’, ‘CONVERGENT_DIVERGENT_PIPE’)
- Returns:
defined pipe type
- Return type:
- property r1: float
Domain inlet radius (r1)
- Returns:
defined inlet radius value
- Return type:
float
- property r2: float
Domain outlet radius (r2)
- Returns:
defined outlet radius value
- Return type:
float
- reset_spacing() None[source]
Resets all spacing parameters (inlet, outlet, throat, interface, local refinement)
- property right_end_BC: Any
Right-end boundary condition
- Returns:
defined right-end boundary condition
- Return type:
- property rt: float
Throat radius (rt)
- Returns:
defined throat radius value
- Return type:
float
- set_from_key_value(key: str, value: Any) bool[source]
Sets data from key-value pair input
- Parameters:
key (str :) – keyword
value (Any :) – value corresponding to keyword
- Returns:
status - True if key is found in list of valid keywords
- Return type:
bool
- update_throat_coordinate_uniform() None[source]
Calculate throat coordinate based on equidistant cells
- property x1: float
Domain inlet coordinate (x1)
- Returns:
defined inlet coordinate value
- Return type:
float
- property x2: float
Domain outlet coordinate (x2)
- Returns:
defined outlet coordinate value
- Return type:
float
- property xi: float
Interface coordinate (xi)
- Returns:
defined interface coordinate value
- Return type:
float
- property xl: float
Local refinement coordinate (xl)
- Returns:
defined local refinement coordinate value
- Return type:
float
- property xt: float
Throat coordinate (xt)
- Returns:
defined throat coordinate value
- Return type:
float