Ignore:
Timestamp:
Jun 15, 2010, 5:34:24 PM (12 years ago)
Author:
steve
Message:

Adding in a few new files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/2010-projects/anuga_1d/channel/test_padarn.py

    r7839 r7842  
    22import random
    33from math import sqrt, pow, pi ,sin, cos
    4 from channel_domain import *
    5 from Numeric import allclose, array, zeros, ones, Float, take, sqrt
    6 from config import g, epsilon
     4import numpy
     5
     6from anuga_1d.channel.channel_domain import *
     7
     8from anuga_1d.config import g, epsilon
    79
    810
     
    1719    omega = sqrt(2*g*z_infty)/L_x ## angular frequency of osccilation
    1820    t=0.0
    19     y = zeros(len(x),Float)
     21    y = numpy.zeros(len(x),numpy.float)
    2022    for i in range(len(x)):
    2123        #y[i] = z_infty+2*A0*z_infty/L_x*cos(omega*t)*(x[i]/L_x-0.5*A0/(L_x)*cos(omega*t))
     
    2628    N = len(x)
    2729    z_infty = 10.0
    28     z = zeros(N,Float)
     30    z = numpy.zeros(N,numpy.float)
    2931    L_x = 2500.0
    3032    A0 = 0.5*L_x
     
    3537
    3638def initial_area(x):
    37     y = zeros(len(x),Float)
     39    y = numpy.zeros(len(x),numpy.float)
    3840    for i in range(len(x)):
    3941        y[i]=initial_stage([x[i]])-bed([x[i]])
     
    6163print "Evaluating domain with %d cells" %N
    6264cell_len = 4*L/N # Origin = 0.0
    63 points = zeros(N+1,Float)
     65points = numpy.zeros(N+1,numpy.float)
    6466for i in range(N+1):
    6567        points[i] = -2*L +i*cell_len
     
    9597
    9698N = float(N)
    97 HeightC = domain.quantities['height'].centroid_values
     99HeightC    = domain.quantities['height'].centroid_values
    98100DischargeC = domain.quantities['discharge'].centroid_values
    99 C = domain.centroids
     101C          = domain.centroids
    100102print 'That took %.2f seconds' %(time.time()-t0)
    101 X = domain.vertices
    102 HeightQ = domain.quantities['area'].vertex_values
    103 VelocityQ = domain.quantities['velocity'].vertex_values
    104 x = X.flat
    105 z = domain.quantities['elevation'].vertex_values.flat
    106 stage=HeightQ.flat+z
     103X          = domain.vertices
     104HeightQ    = domain.quantities['area'].vertex_values
     105VelocityQ  = domain.quantities['velocity'].vertex_values
     106Z          = domain.quantities['elevation'].vertex_values
     107Stage      = HeightQ + Z
    107108
    108109
     
    113114   
    114115plot1 = subplot(211)
    115 
    116 plot(x,z,x,stage)
     116plot(X.flat,Z.flat, X.flat,Stage.flat)
    117117 
    118118plot1.set_ylim([-1,35])
     
    122122           'upper right', shadow=True)
    123123plot2 = subplot(212)
    124 plot(x,VelocityQ.flat)
     124plot(X.flat,VelocityQ.flat)
    125125plot2.set_ylim([-10,10])
    126126   
Note: See TracChangeset for help on using the changeset viewer.