Changeset 6011


Ignore:
Timestamp:
Nov 27, 2008, 4:13:46 PM (16 years ago)
Author:
ole
Message:

Moved obsolete code away

Location:
anuga_core/source
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py

    r6009 r6011  
    123123        # FIXME (Ole): I think this should be get_time(), see ticket:306
    124124        return self.f(self.domain.time)
    125 
    126 
    127 class File_boundary_time(Boundary):
    128     """Boundary values obtained from file and interpolated.
    129     conserved quantities as a function of time.
    130 
    131     Assumes that file contains a time series.
    132 
    133     No spatial info assumed.
    134     """
    135 
    136     #FIXME: Is this still necessary
    137 
    138     def __init__(self, filename, domain):
    139         import time
    140         from Numeric import array
    141         from anuga.config import time_format
    142         from anuga.abstract_2d_finite_volumes.util import File_function
    143 
    144         Boundary.__init__(self)
    145 
    146         self.F = File_function(filename, domain)
    147         self.domain = domain
    148 
    149         #Test
    150         q = self.F(0)
    151 
    152         d = len(domain.conserved_quantities)
    153         msg = 'Values specified in file must be a list or an array of length %d' %d
    154         assert len(q) == d, msg
    155 
    156 
    157     def __repr__(self):
    158         return 'File boundary'
    159 
    160     def evaluate(self, vol_id=None, edge_id=None):
    161         """Return linearly interpolated values based on domain.time
    162 
    163         vol_id and edge_id are ignored
    164         """
    165 
    166         # FIXME (Ole): I think this should be get_time(), see ticket:306       
    167         t = self.domain.time
    168         return self.F(t)
    169 
    170125
    171126
     
    277232        self.default_boundary_invoked = False    # Flag
    278233
    279         # Store pointer to domain
     234        # Store pointer to domain and verbosity
    280235        self.domain = domain
    281        
    282236        self.verbose = verbose
    283237
    284         # Test
    285238
    286239        # Here we'll flag indices outside the mesh as a warning
     
    385338            msg += 'vol_id=%s, edge_id=%s' %(str(vol_id), str(edge_id))
    386339            raise Exception, msg
    387             # FIXME: What should the semantics be?
    388             #return self.F(t)
    389 
    390 
    391 
    392 
    393 
    394 
    395 
    396 
    397 #THIS FAR (10/8/4)
    398 class Connective_boundary(Boundary):
    399     """Connective boundary returns values for the
    400     conserved quantities from a volume as defined by a connection table
    401     mapping between tuples of (volume id, face id) for volumes that
    402     have their boundaries connected.
    403 
    404     FIXME: Perhaps include possibility of mapping between
    405     different domains as well
    406 
    407     FIXME: In case of shallow water we may want to have a
    408     special version that casts this in terms of height rather than stage
    409     """
    410 
    411 
    412     def __init__(self, table):
    413         from domain import Volume
    414 
    415         Boundary.__init__(self)
    416 
    417         self.connection_table = table
    418         self.Volume = Volume
    419 
    420     def __repr__(self):
    421         return 'Connective boundary'
    422 
    423     #FIXME: IF we ever need to get field_values from connected volume,
    424     #that method could be overridden here (using same idea as in
    425     #get_conserved_quantities
    426     #def get_field_values()
    427 
    428     def get_conserved_quantities(self, volume, face=0):
    429 
    430         id = volume.id
    431         if self.connection_table.has_key((id, face)):
    432             other_id, other_face = self.connection_table[(id, face)]
    433 
    434             other_volume = self.Volume.instances[other_id]
    435             cmd = 'q = other_volume.conserved_quantities_face%d' %face;
    436             exec(cmd)
    437             return q
    438         else:
    439             msg = 'Volume, face tuple ($d, %d) has not been mapped'\
    440                   %(id, face)
    441             raise msg
    442 
    443 
    444 
    445 
    446 
    447 #FIXME: Add a boundary with a general function of x,y, and t
    448 
    449 #FIXME: Add periodic boundaries e.g.:
    450 # Attempt at periodic conditions from advection_spik. Remember this
    451 #
    452 #first = 2*(N-1)*N
    453 #for i in range(1,2*N+1,2):
    454 #    k = first + i-1#
    455 #
    456 #    print i,k
    457 #
    458 #    domain[i].faces[2].neighbour = domain[k].faces[1]
    459 #    domain[k].faces[1].neighbour = domain[i].faces[2]
    460 
    461 
    462 
    463 class General_boundary(Boundary):
    464     """General boundary which can compute conserved quantities based on
    465     their previous value, conserved quantities of its neighbour and model time.
    466 
    467     Must specify initial conserved quantities,
    468     neighbour,
    469     domain to get access to model time
    470     a function f(q_old, neighbours_q, t) which must return
    471     new conserved quantities q as a function time
    472 
    473     FIXME: COMPLETE UNTESTED - JUST AN IDEA
    474     """
    475 
    476     def __init__(self, neighbour=None, conserved_quantities=None, domain=None, f=None):
    477         Boundary.__init__(self, neighbour=neighbour, conserved_quantities=conserved_quantities)
    478 
    479         self.f = f
    480         self.domain = domain
    481 
    482 
    483     def get_conserved_quantities(self, volume=None, face=0):
    484    
    485         # FIXME (Ole): I think this should be get_time(), see ticket:306   
    486         return self.f(self.conserved_quantities,
    487                       neighbour.conserved_quantities,
    488                       self.domain.time)
    489 
    490 
    491 
    492 
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r5936 r6011  
    368368    else:
    369369        gauge_neighbour_id=None
     370       
    370371    if domain_starttime is not None:
    371372
Note: See TracChangeset for help on using the changeset viewer.