- Timestamp:
- Sep 1, 2010, 6:11:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/structures/culvert_operator.py
r7981 r7984 22 22 width, 23 23 height=None, 24 apron=None, 25 enquiry_gap=0.2, 24 26 verbose=False): 25 27 26 28 self.domain = domain 27 29 self.domain.set_fractional_step_operator(self) 28 end_points = [end_point0, end_point1]30 self.end_points = [end_point0, end_point1] 29 31 30 32 if height is None: 31 33 height = width 32 34 33 self.width = width 35 if apron is None: 36 apron = width 37 38 self.width = width 34 39 self.height = height 40 self.apron = apron 41 self.enquiry_gap = enquiry_gap 42 self.verbose = verbose 35 43 36 self.culvert = Boyd_box_culvert(self.domain, end_points, self.width, self.height) 37 print self.culvert 44 self.culvert = Boyd_box_culvert(self.domain, 45 self.end_points, 46 self.width, 47 self.height, 48 self.apron, 49 self.enquiry_gap, 50 self.verbose) 51 38 52 self.routine = self.culvert.routine 39 print self.routine 40 self.inlets = self.culvert.get_inlets() 41 42 self.print_stats() 53 54 self.inlets = self.culvert.get_inlets() 55 56 if self.verbose: 57 self.print_stats() 43 58 44 59 … … 48 63 49 64 Q, barrel_speed, outlet_depth = self.routine() 65 50 66 51 67 inflow = self.routine.get_inflow() … … 54 70 55 71 old_inflow_height = inflow.get_average_height() 56 57 58 59 60 Qstar = Q/old_inflow_height/inflow.get_area() 61 62 63 64 factor = 1.0/(1.0 + Qstar*timestep)65 66 67 68 69 70 72 old_inflow_xmom = inflow.get_average_xmom() 73 old_inflow_ymom = inflow.get_average_ymom() 74 75 if old_inflow_height > 0.0 : 76 Qstar = Q/old_inflow_height 77 else: 78 Qstar = 0.0 79 80 factor = 1.0/(1.0 + Qstar*timestep/inflow.get_area()) 81 82 83 84 new_inflow_height = old_inflow_height*factor 85 new_inflow_xmom = old_inflow_xmom*factor 86 new_inflow_ymom = old_inflow_ymom*factor 71 87 72 88 73 89 inflow.set_heights(new_inflow_height) 90 91 #inflow.set_xmoms(Q/inflow.get_area()) 92 #inflow.set_ymoms(0.0) 93 94 74 95 inflow.set_xmoms(new_inflow_xmom) 75 96 inflow.set_ymoms(new_inflow_ymom) 76 97 77 78 # set outflow 79 if old_inflow_height > 0.0 : 80 timestep_star = timestep*new_inflow_height/old_inflow_height 81 else: 82 timestep_star = 0.0 83 84 print Q, barrel_speed, outlet_depth, Qstar, factor, timestep_star 85 98 99 loss = (old_inflow_height - new_inflow_height)*inflow.get_area() 100 101 102 # set outflow 103 if old_inflow_height > 0.0 : 104 timestep_star = timestep*new_inflow_height/old_inflow_height 105 else: 106 timestep_star = 0.0 107 86 108 87 109 outflow_extra_height = Q*timestep_star/outflow.get_area() … … 90 112 91 113 92 outflow.set_heights(outflow.get_average_height() + outflow_extra_height) 93 outflow.set_xmoms(outflow.get_average_xmom() + outflow_extra_momentum[0] ) 94 outflow.set_ymoms(outflow.get_average_ymom() + outflow_extra_momentum[1] ) 114 gain = outflow_extra_height*outflow.get_area() 115 116 #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star 117 #print ' ', loss, gain 118 119 120 new_outflow_height = outflow.get_average_height() + outflow_extra_height 121 new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0] 122 new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1] 123 124 outflow.set_heights(new_outflow_height) 125 126 outflow.set_xmoms(barrel_speed*new_outflow_height*outflow_direction[0]) 127 outflow.set_ymoms(barrel_speed*new_outflow_height*outflow_direction[1]) 128 129 #outflow.set_xmoms(new_outflow_xmom) 130 #outflow.set_ymoms(new_outflow_ymom) 131 132 #print ' outflow volume ',outflow.get_total_water_volume() 95 133 96 134 def print_stats(self): … … 99 137 print 'Generic Culvert Operator' 100 138 print '=====================================' 139 140 print 'Culvert' 141 print self.culvert 142 143 print 'Culvert Routine' 144 print self.routine 101 145 102 146 for i, inlet in enumerate(self.inlets):
Note: See TracChangeset
for help on using the changeset viewer.