optframework.utils.func.jit_pbm_rhs module

optframework.utils.func.jit_pbm_rhs.filter_negative_nodes(xi, wi, threshold=1e-07)[source]

Filter out negative nodes with small weights or raise an error if negative nodes have significant weights.

Parameters:

xi (array-like): Array of nodes (abscissas). wi (array-like): Array of weights corresponding to the nodes. threshold (float): Weight threshold below which negative nodes can be removed.

Returns:

tuple: Filtered (xi, wi) arrays with negative nodes removed if their weights are below threshold.

Raises:

ValueError: If a negative node has a weight exceeding the threshold.

optframework.utils.func.jit_pbm_rhs.hyqmom_newton_correction(xi, wi, moments, method='lm')[source]

Correct QMOM abscissas and weights through Newton iteration to satisfy moment equations, particularly addressing negative abscissas.

Parameters:

xi (array-like): Quadrature abscissas (may contain negative values). wi (array-like): Quadrature weights. moments (array-like): Target moments [M0, M1, M2, …]. method (str): Optimization method for least squares solver.

Returns:

tuple: Corrected (xi, wi) arrays that better satisfy the moment equations.

optframework.utils.func.jit_pbm_rhs.get_dMdt_1d(t, moments, x_max, GQMOM, GQMOM_method, moments_norm_factor, n_add, nu, COLEVAL, CORR_BETA, G, alpha_prim, SIZEEVAL, V_unit, X_SEL, Y_SEL, pl_P1, pl_P2, BREAKRVAL, v, q, BREAKFVAL, type_flag)

Calculate the moment derivatives for 1D population balance equations, handling agglomeration and/or breakage processes.

Parameters:

t (float): Current time. moments (array): Current moments. x_max (float): Maximum coordinate value for scaling. GQMOM (bool): Flag to use Generalized QMOM instead of standard QMOM. GQMOM_method (str): Method for GQMOM calculations (“gaussian”). moments_norm_factor (array): Normalization factors for moments. n_add (int): Number of additional nodes for GQMOM. nu (float): Exponent for the correction in gaussian-GQMOM. COLEVAL (int): Case for collision kernel calculation. CORR_BETA (float): Correction term for collision frequency. G (float): Shear rate [1/s]. alpha_prim (float): Primary particle interaction parameter. SIZEEVAL (int): Case for size dependency. V_unit (float): Unit volume used for concentration calculations. X_SEL (float): Size dependency parameter. Y_SEL (float): Size dependency parameter. pl_P1 (float): First parameter in power law for breakage rate. pl_P2 (float): Second parameter in power law for breakage rate. BREAKRVAL (int): Breakage rate model selector. v (float): Number of fragments in product function of power law. q (float): Parameter describing the breakage type in product function. BREAKFVAL (int): Breakage fragment distribution model selector. type_flag (str): Process type: “agglomeration”, “breakage”, or “mix”.

Returns:

array: (Normalized) moment derivatives (dM/dt).

Raises:

ValueError: If moments are not realizable.

optframework.utils.func.jit_pbm_rhs.get_dMdt_2d(t, moments, n, indices, COLEVAL, CORR_BETA, G, alpha_prim, SIZEEVAL, V_unit, X_SEL, Y_SEL, pl_P1, pl_P2, pl_P3, pl_P4, BREAKRVAL, v, q, BREAKFVAL, type_flag)

Calculate the moment derivatives for 2D population balance equations, handling agglomeration and/or breakage processes with bivariate distributions.

Parameters:

t (float): Current time. moments (array): Current moments of the bivariate distribution. n (int): Number of quadrature nodes per dimension. indices (array): 2D array of moment indices (i,j) corresponding to moments. COLEVAL (int): Case for collision kernel calculation. CORR_BETA (float): Correction term for collision frequency. G (float): Shear rate [1/s]. alpha_prim (array): Primary particle interaction parameters array. SIZEEVAL (int): Case for size dependency. V_unit (float): Unit volume used for concentration calculations. X_SEL (float): Size dependency parameter. Y_SEL (float): Size dependency parameter. pl_P1 (float): First parameter in power law for breakage rate. pl_P2 (float): Second parameter in power law for breakage rate. pl_P3 (float): Third parameter in power law for breakage rate. pl_P4 (float): Fourth parameter in power law for breakage rate. BREAKRVAL (int): Breakage rate model selector. v (float): Number of fragments in product function of power law. q (float): Parameter describing the breakage type in product function. BREAKFVAL (int): Breakage fragment distribution model selector. type_flag (str): Process type: “agglomeration”, “breakage”, or “mix”.

Returns:

array: Moment derivatives (dM/dt).

Raises:

ValueError: If moments are not realizable.