Ignore:
Timestamp:
Feb 1, 2006, 2:03:12 PM (19 years ago)
Author:
jakeman
Message:

create_mesh generates an irregular grid with five regions and run_cairns accepts large bathymetry
files for simulation

Location:
development/cairns_2006
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • development/cairns_2006/create_mesh.py

    r2286 r2312  
    2222    coord_sw = convert_latlon_to_xycoords(-157,-24,latlong_origin)
    2323    coord_nw = convert_latlon_to_xycoords(-157,-8,latlong_origin)
    24    
    25     """
    26     xleft = 0
    27     ybottom = 0
    28     xright = 100
    29     ytop = 100
    30 
    31     point_sw = [xleft, ybottom]
    32     point_se = [xright, ybottom]
    33     point_nw = [xleft, ytop]   
    34     point_ne = [xright, ytop]
    35 
    36     """
    37    
    38     """
    39     #Outline
    40     point_sw = [coord_sw[0], coord_sw[1]]
    41     point_se = [coord_se[0], coord_se[1]]
    42     point_nw = [coord_nw[0], coord_nw[1]]   
    43     point_ne = [coord_ne[0], coord_ne[1]]
    44     """
    4524
    4625    # Sets origin which is needed by an instance of a mesh object
    4726    geo = Geo_reference(xllcorner = coord_se[0],
    4827                        yllcorner = coord_se[1])
    49    
    50     #    geo = Geo_reference(xllcorner = xleft,
    51     #                        yllcorner = ybottom)
    52 
    53     """
    54     coord_nw = [3.6e6,1e6]
    55     coord_ne = [0.0,1e6]
    56     coord_sw = [3.6e6,0.0]
    57     coord_se = [0.0,0.0]
    58 
    59     geo = Geo_reference(xllcorner = 0.0,
    60                         yllcorner = 0.0)
    61     """
    6228   
    6329    print "***********************"
     
    6935    #Boundary
    7036    dict = {}
    71 
    72     """
    73     dict['points'] = [point_se,
    74                       point_ne,
    75                       point_nw,
    76                       point_sw]
    77    
    78     """
    7937   
    8038    dict['points'] = [coord_se,   
     
    8240                      coord_nw,
    8341                      coord_sw]
    84    
    85 #    print dict['points']
    8642   
    8743    dict['segments'] = [[0,1], [1,2], [2,3], [3,0]]  #The outer border
     
    9147                            'border',
    9248                            'border']
    93 
    9449       
    9550    m.addVertsSegs(dict)
    9651   
     52
    9753    dict = {}
    9854    # rupture zone
    9955    # Tonga-Kermadec Subduction zone
    10056    # located between 180E and -173W and 15S and 35S
    101     p0 = convert_latlon_to_xycoords(-173,-20,latlong_origin)
    102     p1 = convert_latlon_to_xycoords(-173,-15,latlong_origin)
    103     p2 = convert_latlon_to_xycoords(-171,-15,latlong_origin)
    104     p3 = convert_latlon_to_xycoords(-171,-20,latlong_origin)
     57    r0 = convert_latlon_to_xycoords(-173,-20,latlong_origin)
     58    r1 = convert_latlon_to_xycoords(-173,-15,latlong_origin)
     59    r2 = convert_latlon_to_xycoords(-171,-15,latlong_origin)
     60    r3 = convert_latlon_to_xycoords(-171,-20,latlong_origin)
    10561
    106     """
    107     rupture_south = degminsec2decimal_degrees(-15,0,0)
    108     rupture_north = degminsec2decimal_degrees(-17,0,0)
    109     rupture_west = degminsec2decimal_degrees(-165,0,0)
    110     rupture_east = degminsec2decimal_degrees(-166,0,0)
    111 
    112     p0 = [rupture_south, rupture_west]
    113     p1 = [rupture_south, rupture_east]
    114     p2 = [rupture_north, rupture_east]
    115     p3 = [rupture_north, rupture_west]
    116     """
    117    
    118 
    119     dict['points']  = [p0, p1, p2, p3]
     62    dict['points']  = [r0, r1, r2, r3]
    12063    dict['segments'] = [[0,1], [1,2], [2,3], [3,0]]
    12164    dict['segment_tags'] = ['', '', '', '']
     
    12467    #Interior regions
    12568    # Cairns lat and long (16.575S, 145.45E)
    126     c0 = convert_latlon_to_xycoords(145,-24,latlong_origin)
    127     c1 = convert_latlon_to_xycoords(145,-8,latlong_origin)
    128     c2 = convert_latlon_to_xycoords(146,-8,latlong_origin)
    129     c3 = convert_latlon_to_xycoords(153,-24,latlong_origin)
     69    c0 = convert_latlon_to_xycoords(149,-22,latlong_origin)
     70    c1 = convert_latlon_to_xycoords(146,-19,latlong_origin)
     71    c2 = convert_latlon_to_xycoords(145,-15,latlong_origin)
     72    c3 = convert_latlon_to_xycoords(145,-13,latlong_origin)
     73    c4 = convert_latlon_to_xycoords(146,-13,latlong_origin)   
     74    c5 = convert_latlon_to_xycoords(147,-17,latlong_origin)
     75    c6 = convert_latlon_to_xycoords(153,-21,latlong_origin)
     76    c7 = convert_latlon_to_xycoords(153,-22,latlong_origin)
    13077
    131     """
    132     coast_south = degminsec2decimal_degrees(-16,0,0)
    133     coast_north = degminsec2decimal_degrees(-17,0,0)
    134     coast_west = degminsec2decimal_degrees(145,0,0)
    135     coast_east = degminsec2decimal_degrees(145,75,0)
    136    
    137     d0 = [coast_south, coast_west]
    138     d1 = [coast_south, coast_east]
    139     d2 = [coast_north, coast_east]
    140     d3 = [coast_north, coast_west]
    141     """
    142 
    143     dict['points']  = [c0, c1, c2, c3]
    144     dict['segments'] = [[0,1], [1,2], [2,3], [3,0]]
    145     dict['segment_tags'] = ['', '', '', '']
     78    dict['points']  = [c0, c1, c2, c3, c4, c5, c6, c7]
     79    dict['segments'] = [[0,1], [1,2], [2,3], [3,4], [4,5], [5,6], [6,7], [7,0]]
     80    dict['segment_tags'] = ['', '', '', '', '', '', '', '']
    14681    m.addVertsSegs(dict)
    14782
     
    179114    m.addVertsSegs(dict)
    180115
    181     """
    182     Generates a rectangular region in the mesh.  Could reduce the number of
    183     traingles needed for this refined area by creating a polygon that better
    184     resmebles the shape of the reef so areas of deep sea floor are not covered
    185     by un-necessary small traiangels
    186116
    187 
    188     #Interior regions
    189     reef1_south = degminsec2decimal_degrees(-20,44,0)
    190     reef1_north = degminsec2decimal_degrees(-20,42,0)
    191     reef1_west = degminsec2decimal_degrees(116,48,0)
    192     reef1_east = degminsec2decimal_degrees(116,53,30)
     117    #Exclude PNG because land mass has no effect on the wave that hits Cairns
     118    # Papua New Guinea
     119    p0 = convert_latlon_to_xycoords(145.5,-12.0,latlong_origin)
     120    p1 = convert_latlon_to_xycoords(145.5,-8.0,latlong_origin)
     121    p2 = convert_latlon_to_xycoords(154.5,-8.0,latlong_origin)
     122    p3 = convert_latlon_to_xycoords(154.5,-12.0,latlong_origin)
    193123   
    194     k0 = [reef1_south, reef1_west]
    195     k1 = [reef1_south, reef1_east]
    196     k2 = [reef1_north, reef1_east]
    197     k3 = [reef1_north, reef1_west]   
    198    
    199     dict['points']  = reef1_polygon = [k0, k1, k2, k3]
     124    dict['points']  = [p0, p1, p2, p3]
    200125    dict['segments'] = [[0,1], [1,2], [2,3], [3,0]]
    201126    dict['segment_tags'] = ['', '', '', '']
    202127    m.addVertsSegs(dict)
    203     """
    204    
    205     base_resolution = 5e11
     128
    206129
    207130    """
     
    212135    m^2
    213136    """
    214     print coord_nw[0]-0.1
    215     print coord_ne[1]-0.1
     137
     138    # base resolution = 5e11 gives good size test grid
     139    #base_resolution = 5e11
     140    base_resolution = 5e9
     141   
    216142    ocean = m.addRegionEN(coord_nw[0]-0.1, coord_nw[1]-0.1)
    217143    ocean.setMaxArea(base_resolution)
     144   
    218145
    219     #    ocean = m.addRegionEN(xright-0.1, ytop-0.1)
    220     #    ocean.setMaxArea(base_resolution)
    221 
    222     rupture = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)
    223     rupture.setMaxArea(base_resolution)
     146    rupture = m.addRegionEN(r0[0]+0.1, r0[1]+0.1)
     147    rupture.setMaxArea(100*base_resolution)
    224148
    225149    coast = m.addRegionEN(c0[0]+0.1, c0[1]+0.1)
    226     coast.setMaxArea(0.001*base_resolution)
     150    coast.setMaxArea(0.003*base_resolution)
    227151
    228152    fiji = m.addRegionEN(f0[0]+0.1, f0[1]+0.1)
     
    233157
    234158    melanesia = m.addRegionEN(m0[0]+0.1, m0[1]+0.1)
    235     melanesia.setMaxArea(0.001*base_resolution)
     159    melanesia.setMaxArea(0.01*base_resolution)
     160   
     161    png = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)
     162    png.setMaxArea(0.01*base_resolution)
    236163   
    237164    #a10000a refers to the max area passed to triangle
  • development/cairns_2006/run_cairns.py

    r2270 r2312  
    1010import sys, os
    1111from pyvolution.shallow_water import Domain, Reflective_boundary,\
    12      File_boundary, Transmissive_Momentum_Set_Stage_boundary, Transmissive_boundary
     12     File_boundary, Transmissive_Momentum_Set_Stage_boundary,\
     13     Transmissive_boundary, Dirichlet_boundary
    1314from pyvolution.mesh_factory import rectangular_cross
    1415from pyvolution.pmesh2domain import pmesh_to_domain_instance
     
    1920from utilities.polygon import read_polygon, Polygon_function
    2021
     22from conversion import convert_latlon_to_xycoords
     23
    2124#-------------------------------
    2225# Domain
    2326#-------------------------------
    2427print 'Creating domain'
     28
    2529"""
    2630M = 36 #float(len1)/m
     
    3640
    3741"""
     42
    3843domain = cache(pmesh_to_domain_instance,
    3944               (project.mesh_filename, Domain),
     
    5358print 'Initial values'
    5459
    55 p0 = read_polygon('cairns_fault.xya')
     60latlong_origin = 145, -24
     61r0 = convert_latlon_to_xycoords(-173,-20,latlong_origin)
     62r1 = convert_latlon_to_xycoords(-173,-15,latlong_origin)
     63r2 = convert_latlon_to_xycoords(-171,-15,latlong_origin)
     64r3 = convert_latlon_to_xycoords(-171,-20,latlong_origin)
     65
     66#p0 = read_polygon('cairns_fault.xya')
    5667#p0 = read_polygon('cairns_fault_degrees.xya')
    57 
    58 domain.set_quantity('stage',Polygon_function([(p0,1000.0)]))
     68p0 = [r0, r1, r2, r3]
     69domain.set_quantity('stage',Polygon_function([(p0,1.0)]))
    5970
    6071#print domain.quantities['stage'].vertex_values
     
    7788print 'Boundaries'
    7889
    79 
    8090#Bts = Transmissive_Momentum_Set_Stage_boundary(domain, tide_function)
    81 
     91#Bd = Dirichlet_boundary([0,0,0])
    8292Br = Reflective_boundary(domain)
    8393domain.set_boundary({'border': Br, 'border': Br, 'border': Br, 'border': Br})
    8494
    8595#Bt = Transmissive_boundary(domain)
    86 #domain.set_boundary({'left': Bt, 'right': Bt, 'top': Bt, 'bottom': Bt})
     96#domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
    8797
    8898#-------------------------------
     
    90100#-------------------------------
    91101
    92 domain.visualise = True
    93 domain.visualise_color_stage = True
     102#domain.visualise = True
     103#domain.visualise_color_stage = True
    94104
    95 #domain.visualise = False
    96 #domain.visualise_color_stage = False
     105#Set domain.visualise = False for large problem sizes
     106domain.visualise = False
     107domain.visualise_color_stage = False
    97108
    98109base = os.path.basename(sys.argv[0])
     
    107118t0 = time.time()
    108119yieldstep = 60.0
    109 finaltime = 480.0
     120finaltime = 21600.0
    110121
    111122for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime):
     
    113124
    114125print 'That took %.2f seconds' %(time.time()-t0)
    115 
Note: See TracChangeset for help on using the changeset viewer.