optframework.dpbe.dpbe_post module
Created on Thu Jul 18 11:11:33 2024
@author: Administrator
- class optframework.dpbe.dpbe_post.DPBEPost(base)[source]
Bases:
object
- calc_x_uni(unit_trans=True)[source]
Calculate unique particle diameters from volume values for a given DPBESolver.
- calc_Qx(x_uni, qx=None, sum_uni=None)[source]
Calculate the cumulative distribution Qx from qx or sum_uni distribution data.
- calc_sum_uni(Qx, sum_total)[source]
Calculate the sum_uni distribution from the Qx cumulative distribution and total sum.
- re_calc_distribution(x_uni, qx=None, Qx=None, sum_uni=None, flag='all')[source]
Recalculate distribution metrics for a given DPBESolver and distribution data.
Can operate on either qx or sum_uni distribution data to calculate Qx, qx, and particle diameters corresponding to specific percentiles (x_10, x_50, x_90).
Parameters
- x_uniarray
Unique particle diameters.
- qxarray, optional
qx distribution data.
- sum_uniarray, optional
sum_uni distribution data.
- flagstr, optional
Specifies which metrics to return. Defaults to ‘all’, can be a comma-separated list of ‘qx’, ‘Qx’, ‘x_10’, ‘x_50’, ‘x_90’.
Returns
- tuple
Selected distribution metrics based on the flag. Can include qx, Qx, x_10, x_50, and x_90 values.
- return_distribution(comp='all', t=0, N=None, flag='all', rel_q=False, q_type='q3')[source]
Returns the particle size distribution (PSD) on a fixed grid.
- This function computes the PSD based on a chosen quantity:
‘q0’: Number-based PSD (weight = N, i.e., V^0 × N)
‘q3’: Volume-based PSD (weight = V * N, i.e., V^1 × N)
‘q6’: Square-volume PSD (weight = V^2 * N)
- The returned values include:
‘x_uni’: Unique particle diameters (in µm)
‘qx’: The density distribution corresponding to the chosen q_type
‘Qx’: Cumulative distribution (0–1)
‘x_10’, ‘x_50’, ‘x_90’: Particle diameters corresponding to 10%, 50%, and 90% cumulative distribution, respectively (in µm)
‘sum_uni’: The cumulative weight at each particle size class (number, volume, or squared-volume)
- Note on unit conversion:
For q3, original volumes (in m³) are converted to µm³ by multiplying by 1e18.
For q6, squared volumes (in m⁶) are converted to µm⁶ by multiplying by 1e36.
For q0, no conversion is necessary.
Parameters
- compstr, optional
Which particles are counted. Currently, only ‘all’ is implemented.
- tint, optional
Time step index to return.
- Narray_like, optional
The particle number distribution. If not provided, the class instance self.N is used.
- flagstr, optional
- Specifies which data to return. Options include:
‘x_uni’: Unique particle diameters
‘qx’: Density distribution (according to q_type)
‘Qx’: Cumulative distribution
‘x_10’: Particle diameter for 10% cumulative distribution
‘x_50’: Particle diameter for 50% cumulative distribution
‘x_90’: Particle diameter for 90% cumulative distribution
‘sum_uni’: Cumulative weight in each particle size class
‘all’: Returns all of the above data.
- rel_qbool, optional
If True, the density distribution qx will be normalized by its maximum value.
- q_typestr, optional
- The type of distribution to compute. Should be one of:
‘q0’ for number-based distribution,
‘q3’ for volume-based distribution,
‘q6’ for square-volume distribution.
The default is ‘q3’.
Returns
A tuple containing the requested arrays. If flag == ‘all’ then the order of return is: (x_uni, qx, Qx, x_10, x_50, x_90, sum_uni) Otherwise, only the items corresponding to the keys specified in flag (comma-separated) are returned.