Changeset 6175


Ignore:
Timestamp:
Jan 15, 2009, 2:54:19 PM (15 years ago)
Author:
ole
Message:

Start time adjustment and better diagnostics for time_limit

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py

    r6173 r6175  
    11331133        delta = 23
    11341134        domain.starttime = start + delta
     1135        time_limit = domain.starttime + 600
    11351136        F = file_function(filename + '.tms', domain,
    1136                           time_limit=600,
     1137                          time_limit=time_limit,
    11371138                          quantities=['Attribute0', 'Attribute1', 'Attribute2'])       
    11381139        assert num.allclose(domain.starttime, start+delta)
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r6174 r6175  
    340340    # if verbose: print 'Get variables'   
    341341    time = fid.variables['time'][:]   
    342 
    343342    # FIXME(Ole): Is time monotoneous?
    344    
     343
    345344    # Apply time limit if requested
    346345    upper_time_index = len(time)   
     
    349348   
    350349    if time_limit is not None:
     350        # Adjust given time limit to given start time
     351        time_limit = time_limit - starttime
     352
     353        # Find limit point
    351354        for i, t in enumerate(time):
    352355            if t > time_limit:
     
    355358               
    356359        msg = 'Time vector is zero. Requested time limit is %f' % time_limit
    357         assert upper_time_index > 0, msg               
     360        assert upper_time_index > 0, msg
     361
     362        if time_limit < time[-1] and verbose is True:
     363            print 'Limited time vector from %.2fs to %.2fs'\
     364                  % (time[-1], time_limit)
    358365
    359366    time = time[:upper_time_index]
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r6174 r6175  
    91029102        # Check the time vector
    91039103        times = fid.variables['time'][:]
    9104        
     9104        starttime = fid.starttime[0]
    91059105        #print times
     9106        #print starttime
    91069107
    91079108        # Check sts quantities
     
    91569157                           boundary_polygon=boundary_polygon)
    91579158        time_vec = Bf.F.get_time()
     9159        assert num.allclose(Bf.F.starttime, starttime)
    91589160        assert num.allclose(time_vec, times_ref)                                   
    91599161       
     
    91619163            Bf = File_boundary(sts_file+'.sts',
    91629164                               domain_fbound,
    9163                                time_limit=time_limit,
     9165                               time_limit=time_limit+starttime,
    91649166                               boundary_polygon=boundary_polygon)
    91659167       
    91669168            time_vec = Bf.F.get_time()
     9169            assert num.allclose(Bf.F.starttime, starttime)           
    91679170            assert num.alltrue(time_vec < time_limit)
    91689171           
     
    91719174            Bf = File_boundary(sts_file+'.sts',
    91729175                               domain_fbound,
    9173                                time_limit=-1,
     9176                               time_limit=-1+starttime,
    91749177                               boundary_polygon=boundary_polygon)           
    91759178            time_vec = Bf.F.get_time()   
  • anuga_work/production/patong/run_patong.py

    r6168 r6175  
    190190                   domain, mean_stage= project.tide,
    191191                   time_thinning=1,
     192                   time_limit=project.finaltime,
    192193                   default_boundary=Bd,
    193194                   use_cache=True,
    194                    verbose = True,
     195                   verbose=True,
    195196                   boundary_polygon=bounding_polygon)
    196197
Note: See TracChangeset for help on using the changeset viewer.