Changeset 577


Ignore:
Timestamp:
Nov 17, 2004, 2:08:55 PM (20 years ago)
Author:
ole
Message:

Got contracting channel to work

Location:
inundation/ga/storm_surge/analytical solutions
Files:
2 edited

Legend:

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

    r562 r577  
    1818"""
    1919
    20 ######################
     20#-----------------------------
    2121# Module imports
    22 #
    23 
    2422import sys
    2523from os import sep
     
    2826from shallow_water import Transmissive_boundary, Reflective_boundary, \
    2927     Dirichlet_boundary
    30 from shallow_water import Constant_height
    31 from domain import rectangular_domain, Domain, Volume
     28from shallow_water import Constant_height, Domain
     29from pmesh2domain import pmesh_to_domain_instance
    3230
    33 import visualise2 as visualise
    34 from Numeric import array
    35 from config import data_dir
    3631
    37 import os, sys
    38 usage = "usage: %s pmesh_file_name" %         os.path.basename(sys.argv[0])
    39 pmesh_file_name = "C:/Storm-Surge/analytical solutions/converging_channel_30846.tsh"
    40 
    41 tags = {}
    42 tags['upstream'] = Dirichlet_boundary(conserved_quantities = array([0.2, 1.2, 0.0]))
    43 tags['reflective'] = Reflective_boundary ()
    44 tags['transmissive'] = Transmissive_boundary ()
    45 
    46 ######################
    47 # Domain and Boundary Condition
    48 #
    49 print "pmesh_file_name ", pmesh_file_name
    50 domain = Domain.pmesh_to_domain(pmesh_file_name, tags = tags)
     32#------------------------------
     33# Domain
     34filename = 'converging_channel_30846.tsh'
     35print 'Creating domain from', filename
     36domain = pmesh_to_domain_instance(filename, Domain)
     37print 'Number of triangles = ', len(domain)
    5138
    5239domain.default_order = 2
     
    5441
    5542# Provide file name for storing output
    56 domain.filename="contracting_channel_second-order"
    57 
    58 print "Number of triangles = ", len(Volume.instances)
    59 
    60 domain.visualise = False
    61 domain.checkpoint = False #
    62 domain.store = True    #Store for visualisation purposes
     43domain.store = True     #Store for visualisation purposes
    6344domain.format = 'sww'   #Native netcdf visualisation format
     45domain.filename = 'contracting_channel_second-order'
    6446
    6547#Reduction operation for get_vertex_values             
    66 from pytools.stats import mean
     48from util import mean
    6749domain.reduction = mean
    68 #domain.reduction = min  #Looks better near steep slopes
    6950
    70 ######################
     51#------------------------------
     52# Boundary Conditions
     53tags = {}
     54tags['upstream'] = Dirichlet_boundary([0.2, 1.2, 0.0])
     55tags['reflective'] = Reflective_boundary(domain)
     56tags['transmissive'] = Transmissive_boundary(domain)
     57domain.set_boundary(tags)
     58
     59#-----------------
    7160#Initial condition
    72 #
    73 print 'Initial condition'
    74 h = 0.2
     61domain.set_quantity('elevation', 0.0)
     62domain.set_quantity('level', 0.2)
     63   
    7564
    76 #Bed-slope and friction
    77 def x_slope(x, y):
    78     return 0*x
    79 
    80 domain.set_conserved_quantities(Constant_height(x_slope, h), None, None)
    81    
    82 ######################
    83 #Visualisation
    84 if domain.visualise:
    85     visualise.create_surface(domain)
    86  
    87 
    88 ######################
     65#-----------------
    8966#Evolution
    90 
    9167import time
    9268t0 = time.time()
    93 for t in domain.evolve(max_timestep = 0.1, yieldstep = 1.0, finaltime = 5):
     69for t in domain.evolve(yieldstep = 0.1, finaltime = 5):
    9470    domain.write_time()
    95 
    96 # Remove the following if Visual Python not required       
    97     if domain.visualise: 
    98         visualise.update(domain, index=0, smooth=True)
    9971   
    10072print 'That took %.2f seconds' %(time.time()-t0)
  • inundation/ga/storm_surge/analytical solutions/converging_channel_30846.tsh

    r561 r577  
    158441584415842 37.3882238461 2.92152822116
    158451584515843 39.9375 1.28837309717
    15846 15844 19.8782375705 1.68085158197
     1584615844 19.8782375705 1.68085158197
     15847# vet att titles
    158471584830846 # <triangle #> [<vertex #>] [<neigbouring triangle #>] [attribute of region] ...Triangulation Triangles...
    15848158490 12827 12825 3849 1394 24955 1395 
Note: See TracChangeset for help on using the changeset viewer.