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')
def __init__(self, phase=None, **kwargs): r''' Initializing the class ''' super(GenericLinearTransport, self).__init__(**kwargs) if phase is None: self._phase = GenericPhase() else: self._phase = phase # Register phase with self if sp.size(phase) != 1: self._phases = phase else: self._phases.append(phase)
def __init__(self, phase=None, **kwargs): super().__init__(**kwargs) if phase is None: self._phase = GenericPhase() self.phases.update({self._phase.name: self._phase}) else: self._phase = phase # Register phase with self if sp.size(phase) != 1: raise Exception('The GenericLinearTransport class can only ' + 'operate on a single phase') else: self.phases.update({phase.name: phase}) if self._net is not phase._net: raise Exception(phase.name + 'and this algorithm are associated' + ' with different networks.')
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)