Ejemplo n.º 1
0
import h5py
from flatdict import FlatDict
from openpnm.io import Dict, GenericIO
from openpnm.network import GenericNetwork
from openpnm.utils import logging, Project
logger = logging.getLogger(__name__)


class HDF5(GenericIO):
    r"""
    The HDF5 (Hierarchical Data Format) file is good for high-peformance, long
    term data storage
    """

    @classmethod
    def to_hdf5(cls, network=None, phases=[], element=['pore', 'throat'],
                filename='', interleave=True, flatten=False, categorize_by=[]):
        r"""
        Creates an HDF5 file containing data from the specified objects,
        and categorized according to the given arguments.

        Parameters
        ----------
        network : OpenPNM Network Object
            The network containing the desired data

        phases : list of OpenPNM Phase Objects (optional, default is none)
            A list of phase objects whose data are to be included

        element : string or list of strings
            An indication of whether 'pore' and/or 'throat' data are desired.
Ejemplo n.º 2
0
 def __setitem__(self, key, value):
     if key == 'loglevel':
         logger = logging.getLogger()
         logger.setLevel(value)
     super().__setitem__(key, value)
Ejemplo n.º 3
0
from openpnm.utils import logging, Project
from openpnm.network import Cubic
from openpnm.geometry import GenericGeometry
import openpnm.models.geometry as gm

logger = logging.getLogger(__name__)


class BereaCubic(Project):
    r"""
    A traditional Berea Sandstone on a Cubic lattice

    Berea Sandstone is one of the standard materials used on geoscience
    studies due to it's importance in oil reservoir engineering as well as
    having well defined pore structure.  This class creates a Cubic Network
    with the appropriate lattice spacing and connectivity, then adds a Geometry
    object with the necessary pore-scale models and prescribed parameters.

    Parameters
    ----------
    shape : array_like
        The number of pores along each direction of the domain.  All other
        aspects of this model are prescribed by the code.

    name : str, optional
        The name to give the Project

    Notes
    -----
    The source code for this Material is relatively straight-forward, so is a
    good example starting point for creating custom materials.
Ejemplo n.º 4
0
 def __setitem__(self, key, value):
     if key == 'loglevel':
         logger = logging.getLogger()
         logger.setLevel(value)
     super().__setitem__(key, value)