Changeset 9672


Ignore:
Timestamp:
Feb 13, 2015, 11:06:09 AM (10 years ago)
Author:
davies
Message:

Improvements to internal boundary operator

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/parallel/parallel_internal_boundary_operator.py

    r9671 r9672  
    2929                 force_constant_inlet_elevations=True,
    3030                 smoothing_timescale=0.0,
     31                 compute_discharge_implicitly=True,
    3132                 description=None,
    3233                 label=None,
     
    8485        self.use_velocity_head = use_velocity_head
    8586        self.zero_outflow_momentum = zero_outflow_momentum
     87
     88        self.compute_discharge_implicitly = compute_discharge_implicitly
    8689       
    8790        #FIXME SR: Why is this hard coded!
     
    129132
    130133
    131 
    132     def discharge_routine_old(self):
     134    def discharge_routine(self):
     135        """Both implicit and explicit methods available
     136        The former seems more stable and more accurate (in at least some
     137        cases). The latter will have less communication in parallel, and
     138        for some simple internal_boundary_functions there is no benefit to
     139        the implicit approach
     140           
     141        """
     142
     143        if self.compute_discharge_implicitly:
     144            Q, barrel_velocity, outlet_culvert_depth = self.discharge_routine_implicit()
     145        else:
     146            Q, barrel_velocity, outlet_culvert_depth = self.discharge_routine_explicit()
     147
     148        return Q, barrel_velocity, outlet_culvert_depth
     149
     150    def discharge_routine_explicit(self):
    133151
    134152        import pypar
     
    267285       
    268286       
    269     def discharge_routine(self):
     287    def discharge_routine_implicit(self):
    270288        """
    271289            Uses semi-implicit discharge estimation:
     
    392410                sol = solve(lhs, rhs)
    393411               
    394                 Q = 0.5*(Q0 + ( Q0 + sol[0]*dQ_dE0 + sol[1]*dQ_dE1))
     412                #Q = 0.5*(Q0 + ( Q0 + sol[0]*dQ_dE0 + sol[1]*dQ_dE1))
     413                Q1 = self.internal_boundary_function(E0 + sol[0], E1 + sol[1])
     414                Q = 0.5*(Q0 + Q1)
    395415            else:
    396416                Q = Q0
  • trunk/anuga_core/anuga/parallel/parallel_operator_factory.py

    r9657 r9672  
    628628                               force_constant_inlet_elevations=True,
    629629                               smoothing_timescale=0.0,
     630                               compute_discharge_implicitly=True,
    630631                               description=None,
    631632                               label=None,
     
    656657                                                                    force_constant_inlet_elevations=force_constant_inlet_elevations,
    657658                                                                    smoothing_timescale=smoothing_timescale,
     659                                                                    compute_discharge_implicitly=compute_discharge_implicitly,
    658660                                                                    description=description,
    659661                                                                    label=label,
     
    756758                                         force_constant_inlet_elevations=force_constant_inlet_elevations,
    757759                                         smoothing_timescale=smoothing_timescale,
     760                                         compute_discharge_implicitly=compute_discharge_implicitly,
    758761                                         description=description,
    759762                                         label=label,
  • trunk/anuga_core/anuga/structures/internal_boundary_operator.py

    r9671 r9672  
    4343                 force_constant_inlet_elevations=True,
    4444                 smoothing_timescale=0.0,
     45                 compute_discharge_implicitly=True,
    4546                 description=None,
    4647                 label=None,
     
    8687        self.zero_outflow_momentum = zero_outflow_momentum
    8788
     89        self.compute_discharge_implicitly = compute_discharge_implicitly
     90
    8891        #FIXME SR: Why is this hard coded!
    8992        self.max_velocity = 99999999999.0
     
    123126
    124127    #    self.domain.timestep = original_timestep
    125    
    126     def discharge_routine_old(self):
     128
     129    def discharge_routine(self):
     130        """Both implicit and explicit methods available
     131        The former seems more stable and more accurate (in at least some
     132        cases). The latter will have less communication in parallel, and
     133        for some simple internal_boundary_functions there is no benefit to
     134        the implicit approach
     135           
     136        """
     137        if self.compute_discharge_implicitly:
     138            Q, barrel_velocity, outlet_culvert_depth = self.discharge_routine_implicit()
     139        else:
     140            Q, barrel_velocity, outlet_culvert_depth = self.discharge_routine_explicit()
     141
     142        return Q, barrel_velocity, outlet_culvert_depth
     143
     144    def discharge_routine_explicit(self):
    127145        """Procedure to determine the inflow and outflow inlets.
    128146        Then use self.internal_boundary_function to do the actual calculation
     
    207225
    208226
    209     def discharge_routine(self):
     227    def discharge_routine_implicit(self):
    210228        """Uses semi-implicit discharge estimation:
    211229          Discharge = 0.5*(Q(H0, T0) + Q(H0 + delta_H, T0+delta_T))
     
    266284            # sol contains delta_E0, delta_E1
    267285            sol = solve(lhs, rhs)
    268            
    269             Q = 0.5*(Q0 + ( Q0 + sol[0]*dQ_dE0 + sol[1]*dQ_dE1))
     286           
     287            #Q = 0.5*(Q0 + ( Q0 + sol[0]*dQ_dE0 + sol[1]*dQ_dE1))
     288            Q1 =  self.internal_boundary_function(E0 + sol[0], E1 + sol[1])
     289            Q = 0.5*(Q0 + Q1)
    270290        else:
    271291            Q = Q0
  • trunk/anuga_core/anuga/utilities/quantity_setting_functions.py

    r9609 r9672  
    328328                if(pi == 'Extent'):
    329329                    # Here fi MUST be a gdal-compatible raster
    330                     if(not (type(fi)==str)):
     330                    if(not (type(fi) == str)):
    331331                        msg = ' pi = "Extent" can only be used when fi is a' +\
    332332                              ' raster file name'
     
    341341                    pi_path = su.getRasterExtent(fi,asPolygon=True)
    342342
    343                 elif(type(pi)==str and os.path.isfile(pi) ):
     343                elif( (type(pi) == str) and os.path.isfile(pi) ):
    344344                    # pi is a file
    345345                    pi_path = su.read_polygon(pi)
  • trunk/anuga_core/validation_tests/behaviour_only/bridge_hecras2/results.tex

    r9631 r9672  
    3737Figure~\ref{Reach} show stage timeseries at various stations downstream in each
    3838model. The ANUGA and HECRAS results are qualitatively similar, but differ in
    39 detail. In early stages of the simulation when discharges are lower, ANUGA
    40 shows stages slightly below HECRAS. This reflects the fact that HECRAS models
    41 side-wall friction while ANUGA does not, so there is more drag in the HECRAS
    42 model. Another relevant factor may be that the models flux the momentum under
    43 the bridge in different ways. ANUGA's method is to compute the average momentum
    44 in each direction along the upstream bridge inflow, and assume that this is
    45 advected by the discharge (as computed from the internal boundary rating
    46 curves). HECRAS's method is based on the energy equation.
    47 
    48 As the discharge increases, the models show more deviation around the
    49 bridge and upstream, and ultimately approach different steady states. The main
    50 reason for this is that they use different methods to model the bridge
    51 overflow, which begins when station 525 exceeds -1m. Another cause of
    52 differences is that in HECRAS, stage over all cross-sections is constant,
    53 including just upstream and downstream of the bridge. On the other hand in
    54 these locations ANUGA predicts some cross-channel variations in channel and
    55 floodplain stage. This is caused by the flux of water under the centre of the
    56 bridge. Just upstream of the bridge, ANUGA predicts the stage in the channel is
    57 slightly lower than on the floodplains, whereas the reverse is true just
    58 downstream, as would be expected from the bridge underflow. Combined with the
    59 fact that ANUGA's enquiry points for the bridge underflow rating curves occur
    60 in the centre of the channel, we cannot expect exact agreement with HECRAS.
    61 HECRAS includes several other bridge models, and these would also give
    62 different results particularly when the bridge deck is inundated.
     39detail.
    6340
    6441\begin{figure}
     
    7047\end{figure}
    7148
     49In early stages of the simulation when discharges are lower, ANUGA shows stages
     50slightly below HECRAS (particularly away from the bridge). This reflects the
     51fact that HECRAS models side-wall friction while ANUGA does not, so there is
     52more drag in the HECRAS model.
     53
     54As the discharge increases, the models show more deviation around the bridge
     55and upstream, and ultimately approach different steady states. At high flows,
     56the main reason for this is that they use different methods to model the bridge
     57overflow, which begins when station 525 exceeds -1m. ANUGA uses the shallow
     58water equations, while HECRAS uses an energy method. Even before this, the
     59models show differences once the flow goes overbank (above -2.4m at station
     60525). Because the ANUGA model here has a fairly coarse mesh, numerical
     61diffusion causes additional drag for overbank flows.
     62
     63Several additional factors will contribute to deviations between the models. ANUGA
     64models cross-channel variations in the water surface elevation, which is
     65assumed constant in HECRAS. The under-bridge flux in ANUGA is based on the
     66water elevations in the central channel up-and-down stream of the bridge, thus
     67the 2D representation will have an effect on the under-bridge flow. The models
     68also flux the momentum under the bridge in different ways. ANUGA's method is to
     69compute the average momentum in each direction along the upstream bridge
     70inflow, and assume that this is advected by the discharge (as computed from the
     71internal boundary rating curves). HECRAS's method is based on the energy
     72equation.
     73
     74
  • trunk/anuga_work/development/gareth/tests/ras_bridge/channel_floodplain1.py

    r9671 r9672  
    187187    hecras_discharge_function,
    188188    exchange_lines=[bridge_in, bridge_out],
    189     enquiry_gap=0.01,
     189    enquiry_gap=5.0,
    190190    zero_outflow_momentum=False,
    191191    smoothing_timescale=0.0,
Note: See TracChangeset for help on using the changeset viewer.