Changeset 5221


Ignore:
Timestamp:
Apr 21, 2008, 5:11:58 PM (15 years ago)
Author:
ole
Message:

Work done during Water Down Under 2008.
Hardwired the three conserved quantities from sww into file_function as it was getting messy trying to exclude irrelevant quantities. Also did some formatting and commenting.

Location:
anuga_core/source/anuga/abstract_2d_finite_volumes
Files:
5 edited

Legend:

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

    r4839 r5221  
    8888        """
    8989
    90         if verbose: print 'General_mesh: Building basic mesh structure'
     90        if verbose: print 'General_mesh: Building basic mesh structure in ANUGA domain'
    9191
    9292        self.triangles = array(triangles, Int)
  • anuga_core/source/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py

    r5178 r5221  
    245245
    246246        if verbose: print 'Initialise file_function'
    247         self.F = file_function(filename, domain,
     247        self.F = file_function(filename,
     248                               domain,
     249                               quantities=domain.conserved_quantities,
    248250                               interpolation_points=self.midpoint_coordinates,
    249251                               time_thinning=time_thinning,
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_generic_boundary_conditions.py

    r4171 r5221  
    253253       
    254254        try:
    255             F = File_boundary(filename + '.tms', domain)           
     255            F = File_boundary(filename + '.tms',
     256                              domain)
    256257        except:
    257258            pass
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py

    r5182 r5221  
    951951        domain = Domain(points, vertices)
    952952
    953         #Check that domain.starttime is updated if non-existing
    954         F = file_function(filename + '.tms', domain)
    955        
     953        # Check that domain.starttime is updated if non-existing
     954        F = file_function(filename + '.tms',
     955                          domain,
     956                          quantities = ['Attribute0', 'Attribute1', 'Attribute2']) 
    956957        assert allclose(domain.starttime, start)
    957958
    958         #Check that domain.starttime is updated if too early
     959        # Check that domain.starttime is updated if too early
    959960        domain.starttime = start - 1
    960         F = file_function(filename + '.tms', domain)
     961        F = file_function(filename + '.tms',
     962                          domain,
     963                          quantities = ['Attribute0', 'Attribute1', 'Attribute2'])
    961964        assert allclose(domain.starttime, start)
    962965
    963         #Check that domain.starttime isn't updated if later
     966        # Check that domain.starttime isn't updated if later
    964967        domain.starttime = start + 1
    965         F = file_function(filename + '.tms', domain)       
     968        F = file_function(filename + '.tms',
     969                          domain,
     970                          quantities = ['Attribute0', 'Attribute1', 'Attribute2'])
    966971        assert allclose(domain.starttime, start+1)
    967972
    968973        domain.starttime = start
    969         F = file_function(filename + '.tms', domain,
     974        F = file_function(filename + '.tms',
     975                          domain,
    970976                          quantities = ['Attribute0', 'Attribute1', 'Attribute2'],
    971977                          use_cache=True)
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r5182 r5221  
    6262                 list of quantity names. The resulting function will return
    6363                 a tuple of values - one for each quantity
    64                  If quantities are None, domain's conserved quantities
    65                  are used.
     64                 If quantities are None, the default quantities are
     65                 ['stage', 'xmomentum', 'ymomentum']
     66                 
    6667
    6768    interpolation_points - list of absolute UTM coordinates for points (N x 2)
     
    7273
    7374   
    74     See Interpolation function for further documentation
     75    See Interpolation function in anuga.fit_interpolate.interpolation for further documentation
    7576    """
    7677
     
    8586    # - interpolation points as absolute UTM coordinates
    8687
    87 
    88 
    89 
    90     # Use domain's conserved_quantity names as defaults
     88    if quantities is None:
     89        if verbose:
     90            msg = 'Quantities specified in file_function are None,'
     91            msg += ' so I will use stage, xmomentum, and ymomentum in that order.'
     92            print msg
     93
     94        quantities = ['stage', 'xmomentum', 'ymomentum']
     95           
     96
     97    # Use domain's startime if available
    9198    if domain is not None:   
    92         if quantities is None:
    93             quantities = domain.conserved_quantities
    94            
    9599        domain_starttime = domain.get_starttime()
    96100    else:
     
    234238    if type(quantity_names) == types.StringType:
    235239        quantity_names = [quantity_names]       
    236    
     240
    237241    if quantity_names is None or len(quantity_names) < 1:
    238         # If no quantities are specified get quantities from file
    239         # x, y, time are assumed as the independent variables so
    240         # they are excluded as potentiol quantities
    241         quantity_names = []
    242         for name in fid.variables.keys():
    243             if name not in ['x', 'y', 'time']:
    244                 quantity_names.append(name)
    245 
    246     if len(quantity_names) < 1:               
    247         msg = 'ERROR: At least one independent value must be specified'
    248         raise msg
     242        msg = 'No quantities are specified in file_function'
     243        raise Exception, msg
    249244
    250245
Note: See TracChangeset for help on using the changeset viewer.