Changeset 3799


Ignore:
Timestamp:
Oct 16, 2006, 5:47:09 PM (18 years ago)
Author:
ole
Message:

Work on okushiri mesh generation to use new mesh_interface

Location:
anuga_validation/automated_validation_tests/okushiri_tank_validation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/create_okushiri.py

    r3708 r3799  
    22"""
    33
    4 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    5 # Assume that the root AnuGA dir is included in your pythonpath
    6 #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    74
    85from Numeric import array, zeros, Float, allclose
    96
    107from anuga.pmesh.mesh import *
     8from anuga.pmesh.mesh_interface import create_mesh_from_regions
    119from anuga.coordinate_transforms.geo_reference import Geo_reference
    1210
     
    7371if __name__ == "__main__":
    7472
    75     #Preparing points
    76     #(Only when using original Benchmark_2_Bathymetry.txt file)
    77     #from anuga.abstract_2d_finite_volumes.data_manager import xya2pts
    78     #xya2pts(project.bathymetry_filename, verbose = True,
    79     #        z_func = lambda z: -z)
    80 
    81 
    82 
    83 
    84 
    8573    # Prepare time boundary
    8674    prepare_timeboundary(project.boundary_filename)
    8775
    8876
    89     # Create Mesh
    90 
    91     #Basic geometry
    92    
     77    #--------------------------------------------------------------------------
     78    # Create the triangular mesh based on overall clipping polygon with a
     79    # tagged
     80    # boundary and interior regions defined in project.py along with
     81    # resolutions (maximal area of per triangle) for each polygon
     82    #--------------------------------------------------------------------------
     83
     84    base_resolution = 1
     85
     86    # Basic geometry
    9387    xleft   = 0
    9488    xright  = 5.448
     
    9690    ytop    = 3.402
    9791
    98     #Outline
     92    # Outline
    9993    point_sw = [xleft, ybottom]
    10094    point_se = [xright, ybottom]
     
    10296    point_ne = [xright, ytop]
    10397
    104     #Midway points (left)
     98    # Midway points (left)
    10599    point_mtop = [xleft + (xright-xleft)/3+1, ytop]
    106100    point_mbottom = [xleft + (xright-xleft)/3+1, ybottom]
    107101
    108 
    109     geo = Geo_reference(xllcorner = xleft,
    110                         yllcorner = ybottom)
    111    
    112                        
    113     print "***********************"
    114     print "geo ref", geo
    115     print "***********************"
    116    
    117     m = Mesh(geo_reference=geo)
    118 
    119     #Boundary
    120     dict = {}
    121     dict['points'] = [point_se,   #se
    122                       point_ne,
    123                       point_mtop,
    124                       point_nw,
    125                       point_sw,
    126                       point_mbottom]
    127 
    128    
    129     dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
    130                         [4,5], [5,0],  #The outer border
    131                         [2,5]]         #Separator
    132    
    133     dict['segment_tags'] = ['wall',
    134                             'wall',
    135                             'wall',
    136                             'wave',
    137                             'wall',
    138                             'wall',
    139                             '']           #Interior
    140 
    141        
    142     m.addVertsSegs(dict)
    143 
    144 
     102    #Localised refined area for gulleys
     103    xl = 4.8
     104    xr = 5.3
     105    yb = 1.6
     106    yt = 2.3
     107    p0 = [xl, yb]
     108    p1 = [xr, yb]
     109    p2 = [xr, yt]
     110    p3 = [xl, yt]
     111    gulleys = [p0, p1, p2, p3]
     112
     113    #Island area
     114    island_0 = [xleft + 2*(xright-xleft)/3+1.2, ytop-0.5]
     115    island_1 = [xleft + 2*(xright-xleft)/3+0.5, ybottom + 2*(ytop-ybottom)/3]
     116    island_2 = [xleft + (xright-xleft)/2+0.3, ybottom + 2*(ytop-ybottom)/3-0.3]
     117    island_3 = [xleft + (xright-xleft)/2+0.3, ybottom + (ytop-ybottom)/3+0.3]
     118    island_4 = [xleft + 2*(xright-xleft)/3+0.4, ybottom + (ytop-ybottom)/3-0.3]
     119    island_5 = [xleft + 2*(xright-xleft)/3+1.2, ybottom+0.2]
     120    island_6 = [xl-.01, yb]  #OK
     121    island_7 = [xl-.01, yt]  #OK     
     122
     123    island = [island_0, island_1, island_2,
     124              island_3, island_4, island_5,
     125              island_6, island_7]
     126
     127
     128   
     129
     130    bounding_polygon = [point_se,
     131                        point_ne,
     132                        point_mtop,
     133                        point_nw,
     134                        point_sw,
     135                        point_mbottom]
     136   
     137
     138    interior_regions = [[gulleys, 0.00002*base_resolution],
     139                        [island, 0.0003*base_resolution]]
     140   
     141
     142
     143   
     144
     145    print 'start create mesh from regions'
     146
     147    meshname = project.mesh_filename + '.msh'
     148    m = create_mesh_from_regions(bounding_polygon,
     149                                 boundary_tags={'wall': [0, 1, 2, 4, 5],
     150                                                'wave': [3]},
     151                                 maximum_triangle_area=0.1,
     152                                 interior_regions=interior_regions,
     153                                 use_cache=True,
     154                                 verbose=True)
     155
     156    m.generateMesh('pzq28.0za1000000a') #???
     157   
     158    import project
     159    m.export_mesh_file(project.mesh_filename)
     160
     161    import sys; sys.exit()
    145162
    146163
     
    175192    dict['points'] = [island_0, island_1, island_2,
    176193                      island_3, island_4, island_5,
    177                       #p0, p3]                     
    178194                      island_6, island_7]
    179195
     
    190206#
    191207   
    192     base_resolution = 1
     208    base_resolution = 10
    193209
    194210    ocean = m.addRegionEN(xleft+.1, ybottom+.1)
     
    207223
    208224
    209     # From r 1709 11 August 2005
    210     #base_resolution = 100
    211     #
    212     #ocean = m.addRegionEN(xleft+.1, ybottom+.1)
    213     #ocean.setMaxArea(0.01*base_resolution)
    214     #
    215     #mid = m.addRegionEN(point_mbottom[0]+.1, ybottom+.1)
    216     #mid.setMaxArea(0.001*base_resolution)
    217 
    218     #inner = m.addRegionEN(island_3[0]+.1, island_3[1]+.1)
    219     #inner.setMaxArea(0.0001*base_resolution)
    220 
    221 
    222     #gulleys = m.addRegionEN(p0[0]+0.1, p0[1]+0.1)
    223     #gulleys.setMaxArea(0.00001*base_resolution)       
    224    
    225    
    226225    m.generateMesh('pzq28.0za1000000a')
    227226
  • anuga_validation/automated_validation_tests/okushiri_tank_validation/validate_okushiri.py

    r3794 r3799  
    3737#-------------------------
    3838#N = 50
    39 N = 50
    40 points, vertices, boundary = rectangular_cross(N, N/5*3,
    41                                                len1=5.448, len2=3.402)
    42 domain = Domain(points, vertices, boundary)
    43 
    44 domain.set_name('okushiri_automated_validation')
     39#N = 50
     40#points, vertices, boundary = rectangular_cross(N, N/5*3,
     41#                                               len1=5.448, len2=3.402)
     42#domain = Domain(points, vertices, boundary)
     43
     44
     45print 'Creating domain from', project.mesh_filename
     46
     47domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
     48
     49
     50domain.set_name('okushiri_automated_validation_varmesh')
    4551domain.set_default_order(2)
    4652domain.set_minimum_storable_height(0.001)
     53domain.set_maximum_allowed_speed(0) # The default in August 2005
     54
    4755domain.check_integrity()
    4856
     
    6775                         domain,
    6876                         verbose=True)
     77
    6978Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
    70 domain.set_boundary({'left': Bts, 'right': Br, 'bottom': Br, 'top': Br})
     79
     80domain.set_boundary({'wave': Bts, 'wall': Br})
     81
     82
    7183
    7284
     
    127139t0 = time.time()
    128140
     141w_max = 0
    129142for j, t in enumerate(domain.evolve(yieldstep = timestep,
    130143                                    finaltime = finaltime)):
     
    139152        #print 'difference', x, y,\
    140153        #      predicted_gauge_values[i][j] - reference_gauge_values[i][j]
     154
     155
     156    w = domain.get_maximum_inundation_elevation()
     157    x, y = domain.get_maximum_inundation_location()
     158    print '  Coastline elevation = %.2f at (x,y)=(%.2f, %.2f)' %(w, x, y)
     159    print
     160   
     161    if w > w_max:
     162        w_max = w
     163        x_max = x
     164        y_max = y
     165
     166
     167print '**********************************************'
     168print 'Max coastline elevation = %.2f at (%.2f, %.2f)' %(w_max, x_max, y_max)
     169print '**********************************************'
     170       
    141171   
    142172
Note: See TracChangeset for help on using the changeset viewer.