 Timestamp:
 Aug 31, 2010, 7:49:21 AM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/anuga_core/source/anuga/structures/culvert_operator.py
r7980 r7981 47 47 timestep = self.domain.get_timestep() 48 48 49 Q, barrel_speed, culvert_outlet_depth = self.routine()49 Q, barrel_speed, outlet_depth = self.routine() 50 50 51 51 inflow = self.routine.get_inflow() 52 52 outflow = self.routine.get_outflow() 53 53 54 55 old_inflow_height = inflow.get_average_height() 56 old_inflow_xmom = inflow.get_average_xmom() 57 old_inflow_ymom = inflow.get_average_ymom() 58 59 if old_inflow_height > 0.0 : 60 Qstar = Q/old_inflow_height/inflow.get_area() 61 else: 62 Qstar = 0.0 63 64 factor = 1.0/(1.0 + Qstar*timestep) 65 66 67 68 new_inflow_height = old_inflow_height*factor 69 new_inflow_xmom = old_inflow_xmom*factor 70 new_inflow_ymom = old_inflow_ymom*factor 71 72 73 inflow.set_heights(new_inflow_height) 74 inflow.set_xmoms(new_inflow_xmom) 75 inflow.set_ymoms(new_inflow_ymom) 76 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 86 87 outflow_extra_height = Q*timestep_star/outflow.get_area() 54 88 outflow_direction =  outflow.outward_culvert_vector 55 56 outflow_momentum_flux = barrel_speed**2*culvert_outlet_depth*outflow_direction 57 58 59 print Q, barrel_speed, culvert_outlet_depth, outflow_momentum_flux 60 61 #FIXME (SR) Check whether we need to mult/divide by inlet area 62 inflow_transfer = Q*timestep/inflow.get_area() 63 64 outflow_transfer = Q*timestep/outflow.get_area() 65 66 67 68 inflow.set_heights(inflow.get_average_height()  inflow_transfer) 69 70 inflow.set_xmoms(0.0) 71 inflow.set_ymoms(0.0) 72 73 #u = outflow.get_xvelocities() 74 #v = outflow.get_yvelocities() 75 76 outflow.set_heights(outflow.get_average_height() + outflow_transfer) 77 #outflow.set_xmoms(outflow.get_xmoms() + timestep*outflow_momentum_flux[0] ) 78 #outflow.set_ymoms(outflow.get_ymoms() + timestep*outflow_momentum_flux[1] ) 89 outflow_extra_momentum = outflow_extra_height*barrel_speed*outflow_direction 90 91 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] ) 79 95 80 96 def print_stats(self):
Note: See TracChangeset
for help on using the changeset viewer.