Ignore:
Timestamp:
Mar 8, 2005, 5:54:25 PM (20 years ago)
Author:
ole
Message:

Added diagnostics about boundary forcing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/domain.py

    r1036 r1043  
    253253
    254254        self.boundary_objects = []
     255        self.boundary_map = boundary_map  #Store for use with eg. boundary_stats.
    255256
    256257        #FIXME: Try to remove the sorting and fix test_mesh.py
     
    316317                    self.number_of_first_order_steps)
    317318
     319    def boundary_stats(self, quantities = None, tag = None):
     320        """Output statistics about boundary forcing
     321
     322       
     323        """
     324       
     325        if quantities is None:
     326            quantities = self.conserved_quantities
     327
     328
     329        print 'Boundary values at time %.4f:' %self.time
     330        for name in quantities:
     331            q = self.quantities[name]
     332
     333            if tag is None:
     334                #Take entire boundary
     335                print '    Quantity %s: min = %12.8f, max = %12.8f'\
     336                      %(name, min(q.boundary_values), max(q.boundary_values))
     337            else:
     338                #Take only boundary associated with tag
     339                maxval = minval = None
     340                for i, ((vol_id, edge_id), B) in enumerate(self.boundary_objects):
     341                    if self.boundary[(vol_id, edge_id)] == tag:
     342                        v = q.boundary_values[i]
     343                        if minval is None or v < minval: minval = v
     344                        if maxval is None or v > maxval: maxval = v                       
     345
     346                if minval is None or maxval is None:
     347                    print 'Sorry no information about tag %s' %tag
     348                else:   
     349                    print '    Quantity %s, tag %s: min = %12.8f, max = %12.8f'\
     350                          %(name, tag, minval, maxval)
     351                       
     352
     353
     354               
     355
     356       
     357       
     358           
     359       
    318360
    319361    def get_name(self):
Note: See TracChangeset for help on using the changeset viewer.