Changeset 8204 for trunk/anuga_work/development
- Timestamp:
- Sep 1, 2011, 7:28:58 PM (14 years ago)
- Location:
- trunk/anuga_work/development/2010-projects/anuga_1d
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/2010-projects/anuga_1d/channel/channel_flow_2_padarn.py
r7884 r8204 1 1 import os 2 2 from math import sqrt, pow, pi 3 from channel_domain import * 4 from Numeric import allclose, array, zeros, ones, Float, take, sqrt 5 from config import g, epsilon 3 4 import numpy as np 5 6 from anuga_1d.channel.channel_domain import * 7 from anuga_1d.config import g, epsilon 8 from anuga_1d.base.generic_mesh import uniform_mesh 6 9 7 10 … … 19 22 20 23 def bed(x): 21 y = zeros(len(x),Float)24 y = np.zeros(len(x),np.float) 22 25 for i in range(len(x)): 23 26 if x[i]<525 and x[i]>475: … … 46 49 print "Evaluating domain with %d cells" %N 47 50 cell_len = L/N # Origin = 0.0 48 points = zeros(N+1,Float)51 points = np.zeros(N+1,np.float) 49 52 50 53 # Define the centroid points … … 62 65 63 66 # Set boundry type, order, timestepping method and limiter 64 domain.set_boundary({'exterior': Dirichlet_boundary([14,20,0,1.4,20/14,9])}) 67 #domain.set_boundary({'exterior': Dirichlet_boundary([14,20,0,1.4,20/14,9])}) 68 domain.set_boundary({'exterior': Reflective_boundary(domain)}) 65 69 domain.order = 2 66 70 domain.set_timestepping_method('rk2') … … 72 76 t0 = time.time() 73 77 78 finaltime= 0.0 79 80 #=================================================================== 81 # Time loop 82 #=================================================================== 74 83 for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): 75 84 domain.write_time() … … 84 93 VelocityQ = domain.quantities['velocity'].vertex_values 85 94 x = X.flat 86 z = domain.quantities['elevation'].vertex_values.flat 87 stage=HeightQ.flat+z 95 z = domain.quantities['elevation'].vertex_values 96 stage=HeightQ+z 97 stage = stage.flat 98 z = z.flat 88 99 89 100 from pylab import plot,title,xlabel,ylabel,legend,savefig,show,hold,subplot -
trunk/anuga_work/development/2010-projects/anuga_1d/sww/run_dry_dam.py
r8073 r8204 81 81 k = 0 82 82 83 N = 1000083 N = 2000 84 84 print "Evaluating domain with %d cells" %N 85 85 domain = Domain(*uniform_mesh(N,x_1=L)) -
trunk/anuga_work/development/2010-projects/anuga_1d/sww/sww_domain.py
r8194 r8204 235 235 236 236 #Calculate height (and fix negatives)better be non-negative! 237 w_C[:] = numpy.maximum(w_C, z_C) 237 238 h_C[:] = w_C - z_C 239 240 238 241 u_C[:] = uh_C/(h_C + h0/h_C) 239 242 … … 282 285 #print 'any' ,numpy.any( h_V[:,1] < 0.0) 283 286 284 h00 = 1e-12287 #h00 = 1e-12 285 288 #print h00 286 289 287 h_V[:,:] = numpy.where (h_V <= h00, 0.0, h_V)288 u_V[:,:] = numpy.where (h_V <= h00, 0.0, u_V)290 #h_V[:,:] = numpy.where (h_V <= h00, 0.0, h_V) 291 #u_V[:,:] = numpy.where (h_V <= h00, 0.0, u_V) 289 292 290 293 # # protect from edge values going negative
Note: See TracChangeset
for help on using the changeset viewer.