Changeset 8592


Ignore:
Timestamp:
Oct 31, 2012, 2:03:04 PM (11 years ago)
Author:
steve
Message:

Changed from exception to warning in parallel_inlet_enquiry

Location:
trunk/anuga_core
Files:
14 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/documentation/user_manual/demos/cairns/ExportResults.py

    r7877 r8592  
    55import anuga
    66
    7 scenario = 'slide'
     7scenario = 'fixed_wave'
    88name = 'cairns_' + scenario
    99
  • trunk/anuga_core/documentation/user_manual/demos/cairns/project.py

    r7838 r8592  
    4848# Make these numbers larger to reduce the number of triangles in the model,
    4949# and hence speed up the simulation
    50 default_res = 10000000    # Background resolution
    51 islands_res = 100000
    52 cairns_res = 100000
    53 shallow_res = 500000
     50
     51# bigger base_scale == less triangles
     52base_scale = 100000
     53base_scale = 1000000
     54default_res = 100 * base_scale   # Background resolution
     55islands_res = base_scale
     56cairns_res = base_scale
     57shallow_res = 5 * base_scale
    5458
    5559# Define list of interior regions with associated resolutions
  • trunk/anuga_core/documentation/user_manual/demos/cairns/runcairns.py

    r8538 r8592  
    6363domain.set_datadir('.')                       # Store sww output here
    6464domain.set_minimum_storable_height(0.01)      # Store only depth > 1cm
     65domain.set_flow_algorithm('tsunami')
    6566
    6667#------------------------------------------------------------------------------
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py

    r8578 r8592  
    305305        """
    306306
    307         import hashtable
     307        import neighbour_table_ext
    308308       
    309309        N = self.number_of_nodes
    310310
    311311       
    312         hashtable.build_neighbour_structure(N,
     312        neighbour_table_ext.build_neighbour_structure(N,
    313313                                            self.triangles,
    314314                                            self.neighbours,
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_table_ext.c

    r8584 r8592  
     1#include "Python.h"
     2#include "numpy/arrayobject.h"
     3
    14#include <stdio.h>   /* gets */
    25#include <stdlib.h>  /* atoi, malloc */
    36#include <string.h>  /* strcpy */
    4 
    5 
    6 
    7 #include "Python.h"
    8 #include "numpy/arrayobject.h"
    9 #include "math.h"
     7#include <math.h>
    108
    119//Shared code snippets
     
    328326
    329327// Module initialisation
    330 void inithashtable(void){
    331   Py_InitModule("hashtable", MethodTable);
     328void initneighbour_table_ext(void){
     329  Py_InitModule("neighbour_table_ext", MethodTable);
    332330  import_array(); // Necessary for handling of NumPY structures
    333331}
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain_ext.c

    r8568 r8592  
     1#include "Python.h"
     2#include "numpy/arrayobject.h"
     3
    14#include <stdio.h>   /* gets */
    25#include <stdlib.h>  /* atoi, malloc */
    36#include <string.h>  /* strcpy */
    4 
    5 
    6 
    7 #include "Python.h"
    8 #include "numpy/arrayobject.h"
    9 #include "math.h"
     7#include <math.h>
    108
    119//Shared code snippets
  • trunk/anuga_core/source/anuga/config.py

    r8538 r8592  
    201201optimised_gradient_limiter = True # Use hardwired gradient limiter
    202202
    203 points_file_block_line_size = 500 # Number of lines read in from a points file
     203points_file_block_line_size = 5000 # Number of lines read in from a points file
    204204                                  # when blocking
    205205
  • trunk/anuga_core/source/anuga/file_conversion/sww2dem.py

    r8563 r8592  
    333333        # Interpolate using quantity values
    334334        if verbose: log.critical('Interpolating')
    335         grid_values = interp.interpolate(result, grid_points).flatten()
     335        grid_values = interp.interpolate(result, grid_points, verbose=verbose).flatten()
    336336        outside_indices = interp.get_outside_poly_indices()
    337337
  • trunk/anuga_core/source/anuga/fit_interpolate/fit.py

    r8588 r8592  
    185185        self.D = Sparse(m,m)
    186186
     187        import time
     188        t0 = time.time()
     189
    187190        if verbose :
    188191            print '['+60*' '+']',
     
    242245
    243246        if verbose:
    244             print ''
     247            print ' %f secs' % (time.time()-t0)
    245248
    246249    def get_D(self):
     
    252255                              point_coordinates,
    253256                              z,
    254                               verbose = False):
     257                              verbose = False,
     258                              output=None):
     259
     260
    255261        """Build:
    256262        AtA  m x m  interpolation matrix, and,
     
    275281
    276282
    277         #if verbose:
    278         #    print 'Fit: Build Matrix AtA Atz'
     283        if verbose and output == 'counter':
     284            print 'Fit: Build Matrix AtA Atz'
     285
     286        import time
     287        t0 = time.time()
    279288
    280289        # Build n x m interpolation matrix
     
    308317
    309318
    310         if verbose :
    311             #print '['+60*' '+']',
    312             print '\b.',
     319        if verbose and output == 'counter' :
     320            print '['+60*' '+']',
     321            #print '\b.',
    313322            sys.stdout.flush()
    314323
    315         #m = max(n/60,1)
     324        m = max(n/60,1)
    316325
    317326
     
    330339
    331340
    332             #if verbose and i%m == 0 :
    333             #    print '\r['+(i/m)*'.'+(60-(i/m))*' '+']',
    334             #    sys.stdout.flush()
     341            if verbose and output == 'counter' and i%m == 0 :
     342                print '\r['+(i/m)*'.'+(60-(i/m))*' '+']',
     343                sys.stdout.flush()
    335344
    336345
     
    364373
    365374
    366         #if verbose:
    367         #    print ''
     375        if verbose and output == 'counter':
     376            print ' %f secs' % (time.time()-t0)
    368377           
    369378        self.AtA = AtA
     
    429438                self.build_fit_subset(points, z, attribute_name, verbose)
    430439
     440
    431441                # FIXME(Ole): I thought this test would make sense here
    432442                # See test_fitting_example_that_crashed_2 in test_shallow_water_domain.py
     
    436446
    437447            point_coordinates = None
     448
     449            if verbose: print ''
     450           
    438451        else:
    439452            point_coordinates =  point_coordinates_or_filename
    440453
    441454
    442         if verbose: print ''
     455
    443456
    444457        if point_coordinates is None:
     
    454467            # if isinstance(point_coordinates,Geospatial_data) and z is None:
    455468            # z will come from the geo-ref
    456             self.build_fit_subset(point_coordinates, z, verbose=verbose)
     469            self.build_fit_subset(point_coordinates, z, verbose=verbose, output='counter')
    457470
    458471
     
    495508       
    496509    def build_fit_subset(self, point_coordinates, z=None, attribute_name=None,
    497                               verbose=False):
     510                              verbose=False, output='dot'):
    498511        """Fit a smooth surface to given 1d array of data points z.
    499512
     
    518531            point_coordinates = point_coordinates.get_data_points( \
    519532                absolute = True)
     533
    520534       
    521535        # Convert input to numeric arrays
     
    528542
    529543        point_coordinates = ensure_numeric(point_coordinates, num.float)
    530         self._build_matrix_AtA_Atz(point_coordinates, z, verbose)
     544        self._build_matrix_AtA_Atz(point_coordinates, z, verbose, output)
     545       
     546        if verbose and output == 'dot':
     547            print '\b.',
     548            sys.stdout.flush()
     549
     550
    531551
    532552
  • trunk/anuga_core/source/anuga/fit_interpolate/interpolate.py

    r8541 r8592  
    466466            if element_found is True:
    467467
    468                 if verbose:
    469                     print 'Point is within mesh:', d, i           
     468                #if verbose:
     469                #    print 'Point is within mesh:', d, i
    470470           
    471471                inside_poly_indices.append(i)
  • trunk/anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r8147 r8592  
    156156            if verbose is True:
    157157                if file_name is not None:
    158                     log.critical('Loading Geospatial data from file: %s'
     158                    log.critical('Geospatial_data: Loading Geospatial data from file: %s'
    159159                                 % file_name)
    160160
     
    168168        if verbose is True:
    169169            if file_name is not None:
    170                 log.critical('Geospatial data created from file: %s'
     170                log.critical('Geospatial_data: Created from file: %s'
    171171                             % file_name)
    172172                if load_file_now is False:
     
    379379
    380380        if self.verbose is True:
    381             log.critical('Using attribute %s' % attribute_name)
    382             log.critical('Available attributes: %s' % (self.attributes.keys()))
     381            log.critical('Geospatial_data: Using attribute %s' % attribute_name)
     382            log.critical('Geospatial_data: Available attributes: %s' % (self.attributes.keys()))
    383383
    384384        msg = 'Attribute name %s does not exist in data set' % attribute_name
     
    706706
    707707            if self.verbose is True:
    708                 log.critical('Reading %d points (in ~%d blocks) from file %s. '
     708                log.critical('Geospatial_data: Reading %d points (in ~%d blocks) from file %s. '
    709709                             % (self.number_of_points, self.number_of_blocks,
    710710                                self.file_name))
    711                 log.critical('Each block consists of %d data points'
     711                log.critical('Geospatial_data: Each block consists of %d data points'
    712712                             % self.max_read_lines)
    713713        else:
     
    741741                if (self.show_verbose >= self.start_row
    742742                    and self.show_verbose < fin_row):
    743                     log.critical('Reading block %d (points %d to %d) out of %d'
     743
     744                    log.critical('\nGeospatial_data: Reading block %d (points %d to %d) out of %d'
    744745                                 % (self.block_number, self.start_row,
    745746                                    fin_row, self.number_of_blocks))
     
    867868    """
    868869
    869     if verbose: log.critical('Reading %s' % file_name)
     870    if verbose: log.critical('Geospatial_data: Reading %s' % file_name)
    870871
    871872    # See if the file is there.  Throw a QUIET IO error if it isn't
     
    879880    keys = fid.variables.keys()
    880881
    881     if verbose: log.critical('Got %d variables: %s' % (len(keys), keys))
     882    if verbose: log.critical('Geospatial_data: Got %d variables: %s' % (len(keys), keys))
    882883
    883884    try:
     
    890891    attributes = {}
    891892    for key in keys:
    892         if verbose: log.critical("reading attribute '%s'" % key)
     893        if verbose: log.critical("Geospatial_data: Reading attribute '%s'" % key)
    893894
    894895        attributes[key] = num.array(fid.variables[key])
     
    900901
    901902    fid.close()
     903
     904    if verbose: log.critical("Geospatial_data: %g data points" % len(pointlist))
    902905
    903906    return pointlist, attributes, geo_reference
  • trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py

    r8578 r8592  
    6262        normals = mesh.get_normals()
    6363
     64        import time
     65        t0 = time.time()
     66
    6467        if verbose :
    6568            print '['+60*' '+']',
    6669            sys.stdout.flush()
    6770
    68         M = N/60
     71        M = max(N/60, 1)
    6972
    7073        # Check each triangle
     
    9093
    9194        if verbose:
    92             print ''
     95            print ' %f secs' % (time.time()-t0)
    9396
    9497    def search_fast(self, point):
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_ext.c

    r8486 r8592  
    45184518
    45194519    // Local variables
    4520     double max_speed, length, inv_area, zl, zr;
     4520    double max_speed, max_speed_total, length, inv_area, zl, zr;
    45214521    double timestep = 1.0e30;
    45224522    double h0 = D->H0 * D->H0; // This ensures a good balance when h approaches H0.
     
    45484548    // For all triangles
    45494549    for (k = 0; k < D->number_of_elements; k++) {
     4550        max_speed_total = 0.0;
    45504551        // Loop through neighbours and compute edge flux for each
    45514552        for (i = 0; i < 3; i++) {
     
    46714672            }
    46724673
     4674            max_speed_total = max(max_speed_total,max_speed);
    46734675        } // End edge i (and neighbour n)
     4676
     4677
    46744678
    46754679
     
    46834687
    46844688        // Keep track of maximal speeds
    4685         D->max_speed[k] = max_speed;
     4689        D->max_speed[k] = max_speed_total;
    46864690
    46874691    } // End triangle k
  • trunk/anuga_core/source/anuga/structures/inlet_operator.py

    r8549 r8592  
    6363       
    6464        #print Q, volume
    65        
    66         assert current_volume + volume >= 0.0, 'Requesting too much water to be removed from an inlet!'
     65
     66        msg =  'Requesting too much water to be removed from an inlet! \n'
     67        msg += 'current_water_volume = %5.2e Increment volume = %5.2e' % (current_volume, volume)
     68        assert current_volume + volume >= 0.0, msg
    6769
    6870        # store last discharge
  • trunk/anuga_core/source/anuga_parallel/parallel_inlet_enquiry.py

    r8227 r8592  
    6363                msg = 'Enquiry point %s' % (self.enquiry_pt)
    6464                msg += 'is in an inlet triangle'
    65                 raise Exception, msg
     65                import warnings
     66                warnings.warn(msg)
     67
    6668
    6769            if self.enquiry_proc >= 0:
Note: See TracChangeset for help on using the changeset viewer.