예제 #1
0
 def test_cones_and_cylinders(self):
     L_actual = mods.cones_and_cylinders(self.geo)
     L_desired = np.array([[0.25, 0.3, 0.45], [0.45, 0.2, 0.35]])
     assert_allclose(L_actual, L_desired)
     # Overlapping pores
     self.geo["pore.diameter"][0] = 1.2
     L_actual = mods.cones_and_cylinders(self.geo)
     L_desired = np.array([[5.7875e-01, 1.0000e-15, 4.2125e-01],
                           [4.5000e-01, 2.0000e-01, 3.5000e-01]])
     assert_allclose(L_actual, L_desired)
     self.geo["pore.diameter"][0] = 0.5
예제 #2
0
def cones_and_cylinders(
    target,
    pore_diameter='pore.diameter',
    throat_diameter='throat.diameter'
):
    r"""
    Finds throat length assuming pores are cones and throats are
    cylinders.

    Parameters
    ----------
    target : GenericGeometry
        Geometry object which this model is associated with. This controls the
        length of the calculated array, and also provides access to other
        necessary properties.
    pore_diameter : str
        Dictionary key of the pore diameter values.
    throat_diameter : str
        Dictionary key of the throat diameter values.

    Returns
    -------
    ndarray
        Array containing throat length values.

    """
    from openpnm.models.geometry import conduit_lengths
    out = conduit_lengths.cones_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter
    )
    return out[:, 1]
예제 #3
0
def trapezoids_and_rectangles(
    target,
    pore_diameter="pore.diameter",
    throat_diameter="throat.diameter",
):
    r"""
    Computes hydraulic size factors for conduits assuming pores are
    trapezoids and throats are rectangles.

    Parameters
    ----------
    target : GenericGeometry
        The object which this model is associated with. This controls the
        length of the calculated array, and also provides access to other
        necessary properties.
    pore_diameter : str
        Dictionary key of the pore diameter values.
    throat_diameter : str
        Dictionary key of the throat diameter values.

    Returns
    -------
    dict
        Dictionary containing conduit size factors. Size factors are
        accessible via the keys: 'pore1', 'throat', and 'pore2'.

    Notes
    -----
    The hydraulic size factor is the geometrical part of the pre-factor in
    Stoke's flow:

    .. math::

        Q = \frac{A^2}{8 \pi \mu L} \Delta P
          = \frac{S_{hydraulic}}{\mu} \Delta P

    Thus :math:`S_{hydraulic}` represents the combined effect of the area
    and length of the *conduit*, which consists of a throat and 1/2 of the
    pores on each end.

    This model should only be used for true 2D networks, i.e. with planar
    symmetry.

    """
    D1, Dt, D2 = _get_conduit_diameters(target, pore_diameter, throat_diameter)
    L1, Lt, L2 = _conduit_lengths.cones_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T

    # Fi is the integral of (1/A^3) dx, x = [0, Li]
    F1 = L1 / 2 * (D1 + Dt) / (D1 * Dt)**2
    F2 = L2 / 2 * (D2 + Dt) / (D2 * Dt)**2
    Ft = Lt / Dt**3

    # S is 1 / (12 * F)
    S1, St, S2 = [1 / (Fi * 12) for Fi in [F1, Ft, F2]]

    return {"pore1": S1, "throat": St, "pore2": S2}
예제 #4
0
def cones_and_cylinders(
    target,
    pore_diameter="pore.diameter",
    throat_diameter="throat.diameter",
):
    r"""
    Computes diffusive shape coefficient assuming pores are truncated cones
    and throats are cylinders.

    Parameters
    ----------
    target : GenericGeometry
        Geometry object which this model is associated with. This controls
        the length of the calculated array, and also provides access to
        other necessary properties.
    pore_diameter : str
        Dictionary key of the pore diameter values.
    throat_diameter : str
        Dictionary key of the throat diameter values.

    Returns
    -------
    A dictionary containing the diffusive_shape_coefficient, which can be
    accessed via the dict keys 'pore1', 'pore2', and 'throat'.

    Notes
    -----
    The diffusive size factor is the geometrical part of the pre-factor in
    Fick's law:

    .. math::

        n_A = \frac{A}{L} \Delta C_A
            = S_{diffusive} D_{AB} \Delta C_A

    Thus :math:`S_{diffusive}` represents the combined effect of the area and
    length of the *conduit*, which consists of a throat and 1/2 of the pore
    on each end.

    """
    D1, Dt, D2 = _get_conduit_diameters(target, pore_diameter, throat_diameter)
    L1, Lt, L2 = _conduit_lengths.cones_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T

    # Fi is the integral of (1/A) dx, x = [0, Li]
    F1 = 4 * L1 / (D1 * Dt * _np.pi)
    F2 = 4 * L2 / (D2 * Dt * _np.pi)
    Ft = Lt / (_np.pi * Dt**2 / 4)

    return {"pore1": 1 / F1, "throat": 1 / Ft, "pore2": 1 / F2}
예제 #5
0
def cones_and_cylinders(
    target,
    pore_diameter="pore.diameter",
    throat_diameter="throat.diameter",
):
    r"""
    Computes hydraulic size factors for conduits assuming pores are
    truncated cones and throats are cylinders.

    Parameters
    ----------
    target : GenericGeometry
        The object which this model is associated with. This controls the
        length of the calculated array, and also provides access to other
        necessary properties.
    pore_diameter : str
        Dictionary key of the pore diameter values.
    throat_diameter : str
        Dictionary key of the throat diameter values.

    Returns
    -------
    dict
        Dictionary containing conduit size factors. Size factors are
        accessible via the keys: 'pore1', 'throat', and 'pore2'.

    Notes
    -----
    The hydraulic size factor is the geometrical part of the pre-factor in
    Stoke's flow:

    .. math::

        Q = \frac{A^2}{8 \pi \mu L} \Delta P
          = \frac{S_{hydraulic}}{\mu} \Delta P

    Thus :math:`S_{hydraulic}` represents the combined effect of the area
    and length of the *conduit*, which consists of a throat and 1/2 of the
    pores on each end.

    """
    D1, Dt, D2 = _get_conduit_diameters(target, pore_diameter, throat_diameter)
    L1, Lt, L2 = _conduit_lengths.cones_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T

    # Fi is the integral of (1/A^2) dx, x = [0, Li]
    F1 = 16 / 3 * (L1 * (D1**2 + D1 * Dt + Dt**2) /
                   (D1**3 * Dt**3 * _np.pi**2))
    F2 = 16 / 3 * (L2 * (D2**2 + D2 * Dt + Dt**2) /
                   (D2**3 * Dt**3 * _np.pi**2))
    Ft = Lt / (_np.pi * Dt**2 / 4)**2

    # I is the integral of (y^2 + z^2) dA, divided by A^2
    I1 = I2 = It = 1 / (2 * _np.pi)

    # S is 1 / (16 * pi^2 * I * F)
    S1 = 1 / (16 * _np.pi**2 * I1 * F1)
    St = 1 / (16 * _np.pi**2 * It * Ft)
    S2 = 1 / (16 * _np.pi**2 * I2 * F2)

    return {"pore1": S1, "throat": St, "pore2": S2}