Changeset 7326
- Timestamp:
- Aug 5, 2009, 8:32:48 PM (16 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/fit_interpolate/interpolate.py
r7317 r7326 767 767 # Check temporal info 768 768 time = ensure_numeric(time) 769 769 770 if not num.alltrue(time[1:] - time[:-1] >= 0): 770 771 # This message is time consuming to form due to the conversion of -
anuga_core/source/anuga/interface.py
r7325 r7326 14 14 from anuga.shallow_water import Field_boundary 15 15 from anuga.shallow_water import Transmissive_stage_zero_momentum_boundary 16 from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary 16 from anuga.shallow_water import Transmissive_momentum_set_stage_boundary 17 from anuga.shallow_water import Transmissive_n_momentum_zero_t_momentum_set_stage_boundary 17 18 18 19 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions import Time_boundary -
anuga_core/source/anuga/shallow_water/__init__.py
r6928 r7326 14 14 Field_boundary,\ 15 15 Transmissive_stage_zero_momentum_boundary,\ 16 Transmissive_n_momentum_zero_t_momentum_set_stage_boundary,\ 16 17 AWI_boundary 18 17 19 18 20 -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r7325 r7326 1285 1285 1286 1286 ## 1287 # @brief Instantiate a Reflective_boundary.1287 # @brief Instantiate a Transmissive_momentum_set_stage_boundary. 1288 1288 # @param domain 1289 1289 # @param function … … 1337 1337 1338 1338 q[0] = x 1339 1339 1340 return q 1340 1341 … … 1353 1354 pass 1354 1355 1356 1357 ## 1358 # @brief Class for a transmissive boundary. 1359 # @note Inherits from Boundary. 1360 class Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(Boundary): 1361 """Returns the same normal momentum as that 1362 present in neighbour volume edge. Zero out the tangential momentum. 1363 Sets stage by specifying a function f of time which may either be a 1364 vector function or a scalar function 1365 1366 Example: 1367 1368 def waveform(t): 1369 return sea_level + normalized_amplitude/cosh(t-25)**2 1370 1371 Bts = Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(domain, waveform) 1372 1373 Underlying domain must be specified when boundary is instantiated 1374 """ 1375 1376 ## 1377 # @brief Instantiate a Transmissive_n_momentum_zero_t_momentum_set_stage_boundary. 1378 # @param domain 1379 # @param function 1380 def __init__(self, domain=None, function=None): 1381 Boundary.__init__(self) 1382 1383 if domain is None: 1384 msg = 'Domain must be specified for this type boundary' 1385 raise Exception, msg 1386 1387 if function is None: 1388 msg = 'Function must be specified for this type boundary' 1389 raise Exception, msg 1390 1391 self.domain = domain 1392 self.function = function 1393 1394 ## 1395 # @brief Return a representation of this instance. 1396 def __repr__(self): 1397 return 'Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(%s)' %self.domain 1398 1399 ## 1400 # @brief Calculate transmissive results. 1401 # @param vol_id 1402 # @param edge_id 1403 def evaluate(self, vol_id, edge_id): 1404 """Transmissive_n_momentum_zero_t_momentum_set_stage_boundary 1405 return the edge momentum values of the volume they serve. 1406 """ 1407 1408 q = self.domain.get_conserved_quantities(vol_id, edge = edge_id) 1409 1410 normal = self.domain.get_normal(vol_id, edge_id) 1411 1412 1413 t = self.domain.get_time() 1414 1415 if hasattr(self.function, 'time'): 1416 # Roll boundary over if time exceeds 1417 while t > self.function.time[-1]: 1418 msg = 'WARNING: domain time %.2f has exceeded' % t 1419 msg += 'time provided in ' 1420 msg += 'transmissive_momentum_set_stage_boundary object.\n' 1421 msg += 'I will continue, reusing the object from t==0' 1422 log.critical(msg) 1423 t -= self.function.time[-1] 1424 1425 value = self.function(t) 1426 try: 1427 x = float(value) 1428 except: 1429 x = float(value[0]) 1430 1431 ## import math 1432 ## if vol_id == 9433: 1433 ## print 'vol_id = ',vol_id, ' edge_id = ',edge_id, 'q = ', q, ' x = ',x 1434 ## print 'normal = ', normal 1435 ## print 'n . p = ', (normal[0]*q[1] + normal[1]*q[2]) 1436 ## print 't . p = ', (normal[1]*q[1] - normal[0]*q[2]) 1437 1438 1439 q[0] = x 1440 ndotq = (normal[0]*q[1] + normal[1]*q[2]) 1441 q[1] = normal[0]*ndotq 1442 q[2] = normal[1]*ndotq 1443 1444 1445 return q 1355 1446 1356 1447 ##
Note: See TracChangeset
for help on using the changeset viewer.