Changeset 8064
- Timestamp:
- Nov 3, 2010, 1:58:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py
r8023 r8064 499 499 """Get the absolute model time (seconds).""" 500 500 501 return self.time + self.starttime 502 501 return self.time 503 502 504 503 ## … … 1016 1015 1017 1016 model_time = self.get_time() 1017 1018 1018 if self.recorded_min_timestep == self.recorded_max_timestep: 1019 1019 msg += 'Time = %.4f, delta t = %.8f, steps=%d' \ … … 1225 1225 # Observe time interval restriction if any 1226 1226 if self.monitor_time_interval is not None and\ 1227 (self. time< self.monitor_time_interval[0] or\1228 self. time> self.monitor_time_interval[1]):1227 (self.get_time() < self.monitor_time_interval[0] or\ 1228 self.get_time() > self.monitor_time_interval[1]): 1229 1229 return 1230 1230 … … 1249 1249 maxloc = Q.get_maximum_location() 1250 1250 info_block['max_location'] = maxloc 1251 info_block['max_time'] = self. time1251 info_block['max_time'] = self.get_time() 1252 1252 1253 1253 # Update minimum … … 1258 1258 minloc = Q.get_minimum_location() 1259 1259 info_block['min_location'] = minloc 1260 info_block['min_time'] = self. time1260 info_block['min_time'] = self.get_time() 1261 1261 1262 1262 ## … … 1428 1428 assert hasattr(self, 'boundary_objects'), msg 1429 1429 1430 self.set_time(self.get_starttime()) 1431 1430 1432 if yieldstep is None: 1431 1433 yieldstep = self.evolve_max_timestep … … 1445 1447 1446 1448 N = len(self) # Number of triangles 1447 self.yieldtime = self. time+ yieldstep # set next yield time1449 self.yieldtime = self.get_time() + yieldstep # set next yield time 1448 1450 1449 1451 # Initialise interval of timestep sizes (for reporting only) … … 1467 1469 self.update_extrema() 1468 1470 1469 1470 1471 1471 # Or maybe restore from latest checkpoint 1472 1472 if self.checkpoint is True: … … 1474 1474 1475 1475 if skip_initial_step is False: 1476 yield(self. time) # Yield initial values1476 yield(self.get_time()) # Yield initial values 1477 1477 1478 1478 while True: 1479 1479 1480 initial_time = self. time1480 initial_time = self.get_time() 1481 1481 1482 1482 #========================================== … … 1484 1484 #========================================== 1485 1485 if self.get_timestepping_method() == 'euler': 1486 self.evolve_one_euler_step(yieldstep, finaltime)1486 self.evolve_one_euler_step(yieldstep, self.finaltime) 1487 1487 1488 1488 elif self.get_timestepping_method() == 'rk2': 1489 self.evolve_one_rk2_step(yieldstep, finaltime)1489 self.evolve_one_rk2_step(yieldstep, self.finaltime) 1490 1490 1491 1491 elif self.get_timestepping_method() == 'rk3': 1492 self.evolve_one_rk3_step(yieldstep, finaltime)1492 self.evolve_one_rk3_step(yieldstep, self.finaltime) 1493 1493 1494 1494 #========================================== … … 1503 1503 1504 1504 # Update time 1505 self. time = initial_time + self.timestep1505 self.set_time(initial_time + self.timestep) 1506 1506 1507 1507 # Update vertex and edge values … … 1519 1519 1520 1520 # Yield results 1521 if finaltime is not None and self.time >= finaltime-epsilon: 1522 if self.time > finaltime: 1521 if self.finaltime is not None and self.get_time() >= self.finaltime-epsilon: 1522 1523 if self.get_time() > self.finaltime: 1523 1524 # FIXME (Ole, 30 April 2006): Do we need this check? 1524 1525 # Probably not (Ole, 18 September 2008). 1525 1526 # Now changed to Exception. 1526 msg = ('WARNING (domain.py): time overshot finaltime. ' 1527 'Contact Ole.Nielsen@ga.gov.au') 1527 msg = ('WARNING (domain.py): time overshot finaltime. ') 1528 1528 raise Exception, msg 1529 1529 1530 1530 # Log and then Yield final time and stop 1531 self. time = finaltime1531 self.set_time(self.finaltime) 1532 1532 self.log_operator_timestepping_statistics() 1533 yield(self. time)1533 yield(self.get_time()) 1534 1534 break 1535 1535 1536 1536 # if we are at the next yield point 1537 if self. time>= self.yieldtime:1537 if self.get_time() >= self.yieldtime: 1538 1538 # Yield (intermediate) time and allow inspection of domain 1539 1539 if self.checkpoint is True: … … 1543 1543 # Log and then Pass control on to outer loop for more specific actions 1544 1544 self.log_operator_timestepping_statistics() 1545 yield(self. time)1545 yield(self.get_time()) 1546 1546 1547 1547 # Reinitialise … … 1614 1614 1615 1615 # Update time 1616 self. time += self.timestep1616 self.set_time(self.get_time() + self.timestep) 1617 1617 1618 1618 # Update vertex and edge values … … 1663 1663 self.backup_conserved_quantities() 1664 1664 1665 initial_time = self. time1665 initial_time = self.get_time() 1666 1666 1667 1667 ###### … … 1685 1685 1686 1686 # Update time 1687 self. time += self.timestep1687 self.set_time(self.time + self.timestep) 1688 1688 1689 1689 # Update vertex and edge values … … 1721 1721 1722 1722 # Set substep time 1723 self. time = initial_time + self.timestep*0.51723 self.set_time(initial_time + self.timestep*0.5) 1724 1724 1725 1725 # Update vertex and edge values … … 1754 1754 1755 1755 # Set new time 1756 self. time = initial_time + self.timestep1756 self.set_time(initial_time + self.timestep) 1757 1757 1758 1758 … … 1941 1941 1942 1942 # Ensure that final time is not exceeded 1943 if finaltime is not None and self. time+ timestep > finaltime :1944 timestep = finaltime -self.time1943 if finaltime is not None and self.get_time() + timestep > finaltime : 1944 timestep = finaltime - self.get_time() 1945 1945 1946 1946 # Ensure that model time is aligned with yieldsteps 1947 if self. time+ timestep > self.yieldtime:1948 timestep = self.yieldtime - self. time1947 if self.get_time() + timestep > self.yieldtime: 1948 timestep = self.yieldtime - self.get_time() 1949 1949 1950 1950 self.timestep = timestep … … 2075 2075 for i in range(self.number_of_full_triangles): 2076 2076 if self.max_speed[i] > bins[-1]: 2077 msg = 'Time=%f: Ignoring isolated high ' % self. time2077 msg = 'Time=%f: Ignoring isolated high ' % self.get_time() 2078 2078 msg += 'speed triangle ' 2079 2079 msg += '#%d of %d with max speed=%f' \
Note: See TracChangeset
for help on using the changeset viewer.