g3d.flow.operators package

Submodules

g3d.flow.operators.irsm module

Implicit Residual Smoothing (IRSM)

class g3d.flow.operators.irsm.IRSMOperator(*args: Any, **kwargs: Any)[source]

Bases: G3DMatrixOperator

Definition of class IRSMOperator, extends G3DMatrixOperator: Implicit Residual SMoothing (IRSM)

Attributes:
A

Operator system coefficient matrix A (Ax=b)

nc

Number of matrix columns

nr

Number of matrix rows

populated

Matrix definition state

tag

tag (string) used for identification

Methods

copy(e)

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

nullify()

Resets operator settings to default

populate_sparse_matrix(rows, cols, coefs[, ...])

Populates coefficient matrix A (Ax=b)

print([print_matrix])

Prints operator data

set(*args, **kwargs)

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

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)

smooth(b)

Applies smoothing to specified array

solve(b[, perm_c_spec, use_umfpack])

Solve Ax=b for x

nullify() → None[source]

Resets operator settings to default

smooth(b: ndarray) → None[source]

Applies smoothing to specified array

Parameters:

b (ndarray :) – data array (right-hand side vector Ax=b)

g3d.flow.operators.operator module

G3DOperator class definition (base class for operators)

class g3d.flow.operators.operator.G3DMatrixOperator(*args: Any, **kwargs: Any)[source]

Bases: G3DOperator

Definition of class G3DMatrixOperator, extends class G3DOperator: matrix operator base class

Attributes:
A

Operator system coefficient matrix A (Ax=b)

nc

Number of matrix columns

nr

Number of matrix rows

populated

Matrix definition state

tag

tag (string) used for identification

Methods

copy(e)

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

nullify()

Resets matrix operator to its default state

populate_sparse_matrix(rows, cols, coefs[, ...])

Populates coefficient matrix A (Ax=b)

print([print_matrix])

Prints operator data

set(*args, **kwargs)

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

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)

solve(b[, perm_c_spec, use_umfpack])

Solve Ax=b for x

property A: Any

Operator system coefficient matrix A (Ax=b)

Returns:

coefficient matrix A (Ax=b)

Return type:

csr_array

property nc: int

Number of matrix columns

Returns:

matrix column count

Return type:

int

property nr: int

Number of matrix rows

Returns:

matrix row count

Return type:

int

nullify() → None[source]

Resets matrix operator to its default state

populate_sparse_matrix(rows: ndarray, cols: ndarray, coefs: ndarray, nr: int | None = None, nc: int | None = None) → None[source]

Populates coefficient matrix A (Ax=b)

Parameters:
  • rows (ndarray :) – matrix row indices

  • cols (ndarray :) – matrix column indices

  • coefs (ndarray :) – matrix coefficients

  • nr (int :) – number of rows (Default value = None)

  • nc (int :) – number of columns (Default value = None)

property populated: bool

Matrix definition state

Returns:

populated status

Return type:

bool

print(print_matrix: bool = False) → None[source]

Prints operator data

Parameters:

print_matrix (bool :) – print operator coefficient matrix (Default value = False)

solve(b: ndarray, perm_c_spec: Any | None = None, use_umfpack: bool = True) → ndarray[source]

Solve Ax=b for x

Parameters:
  • b (ndarray :) – right-hand side vector

  • perm_c_spec (Any :) – param use_umfpack: parameter forwarded to scipy linear matrix solver spsolve parameter forwarded to scipy linear matrix solver spsolve how to permute the columns of the matrix for sparsity preservation. (Default value = None, which implies ‘COLAMD’)

  • use_umfpack (bool :) – parameter forwarded to scipy linear matrix solver spsolve (Default value = True)

Returns:

vector x

Return type:

ndarray

class g3d.flow.operators.operator.G3DOperator(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Definition of class G3DOperator: operator base class

Attributes:
tag

tag (string) used for identification

Methods

copy(e)

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

nullify()

Resets operator to default state

print()

prints entity data

set(*args, **kwargs)

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

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)

nullify() → None[source]

