Changeset 1586


Ignore:
Timestamp:
Jul 7, 2005, 12:04:36 PM (19 years ago)
Author:
steve
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/analytical solutions/Analytical_solution_contracting_channel.py

    r1558 r1586  
    2828from shallow_water import Constant_height, Domain
    2929from pmesh2domain import pmesh_to_domain_instance
    30 from mesh_factory import contracting_channel
     30from mesh_factory import contracting_channel_cross
    3131
    3232#-------
     
    4343W_downstream = 2.5
    4444L_1 = 5.
    45 L_2 = 10.
     45L_2 = 11
    4646L_3 = Total_length - L_1 - L_2
    4747n = 20
     
    4949
    5050points, elements, boundary = \
    51      contracting_channel(m, n, W_upstream, W_downstream, L_1, L_2, L_3)
     51     contracting_channel_cross(m, n, W_upstream, W_downstream, L_1, L_2, L_3)
    5252domain = Domain(points, elements, boundary)
    5353
     
    6666domain.filename = 'contracting_channel_second-order'
    6767
     68
    6869#----------------------------------------------------------
    6970# Decide which quantities are to be stored at each timestep
    7071domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
    7172
     73#------------------------------------------------
    7274# This is for Visual Python
    73 domain.visualise = True
     75#domain.visualise = True
    7476
    7577#------------------------------------------
     
    9395
    9496# Use the inscribed circle with safety factor of 0.9 to establish the time step
    95 #domain.set_to_inscribed_circle(safety_factor=0.9)
    96 
    97 ### List all triangles that exist in region x > 35
    98 ##n_triangle = []
    99 ##for n in range(len(domain.triangles)):
    100 ##    t = domain.triangles[n]
    101 ##    tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
    102 ##
    103 ##    for i in range(n_points):
    104 ##        if inside_polygon(points(i),tri):
    105 ##            print 'Point is within triangle with vertices '+'%s'%tri
    106 ##            n_triangle[i] = n
    107 ##            t = domain.triangles[n_triangle[i]]
    108 ##            tri[i] = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
     97# domain.set_to_inscribed_circle(safety_factor=0.9)
    10998
    11099#----------
     
    112101import time
    113102t0 = time.time()
    114 for t in domain.evolve(yieldstep = 0.2, finaltime = 50.0):
     103for t in domain.evolve(yieldstep = 5.0, finaltime = 50.0):
    115104    domain.write_time()
    116105
     
    131120        n_points = n_points + 1
    132121
    133 
    134122average_stage = average_stage/n_points
    135123
    136124#Standard Deviation
    137125sigma = 0.0
     126max_stage = -999999.
     127min_stage = 999999
    138128for n in range(N):
    139129    if XY[n,0] > 35.0:
    140130        sigma = sigma + (average_stage - stage[n])**2
     131        if stage[n] > max_stage:
     132            max_stage = stage[n]
     133        if stage[n] < min_stage:
     134            min_stage = stage[n]
    141135
    142136import math
    143137sigma = math.sqrt(sigma/(n_points-1))
    144138
    145 print average_stage, sigma
     139print L_2, average_stage, sigma, max_stage, min_stage, n_points
    146140
    147 
    148 
    149 
    150 
    151 ##average_stage = 0.
    152 ##t_array = asarray([[0,1,2]])
    153 ##for i in range(n_points):
    154 ##    tri_array = asarray(tri(i))
    155 ##    stage = domain.get_quantity('stage')[n_triangle(i)]
    156 ##    average_triangle_stage[i] = (stage[0]+stage[1]+stage[2])/3.
    157 ##    average_stage = average_stage + average_triangle_stage[i]
    158 ##
    159 ##average_stage = average_stage/n_points
    160 ##sigma = 0.
    161 ##for i in range(n_points):
    162 ##    sigma = sigma + average_triangle_stage[i] - average_stage
    163 ##
    164 ##sigma = sqrt(sigma/n_points)
    165 ##print sigma
    166 ##
    167 
    168 
     141domain.initialise_visualiser()
     142domain.visualiser.update_all()
Note: See TracChangeset for help on using the changeset viewer.