Пример #1
0
    def __init__(self, network=None, components=[], **kwargs):
        super(GenericPhase, self).__init__(**kwargs)
        logger.name = self.name

        if network is None:
            self._net = GenericNetwork()
        else:
            self._net = network

        # Initialize label 'all' in the object's own info dictionaries
        self['pore.all'] = self._net['pore.all']
        self['throat.all'] = self._net['throat.all']

        #Set standard conditions on the fluid to get started
        self['pore.temperature'] = 298.0
        self['pore.pressure'] = 101325.0

        # Register Ohase object in Network dictionary
        self._net['pore.' + self.name] = True
        self._net['throat.' + self.name] = True

        if components != []:
            for comp in components:
                self.set_component(phase=comp)
        self._net._phases.append(self)  # Append this Phase to the Network
Пример #2
0
    def __init__(self, network=None, phase=None, geometry=None,
                 pores=[], throats=[], **kwargs):
        super().__init__(**kwargs)
        logger.name = self.name

        # Associate with Network
        if network is None:
            self._net = GenericNetwork()
        else:
            self._net = network  # Attach network to self
            self._net._physics.append(self)  # Register self with network

        # Associate with Phase
        if phase is None:
            phase = GenericPhase(network=self._net)
        phase._physics.append(self)  # Register self with phase
        self._phases.append(phase)  # Register phase with self

        if geometry is not None:
            if (sp.size(pores) > 0) or (sp.size(throats) > 0):
                raise Exception('Cannot specify a Geometry AND pores or throats')
            pores = self._net.toindices(self._net['pore.' + geometry.name])
            throats = self._net.toindices(self._net['throat.' + geometry.name])

        # Initialize a label dictionary in the associated phase and network
        self._phases[0]['pore.'+self.name] = False
        self._phases[0]['throat.'+self.name] = False
        self._net['pore.'+self.name] = False
        self._net['throat.'+self.name] = False
        try:
            self.set_locations(pores=pores, throats=throats)
        except:
            self.controller.purge_object(self)
            raise Exception('Provided locations are in use, instantiation cancelled')
Пример #3
0
    def __init__(self, network=None, **kwargs):
        super().__init__(**kwargs)
        logger.name = self.name

        if network is None:
            network = GenericNetwork()
        self.network.update({network.name: network})

        # Initialize label 'all' in the object's own info dictionaries
        self['pore.all'] = self._net['pore.all']
        self['throat.all'] = self._net['throat.all']
Пример #4
0
    def __init__(self, network=None, pores=[], throats=[], **kwargs):
        super().__init__(**kwargs)
        logger.name = self.name

        if network is None:
            network = GenericNetwork()
        self.network.update({network.name: network})  # Attach network to self
        # Register self with network.geometries
        self._net.geometries.update({self.name: self})

        # Initialize a label dictionary in the associated network
        self._net['pore.'+self.name] = False
        self._net['throat.'+self.name] = False
        try:
            self.set_locations(pores=pores, throats=throats)
        except:
            self.workspace.purge_object(self)
            raise Exception('Provided locations are in use, instantiation cancelled')
Пример #5
0
    def __init__(self,
                 network=None,
                 phase=None,
                 geometry=None,
                 pores=[],
                 throats=[],
                 **kwargs):
        super(GenericPhysics, self).__init__(**kwargs)
        logger.name = self.name

        #Associate with Network
        if network is None:
            self._net = GenericNetwork()
        else:
            self._net = network  # Attach network to self
            self._net._physics.append(self)  # Register self with network

        #Associate with Phase
        if phase is None:
            self._phases.append(GenericPhase())
        else:
            phase._physics.append(self)  # Register self with phase
            self._phases.append(phase)  # Register phase with self

        if geometry is not None:
            if (pores != []) or (throats != []):
                raise Exception(
                    'Cannot specify a Geometry AND pores or throats')
            pores = self._net.toindices(self._net['pore.' + geometry.name])
            throats = self._net.toindices(self._net['throat.' + geometry.name])

        #Initialize a label dictionary in the associated fluid
        self._phases[0]['pore.' + self.name] = False
        self._phases[0]['throat.' + self.name] = False
        self._net['pore.' + self.name] = False
        self._net['throat.' + self.name] = False
        self.set_locations(pores=pores, throats=throats)
Пример #6
0
    def __init__(self, network=None, components=[], **kwargs):
        super().__init__(**kwargs)
        logger.name = self.name

        if network is None:
            network = GenericNetwork()
        self.network.update({network.name: network})

        # Initialize label 'all' in the object's own info dictionaries
        self['pore.all'] = self._net['pore.all']
        self['throat.all'] = self._net['throat.all']

        # Set standard conditions on the fluid to get started
        self['pore.temperature'] = 298.0
        self['pore.pressure'] = 101325.0

        # Register Ohase object in Network dictionary
        self._net['pore.'+self.name] = True
        self._net['throat.'+self.name] = True

        if components != []:
            for comp in components:
                self.set_component(phase=comp)
        self._net.phases.update({self.name: self})  # Connect Phase to Network
Пример #7
0
    def __init__(self,
                 network=None,
                 pores=[],
                 throats=[],
                 seed=None,
                 **kwargs):
        r"""
        Initialize
        """
        super(GenericGeometry, self).__init__(**kwargs)
        logger.name = self.name

        if network is None:
            self._net = GenericNetwork()
        else:
            self._net = network  # Attach network to self
            self._net._geometries.append(
                self)  # Register self with network.geometries

        #Initialize a label dictionary in the associated network
        self._net['pore.' + self.name] = False
        self._net['throat.' + self.name] = False
        self.set_locations(pores=pores, throats=throats)
        self._seed = seed