예제 #1
0
def spheres_and_cylinders(
    target,
    pore_diameter='pore.diameter',
    throat_diameter='throat.diameter'
):
    r"""
    Finds throat length assuming pores are spheres 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.spheres_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter
    )
    return out[:, 1]
예제 #2
0
 def test_spheres_and_cylinders(self):
     L_actual = mods.spheres_and_cylinders(self.geo)
     L_desired = np.array([[0.15, 0.44688711, 0.40311289],
                           [0.40311289, 0.30965898, 0.28722813]])
     assert_allclose(L_actual, L_desired)
     # Incompatible data with model assumptions
     self.geo["pore.diameter"][1] = 0.3
     with pytest.raises(Exception):
         L_actual = mods.spheres_and_cylinders(self.geo)
     self.geo["pore.diameter"][1] = 0.9
     # Overlapping pores
     self.geo["pore.diameter"][0] = 1.2
     L_actual = mods.spheres_and_cylinders(self.geo)
     L_desired = np.array([[5.78750000e-01, 1.00000000e-15, 4.21250000e-01],
                           [4.03112887e-01, 3.09658980e-01,
                            2.87228132e-01]])
     assert_allclose(L_actual, L_desired)
     self.geo["pore.diameter"][0] = 0.5
예제 #3
0
def ncylinders_in_series(target,
                         pore_diameter="pore.diameter",
                         throat_diameter="throat.diameter",
                         n=5):
    r"""
    Computes diffusive size factors for conduits of spheres and cylinders
    with the spheres approximated as N cylinders in series.

    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 pointing to the pore diameter values.
    throat_diameter : str
        Dictionary key pointing to the throat diameter values.
    n : int
        Number of cylindrical divisions for each pore

    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)
    # Ensure throats are never bigger than connected pores
    Dt = _np.minimum(Dt, 0.99 * _np.minimum(D1, D2))
    L1, Lt, L2 = _conduit_lengths.spheres_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T
    dL1 = _np.linspace(0, L1, num=n)
    dL2 = _np.linspace(0, L2, num=n)
    r1 = D1 / 2 * _np.sin(_np.arccos(dL1 / (D1 / 2)))
    r2 = D2 / 2 * _np.sin(_np.arccos(dL2 / (D2 / 2)))

    gtemp = (_np.pi * r1**2 / (L1 / n)).T
    F1 = 1 / _np.sum(1 / gtemp, axis=1)
    gtemp = (_np.pi * r2**2 / (L2 / n)).T
    F2 = 1 / _np.sum(1 / gtemp, axis=1)
    Ft = (_np.pi * (Dt / 2)**2 / (Lt)).T

    return {"pore1": F1, "throat": Ft, "pore2": F2}
예제 #4
0
def spheres_and_cylinders(
    target,
    pore_diameter="pore.diameter",
    throat_diameter="throat.diameter",
):
    r"""
    Computes diffusive shape coefficient for conduits assuming pores are
    spheres 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.

    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.spheres_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T

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

    return {"pore1": 1 / F1, "throat": 1 / Ft, "pore2": 1 / F2}
예제 #5
0
def ncylinders_in_series(
    target,
    pore_diameter="pore.diameter",
    throat_diameter="throat.diameter",
    n=5,
):
    r"""
    Computes hydraulic size factors for conduits of spheres and cylinders
    with the spheres approximated as N cylinders in series.

    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 pointing to the pore diameter values.
    throat_diameter : str
        Dictionary key pointing to the throat diameter values.
    n : int
        Number of cylindrical divisions for each pore

    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)
    # Ensure throats are never bigger than connected pores
    Dt = _np.minimum(Dt, 0.99 * _np.minimum(D1, D2))
    L1, Lt, L2 = _conduit_lengths.spheres_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T
    dL1 = _np.linspace(0, L1, num=n)
    dL2 = _np.linspace(0, L2, num=n)
    r1 = D1 / 2 * _np.sin(_np.arccos(dL1 / (D1 / 2)))
    r2 = D2 / 2 * _np.sin(_np.arccos(dL2 / (D2 / 2)))

    gtemp = (_np.pi * r1**4 / (8 * L1 / n)).T
    F1 = 1 / _np.sum(1 / gtemp, axis=1)
    gtemp = (_np.pi * r2**4 / (8 * L2 / n)).T
    F2 = 1 / _np.sum(1 / gtemp, axis=1)
    Ft = (_np.pi * (Dt / 2)**4 / (8 * Lt)).T

    return {"pore1": F1, "throat": Ft, "pore2": F2}
예제 #6
0
def spheres_and_cylinders(
    target,
    pore_diameter="pore.diameter",
    throat_diameter="throat.diameter",
):
    r"""
    Computes hydraulic size factors for conduits assuming pores are
    spheres 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
    -------
    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.spheres_and_cylinders(
        target, pore_diameter=pore_diameter, throat_diameter=throat_diameter).T

    # Fi is the integral of (1/A^2) dx, x = [0, Li]
    a = 4 / (D1**3 * _np.pi**2)
    b = 2 * D1 * L1 / (D1**2 - 4 * L1**2) + _np.arctanh(2 * L1 / D1)
    F1 = a * b
    a = 4 / (D2**3 * _np.pi**2)
    b = 2 * D2 * L2 / (D2**2 - 4 * L2**2) + _np.arctanh(2 * L2 / D2)
    F2 = a * b
    Ft = Lt / (_np.pi / 4 * Dt**2)**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}