Changeset 2494


Ignore:
Timestamp:
Mar 8, 2006, 2:26:58 PM (19 years ago)
Author:
ole
Message:

Introduced duration keyword in evolve and updated dependencies

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • development/euler/euler.py

    r2229 r2494  
    139139
    140140
    141     def evolve(self, yieldstep = None, finaltime = None,
     141    def evolve(self,
     142               yieldstep = None,
     143               finaltime = None,
     144               duration = None,               
    142145               skip_initial_step = False):
     146       
    143147        """Specialisation of basic evolve method from parent class
    144148        """
     
    170174
    171175        #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):           
    174184            #Real time viz
    175185            if self.visualise is True:
     
    295305    """
    296306
    297     from config import g, epsilon
     307    from pyvolution.config import g, epsilon
    298308    from math import sqrt
    299309    from Numeric import array
  • development/euler/test_euler.py

    r2229 r2494  
    44from math import sqrt, pi
    55
    6 from config import g, epsilon
     6from pyvolution.config import g, epsilon
    77from Numeric import allclose, array, zeros, ones, Float, take
    88from shallow_water import *
  • inundation/pyvolution/advection.py

    r2152 r2494  
    339339
    340340
    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       
    342348        """Specialisation of basic evolve method from parent class
    343349        """
     
    354360
    355361        #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
    357369
    358370
  • inundation/pyvolution/domain.py

    r2491 r2494  
    487487    #Main components of evolve
    488488
    489     def evolve(self, yieldstep = None, finaltime = None,
     489    def evolve(self,
     490               yieldstep = None,
     491               finaltime = None,
     492               duration = None,             
    490493               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
    495514
    496515        Evolve is implemented as a generator and is to be called as such, e.g.
    497516
    498         for t in domain.evolve(timestep, yieldstep, finaltime):
     517        for t in domain.evolve(yieldstep, finaltime):
    499518            <Do something with domain and t>
     519
     520
     521        All times are given in seconds       
    500522
    501523        """
     
    506528        msg = 'Boundary tags must be bound to boundary objects before evolving system, '
    507529        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()
    509532        assert hasattr(self, 'boundary_objects'), msg
    510533
     
    519542
    520543
     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
    521557        self.yieldtime = 0.0 #Time between 'yields'
    522558
     
    524560        self.min_timestep = max_timestep
    525561        self.max_timestep = min_timestep
    526         self.finaltime = finaltime
    527562        self.number_of_steps = 0
    528563        self.number_of_first_order_steps = 0
  • inundation/pyvolution/shallow_water.py

    r2320 r2494  
    213213
    214214
    215     def evolve(self, yieldstep = None, finaltime = None,
     215    def evolve(self,
     216               yieldstep = None,
     217               finaltime = None,
     218               duration = None,               
    216219               skip_initial_step = False):
    217220        """Specialisation of basic evolve method from parent class
     
    251254
    252255        #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):
    255261            #Real time viz
    256262            if self.visualise is True:
Note: See TracChangeset for help on using the changeset viewer.