Changeset 7634
- Timestamp:
- Feb 24, 2010, 2:42:00 PM (15 years ago)
- Location:
- anuga_validation/analytical_solutions
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
anuga_validation/analytical_solutions/carrier_wave_runup.py
r7626 r7634 14 14 """ 15 15 16 # #####################16 #------------------- 17 17 # Module imports 18 18 import sys 19 from os import sep20 sys.path.append('..'+sep+'pyvolution')21 22 from shallow_water import Domain, Reflective_boundary, Time_boundary23 19 from math import sqrt, cos, sin, pi 24 from mesh_factory import strang_mesh 25 20 from numpy import asarray 21 from time import localtime, strftime, gmtime 22 23 24 #------------------- 25 # Anuga Imports 26 #------------------- 27 from anuga.shallow_water_balanced.swb_domain import Domain, Transmissive_boundary, Reflective_boundary,\ 28 Dirichlet_boundary, Time_boundary 29 30 #from anuga.interface import Domain, Transmissive_boundary, Reflective_boundary,\ 31 # Dirichlet_boundary 32 33 from anuga.utilities.polygon import inside_polygon, is_inside_triangle 34 from anuga.abstract_2d_finite_volumes.mesh_factory import strang_mesh 35 36 37 #------------------- 26 38 #Convenience functions 39 #------------------- 27 40 def imag(a): 28 41 return a.imag … … 32 45 33 46 34 # #####################47 #-------------------- 35 48 # Domain 36 49 # Strang_domain will search through the file and test to see if there are … … 41 54 domain = Domain(points, elements) 42 55 43 domain.default_order = 2 44 domain.smooth = True 45 56 print 'extent ',domain.get_extent() 57 58 #---------------- 59 # Order of scheme 60 # Good compromise between 61 # limiting and CFL 62 #--------------- 63 domain.set_default_order(2) 64 domain.set_timestepping_method(2) 65 domain.set_beta(0.7) 66 domain.set_CFL(0.6) 67 68 69 #------------------- 46 70 #Set a default tagging 71 #------------------- 47 72 epsilon = 1.0e-12 48 73 … … 52 77 domain.boundary[(id,face)] = 'left' 53 78 54 55 56 79 #--------------------- 57 80 # Provide file name for storing output 81 #--------------------- 58 82 domain.store = True 59 83 domain.format = 'sww' 60 domain.set_name('run-up_second_order_again') 84 85 time = strftime('%Y%m%d_%H%M%S',localtime()) 86 output_file= 'carrier_wave_runup_'+time 87 88 domain.set_name(output_file) 61 89 62 90 print "Number of triangles = ", len(domain) 63 91 64 #Reduction operation for get_vertex_values 65 from anuga.pyvolution.util import mean 66 domain.reduction = mean 67 #domain.reduction = min #Looks better near steep slopes 68 92 #----------------------- 69 93 #Define the boundary condition 70 def stage_setup(x,t_star1): 94 #----------------------- 95 def stage_setup(x,t): 71 96 vh = 0 72 97 alpha = 0.1 … … 83 108 for j in range (1,50): 84 109 sigma0 = (sigma_max+sigma_min)/2. 85 lambda_prime = 2./a*(t _star1/sqrt(l_0/alpha/g)+v1)110 lambda_prime = 2./a*(t/sqrt(l_0/alpha/g)+v1) 86 111 sigma_prime = sigma0/a 87 112 const = (1.-ii*lambda_prime)**2+sigma_prime**2 … … 123 148 124 149 125 # #####################150 #--------------------- 126 151 #Initial condition 152 #--------------------- 127 153 print 'Initial condition' 128 154 t_star1 = 0.0 … … 162 188 domain.set_boundary({'left': Bw, 'external': Br}) 163 189 164 190 import time 191 visualize = True 192 if visualize: 193 from anuga.visualiser import RealtimeVisualiser 194 vis = RealtimeVisualiser(domain) 195 vis.render_quantity_height("elevation", zScale=3.0, offset = 0.01, dynamic=False) 196 vis.render_quantity_height("stage", zScale = 3.0, dynamic=True, opacity = 0.6, wireframe=False) 197 #vis.colour_height_quantity('stage', (lambda q:q['stage'], 1.0, 2.0)) 198 vis.colour_height_quantity('stage', (0.4, 0.6, 0.4)) 199 vis.start() 200 time.sleep(2.0) 165 201 166 202 #domain.visualise = True … … 168 204 ###################### 169 205 #Evolution 170 import time 206 171 207 t0 = time.time() 208 209 172 210 for t in domain.evolve(yieldstep = 1., finaltime = 100): 173 211 domain.write_time() 174 212 print boundary_stage(domain.time) 213 if visualize: vis.update() 214 215 if visualize: vis.evolveFinished() 175 216 176 217 print 'That took %.2f seconds' %(time.time()-t0) -
anuga_validation/analytical_solutions/yoon_cross_mesh.py
r7626 r7634 11 11 #--------------- 12 12 # Module imports 13 #import sys14 #from os import sep15 #sys.path.append('..'+sep+'pyvolution')16 13 from anuga.shallow_water_balanced.swb_domain import Domain, Transmissive_boundary, Reflective_boundary,\ 17 14 Dirichlet_boundary -
anuga_validation/analytical_solutions/yoon_import_mesh.py
r7626 r7634 13 13 # Module imports 14 14 import sys 15 from os import sep 16 sys.path.append('..'+sep+'pyvolution') 17 from shallow_water import Domain, Dirichlet_boundary 15 16 from anuga.interface import Domain, Dirichlet_boundary 18 17 from math import sqrt, cos, sin, pi 19 from mesh_factory import strang_mesh 20 from anuga.pyvolution.util import inside_polygon 21 from Numeric import asarray 22 from least_squares import Interpolation 18 from anuga.abstract_2d_finite_volume.mesh_factory import strang_mesh 19 from anuga.utilities.polygon import inside_polygon 20 21 from numpy import asarray 22 from anuga.fit_interpolate.interpolate import Interpolation 23 23 24 24 #-------------------------------
Note: See TracChangeset
for help on using the changeset viewer.