Changeset 6045
- Timestamp:
- Dec 5, 2008, 11:35:49 AM (16 years ago)
- Location:
- anuga_core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/anuga_user_manual.tex
r5976 r6045 2316 2316 2317 2317 %%% 2318 \begin{classdesc}{Transmissive\_Momentum\_Set\_Stage\_boundary}{Boundary} 2318 %\begin{classdesc}{Transmissive\_Momentum\_Set\_Stage\_boundary}{Boundary} 2319 \begin{classdesc}{Transmissive\_momentum\_set\_stage\_boundary}{Boundary} 2319 2320 Module: \module{shallow\_water} 2320 2321 \label{pg: transmissive momentum set stage boundary} … … 2335 2336 2336 2337 2337 \begin{classdesc}{Dirichlet\_Discharge\_boundary}{Boundary} 2338 \begin{classdesc}{Transmissive\_stage\_zero\_momentum\_boundary}{Boundary} 2339 Module: \module{shallow\_water} 2340 \label{pg: transmissive stage zero momentum boundary} 2341 2342 This boundary returns same stage conserved quantities as 2343 those present in its neighbour volume but sets momentum to zero. 2344 The underlying domain must be specified when boundary is instantiated 2345 2346 This type of boundary is useful when stage is known at the boundary as a 2347 function of time, but momentum should be set to zero. This is for example the case where a boundary is needed in the ocean on the two sides perpendicular to the coast to maintain the wave height of the incoming wave. 2348 2349 This class is specific to the shallow water equation as it works with the 2350 momentum quantities assumed to be the second and third conserved quantities. 2351 2352 This boundary condition should not cause the numerical instabilities seen with the transmissive momentum 2353 boundary conditions (see Page \pageref{pg: transmissive boundary} and Page \pageref{pg: transmissive momentum set stage boundary}). 2354 2355 \end{classdesc} 2356 2357 2358 \begin{classdesc}{Dirichlet\_discharge\_boundary}{Boundary} 2338 2359 Module: \module{shallow\_water} 2339 2360 -
anuga_core/source/anuga/shallow_water/__init__.py
r4733 r6045 10 10 Transmissive_boundary, Reflective_boundary,\ 11 11 Dirichlet_boundary, Time_boundary, File_boundary,\ 12 Transmissive_ Momentum_Set_Stage_boundary,\13 Dirichlet_ Discharge_boundary,\12 Transmissive_momentum_set_stage_boundary,\ 13 Dirichlet_discharge_boundary,\ 14 14 Field_boundary 15 15 16 16 17 # FIXME (Ole): Deprecate 18 from shallow_water_domain import Transmissive_Momentum_Set_Stage_boundary 19 from shallow_water_domain import Dirichlet_Discharge_boundary 20 -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r6006 r6045 1108 1108 1109 1109 1110 class Transmissive_Momentum_Set_Stage_boundary(Boundary): 1110 1111 class Transmissive_momentum_set_stage_boundary(Boundary): 1111 1112 """Returns same momentum conserved quantities as 1112 1113 those present in its neighbour volume. … … 1119 1120 return sea_level + normalized_amplitude/cosh(t-25)**2 1120 1121 1121 Bts = Transmissive_ Momentum_Set_Stage_boundary(domain, waveform)1122 Bts = Transmissive_momentum_set_stage_boundary(domain, waveform) 1122 1123 1123 1124 … … 1140 1141 1141 1142 def __repr__(self): 1142 return 'Transmissive_ Momentum_Set_Stage_boundary(%s)' %self.domain1143 return 'Transmissive_momentum_set_stage_boundary(%s)' %self.domain 1143 1144 1144 1145 def evaluate(self, vol_id, edge_id): 1145 """Transmissive Momentum Set Stage boundaries return the edge momentum1146 """Transmissive momentum set stage boundaries return the edge momentum 1146 1147 values of the volume they serve. 1147 1148 """ … … 1182 1183 1183 1184 1184 1185 class Dirichlet_Discharge_boundary(Boundary): 1185 # Backward compatibility 1186 # FIXME(Ole): Deprecate 1187 class Transmissive_Momentum_Set_Stage_boundary(Transmissive_momentum_set_stage_boundary): 1188 pass 1189 1190 1191 1192 class Transmissive_stage_zero_momentum_boundary(Boundary): 1193 """Return same stage as those present in its neighbour volume. Set momentum to zero. 1194 1195 Underlying domain must be specified when boundary is instantiated 1196 """ 1197 1198 def __init__(self, domain=None): 1199 Boundary.__init__(self) 1200 1201 if domain is None: 1202 msg = 'Domain must be specified for ' 1203 msg += 'Transmissive_stage_zero_momentum boundary' 1204 raise Exception, msg 1205 1206 self.domain = domain 1207 1208 def __repr__(self): 1209 return 'Transmissive_stage_zero_momentum_boundary(%s)' %self.domain 1210 1211 def evaluate(self, vol_id, edge_id): 1212 """Transmissive boundaries return the edge values 1213 of the volume they serve. 1214 """ 1215 1216 q = self.domain.get_conserved_quantities(vol_id, edge=edge_id) 1217 1218 q[1] = q[2] = 0.0 1219 return q 1220 1221 1222 1223 class Dirichlet_discharge_boundary(Boundary): 1186 1224 """ 1187 1225 Sets stage (stage0) … … 1191 1229 """ 1192 1230 1193 def __init__(self, domain =None, stage0=None, wh0=None):1231 def __init__(self, domain=None, stage0=None, wh0=None): 1194 1232 Boundary.__init__(self) 1195 1233 … … 1229 1267 1230 1268 1269 1270 # Backward compatibility 1271 # FIXME(Ole): Deprecate 1272 class Dirichlet_Discharge_boundary(Dirichlet_discharge_boundary): 1273 pass 1274 1275 1276 1277 1278 1231 1279 class Field_boundary(Boundary): 1232 1280 """Set boundary from given field represented in an sww file containing values -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r6002 r6045 558 558 559 559 560 560 561 562 def test_boundary_conditionsIII(self): 563 """test_boundary_conditionsIII 564 565 Test Transmissive_stage_zero_momentum_boundary 566 """ 567 568 a = [0.0, 0.0] 569 b = [0.0, 2.0] 570 c = [2.0,0.0] 571 d = [0.0, 4.0] 572 e = [2.0, 2.0] 573 f = [4.0,0.0] 574 575 points = [a, b, c, d, e, f] 576 #bac, bce, ecf, dbe 577 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4] ] 578 boundary = { (0, 0): 'Third', 579 (0, 2): 'First', 580 (2, 0): 'Second', 581 (2, 1): 'Second', 582 (3, 1): 'Second', 583 (3, 2): 'Third'} 584 585 586 domain = Domain(points, vertices, boundary) 587 domain.check_integrity() 588 589 590 domain.set_quantity('stage', [[1,2,3], [5,5,5], 591 [0,0,9], [-6, 3, 3]]) 592 593 domain.set_quantity('xmomentum', [[1,1,1], [2,2,2], 594 [3,3,3], [4, 4, 4]]) 595 596 domain.set_quantity('ymomentum', [[10,10,10], [20,20,20], 597 [30,30,30], [40, 40, 40]]) 598 599 600 D = Dirichlet_boundary([5,2,1]) 601 T = Transmissive_stage_zero_momentum_boundary(domain) 602 R = Reflective_boundary(domain) 603 domain.set_boundary( {'First': D, 'Second': T, 'Third': R}) 604 605 domain.update_boundary() 606 607 # Stage 608 assert domain.quantities['stage'].boundary_values[0] == 2.5 609 assert domain.quantities['stage'].boundary_values[0] ==\ 610 domain.get_conserved_quantities(0, edge=0)[0] #Reflective (2.5) 611 assert domain.quantities['stage'].boundary_values[1] == 5. #Dirichlet 612 assert domain.quantities['stage'].boundary_values[2] ==\ 613 domain.get_conserved_quantities(2, edge=0)[0] #Transmissive (4.5) 614 assert domain.quantities['stage'].boundary_values[3] ==\ 615 domain.get_conserved_quantities(2, edge=1)[0] #Transmissive (4.5) 616 assert domain.quantities['stage'].boundary_values[4] ==\ 617 domain.get_conserved_quantities(3, edge=1)[0] #Transmissive (-1.5) 618 assert domain.quantities['stage'].boundary_values[5] ==\ 619 domain.get_conserved_quantities(3, edge=2)[0] #Reflective (-1.5) 620 621 # Xmomentum 622 assert domain.quantities['xmomentum'].boundary_values[0] == 1.0 #Reflective 623 assert domain.quantities['xmomentum'].boundary_values[1] == 2. #Dirichlet 624 assert domain.quantities['xmomentum'].boundary_values[2] == 0.0 625 assert domain.quantities['xmomentum'].boundary_values[3] == 0.0 626 assert domain.quantities['xmomentum'].boundary_values[4] == 0.0 627 assert domain.quantities['xmomentum'].boundary_values[5] == -4.0 #Reflective 628 629 # Ymomentum 630 assert domain.quantities['ymomentum'].boundary_values[0] == -10.0 #Reflective 631 assert domain.quantities['ymomentum'].boundary_values[1] == 1. #Dirichlet 632 assert domain.quantities['ymomentum'].boundary_values[2] == 0.0 633 assert domain.quantities['ymomentum'].boundary_values[3] == 0.0 634 assert domain.quantities['ymomentum'].boundary_values[4] == 0.0 635 assert domain.quantities['ymomentum'].boundary_values[5] == 40. #Reflective 636 637 638 561 639 562 640 def test_boundary_condition_time(self):
Note: See TracChangeset
for help on using the changeset viewer.