Changeset 2620
- Timestamp:
- Mar 28, 2006, 2:21:34 PM (17 years ago)
- Location:
- inundation
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/examples/beach.py
r2601 r2620 29 29 print 'Creating domain from %s.tsh' %name 30 30 #domain = pmesh_to_domain_instance(name + '.tsh', Domain) 31 domain = Domain(mesh_file = name + '.tsh')31 domain = Domain(mesh_filename = name + '.tsh') 32 32 33 33 domain.store = True -
inundation/examples/island.py
r2619 r2620 17 17 from pyvolution.mesh_factory import rectangular 18 18 from pyvolution.shallow_water import Domain, Reflective_boundary 19 from pmesh.mesh_interface import create_mesh_from_regions 19 20 from utilities.polygon import Polygon_function, read_polygon 20 21 … … 28 29 points, vertices, boundary = rectangular(N, N, 100, 100) 29 30 31 32 create_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 30 47 #Create shallow water domain 31 domain = Domain(points, vertices, boundary) 48 #domain = Domain(points, vertices, boundary) 49 domain = Domain(mesh_filename = 'island.msh') 32 50 domain.smooth = False 33 51 domain.set_name('island') … … 55 73 return z 56 74 57 domain.set_quantity('friction', 0.1)75 domain.set_quantity('friction', 1.0) 58 76 domain.set_quantity('elevation', island) 59 77 domain.set_quantity('stage', 1) … … 75 93 76 94 import time 77 for t in domain.evolve(yieldstep = 1, finaltime = 100):95 for t in domain.evolve(yieldstep = 0.5, finaltime = 100): 78 96 domain.write_time() 79 97 -
inundation/pyvolution/domain.py
r2607 r2620 20 20 class Domain(Mesh): 21 21 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. 22 26 def __init__(self, coordinates=None, vertices=None, 23 27 boundary=None, … … 25 29 tagged_elements=None, geo_reference=None, 26 30 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: 30 34 coordinates, vertices, boundary, vertex_quantity_dict \ 31 35 ,tagged_elements, geo_reference = \ 32 pmesh_to_domain(file_name=mesh_file )36 pmesh_to_domain(file_name=mesh_filename) 33 37 # FIXME(DSG-DSG) have to do something with vertex_quantity_dict 34 38 … … 109 113 self.already_computed_flux = zeros((N, 3), Int) 110 114 111 if mesh_file is not None:115 if mesh_filename is not None: 112 116 # If the mesh file passed any quantity values 113 117 # , initialise with these values. -
inundation/pyvolution/shallow_water.py
r2601 r2620 72 72 tagged_elements = None, geo_reference = None, 73 73 use_inscribed_circle=False, 74 mesh_file =None):74 mesh_filename=None): 75 75 76 76 conserved_quantities = ['stage', 'xmomentum', 'ymomentum'] … … 78 78 Generic_Domain.__init__(self, coordinates, vertices, boundary, 79 79 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) 81 82 82 83 from config import minimum_allowed_height, maximum_allowed_speed, g -
inundation/pyvolution/test_shallow_water.py
r2601 r2620 3329 3329 #domain = pmesh_to_domain_instance(fileName, Domain) 3330 3330 3331 domain = Domain(mesh_file =fileName)3331 domain = Domain(mesh_filename=fileName) 3332 3332 3333 3333 os.remove(fileName)
Note: See TracChangeset
for help on using the changeset viewer.