Changeset 2494
- Timestamp:
- Mar 8, 2006, 2:26:58 PM (19 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
development/euler/euler.py
r2229 r2494 139 139 140 140 141 def evolve(self, yieldstep = None, finaltime = None, 141 def evolve(self, 142 yieldstep = None, 143 finaltime = None, 144 duration = None, 142 145 skip_initial_step = False): 146 143 147 """Specialisation of basic evolve method from parent class 144 148 """ … … 170 174 171 175 #Call basic machinery from parent class 172 for t in Generic_domain.evolve(self, yieldstep, finaltime, 173 skip_initial_step): 176 #for t in Generic_domain.evolve(self, yieldstep, finaltime, 177 # skip_initial_step): 178 179 for t in Generic_domain.evolve(self, 180 yieldstep=yieldstep, 181 finaltime=finaltime, 182 duration=duration, 183 skip_initial_step=skip_initial_step): 174 184 #Real time viz 175 185 if self.visualise is True: … … 295 305 """ 296 306 297 from config import g, epsilon307 from pyvolution.config import g, epsilon 298 308 from math import sqrt 299 309 from Numeric import array -
development/euler/test_euler.py
r2229 r2494 4 4 from math import sqrt, pi 5 5 6 from config import g, epsilon6 from pyvolution.config import g, epsilon 7 7 from Numeric import allclose, array, zeros, ones, Float, take 8 8 from shallow_water import * -
inundation/pyvolution/advection.py
r2152 r2494 339 339 340 340 341 def evolve(self, yieldstep = None, finaltime = None): 341 342 def evolve(self, 343 yieldstep = None, 344 finaltime = None, 345 duration = None, 346 skip_initial_step = False): 347 342 348 """Specialisation of basic evolve method from parent class 343 349 """ … … 354 360 355 361 #Call basic machinery from parent class 356 for t in Generic_domain.evolve(self, yieldstep, finaltime): 362 for t in Generic_domain.evolve(self, 363 yieldstep=yieldstep, 364 finaltime=finaltime, 365 duration=duration, 366 skip_initial_step=skip_initial_step): 367 368 357 369 358 370 -
inundation/pyvolution/domain.py
r2491 r2494 487 487 #Main components of evolve 488 488 489 def evolve(self, yieldstep = None, finaltime = None, 489 def evolve(self, 490 yieldstep = None, 491 finaltime = None, 492 duration = None, 490 493 skip_initial_step = False): 491 """Evolve model from time=0.0 to finaltime yielding results 492 every yieldstep. 493 494 Internally, smaller timesteps may be taken. 494 """Evolve model through time starting from self.starttime. 495 496 497 yieldstep: Interval between yields where results are stored, 498 statistics written and domain inspected or 499 possibly modified. If omitted the internal predefined 500 max timestep is used. 501 Internally, smaller timesteps may be taken. 502 503 duration: Duration of simulation 504 505 finaltime: Time where simulation should end 506 507 If both duration and finaltime are given an exception is thrown. 508 509 510 skip_initial_step: Boolean flag that decides whether the first 511 yield step is skipped or not. This is useful for example to avoid 512 duplicate steps when multiple evolve processes are dove tailed. 513 495 514 496 515 Evolve is implemented as a generator and is to be called as such, e.g. 497 516 498 for t in domain.evolve( timestep,yieldstep, finaltime):517 for t in domain.evolve(yieldstep, finaltime): 499 518 <Do something with domain and t> 519 520 521 All times are given in seconds 500 522 501 523 """ … … 506 528 msg = 'Boundary tags must be bound to boundary objects before evolving system, ' 507 529 msg += 'e.g. using the method set_boundary.\n' 508 msg += 'This system has the boundary tags %s ' %self.get_boundary_tags() 530 msg += 'This system has the boundary tags %s '\ 531 %self.get_boundary_tags() 509 532 assert hasattr(self, 'boundary_objects'), msg 510 533 … … 519 542 520 543 544 if finaltime is not None and duration is not None: 545 print 'F', finaltime, duration 546 msg = 'Only one of finaltime and duration may be specified' 547 raise msg 548 else: 549 if finaltime is not None: 550 self.finaltime = float(finaltime) 551 if duration is not None: 552 self.finaltime = self.starttime + float(duration) 553 554 555 556 521 557 self.yieldtime = 0.0 #Time between 'yields' 522 558 … … 524 560 self.min_timestep = max_timestep 525 561 self.max_timestep = min_timestep 526 self.finaltime = finaltime527 562 self.number_of_steps = 0 528 563 self.number_of_first_order_steps = 0 -
inundation/pyvolution/shallow_water.py
r2320 r2494 213 213 214 214 215 def evolve(self, yieldstep = None, finaltime = None, 215 def evolve(self, 216 yieldstep = None, 217 finaltime = None, 218 duration = None, 216 219 skip_initial_step = False): 217 220 """Specialisation of basic evolve method from parent class … … 251 254 252 255 #Call basic machinery from parent class 253 for t in Generic_Domain.evolve(self, yieldstep, finaltime, 254 skip_initial_step): 256 for t in Generic_Domain.evolve(self, 257 yieldstep=yieldstep, 258 finaltime=finaltime, 259 duration=duration, 260 skip_initial_step=skip_initial_step): 255 261 #Real time viz 256 262 if self.visualise is True:
Note: See TracChangeset
for help on using the changeset viewer.