Changeset 7624


Ignore:
Timestamp:
Feb 16, 2010, 9:33:23 AM (14 years ago)
Author:
steve
Message:

Cleaning up directory

Location:
anuga_validation/analytical solutions
Files:
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • anuga_validation/analytical solutions/Analytical_solution_Yoon_cross_mesh.py

    r3846 r7624  
    11"""Example of shallow water wave equation analytical solution
    22consists of a parabolic profile in a parabolic basin. Analytical
    3 solutiuon to this problem was derived by Carrier and Greenspan
     3solutiuon to this problem was derived by Thacker
    44and used by Yoon and Chou.
    55
     
    1414#from os import sep
    1515#sys.path.append('..'+sep+'pyvolution')
    16 from anuga.pyvolution.shallow_water import Domain, Transmissive_boundary, Reflective_boundary,\
     16from anuga.shallow_water_balanced.swb_domain import Domain, Transmissive_boundary, Reflective_boundary,\
    1717     Dirichlet_boundary
     18
     19#from anuga.interface import Domain, Transmissive_boundary, Reflective_boundary,\
     20#     Dirichlet_boundary
    1821from math import sqrt, cos, sin, pi
    19 from anuga.pyvolution.mesh_factory import rectangular_cross
    20 from anuga.utilities.polygon import inside_polygon
    21 from Numeric import asarray
    22 from anuga.pyvolution.least_squares import Interpolation
     22from anuga.interface import rectangular_cross
     23from anuga.utilities.polygon import inside_polygon, is_inside_triangle
     24from numpy import asarray
     25
    2326
    2427#-------------------------------
    2528# Domain
    26 n = 100
    27 m = 100
    28 delta_x = 80.0
    29 delta_y = 80.0
    30 lenx = delta_x*n
    31 leny = delta_y*m
     29n = 200
     30m = 200
     31lenx = 8000.0
     32leny = 8000.0
    3233origin = (-4000.0, -4000.0)
    3334
     
    3738#----------------
    3839# Order of scheme
    39 domain.default_order = 1
     40# Good compromise between
     41# limiting and CFL
     42#---------------
     43domain.set_default_order(2)
     44domain.set_timestepping_method(2)
     45domain.set_beta(0.7)
     46domain.set_CFL(0.6)
    4047
    4148domain.smooth = True
     
    5461#------------------------------------------
    5562# Reduction operation for get_vertex_values
    56 from anuga.pyvolution.util import mean
     63from anuga.utilities.numerical_tools import mean
    5764domain.reduction = mean #domain.reduction = min  #Looks better near steep slopes
    5865
     
    107114# Find triangle that contains the point points
    108115# and print to file
    109 points = [0.,0.]
     116
     117
     118
     119points = (0.0, 0.0)
    110120for n in range(len(domain.triangles)):
    111     t = domain.triangles[n]
    112     tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
     121    tri = domain.get_vertex_coordinates(n)
    113122
    114     if inside_polygon(points,tri):
    115         print 'Point is within triangle with vertices '+'%s'%tri
     123    if is_inside_triangle(points,tri):
     124        #print 'Point is within triangle with vertices '+'%s'%tri
    116125        n_point = n
    117126
    118127print 'n_point = ',n_point
    119128t = domain.triangles[n_point]
    120 tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
     129print 't = ', t
     130tri = domain.get_vertex_coordinates(n)
    121131
    122132filename=domain.get_name()
     
    137147    domain.write_time()
    138148
    139     tri_array = asarray(tri)
    140     t_array = asarray([[0,1,2]])
    141     interp = Interpolation(tri_array,t_array,[points])
     149    #tri_array = asarray(tri)
     150    #t_array = asarray([[0,1,2]])
     151    #interp = Interpolation(tri_array,t_array,[points])
    142152
    143153
    144     stage     = Stage.get_values(location='centroids',indices=[n_point])[0]
    145     xmomentum = Xmomentum.get_values(location='centroids',indices=[n_point])[0]
    146     ymomentum = Ymomentum.get_values(location='centroids',indices=[n_point])[0]
     154    stage     = Stage.get_values(location='centroids',indices=[n_point])
     155    xmomentum = Xmomentum.get_values(location='centroids',indices=[n_point])
     156    ymomentum = Ymomentum.get_values(location='centroids',indices=[n_point])
     157    #print '%10.6f   %10.6f  %10.6f   %10.6f\n'%(t,stage,xmomentum,ymomentum)
    147158    file.write( '%10.6f   %10.6f  %10.6f   %10.6f\n'%(t,stage,xmomentum,ymomentum) )
    148159
     
    161172xlabel('time(s)')
    162173ylabel('stage (m)')
    163 legend(('Observed', 'Modelled'), shadow=True, loc='upper left')
     174#legend(('Observed', 'Modelled'), shadow=True, loc='upper left')
    164175#savefig(name, dpi = 300)
    165176
Note: See TracChangeset for help on using the changeset viewer.