Changeset 9233
- Timestamp:
- Jul 2, 2014, 1:33:17 PM (10 years ago)
- Location:
- trunk/anuga_core/source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/structures/boyd_box_operator.py
r9148 r9233 1 1 import anuga 2 2 import math 3 import numpy 3 4 4 5 … … 129 130 130 131 # delta_total_energy will determine which inlet is inflow 132 # Update 02/07/2014 -- now using smooth_delta_total_energy 131 133 if self.use_velocity_head: 132 134 self.delta_total_energy = \ … … 136 138 self.inlets[0].get_enquiry_stage() - self.inlets[1].get_enquiry_stage() 137 139 138 self.inflow = self.inlets[0] 139 self.outflow = self.inlets[1] 140 141 if self.delta_total_energy < 0: 140 # Compute 'smoothed' total energy 141 forward_Euler_smooth=True 142 if(forward_Euler_smooth): 143 # To avoid 'overshoot' we ensure ts<1. 144 if(self.domain.timestep>0.): 145 ts=self.domain.timestep/max(self.domain.timestep, self.smoothing_timescale,1.0e-06) 146 else: 147 # Without this the unit tests with no smoothing fail [since they have domain.timestep=0.] 148 # Note though the discontinuous behaviour as domain.timestep-->0. from above 149 ts=1.0 150 self.smooth_delta_total_energy=self.smooth_delta_total_energy+\ 151 ts*(self.delta_total_energy-self.smooth_delta_total_energy) 152 else: 153 # Use backward euler -- the 'sensible' ts limitation is different in this case 154 # ts --> Inf is reasonable and corresponds to the 'nosmoothing' case 155 ts=self.domain.timestep/max(self.smoothing_timescale, 1.0e-06) 156 self.smooth_delta_total_energy = (self.smooth_delta_total_energy+ts*(self.delta_total_energy))/(1.+ts) 157 158 if self.smooth_delta_total_energy >= 0.: 159 self.inflow = self.inlets[0] 160 self.outflow = self.inlets[1] 161 self.delta_total_energy=self.smooth_delta_total_energy 162 else: 142 163 self.inflow = self.inlets[1] 143 164 self.outflow = self.inlets[0] 144 self.delta_total_energy = -self. delta_total_energy165 self.delta_total_energy = -self.smooth_delta_total_energy 145 166 146 167 147 148 149 150 168 # Only calculate flow if there is some water at the inflow inlet. 151 169 if self.inflow.get_enquiry_depth() > 0.01: #this value was 0.01: … … 193 211 sum_loss =self.sum_loss, 194 212 manning =self.manning) 213 # 214 # Update 02/07/2014 -- using time-smoothed discharge 215 Qsign=numpy.sign(self.smooth_delta_total_energy) #(self.outflow_index-self.inflow_index) # To adjust sign of Q 216 if(forward_Euler_smooth): 217 self.smooth_Q = self.smooth_Q +ts*(Q*Qsign-self.smooth_Q) 218 else: 219 # Try implicit euler method 220 self.smooth_Q = (self.smooth_Q+ts*(Q*Qsign))/(1.+ts) 221 222 if numpy.sign(self.smooth_Q)!=Qsign: 223 # The flow direction of the 'instantaneous Q' based on the 224 # 'smoothed delta_total_energy' is not the same as the 225 # direction of smooth_Q. To prevent 'jumping around', let's 226 # set Q to zero 227 Q=0. 228 else: 229 Q = min(abs(self.smooth_Q), Q) #abs(self.smooth_Q) 230 barrel_velocity=Q/flow_area 231 195 232 else: 196 233 Q = barrel_velocity = outlet_culvert_depth = 0.0 -
trunk/anuga_core/source/anuga/utilities/spatialInputUtil.py
r9219 r9233 75 75 driver=ogr.GetDriverByName("ESRI Shapefile") 76 76 dataSrc=driver.Open(shapefile, 0) 77 #dataSrc=ogr.Open(shapefile) 77 78 layer=dataSrc.GetLayer() 78 79 … … 110 111 driver=ogr.GetDriverByName("ESRI Shapefile") 111 112 dataSrc=driver.Open(shapefile, 0) 113 #dataSrc=ogr.Open(shapefile) 112 114 layer=dataSrc.GetLayer() 113 115 … … 139 141 driver=ogr.GetDriverByName("ESRI Shapefile") 140 142 dataSrc=driver.Open(shapefile, 0) 143 #dataSrc=ogr.Open(shapefile) 141 144 layer=dataSrc.GetLayer() 142 145 -
trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py
r9133 r9233 174 174 if(forward_Euler_smooth): 175 175 # To avoid 'overshoot' we ensure ts<1. 176 ts=self.domain.timestep/max(self.domain.timestep, self.smoothing_timescale,1.0e-06) 176 if(self.domain.timestep>0.): 177 ts=self.domain.timestep/max(self.domain.timestep, self.smoothing_timescale,1.0e-06) 178 else: 179 # This case is included in the serial version, which ensures the unit tests pass 180 # even when domain.timestep=0.0. 181 # Note though the discontinuous behaviour as domain.timestep-->0. from above 182 ts=1.0 177 183 self.smooth_delta_total_energy=self.smooth_delta_total_energy+\ 178 184 ts*(self.delta_total_energy-self.smooth_delta_total_energy) -
trunk/anuga_core/source/anuga_parallel/parallel_operator_factory.py
r9130 r9233 154 154 manning=manning, 155 155 enquiry_gap=enquiry_gap, 156 smoothing_timescale=smoothing_timescale, 156 157 use_momentum_jet=use_momentum_jet, 157 158 use_velocity_head=use_velocity_head,
Note: See TracChangeset
for help on using the changeset viewer.