Changeset 8008
- Timestamp:
- Sep 7, 2010, 9:17:12 PM (14 years ago)
- Location:
- trunk/anuga_core/source/anuga/structures
- Files:
-
- 8 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/structures/boyd_box_operator.py
r8001 r8008 66 66 self.discharge = 0.0 67 67 self.velocity = 0.0 68 69 70 def __call__(self):71 72 timestep = self.domain.get_timestep()73 74 self.__determine_inflow_outflow()75 76 Q, barrel_speed, outlet_depth = self.__discharge_routine()77 78 old_inflow_height = self.inflow.get_average_height()79 old_inflow_xmom = self.inflow.get_average_xmom()80 old_inflow_ymom = self.inflow.get_average_ymom()81 82 if old_inflow_height > 0.0 :83 Qstar = Q/old_inflow_height84 else:85 Qstar = 0.086 87 factor = 1.0/(1.0 + Qstar*timestep/self.inflow.get_area())88 89 new_inflow_height = old_inflow_height*factor90 new_inflow_xmom = old_inflow_xmom*factor91 new_inflow_ymom = old_inflow_ymom*factor92 93 94 self.inflow.set_heights(new_inflow_height)95 96 #inflow.set_xmoms(Q/inflow.get_area())97 #inflow.set_ymoms(0.0)98 99 100 self.inflow.set_xmoms(new_inflow_xmom)101 self.inflow.set_ymoms(new_inflow_ymom)102 103 104 loss = (old_inflow_height - new_inflow_height)*self.inflow.get_area()105 106 107 # set outflow108 if old_inflow_height > 0.0 :109 timestep_star = timestep*new_inflow_height/old_inflow_height110 else:111 timestep_star = 0.0112 113 114 outflow_extra_height = Q*timestep_star/self.outflow.get_area()115 outflow_direction = - self.outflow.outward_culvert_vector116 outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction117 118 119 gain = outflow_extra_height*self.outflow.get_area()120 121 #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star122 #print ' ', loss, gain123 124 # Stats125 self.discharge = Q#outflow_extra_height*self.outflow.get_area()/timestep126 self.velocity = barrel_speed#self.discharge/outlet_depth/self.width127 128 new_outflow_height = self.outflow.get_average_height() + outflow_extra_height129 130 if self.use_momentum_jet :131 # FIXME (SR) Review momentum to account for possible hydraulic jumps at outlet132 #new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]133 #new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]134 135 new_outflow_xmom = barrel_speed*new_outflow_height*outflow_direction[0]136 new_outflow_ymom = barrel_speed*new_outflow_height*outflow_direction[1]137 138 else:139 #new_outflow_xmom = outflow.get_average_xmom()140 #new_outflow_ymom = outflow.get_average_ymom()141 142 new_outflow_xmom = 0.0143 new_outflow_ymom = 0.0144 145 146 self.outflow.set_heights(new_outflow_height)147 self.outflow.set_xmoms(new_outflow_xmom)148 self.outflow.set_ymoms(new_outflow_ymom)149 150 151 def __determine_inflow_outflow(self):152 # Determine flow direction based on total energy difference153 154 if self.use_velocity_head:155 self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()156 else:157 self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()158 159 160 self.inflow = self.inlets[0]161 self.outflow = self.inlets[1]162 163 164 if self.delta_total_energy < 0:165 self.inflow = self.inlets[1]166 self.outflow = self.inlets[0]167 self.delta_total_energy = -self.delta_total_energy168 68 169 69 170 def __discharge_routine(self):70 def discharge_routine(self): 171 71 172 72 local_debug ='false' -
trunk/anuga_core/source/anuga/structures/boyd_pipe_operator.py
r8002 r8008 59 59 self.inlets = self.get_inlets() 60 60 61 62 61 # Stats 63 62 … … 65 64 self.velocity = 0.0 66 65 67 68 def __call__(self):69 70 timestep = self.domain.get_timestep()71 72 self.__determine_inflow_outflow()73 74 Q, barrel_speed, outlet_depth = self.__discharge_routine()75 76 #inflow = self.routine.get_inflow()77 #outflow = self.routine.get_outflow()78 79 old_inflow_height = self.inflow.get_average_height()80 old_inflow_xmom = self.inflow.get_average_xmom()81 old_inflow_ymom = self.inflow.get_average_ymom()82 83 if old_inflow_height > 0.0 :84 Qstar = Q/old_inflow_height85 else:86 Qstar = 0.087 88 factor = 1.0/(1.0 + Qstar*timestep/self.inflow.get_area())89 90 new_inflow_height = old_inflow_height*factor91 new_inflow_xmom = old_inflow_xmom*factor92 new_inflow_ymom = old_inflow_ymom*factor93 94 95 self.inflow.set_heights(new_inflow_height)96 97 #inflow.set_xmoms(Q/inflow.get_area())98 #inflow.set_ymoms(0.0)99 100 101 self.inflow.set_xmoms(new_inflow_xmom)102 self.inflow.set_ymoms(new_inflow_ymom)103 104 105 loss = (old_inflow_height - new_inflow_height)*self.inflow.get_area()106 107 108 # set outflow109 if old_inflow_height > 0.0 :110 timestep_star = timestep*new_inflow_height/old_inflow_height111 else:112 timestep_star = 0.0113 114 115 outflow_extra_height = Q*timestep_star/self.outflow.get_area()116 outflow_direction = - self.outflow.outward_culvert_vector117 outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction118 119 120 gain = outflow_extra_height*self.outflow.get_area()121 122 #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star123 #print ' ', loss, gain124 125 # Stats126 self.discharge = Q#outflow_extra_height*self.outflow.get_area()/timestep127 self.velocity = barrel_speed#self.discharge/outlet_depth/self.width128 129 new_outflow_height = self.outflow.get_average_height() + outflow_extra_height130 131 if self.use_momentum_jet :132 # FIXME (SR) Review momentum to account for possible hydraulic jumps at outlet133 #new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0]134 #new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1]135 136 new_outflow_xmom = barrel_speed*new_outflow_height*outflow_direction[0]137 new_outflow_ymom = barrel_speed*new_outflow_height*outflow_direction[1]138 139 else:140 #new_outflow_xmom = outflow.get_average_xmom()141 #new_outflow_ymom = outflow.get_average_ymom()142 143 new_outflow_xmom = 0.0144 new_outflow_ymom = 0.0145 146 147 self.outflow.set_heights(new_outflow_height)148 self.outflow.set_xmoms(new_outflow_xmom)149 self.outflow.set_ymoms(new_outflow_ymom)150 151 152 def __determine_inflow_outflow(self):153 # Determine flow direction based on total energy difference154 155 if self.use_velocity_head:156 self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy()157 else:158 self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage()159 160 161 self.inflow = self.inlets[0]162 self.outflow = self.inlets[1]163 164 165 if self.delta_total_energy < 0:166 self.inflow = self.inlets[1]167 self.outflow = self.inlets[0]168 self.delta_total_energy = -self.delta_total_energy169 170 66 171 def __discharge_routine(self):67 def discharge_routine(self): 172 68 173 69 local_debug ='false' -
trunk/anuga_core/source/anuga/structures/structure_operator.py
r8004 r8008 8 8 Sets up the geometry of problem 9 9 10 This is the base class for culverts. Inherit from this class (and overwrite11 compute_discharge method for specific subclasses)10 This is the base class for structures (culverts, pipes, bridges etc). Inherit from this class (and overwrite 11 discharge_routine method for specific subclasses) 12 12 13 13 Input: Two points, pipe_size (either diameter or width, height), … … 63 63 self.inlets.append(inlet.Inlet(self.domain, polygon1, exchange_polygon1, outward_vector1)) 64 64 65 65 66 def __call__(self): 66 67 67 pass 68 timestep = self.domain.get_timestep() 69 70 self.__determine_inflow_outflow() 71 72 Q, barrel_speed, outlet_depth = self.discharge_routine() 73 74 old_inflow_height = self.inflow.get_average_height() 75 old_inflow_xmom = self.inflow.get_average_xmom() 76 old_inflow_ymom = self.inflow.get_average_ymom() 77 78 if old_inflow_height > 0.0 : 79 Q_star = Q/old_inflow_height 80 else: 81 Q_star = 0.0 82 83 factor = 1.0/(1.0 + Q_star*timestep/self.inflow.get_area()) 84 85 new_inflow_height = old_inflow_height*factor 86 new_inflow_xmom = old_inflow_xmom*factor 87 new_inflow_ymom = old_inflow_ymom*factor 88 89 self.inflow.set_heights(new_inflow_height) 90 91 #inflow.set_xmoms(Q/inflow.get_area()) 92 #inflow.set_ymoms(0.0) 93 94 self.inflow.set_xmoms(new_inflow_xmom) 95 self.inflow.set_ymoms(new_inflow_ymom) 96 97 loss = (old_inflow_height - new_inflow_height)*self.inflow.get_area() 98 99 # set outflow 100 if old_inflow_height > 0.0 : 101 timestep_star = timestep*new_inflow_height/old_inflow_height 102 else: 103 timestep_star = 0.0 104 105 outflow_extra_height = Q*timestep_star/self.outflow.get_area() 106 outflow_direction = - self.outflow.outward_culvert_vector 107 outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction 108 109 gain = outflow_extra_height*self.outflow.get_area() 110 111 #print Q, Q*timestep, barrel_speed, outlet_depth, Qstar, factor, timestep_star 112 #print ' ', loss, gain 113 114 # Stats 115 self.discharge = Q#outflow_extra_height*self.outflow.get_area()/timestep 116 self.velocity = barrel_speed#self.discharge/outlet_depth/self.width 117 118 new_outflow_height = self.outflow.get_average_height() + outflow_extra_height 119 120 if self.use_momentum_jet : 121 # FIXME (SR) Review momentum to account for possible hydraulic jumps at outlet 122 #new_outflow_xmom = outflow.get_average_xmom() + outflow_extra_momentum[0] 123 #new_outflow_ymom = outflow.get_average_ymom() + outflow_extra_momentum[1] 124 125 new_outflow_xmom = barrel_speed*new_outflow_height*outflow_direction[0] 126 new_outflow_ymom = barrel_speed*new_outflow_height*outflow_direction[1] 127 128 else: 129 #new_outflow_xmom = outflow.get_average_xmom() 130 #new_outflow_ymom = outflow.get_average_ymom() 131 132 new_outflow_xmom = 0.0 133 new_outflow_ymom = 0.0 134 135 self.outflow.set_heights(new_outflow_height) 136 self.outflow.set_xmoms(new_outflow_xmom) 137 self.outflow.set_ymoms(new_outflow_ymom) 138 139 140 def __determine_inflow_outflow(self): 141 # Determine flow direction based on total energy difference 142 143 if self.use_velocity_head: 144 self.delta_total_energy = self.inlets[0].get_enquiry_total_energy() - self.inlets[1].get_enquiry_total_energy() 145 else: 146 self.delta_total_energy = self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage() 147 148 149 self.inflow = self.inlets[0] 150 self.outflow = self.inlets[1] 151 152 153 if self.delta_total_energy < 0: 154 self.inflow = self.inlets[1] 155 self.outflow = self.inlets[0] 156 self.delta_total_energy = -self.delta_total_energy 157 68 158 69 159 def __create_exchange_polygons(self): … … 124 214 msg = 'Enquiry point falls inside an exchange polygon.' 125 215 assert not anuga.inside_polygon(ep, polygon), msg 126 127 128 #print ' outflow volume ',outflow.get_total_water_volume() 129 216 217 218 def discharge_routine(self): 219 220 pass 221 130 222 131 223 def print_stats(self): … … 165 257 message += 'Inlet Driving Energy %.2f\n' % self.driving_energy 166 258 message += 'delta total energy %.2f\n' % self.delta_total_energy 167 # message += 'Net boundary flow by tags [m^3/s]\n'168 # for tag in boundary_flows:169 # message += ' %s [m^3/s]: %.2f\n' % (tag, boundary_flows[tag])170 #171 # message += 'Total net boundary flow [m^3/s]: %.2f\n' % \172 # (total_boundary_inflow + total_boundary_outflow)173 # message += 'Total volume in domain [m^3]: %.2f\n' % \174 # self.compute_total_volume()175 #176 # # The go through explicit forcing update and record the rate of change177 # # for stage and178 # # record into forcing_inflow and forcing_outflow. Finally compute179 # # integral of depth to obtain total volume of domain.180 #181 # FIXME(Ole): This part is not yet done.182 259 183 260 return message 184 261 262 185 263 def get_inlets(self): 186 264 -
trunk/anuga_core/source/anuga/structures/testing_wide_bridge.py
r8005 r8008 255 255 #------------------------------------------------------------------------------ 256 256 257 for t in domain.evolve(yieldstep = 1, finaltime = 10 ):257 for t in domain.evolve(yieldstep = 1, finaltime = 100): 258 258 print domain.timestepping_statistics() 259 259 print domain.volumetric_balance_statistics()
Note: See TracChangeset
for help on using the changeset viewer.