Changeset 8492


Ignore:
Timestamp:
Aug 6, 2012, 11:14:34 AM (12 years ago)
Author:
steve
Message:

Fixed up logging in erosion operator

Location:
trunk/anuga_core/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/operators/base_operator.py

    r8477 r8492  
     1
     2from anuga.utilities.system_tools import log_to_file
     3
    14
    25class Operator:
     
    3740
    3841
    39         if label == None:
    40             self.label = "operator_%g" % Operator.counter
    41         else:
    42             self.label = label + '_%g' % Operator.counter
     42        self.set_label(label)
    4343
    4444
     
    9696            log_to_file(self.log_filename, self.timestepping_statistics())
    9797
     98    def set_label(self, label=None):
     99
     100        if label == None:
     101            self.label = "operator_%g" % Operator.counter
     102        else:
     103            self.label = label + '_%g' % Operator.counter
    98104
    99105
     
    106112            self.log_filename = self.label + '.log'
    107113            log_to_file(self.log_filename, self.statistics(), mode='w')
    108             log_to_file(self.log_filename, 'time,Q')
     114            #log_to_file(self.log_filename, 'time,Q')
    109115
    110116            #log_to_file(self.log_filename, self.culvert_type)
  • trunk/anuga_core/source/anuga/operators/erosion_operators.py

    r8484 r8492  
    6666        #-----------------------------------------
    6767        self.setup_node_structures()
     68
     69        #-----------------------------------------
     70        # Some stras for reporting
     71        #-----------------------------------------
     72        self.max_change = 0
     73       
    6874       
    6975
     
    8995            #--------------------------------------
    9096            # Update all three vertices for each cell
     97            # associated with self.indices
    9198            #--------------------------------------
    9299            ind = self.indices
    93100            m = num.sqrt(self.xmom_c[ind]**2 + self.ymom_c[ind]**2)
    94             m = num.vstack((m,m,m)).T
     101            m = num.vstack((m,m,m)).T  # Stack up m to apply to vertices
    95102            m = num.where(m>self.threshold, m, 0.0)
    96             self.elev_v[ind] = num.maximum(self.elev_v[ind] - m*dt, self.base)
    97              #num.maximum(self.elev_v[ind] - momentum*dt, Z)
    98 
     103
     104            de = m*dt
     105            self.elev_v[ind] = num.maximum(self.elev_v[ind] - de, self.base)
     106
     107            self.max_change = num.max(de)
    99108
    100109        return updated
     
    188197
    189198    def timestepping_statistics(self):
    190 
    191         message  = indent + self.label + ': Erosion_operator'
     199        from anuga import indent
     200
     201        message  = indent + self.label + ': Erosion_operator, time '
     202        message += str(self.get_time())+ ' max(Delta Elev) '+ str(self.max_change)
    192203        return message
    193204
  • trunk/anuga_core/source/anuga_parallel/run_parallel_sw_merimbula.py

    r8487 r8492  
    4242#--------------------------------------------------------------------------
    4343
    44 mesh_filename = "merimbula_10785_1.tsh" ; x0 = 756000.0 ; x1 = 756500.0
    45 #mesh_filename = "merimbula_43200.tsh"   ; x0 = 756000.0 ; x1 = 756500.0
     44#mesh_filename = "merimbula_10785_1.tsh" ; x0 = 756000.0 ; x1 = 756500.0
     45mesh_filename = "merimbula_43200.tsh"   ; x0 = 756000.0 ; x1 = 756500.0
    4646#mesh_filename = "test-100.tsh" ; x0 = 0.25 ; x1 = 0.5
    4747#mesh_filename = "test-20.tsh" ; x0 = 250.0 ; x1 = 350.0
    48 yieldstep = 20
    49 finaltime = 1000
     48yieldstep = 50
     49finaltime = 500
    5050verbose = True
    5151
     
    109109#--------------------------------------------------------------------------
    110110
    111    
     111domain.set_flow_algorithm('2_0')   
     112
    112113#domain.smooth = False
    113 domain.set_default_order(2)
    114 domain.set_timestepping_method('rk2')
     114#domain.set_default_order(2)
     115#domain.set_timestepping_method('rk2')
    115116#domain.set_CFL(0.7)
    116117#domain.set_beta(1.5)
     
    153154
    154155
    155 if myid == 0:
    156     print 'Number of processors %g ' %numprocs
    157     print 'That took %.2f seconds' %(time.time()-t0)
    158     print 'Communication time %.2f seconds'%domain.communication_time
    159     print 'Reduction Communication time %.2f seconds'%domain.communication_reduce_time
    160     print 'Broadcast time %.2f seconds'%domain.communication_broadcast_time
     156barrier()
     157
     158for p in range(numprocs):
     159    if myid == p:
     160        print 'Processor %g ' %myid
     161        print 'That took %.2f seconds' %(time.time()-t0)
     162        print 'Communication time %.2f seconds'%domain.communication_time
     163        print 'Reduction Communication time %.2f seconds'%domain.communication_reduce_time
     164        print 'Broadcast time %.2f seconds'%domain.communication_broadcast_time
     165    else:
     166        pass
     167
     168    barrier()
    161169
    162170
     
    164172# Merge the individual sww files into one file
    165173#--------------------------------------------------
    166 domain.sww_merge(delete_old=False)
     174#domain.sww_merge(delete_old=False)
    167175
    168176finalize()
Note: See TracChangeset for help on using the changeset viewer.