Changeset 8592
- Timestamp:
- Oct 31, 2012, 2:03:04 PM (11 years ago)
- 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 5 5 import anuga 6 6 7 scenario = ' slide'7 scenario = 'fixed_wave' 8 8 name = 'cairns_' + scenario 9 9 -
trunk/anuga_core/documentation/user_manual/demos/cairns/project.py
r7838 r8592 48 48 # Make these numbers larger to reduce the number of triangles in the model, 49 49 # 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 52 base_scale = 100000 53 base_scale = 1000000 54 default_res = 100 * base_scale # Background resolution 55 islands_res = base_scale 56 cairns_res = base_scale 57 shallow_res = 5 * base_scale 54 58 55 59 # Define list of interior regions with associated resolutions -
trunk/anuga_core/documentation/user_manual/demos/cairns/runcairns.py
r8538 r8592 63 63 domain.set_datadir('.') # Store sww output here 64 64 domain.set_minimum_storable_height(0.01) # Store only depth > 1cm 65 domain.set_flow_algorithm('tsunami') 65 66 66 67 #------------------------------------------------------------------------------ -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py
r8578 r8592 305 305 """ 306 306 307 import hashtable307 import neighbour_table_ext 308 308 309 309 N = self.number_of_nodes 310 310 311 311 312 hashtable.build_neighbour_structure(N,312 neighbour_table_ext.build_neighbour_structure(N, 313 313 self.triangles, 314 314 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 1 4 #include <stdio.h> /* gets */ 2 5 #include <stdlib.h> /* atoi, malloc */ 3 6 #include <string.h> /* strcpy */ 4 5 6 7 #include "Python.h" 8 #include "numpy/arrayobject.h" 9 #include "math.h" 7 #include <math.h> 10 8 11 9 //Shared code snippets … … 328 326 329 327 // Module initialisation 330 void init hashtable(void){331 Py_InitModule(" hashtable", MethodTable);328 void initneighbour_table_ext(void){ 329 Py_InitModule("neighbour_table_ext", MethodTable); 332 330 import_array(); // Necessary for handling of NumPY structures 333 331 } -
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain_ext.c
r8568 r8592 1 #include "Python.h" 2 #include "numpy/arrayobject.h" 3 1 4 #include <stdio.h> /* gets */ 2 5 #include <stdlib.h> /* atoi, malloc */ 3 6 #include <string.h> /* strcpy */ 4 5 6 7 #include "Python.h" 8 #include "numpy/arrayobject.h" 9 #include "math.h" 7 #include <math.h> 10 8 11 9 //Shared code snippets -
trunk/anuga_core/source/anuga/config.py
r8538 r8592 201 201 optimised_gradient_limiter = True # Use hardwired gradient limiter 202 202 203 points_file_block_line_size = 500 # Number of lines read in from a points file203 points_file_block_line_size = 5000 # Number of lines read in from a points file 204 204 # when blocking 205 205 -
trunk/anuga_core/source/anuga/file_conversion/sww2dem.py
r8563 r8592 333 333 # Interpolate using quantity values 334 334 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() 336 336 outside_indices = interp.get_outside_poly_indices() 337 337 -
trunk/anuga_core/source/anuga/fit_interpolate/fit.py
r8588 r8592 185 185 self.D = Sparse(m,m) 186 186 187 import time 188 t0 = time.time() 189 187 190 if verbose : 188 191 print '['+60*' '+']', … … 242 245 243 246 if verbose: 244 print ' '247 print ' %f secs' % (time.time()-t0) 245 248 246 249 def get_D(self): … … 252 255 point_coordinates, 253 256 z, 254 verbose = False): 257 verbose = False, 258 output=None): 259 260 255 261 """Build: 256 262 AtA m x m interpolation matrix, and, … … 275 281 276 282 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() 279 288 280 289 # Build n x m interpolation matrix … … 308 317 309 318 310 if verbose :311 #print '['+60*' '+']',312 print '\b.',319 if verbose and output == 'counter' : 320 print '['+60*' '+']', 321 #print '\b.', 313 322 sys.stdout.flush() 314 323 315 #m = max(n/60,1)324 m = max(n/60,1) 316 325 317 326 … … 330 339 331 340 332 #if verboseand 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() 335 344 336 345 … … 364 373 365 374 366 #if verbose:367 # print ''375 if verbose and output == 'counter': 376 print ' %f secs' % (time.time()-t0) 368 377 369 378 self.AtA = AtA … … 429 438 self.build_fit_subset(points, z, attribute_name, verbose) 430 439 440 431 441 # FIXME(Ole): I thought this test would make sense here 432 442 # See test_fitting_example_that_crashed_2 in test_shallow_water_domain.py … … 436 446 437 447 point_coordinates = None 448 449 if verbose: print '' 450 438 451 else: 439 452 point_coordinates = point_coordinates_or_filename 440 453 441 454 442 if verbose: print '' 455 443 456 444 457 if point_coordinates is None: … … 454 467 # if isinstance(point_coordinates,Geospatial_data) and z is None: 455 468 # 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') 457 470 458 471 … … 495 508 496 509 def build_fit_subset(self, point_coordinates, z=None, attribute_name=None, 497 verbose=False ):510 verbose=False, output='dot'): 498 511 """Fit a smooth surface to given 1d array of data points z. 499 512 … … 518 531 point_coordinates = point_coordinates.get_data_points( \ 519 532 absolute = True) 533 520 534 521 535 # Convert input to numeric arrays … … 528 542 529 543 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 531 551 532 552 -
trunk/anuga_core/source/anuga/fit_interpolate/interpolate.py
r8541 r8592 466 466 if element_found is True: 467 467 468 if verbose:469 print 'Point is within mesh:', d, i468 #if verbose: 469 # print 'Point is within mesh:', d, i 470 470 471 471 inside_poly_indices.append(i) -
trunk/anuga_core/source/anuga/geospatial_data/geospatial_data.py
r8147 r8592 156 156 if verbose is True: 157 157 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' 159 159 % file_name) 160 160 … … 168 168 if verbose is True: 169 169 if file_name is not None: 170 log.critical('Geospatial data created from file: %s'170 log.critical('Geospatial_data: Created from file: %s' 171 171 % file_name) 172 172 if load_file_now is False: … … 379 379 380 380 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())) 383 383 384 384 msg = 'Attribute name %s does not exist in data set' % attribute_name … … 706 706 707 707 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. ' 709 709 % (self.number_of_points, self.number_of_blocks, 710 710 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' 712 712 % self.max_read_lines) 713 713 else: … … 741 741 if (self.show_verbose >= self.start_row 742 742 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' 744 745 % (self.block_number, self.start_row, 745 746 fin_row, self.number_of_blocks)) … … 867 868 """ 868 869 869 if verbose: log.critical(' Reading %s' % file_name)870 if verbose: log.critical('Geospatial_data: Reading %s' % file_name) 870 871 871 872 # See if the file is there. Throw a QUIET IO error if it isn't … … 879 880 keys = fid.variables.keys() 880 881 881 if verbose: log.critical('G ot %d variables: %s' % (len(keys), keys))882 if verbose: log.critical('Geospatial_data: Got %d variables: %s' % (len(keys), keys)) 882 883 883 884 try: … … 890 891 attributes = {} 891 892 for key in keys: 892 if verbose: log.critical(" reading attribute '%s'" % key)893 if verbose: log.critical("Geospatial_data: Reading attribute '%s'" % key) 893 894 894 895 attributes[key] = num.array(fid.variables[key]) … … 900 901 901 902 fid.close() 903 904 if verbose: log.critical("Geospatial_data: %g data points" % len(pointlist)) 902 905 903 906 return pointlist, attributes, geo_reference -
trunk/anuga_core/source/anuga/pmesh/mesh_quadtree.py
r8578 r8592 62 62 normals = mesh.get_normals() 63 63 64 import time 65 t0 = time.time() 66 64 67 if verbose : 65 68 print '['+60*' '+']', 66 69 sys.stdout.flush() 67 70 68 M = N/6071 M = max(N/60, 1) 69 72 70 73 # Check each triangle … … 90 93 91 94 if verbose: 92 print ' '95 print ' %f secs' % (time.time()-t0) 93 96 94 97 def search_fast(self, point): -
trunk/anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r8486 r8592 4518 4518 4519 4519 // Local variables 4520 double max_speed, length, inv_area, zl, zr;4520 double max_speed, max_speed_total, length, inv_area, zl, zr; 4521 4521 double timestep = 1.0e30; 4522 4522 double h0 = D->H0 * D->H0; // This ensures a good balance when h approaches H0. … … 4548 4548 // For all triangles 4549 4549 for (k = 0; k < D->number_of_elements; k++) { 4550 max_speed_total = 0.0; 4550 4551 // Loop through neighbours and compute edge flux for each 4551 4552 for (i = 0; i < 3; i++) { … … 4671 4672 } 4672 4673 4674 max_speed_total = max(max_speed_total,max_speed); 4673 4675 } // End edge i (and neighbour n) 4676 4677 4674 4678 4675 4679 … … 4683 4687 4684 4688 // Keep track of maximal speeds 4685 D->max_speed[k] = max_speed ;4689 D->max_speed[k] = max_speed_total; 4686 4690 4687 4691 } // End triangle k -
trunk/anuga_core/source/anuga/structures/inlet_operator.py
r8549 r8592 63 63 64 64 #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 67 69 68 70 # store last discharge -
trunk/anuga_core/source/anuga_parallel/parallel_inlet_enquiry.py
r8227 r8592 63 63 msg = 'Enquiry point %s' % (self.enquiry_pt) 64 64 msg += 'is in an inlet triangle' 65 raise Exception, msg 65 import warnings 66 warnings.warn(msg) 67 66 68 67 69 if self.enquiry_proc >= 0:
Note: See TracChangeset
for help on using the changeset viewer.