Changeset 9682


Ignore:
Timestamp:
Feb 23, 2015, 2:01:25 PM (10 years ago)
Author:
davies
Message:

Recording yieldstep average abs discharge in structures

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/abstract_2d_finite_volumes/generic_domain.py

    r9617 r9682  
    15241524            yieldstep = float(yieldstep)
    15251525
     1526        # Can be useful to access yieldstep from inside domain
     1527        self.yieldstep = yieldstep
     1528
    15261529        self._order_ = self.default_order
    15271530
  • trunk/anuga_core/anuga/parallel/parallel_internal_boundary_operator.py

    r9681 r9682  
    456456            if numpy.sign(self.smooth_Q) != numpy.sign(Q):
    457457                Q = 0.
     458                self.smooth_Q = 0.
    458459            else:
    459460                # Make Q positive (for anuga's structure operator)
  • trunk/anuga_core/anuga/parallel/parallel_structure_operator.py

    r9681 r9682  
    152152        self.accumulated_flow = 0.0
    153153        self.discharge = 0.0
    154         self.discharge_function_value = 0.0
     154        self.discharge_abs_timemean = 0.0
    155155        self.velocity = 0.0
    156156        self.outlet_depth = 0.0
     
    400400            # Update Stats
    401401            self.discharge  = Q*timestep_star/timestep #outflow_extra_depth*self.outflow.get_area()/timestep
    402             self.discharge_function_value = Q
     402            self.discharge_abs_timemean += Q*timestep_star/self.domain.yieldstep
    403403            self.velocity = barrel_speed #self.discharge/outlet_depth/self.width
    404404
     
    630630            message += 'Type: %s\n' % self.structure_type
    631631            message += 'Discharge [m^3/s]: %.2f\n' % self.discharge
    632             message += 'Discharge function value [m^3/s]: %.2f\n' % self.discharge_function_value
     632            message += 'Discharge function value [m^3/s]: %.2f\n' % self.discharge_abs_timemean
    633633            message += 'Velocity  [m/s]: %.2f\n' % self.velocity
    634634            message += 'Inlet Driving Energy %.2f\n' % self.driving_energy
     
    650650            self.log_filename = self.domain.get_datadir() + '/' + self.label + '.log'
    651651            log_to_file(self.log_filename, stats, mode='w')
    652             log_to_file(self.log_filename, 'time,discharge,discharge_function_value,velocity,driving_energy,delta_total_energy')
     652            log_to_file(self.log_filename, 'time,discharge_instantaneous,discharge_abs_timemean,velocity_instantaneous,driving_energy_instantaneous,delta_total_energy_instantaneous')
    653653
    654654            #log_to_file(self.log_filename, self.culvert_type)
     
    674674        message  = '%.5f, ' % self.domain.get_time()
    675675        message += '%.5f, ' % self.discharge
    676         message += '%.5f, ' % self.discharge_function_value
     676        message += '%.5f, ' % self.discharge_abs_timemean
    677677        message += '%.5f, ' % self.velocity
    678678        message += '%.5f, ' % self.driving_energy
    679679        message += '%.5f' % self.delta_total_energy
    680680
     681        # Reset discharge_abs_timemean each time there is reporting (FIXME:
     682        # This assumes this function is only called after each yieldstep)
     683        self.discharge_abs_timemean = 0.
     684
    681685        return message
    682686
  • trunk/anuga_core/anuga/structures/internal_boundary_operator.py

    r9681 r9682  
    145145        return Q, barrel_velocity, outlet_culvert_depth
    146146
     147
    147148    def discharge_routine_explicit(self):
    148149        """Procedure to determine the inflow and outflow inlets.
     
    224225            # Make Q positive (for anuga's structure operator)
    225226            Q = min( abs(self.smooth_Q), abs(Q) )
     227            #Q = abs(self.smooth_Q)
    226228
    227229        return Q, barrel_velocity, outlet_culvert_depth
     
    260262        dt = self.domain.get_timestep()
    261263
    262 
    263264        if dt > 0.:
    264265            E0 = self.inlet0_energy
     
    275276                Q1 =  self.internal_boundary_function(E0 + sol[0], E1 + sol[1])
    276277                discharge = (1.0-theta)*Q0 + theta*Q1
     278                # We need to find 'sol' such that 'output' is [0., 0.]
    277279                output = sol*areas - discharge*dt*numpy.array([-1., 1.])
    278280                return(output)
     
    281283            Q1 =  self.internal_boundary_function(E0 + final_sol[0], E1 + final_sol[1])
    282284            Q = (1.0-theta)*Q0 + theta*Q1
    283 
    284285        else:
    285286            Q = Q0
    286 
    287287
    288288        # Use time-smoothed discharge if smoothing_timescale > 0.
     
    306306        if numpy.sign(self.smooth_Q) != numpy.sign(Q):
    307307            Q = 0.
     308            self.smooth_Q = 0.
    308309        else:
    309310            # Make Q positive (for anuga's structure operator)
    310311            Q = min( abs(self.smooth_Q), abs(Q) )
     312            #Q = abs(self.smooth_Q)
     313            # FIXME: Debugging
     314            #Q = abs(self.smooth_Q)
    311315
    312316        barrel_velocity = numpy.nan
  • trunk/anuga_core/anuga/structures/structure_operator.py

    r9681 r9682  
    121121        self.accumulated_flow = 0.0
    122122        self.discharge = 0.0
    123         self.discharge_function_value = 0.0
     123        self.discharge_abs_timemean = 0.0
    124124        self.velocity = 0.0
    125125        self.outlet_depth = 0.0
     
    186186        enquiry_point1 = self.enquiry_points[1]
    187187
    188         #outward_vector1  = - self.culvert_vector
    189188        self.inlets.append(inlet_enquiry.Inlet_enquiry(
    190189                           self.domain,
     
    195194                           verbose = self.verbose))
    196195
    197 
    198         tris_1 = self.inlets[1].triangle_indices
    199         #print tris_1
    200         #print self.domain.centroid_coordinates[tris_1]       
    201        
    202         self.set_logging(logging)
    203 
    204196        if force_constant_inlet_elevations:
    205197            # Try to enforce a constant inlet elevation
    206198            inlet_global_elevation = self.inlets[-1].get_average_elevation()
    207199            self.inlets[-1].set_elevations(inlet_global_elevation)
     200
     201        tris_1 = self.inlets[1].triangle_indices
     202       
     203        self.set_logging(logging)
     204
    208205       
    209206
     
    319316        self.accumulated_flow += gain
    320317        self.discharge  = Q*timestep_star/timestep
    321         self.discharge_function_value = Q
     318        self.discharge_abs_timemean += gain/self.domain.yieldstep
    322319        self.velocity =   barrel_speed
    323320        self.outlet_depth = outlet_depth
     
    555552       
    556553        message += 'Discharge [m^3/s]: %.2f\n' % self.discharge
    557         message += 'Discharge_function_value [m^3/s]: %.2f\n' % self.discharge_function_value
     554        message += 'Discharge_function_value [m^3/s]: %.2f\n' % self.discharge_abs_timemean
    558555        message += 'Velocity  [m/s]: %.2f\n' % self.velocity
    559556        message += 'Outlet Depth  [m]: %.2f\n' % self.outlet_depth
     
    577574            self.log_filename = self.domain.get_datadir() + '/' + self.label + '.log'
    578575            log_to_file(self.log_filename, self.statistics(), mode='w')
    579             log_to_file(self.log_filename, 'time, discharge, discharge_function_value, velocity, accumulated_flow, driving_energy, delta_total_energy')
     576            log_to_file(self.log_filename, 'time, discharge_instantaneous, discharge_abs_timemean, velocity, accumulated_flow, driving_energy_instantaneous, delta_total_energy_instantaneous')
    580577
    581578            #log_to_file(self.log_filename, self.culvert_type)
     
    586583        message  = '%.5f, ' % self.domain.get_time()
    587584        message += '%.5f, ' % self.discharge
    588         message += '%.5f, ' % self.discharge_function_value
     585        message += '%.5f, ' % self.discharge_abs_timemean
    589586        message += '%.5f, ' % self.velocity
    590587        message += '%.5f, ' % self.accumulated_flow
    591588        message += '%.5f, ' % self.driving_energy
    592589        message += '%.5f' % self.delta_total_energy
    593        
    594 
     590       
     591        # Reset discharge_abs_timemean since last time this function was called
     592        # (FIXME: This assumes that the function is called only just after a
     593        # yield step)
     594        self.discharge_abs_timemean = 0.
    595595
    596596        return message
  • trunk/anuga_work/development/gareth/tests/ras_bridge/channel_floodplain1.py

    r9681 r9682  
    191191    smoothing_timescale=0.0,
    192192    logging=True)
     193
     194print 'I0: ', bridge.inlets[0].triangle_indices
     195print 'EQ0: ', bridge.inlets[0].enquiry_index
     196print 'I1: ', bridge.inlets[0].triangle_indices
     197print 'EQ1: ', bridge.inlets[1].enquiry_index
    193198   
    194199#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.