Resets operator to default state

print() → None[source]

prints entity data

Module contents

g3d/flow/operators sub library

class g3d.flow.operators.G3DMatrixOperator(*args: Any, **kwargs: Any)[source]

Bases: G3DOperator

Definition of class G3DMatrixOperator, extends class G3DOperator: matrix operator base class

Attributes:
A

Operator system coefficient matrix A (Ax=b)

nc

Number of matrix columns

nr

Number of matrix rows

populated

Matrix definition state

tag

tag (string) used for identification

Methods

copy(e)

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

nullify()

Resets matrix operator to its default state

populate_sparse_matrix(rows, cols, coefs[, ...])

Populates coefficient matrix A (Ax=b)

print([print_matrix])

Prints operator data

set(*args, **kwargs)

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

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)

solve(b[, perm_c_spec, use_umfpack])

Solve Ax=b for x

property A: Any

Operator system coefficient matrix A (Ax=b)

Returns:

coefficient matrix A (Ax=b)

Return type:

csr_array

property nc: int

Number of matrix columns

Returns:

matrix column count

Return type:

int

property nr: int

Number of matrix rows

Returns:

matrix row count

Return type:

int

nullify() → None[source]

Resets matrix operator to its default state

populate_sparse_matrix(rows: ndarray, cols: ndarray, coefs: ndarray, nr: int | None = None, nc: int | None = None) → None[source]

Populates coefficient matrix A (Ax=b)

Parameters:
  • rows (ndarray :) – matrix row indices

  • cols (ndarray :) – matrix column indices

  • coefs (ndarray :) – matrix coefficients

  • nr (int :) – number of rows (Default value = None)

  • nc (int :) – number of columns (Default value = None)

property populated: bool

Matrix definition state

Returns:

populated status

Return type:

bool

print(print_matrix: bool = False) → None[source]

Prints operator data

Parameters:

print_matrix (bool :) – print operator coefficient matrix (Default value = False)

solve(b: ndarray, perm_c_spec: Any | None = None, use_umfpack: bool = True) → ndarray[source]

Solve Ax=b for x

Parameters:
  • b (ndarray :) – right-hand side vector

  • perm_c_spec (Any :) – param use_umfpack: parameter forwarded to scipy linear matrix solver spsolve parameter forwarded to scipy linear matrix solver spsolve how to permute the columns of the matrix for sparsity preservation. (Default value = None, which implies ‘COLAMD’)

  • use_umfpack (bool :) – parameter forwarded to scipy linear matrix solver spsolve (Default value = True)

Returns:

vector x

Return type:

ndarray

class g3d.flow.operators.G3DOperator(*args: Any, **kwargs: Any)[source]

Bases: G3DEntity

Definition of class G3DOperator: operator base class

Attributes:
tag

tag (string) used for identification

Methods

copy(e)

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

nullify()

Resets operator to default state

print()

prints entity data

set(*args, **kwargs)

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

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)

nullify() → None[source]

Resets operator to default state

print() → None[source]

prints entity data

class g3d.flow.operators.IRSMOperator(*args: Any, **kwargs: Any)[source]

Bases: G3DMatrixOperator

Definition of class IRSMOperator, extends G3DMatrixOperator: Implicit Residual SMoothing (IRSM)

Attributes:
A

Operator system coefficient matrix A (Ax=b)

nc

Number of matrix columns

nr

Number of matrix rows

populated

Matrix definition state

tag

tag (string) used for identification

Methods

copy(e)

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

nullify()

Resets operator settings to default

populate_sparse_matrix(rows, cols, coefs[, ...])

Populates coefficient matrix A (Ax=b)

print([print_matrix])

Prints operator data

set(*args, **kwargs)

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

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)

smooth(b)

Applies smoothing to specified array

solve(b[, perm_c_spec, use_umfpack])

Solve Ax=b for x

nullify() → None[source]

Resets operator settings to default

smooth(b: ndarray) → None[source]

Applies smoothing to specified array

Parameters:

b (ndarray :) – data array (right-hand side vector Ax=b)