Changeset 4567


Ignore:
Timestamp:
Jun 28, 2007, 5:27:17 PM (17 years ago)
Author:
ole
Message:

Thoughts on centroid values - this is probably not going to be useful as nodal values will be good enough given the inherent discretisation error.

Location:
anuga_core/source/anuga/shallow_water
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r4563 r4567  
    8989     pmesh_to_domain_instance
    9090from anuga.abstract_2d_finite_volumes.util import get_revision_number, \
    91      remove_lone_verts, sww2timeseries
     91     remove_lone_verts, sww2timeseries, get_centroid_values
    9292from anuga.load_mesh.loadASCII import export_mesh_file
    9393# formula mappings
     
    54485448
    54495449def get_maximum_inundation_data(filename, polygon=None, time_interval=None,
     5450                                use_centroid_values=False,
    54505451                                verbose=False):
    54515452    """Compute maximum run up height from sww file.
     
    55135514    elevation = fid.variables['elevation'][:]
    55145515    stage = fid.variables['stage'][:]
     5516
     5517
     5518    # Here's where one could convert nodal information to centroid information
     5519    # but is probably something we need to write in C.
     5520    # Here's a Python thought which is NOT finished!!!
     5521    if use_centroid_values is True:
     5522        x = get_centroid_values(x, volumes)
     5523        y = get_centroid_values(y, volumes)   
     5524        elevation = get_centroid_values(elevation, volumes)   
    55155525
    55165526
     
    55745584    maximal_runup_location = None
    55755585    for i in timesteps:
    5576         depth = stage[i,:] - elevation
     5586        if use_centroid_values is True:
     5587            stage_i = get_centroid_values(stage[i,:], volumes)               
     5588        else:
     5589            stage_i = stage[i,:]
     5590           
     5591        depth = stage_i  - elevation
    55775592   
    55785593        # Get wet nodes i.e. nodes with depth>0 within given region and timesteps
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r4563 r4567  
    70807080        runup = get_maximum_inundation_elevation(swwfile)
    70817081        location = get_maximum_inundation_location(swwfile)
     7082        #print runup, location
    70827083        assert allclose(runup, 11)
    70837084        assert allclose(location[0], 15)
     
    70867087        runup = get_maximum_inundation_elevation(swwfile, time_interval=[45,50])
    70877088        location = get_maximum_inundation_location(swwfile, time_interval=[45,50])
     7089        #print runup, location       
    70887090        assert allclose(runup, 1)
    70897091        assert allclose(location[0], 65)
     
    70937095        runup = get_maximum_inundation_elevation(swwfile, polygon=p)
    70947096        location = get_maximum_inundation_location(swwfile, polygon=p)
     7097        #print runup, location       
    70957098        assert allclose(runup, 4)
    70967099        assert allclose(location[0], 50)               
Note: See TracChangeset for help on using the changeset viewer.