Changeset 7804
- Timestamp:
- Jun 7, 2010, 4:19:31 PM (15 years ago)
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/classroom/ripcurrent.py
r7589 r7804 16 16 # Import necessary modules 17 17 #------------------------------------------------------------------------------ 18 from anuga.interface import create_domain_from_regions 19 from anuga.shallow_water.shallow_water_domain import Dirichlet_boundary 20 from anuga.shallow_water.shallow_water_domain import Reflective_boundary 21 from anuga.shallow_water.shallow_water_domain import Time_boundary 22 from anuga.shallow_water.data_manager import get_mesh_and_quantities_from_file 18 import anuga 23 19 from pylab import figure, plot, axis, quiver, quiverkey, show, title, axhline 24 20 from pylab import cos, sin, pi … … 41 37 halfchannelwidth = 5 42 38 bank_slope = 0.1 43 simulation_length = 139 simulation_length = 60 44 40 timestep = 1 45 41 … … 50 46 length = 120 51 47 width = 170 52 seafloor_resolution = 60.0 # Resolution: Max area of triangles in the mesh48 seafloor_resolution = 20.0 # Resolution: Max area of triangles in the mesh 53 49 feature_resolution = 1.0 54 50 beach_resolution = 10.0 55 51 56 52 sea_boundary_polygon = [[0,0],[length,0],[length,width],[0,width]] 57 feature_boundary_polygon = [[0,100],[length,100],[length,150],[0,150]] 53 feature_boundary_polygon = [[19,99],[length/2+1,99],[length/2+1,151],[0,151]] 54 hole_boundary_polygon = [[20,100],[length/2,100],[length/2,150],[20,150]] 58 55 beach_interior_polygon = [[0,150],[length,150],[length,width],[0,width]] 59 56 … … 64 61 [beach_interior_polygon, beach_resolution]] 65 62 66 domain = create_domain_from_regions(sea_boundary_polygon,63 domain = anuga.create_domain_from_regions(sea_boundary_polygon, 67 64 boundary_tags={'bottom': [0], 68 65 'right' : [1], … … 72 69 mesh_filename=meshname, 73 70 interior_regions=feature_regions, 71 interior_holes=[hole_boundary_polygon], 74 72 use_cache=True, 75 73 verbose=True) … … 149 147 # Setup boundary conditions 150 148 #------------------------------------------------------------------------------ 151 Bi = Dirichlet_boundary([0.4, 0, 0]) # Inflow152 Br = Reflective_boundary(domain) # Solid reflective wall153 Bo = Dirichlet_boundary([-5, 0, 0]) # Outflow149 Bi = anuga.Dirichlet_boundary([0.4, 0, 0]) # Inflow 150 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 151 Bo = anuga.Dirichlet_boundary([-5, 0, 0]) # Outflow 154 152 155 153 def wave(t): … … 158 156 159 157 A = 0.4 # Amplitude of wave [m] (wave height) 160 T = 5# Wave period [s]158 T = 1 # Wave period [s] 161 159 162 160 if t < 30000000000: … … 165 163 return [0.0, 0, 0] 166 164 167 Bt = Time_boundary(domain, f=wave)168 169 170 domain.set_boundary({'left': Br, 'right': Br, 'top': Bo, 'bottom': Bt })165 Bt = anuga.Time_boundary(domain, f=wave) 166 167 168 domain.set_boundary({'left': Br, 'right': Br, 'top': Bo, 'bottom': Bt, 'exterior': Br}) 171 169 172 170 -
trunk/anuga_core/documentation/user_manual/anuga_user_manual.tex
r7631 r7804 72 72 % will be used. 73 73 74 %\release{1. 0} % release version; this is used to define the74 %\release{1.2} % release version; this is used to define the 75 75 % % \version macro 76 76 … … 147 147 where the more adventurous reader might like to go. 148 148 149 This manual describes \anuga version 1. 0. To check for later versions of this manual149 This manual describes \anuga version 1.2. To check for later versions of this manual 150 150 go to \url{https://datamining.anu.edu.au/anuga}. 151 151 … … 335 335 336 336 \begin{verbatim} 337 points, vertices, boundary = rectangular_cross(10, 10)337 points, vertices, boundary = anuga.rectangular_cross(10, 10) 338 338 \end{verbatim} 339 339 … … 345 345 346 346 \begin{verbatim} 347 points, vertices, boundary = rectangular_cross(m, n)347 points, vertices, boundary = anuga.rectangular_cross(m, n) 348 348 \end{verbatim} 349 349 … … 372 372 373 373 \begin{verbatim} 374 domain = Domain(points, vertices, boundary)374 domain = anuga.Domain(points, vertices, boundary) 375 375 \end{verbatim} 376 376 … … 499 499 500 500 \begin{verbatim} 501 Br = Reflective_boundary(domain)502 Bt = Transmissive_boundary(domain)503 Bd = Dirichlet_boundary([0.2, 0.0, 0.0])504 Bw = Time_boundary(domain=domain,501 Br = anuga.Reflective_boundary(domain) 502 Bt = anuga.Transmissive_boundary(domain) 503 Bd = anuga.Dirichlet_boundary([0.2, 0.0, 0.0]) 504 Bw = anuga.Time_boundary(domain=domain, 505 505 f=lambda t: [(0.1*sin(t*2*pi)-0.3)*exp(-t), 0.0, 0.0]) 506 506 \end{verbatim} … … 609 609 610 610 \begin{verbatim} 611 Bw = Time_boundary(domain=domain, f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0])611 Bw = anuga.Time_boundary(domain=domain, f=lambda t: [(0.1*sin(t*2*pi)-0.3), 0.0, 0.0]) 612 612 \end{verbatim} 613 613 … … 726 726 727 727 \begin{verbatim} 728 points, vertices, boundary = rectangular_cross(m, n, len1=length, len2=width)728 points, vertices, boundary = anuga.rectangular_cross(m, n, len1=length, len2=width) 729 729 \end{verbatim} 730 730 … … 742 742 dx = dy = 1 # Resolution: Length of subdivisions on both axes 743 743 744 points, vertices, boundary = rectangular_cross(int(length/dx), int(width/dy),744 points, vertices, boundary = anuga.rectangular_cross(int(length/dx), int(width/dy), 745 745 len1=length, len2=width) 746 746 \end{verbatim} … … 780 780 781 781 \begin{verbatim} 782 Bo = Dirichlet_boundary([-5, 0, 0]) # Outflow782 Bo = anuga.Dirichlet_boundary([-5, 0, 0]) # Outflow 783 783 \end{verbatim} 784 784 … … 1024 1024 \begin{verbatim} 1025 1025 remainder_res = 10000000 1026 domain = create_domain_from_regions(project.bounding_polygon,1026 domain = anuga.create_domain_from_regions(project.bounding_polygon, 1027 1027 boundary_tags={'top': [0], 1028 1028 'ocean_east': [1], … … 1145 1145 1146 1146 \begin{verbatim} 1147 Bd = Dirichlet_boundary([tide,0,0]) # Mean water level1148 Bs = Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary1147 Bd = anuga.Dirichlet_boundary([tide,0,0]) # Mean water level 1148 Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Neutral boundary 1149 1149 1150 1150 if project.scenario == 'fixed_wave': 1151 1151 # Huge 50m wave starting after 60 seconds and lasting 1 hour. 1152 Bw = Time_boundary(domain=domain,1152 Bw = anuga.Time_boundary(domain=domain, 1153 1153 function=lambda t: [(60<t<3660)*50, 0, 0]) 1154 1154 domain.set_boundary({'ocean_east': Bw, -
trunk/anuga_core/documentation/user_manual/version.tex
r6055 r7804 7 7 % release version; this is used to define the 8 8 % \version macro 9 \release{1. 0beta\_6051}9 \release{1.2beta\_6051} -
trunk/anuga_core/source/anuga/file_conversion/asc2dem.py
r7758 r7804 1 1 # external modules 2 2 import numpy as num 3 import anuga.utilities.log as log 3 4 4 5 # ANUGA modules -
trunk/anuga_core/source/anuga/file_conversion/dem2pts.py
r7742 r7804 3 3 4 4 # ANUGA modules 5 import anuga.utilities.log as log 5 6 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a, \ 6 7 netcdf_float -
trunk/anuga_core/source/anuga/file_conversion/test_urs2sww.py
r7800 r7804 16 16 from anuga.coordinate_transforms.redfearn import redfearn 17 17 18 from urs2sww import urs2sww 18 from urs2sww import urs2sww, urs_ungridded2sww 19 19 import urs 20 20 … … 163 163 #Latitude: -21 0 ' 0.00000 '' Longitude: 115 0 ' 0.00000 '' 164 164 165 'hole_points_UTM(base_name, mean_stage=-240992.0,165 hole_points_UTM(base_name, mean_stage=-240992.0, 166 166 hole_points_UTM=[ 292110.784, 7676551.710 ]) 167 167 -
trunk/anuga_core/source/anuga/fit_interpolate/fit.py
r7751 r7804 299 299 assert flag is True, msg 300 300 301 # FIXME(Ole): This is the message referred to in ticket:314 302 minx = min(self.mesh_boundary_polygon[:,0]) 303 maxx = max(self.mesh_boundary_polygon[:,0]) 304 miny = min(self.mesh_boundary_polygon[:,1]) 305 maxy = max(self.mesh_boundary_polygon[:,1]) 306 msg = 'Could not find triangle for point %s. ' % str(x) 307 msg += 'Mesh boundary extent is (%.f, %.f), (%.f, %.f)'\ 308 % (minx, maxx, miny, maxy) 309 raise RuntimeError, msg 310 301 # data point has fallen within a hole - so ignore it. 311 302 312 303 self.AtA = AtA -
trunk/anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r7780 r7804 5343 5343 os.remove(ptsfile) 5344 5344 5345 5346 def test_fitting_in_hole(self): 5347 ''' 5348 Make sure we can fit a mesh that has a hole in it. 5349 This is a regression test for ticket:234 5350 5351 ''' 5352 verbose = False 5353 5354 from anuga.shallow_water.shallow_water_domain import Domain 5355 from anuga.pmesh.mesh_interface import create_mesh_from_regions 5356 from anuga.geospatial_data.geospatial_data import Geospatial_data 5357 5358 5359 # Get path where this test is run 5360 path = get_pathname_from_package('anuga.shallow_water') 5361 5362 5363 #---------------------------------------------------------------------- 5364 # Create domain 5365 #-------------------------------------------------------------------- 5366 W = 303400 5367 N = 6195800 5368 E = 308640 5369 S = 6193120 5370 border = 2000 5371 bounding_polygon = [[W, S], [E, S], [E, N], [W, N]] 5372 hole_polygon = [[W+border, S+border], [E-border, S+border], \ 5373 [E-border, N-border], [W+border, N-border]] 5374 5375 meshname = os.path.join(path, 'offending_mesh.msh') 5376 create_mesh_from_regions(bounding_polygon, 5377 boundary_tags={'south': [0], 'east': [1], 5378 'north': [2], 'west': [3]}, 5379 maximum_triangle_area=1000000, 5380 filename=meshname, 5381 interior_holes=[hole_polygon], 5382 use_cache=False, 5383 verbose=verbose) 5384 5385 domain = Domain(meshname, use_cache=False, verbose=verbose) 5386 5387 #---------------------------------------------------------------------- 5388 # Fit data point inside hole to mesh 5389 #---------------------------------------------------------------------- 5390 5391 points_file = os.path.join(path, 'offending_point.pts') 5392 5393 # Offending point 5394 G = Geospatial_data(data_points=[[(E+W)/2, (N+S)/2]], 5395 attributes=[1]) 5396 G.export_points_file(points_file) 5397 5398 # fit data using the point within the hole. 5399 domain.set_quantity('elevation', filename=points_file, 5400 use_cache=False, verbose=verbose, alpha=0.01) 5401 os.remove(meshname) 5402 os.remove(points_file) 5403 5404 5345 5405 def test_fitting_example_that_crashed(self): 5346 5406 """This unit test has been derived from a real world example
Note: See TracChangeset
for help on using the changeset viewer.