Changeset 2620


Ignore:
Timestamp:
Mar 28, 2006, 2:21:34 PM (18 years ago)
Author:
ole
Message:

Worked on island.py example and it's gauges.
Renamed mesh_file to mesh_filename

Location:
inundation
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • inundation/examples/beach.py

    r2601 r2620  
    2929print 'Creating domain from %s.tsh' %name
    3030#domain = pmesh_to_domain_instance(name + '.tsh', Domain)
    31 domain = Domain(mesh_file= name + '.tsh')
     31domain = Domain(mesh_filename = name + '.tsh')
    3232
    3333domain.store = True
  • inundation/examples/island.py

    r2619 r2620  
    1717from pyvolution.mesh_factory import rectangular
    1818from pyvolution.shallow_water import Domain, Reflective_boundary
     19from pmesh.mesh_interface import create_mesh_from_regions
    1920from utilities.polygon import Polygon_function, read_polygon
    2021
     
    2829points, vertices, boundary = rectangular(N, N, 100, 100)
    2930
     31
     32create_mesh_from_regions( [[0,0], [100,0], [100,100], [0,100]],
     33                          boundary_tags = {'bottom': [0],
     34                                           'right': [1],
     35                                           'top': [2],
     36                                           'left': [3]},
     37                          maximum_triangle_area = 25,
     38                          filename = 'island.msh',
     39                          interior_regions=[ ([[55,25], [75,25],
     40                                               [75,75], [55,75]], 3)]
     41                          )
     42                         
     43                                                   
     44                         
     45                           
     46
    3047#Create shallow water domain
    31 domain = Domain(points, vertices, boundary)
     48#domain = Domain(points, vertices, boundary)
     49domain = Domain(mesh_filename = 'island.msh')
    3250domain.smooth = False
    3351domain.set_name('island')
     
    5573    return z
    5674
    57 domain.set_quantity('friction', 0.1)
     75domain.set_quantity('friction', 1.0)
    5876domain.set_quantity('elevation', island)
    5977domain.set_quantity('stage', 1)
     
    7593
    7694import time
    77 for t in domain.evolve(yieldstep = 1, finaltime = 100):
     95for t in domain.evolve(yieldstep = 0.5, finaltime = 100):
    7896    domain.write_time()
    7997
  • inundation/pyvolution/domain.py

    r2607 r2620  
    2020class Domain(Mesh):
    2121
     22
     23    #FIXME (Ole): I would like this interface to automatically work out
     24    #whether input is mesh data or a filename (as in set_quantity).
     25    #That way the user need not remember the keyword arguments.
    2226    def __init__(self, coordinates=None, vertices=None,
    2327                 boundary=None,
     
    2529                 tagged_elements=None, geo_reference=None,
    2630                 use_inscribed_circle=False,
    27                  mesh_file=None):
    28 
    29         if mesh_file is not None:
     31                 mesh_filename=None):
     32
     33        if mesh_filename is not None:
    3034            coordinates, vertices, boundary, vertex_quantity_dict \
    3135                                ,tagged_elements, geo_reference = \
    32                                 pmesh_to_domain(file_name=mesh_file)
     36                                pmesh_to_domain(file_name=mesh_filename)
    3337            # FIXME(DSG-DSG) have to do something with vertex_quantity_dict
    3438
     
    109113        self.already_computed_flux = zeros((N, 3), Int)
    110114
    111         if mesh_file is not None:
     115        if mesh_filename is not None:
    112116            # If the mesh file passed any quantity values
    113117            # , initialise with these values.
  • inundation/pyvolution/shallow_water.py

    r2601 r2620  
    7272                 tagged_elements = None, geo_reference = None,
    7373                 use_inscribed_circle=False,
    74                  mesh_file=None):
     74                 mesh_filename=None):
    7575
    7676        conserved_quantities = ['stage', 'xmomentum', 'ymomentum']
     
    7878        Generic_Domain.__init__(self, coordinates, vertices, boundary,
    7979                                conserved_quantities, other_quantities,
    80                                 tagged_elements, geo_reference, use_inscribed_circle, mesh_file)
     80                                tagged_elements, geo_reference,
     81                                use_inscribed_circle, mesh_filename)
    8182
    8283        from config import minimum_allowed_height, maximum_allowed_speed, g
  • inundation/pyvolution/test_shallow_water.py

    r2601 r2620  
    33293329         #domain = pmesh_to_domain_instance(fileName, Domain)
    33303330         
    3331          domain = Domain(mesh_file=fileName)
     3331         domain = Domain(mesh_filename=fileName)
    33323332         
    33333333         os.remove(fileName)
Note: See TracChangeset for help on using the changeset viewer.