Changeset 3719


Ignore:
Timestamp:
Oct 10, 2006, 10:48:31 AM (18 years ago)
Author:
steve
Message:

Adding holes to create_mesh_from_regions

Location:
anuga_core/source/anuga
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/quantity_ext.c

    r3678 r3719  
    209209
    210210
    211         //MH080605 set semi_impliit_update[k] to 0.0 here, rather than in update_conserved_quantities.py
     211        //MH080605 set semi_implicit_update[k] to 0.0 here, rather than in update_conserved_quantities.py
    212212        for (k=0;k<N;k++){
    213213                semi_implicit_update[k]=0.0;
  • anuga_core/source/anuga/examples/island.py

    r3563 r3719  
    3333                                           'top': [2],
    3434                                           'left': [3]},
    35                           maximum_triangle_area = 5,
     35                          maximum_triangle_area = 1.0,
    3636                          filename = 'island.msh' ,
    37                           interior_regions=[ ([[50,25], [70,25], [70,75], [50,75]], 3)]
     37                          interior_regions=[ ([[50,25], [70,25], [70,75], [50,75]], 1.0)]
     38                          #interior_holes=[[50,25], [70,25], [70,75], [50,75]],
    3839                          )
    3940
     
    5455# beta_h == 0.0 means that constant (1st order) gradients are introduced
    5556# on h. This is equivalent to the constant depth used previously.
    56 domain.beta_h = 0.9
     57domain.beta_h     = 0.2
     58domain.beta_w_dry = 0.2
    5759
    5860
     
    7880
    7981#domain.set_quantity('friction', 0.1)  #Honky dory
    80 domain.set_quantity('friction', 100)     #Creep
     82domain.set_quantity('friction', 100.0)     #Creep
    8183domain.set_quantity('elevation', island)
    8284domain.set_quantity('stage', 1)
     
    9496domain.check_integrity()
    9597
    96 
     98domain.initialise_visualiser()
    9799#------------------------------------------------------------------------------
    98100# Evolve system through time
  • anuga_core/source/anuga/mesh_engine/test_triangmodule.py

    r3514 r3719  
    211211
    212212    def testbad_hole(self):
    213 
     213       
    214214        holelist = [(9.0)]
    215215        regionlist = []
    216 
    217         points = [(0.0,0.0),(0.0,10.0),(3.0,0.0),(3.0,10.0)]
    218         pointattlist = [[],[],[],[]]
    219         seglist = [(0,1),(1,3),(3,2),(2,0)]
     216       
     217        points = [(0.0,0.0),(0.0,10.0),(3.0,0.0),(3.0,10.0)]
     218        pointattlist = [[],[],[],[]]
     219        seglist = [(0,1),(1,3),(3,2),(2,0)]
    220220        segattlist = [0,0,0,0]
    221221        trilist = []
  • anuga_core/source/anuga/pmesh/mesh_interface.py

    r3715 r3719  
    2525                             filename=None,
    2626                             interior_regions=None,
     27                             interior_holes=None,
    2728                             poly_geo_reference=None,
    2829                             mesh_geo_reference=None,
     
    4344    Interior_regions is a list of tuples consisting of (polygon, resolution)
    4445    for each region to be separately refined.
     46   
     47    Interior_holes is a list of ploygons for each hole.
    4548
    4649    This function does not allow segments to share points - use underlying
     
    7174              'filename': filename,
    7275              'interior_regions': interior_regions,
     76              'interior_holes': interior_holes,
    7377              'poly_geo_reference': poly_geo_reference,
    7478              'mesh_geo_reference': mesh_geo_reference,
     
    106110                              filename=None,
    107111                              interior_regions=None,
     112                              interior_holes=None,
    108113                              poly_geo_reference=None,
    109114                              mesh_geo_reference=None,
     
    146151                raise PolygonError, msg
    147152
    148 
     153    if interior_holes is not None:       
     154        # Test that all the interior polygons are inside the bounding_poly
     155        for interior_polygon, res in interior_holes:
     156            indices = inside_polygon(interior_polygon, bounding_polygon,
     157                                     closed = True, verbose = False)
     158   
     159            if len(indices) <> len(interior_polygon):
     160                msg = 'Interior polygon %s is outside bounding polygon: %s'\
     161                      %(str(interior_polygon), str(bounding_polygon))
     162                raise PolygonError, msg
    149163
    150164    # Resolve geo referencing       
     
    192206
    193207    # Do interior regions
     208#    if interior_regions is not None:   
     209#        for polygon, res in interior_regions:
     210#            m.add_region_from_polygon(polygon,
     211#                                      geo_reference=poly_geo_reference)
     212#            # convert bounding poly to absolute values
     213#            if poly_geo_reference is not None:
     214#                polygon_absolute = \
     215#                    poly_geo_reference.get_absolute(polygon)
     216#            else:
     217#                polygon_absolute = polygon
     218#            inner_point = point_in_polygon(polygon_absolute)
     219#            region = m.add_region(inner_point[0], inner_point[1])
     220#            region.setMaxArea(res)
     221           
     222           
    194223    if interior_regions is not None:   
    195224        for polygon, res in interior_regions:
    196225            m.add_region_from_polygon(polygon,
     226                                      max_triangle_area = res,
    197227                                      geo_reference=poly_geo_reference)
    198             # convert bounding poly to absolute values
    199             if poly_geo_reference is not None:
    200                 polygon_absolute = \
    201                     poly_geo_reference.get_absolute(polygon)
    202             else:
    203                 polygon_absolute = polygon
    204             inner_point = point_in_polygon(polygon_absolute)
    205             region = m.add_region(inner_point[0], inner_point[1])
    206             region.setMaxArea(res)
     228   
     229           
     230   # Do interior holes
     231    if interior_holes is not None:   
     232        for polygon, res in interior_holes:
     233            m.add_hole_from_polygon(polygon,
     234                                      geo_reference=poly_geo_reference)
     235       
    207236           
    208237
  • anuga_core/source/anuga/pmesh/test_mesh_interface.py

    r3715 r3719  
    137137        interior_regions = [(inner1_polygon, 5),(inner2_polygon, 0.2)]
    138138
    139 
     139        interior_holes = None
    140140
    141141        # Clear cache first
     
    147147               'filename': None,
    148148               'interior_regions': interior_regions,
     149               'interior_holes': interior_holes,
    149150               'poly_geo_reference': geo_ref_poly,
    150151               'mesh_geo_reference': mesh_geo,
  • anuga_core/source/anuga/shallow_water/shallow_water_ext.c

    r3703 r3719  
    524524
    525525    if (hc < minimum_allowed_height) {
    526 
     526       
    527527      //Old code: Set momentum to zero and ensure h is non negative
    528528      //xmomc[k] = 0.0;
     
    536536      //             has no Python equivalent
    537537      if (hc <= 0.0) {
    538         wc[k] = zc[k];
    539         xmomc[k] = 0.0;
    540         ymomc[k] = 0.0;
     538        wc[k] = zc[k];
     539                xmomc[k] = 0.0;
     540                ymomc[k] = 0.0;
    541541      } else {
    542542        //Reduce excessive speeds derived from division by small hc
     543       
    543544        u = xmomc[k]/hc;
    544         if (fabs(u) > maximum_allowed_speed) {
    545           reduced_speed = maximum_allowed_speed * u/fabs(u);
    546           //printf("Speed (u) has been reduced from %.3f to %.3f\n",
    547           //     u, reduced_speed);
    548           xmomc[k] = reduced_speed * hc;
    549         }
     545                if (fabs(u) > maximum_allowed_speed) {
     546                        reduced_speed = maximum_allowed_speed * u/fabs(u);
     547                        //printf("Speed (u) has been reduced from %.3f to %.3f\n",
     548                        //       u, reduced_speed);
     549                        xmomc[k] = reduced_speed * hc;
     550                }
    550551
    551552        v = ymomc[k]/hc;
    552         if (fabs(v) > maximum_allowed_speed) {
    553           reduced_speed = maximum_allowed_speed * v/fabs(v);
    554           //printf("Speed (v) has been reduced from %.3f to %.3f\n",
    555           //     v, reduced_speed);
    556           ymomc[k] = reduced_speed * hc;
    557         }
     553                if (fabs(v) > maximum_allowed_speed) {
     554                        reduced_speed = maximum_allowed_speed * v/fabs(v);
     555                        //printf("Speed (v) has been reduced from %.3f to %.3f\n",
     556                        //       v, reduced_speed);
     557                        ymomc[k] = reduced_speed * hc;
     558                }
    558559      }
    559560    }
Note: See TracChangeset for help on using the changeset viewer.