Changeset 4705
- Timestamp:
- Sep 5, 2007, 5:17:30 PM (18 years ago)
- Location:
- anuga_core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/anuga_user_manual.tex
r4691 r4705 2314 2314 \end{funcdesc} 2315 2315 2316 2316 2317 \begin{funcdesc}{set\_quantities\_to\_be\_monitored}{} 2318 Module: \module{abstract\_2d\_finite\_volumes.domain} 2319 2320 Selects quantities and derived quantities for which extrema attained at internal timesteps 2321 will be collected. 2322 2323 Information can be tracked in the evolve loop by printing \code{quantity\_statistics} and 2324 collected data will be stored in the sww file. 2325 2326 Optional parameters \code{polygon} and \code{time\_interval} may be specified to restrict the 2327 extremum computation. 2328 \end{funcdesc} 2329 2330 \begin{funcdesc}{quantity\_statistics}{} 2331 Module: \module{abstract\_2d\_finite\_volumes.domain} 2332 2333 Reports on extrema attained by selected quantities. 2334 2335 Returns a string of the following type for each 2336 timestep: 2337 2338 \begin{verbatim} 2339 Monitored quantities at time 1.0000: 2340 stage-elevation: 2341 values since time = 0.00 in [0.00000000, 0.30000000] 2342 minimum attained at time = 0.00000000, location = (0.16666667, 0.33333333) 2343 maximum attained at time = 0.00000000, location = (0.83333333, 0.16666667) 2344 ymomentum: 2345 values since time = 0.00 in [0.00000000, 0.06241221] 2346 minimum attained at time = 0.00000000, location = (0.33333333, 0.16666667) 2347 maximum attained at time = 0.22472667, location = (0.83333333, 0.66666667) 2348 xmomentum: 2349 values since time = 0.00 in [-0.06062178, 0.47886313] 2350 minimum attained at time = 0.00000000, location = (0.16666667, 0.33333333) 2351 maximum attained at time = 0.35103646, location = (0.83333333, 0.16666667) 2352 \end{verbatim} 2353 2354 The quantities (and derived quantities) listed here must be selected at model 2355 initialisation using the method \code{domain.set_quantities_to_be_monitored}.\\ 2356 2357 The optional keyword argument \code{precision='\%.4f'} will 2358 determine the precision used for floating point values in the output. 2359 This diagnostics helps track extrema attained by the selected quantities 2360 at every internal timestep. 2361 2362 These values are also stored in the sww file for post processing. 2363 2364 \end{funcdesc} 2365 2366 2367 2317 2368 \begin{funcdesc}{get\_values}{location='vertices', indices = None} 2318 2369 Module: \module{abstract\_2d\_finite\_volumes.quantity} -
anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py
r4592 r4705 498 498 if not segments.has_key(tuple(A)): 499 499 segments[tuple(A)] = [] # Empty list for candidate points 500 500 501 501 segments[tuple(A)].append(B) 502 502 503 503 504 504 # Start with smallest point and follow boundary (counter clock wise) 505 polygon = [ p0]# Storage for final boundary polygon505 polygon = [list(p0)]# Storage for final boundary polygon 506 506 point_registry = {} # Keep track of storage to avoid multiple runs 507 507 # around boundary. This will only be the case if … … 599 599 point_registry[tuple(p1)] = len(point_registry) 600 600 601 polygon.append( p1)601 polygon.append(list(p1)) # De-Numeric each point :-) 602 602 p0 = p1 603 603 -
anuga_core/source/anuga/shallow_water/data_manager.py
r4704 r4705 345 345 if domain.quantities_to_be_monitored is not None: 346 346 fid.createDimension('singleton', 1) 347 fid.createDimension('two', 2) 348 349 poly = domain.monitor_polygon 350 if poly is not None: 351 N = len(poly) 352 fid.createDimension('polygon_length', N) 353 fid.createVariable('extrema:polygon', 354 self.precision, 355 ('polygon_length', 356 'two')) 357 fid.variables['extrema:polygon'][:] = poly 358 359 interval = domain.monitor_time_interval 360 if interval is not None: 361 fid.createVariable('extrema:time_interval', 362 self.precision, 363 ('two',)) 364 fid.variables['extrema:time_interval'][:] = interval 365 366 367 368 347 369 for q in domain.quantities_to_be_monitored: 348 370 #print 'doing', q -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r4704 r4705 274 274 'ymomentum', 275 275 'stage-elevation']) 276 277 assert domain.monitor_polygon is None 278 assert domain.monitor_time_interval is None 279 280 281 domain.set_quantities_to_be_monitored(['xmomentum', 282 'ymomentum', 283 'stage-elevation'], 284 polygon=domain.get_boundary_polygon(), 285 time_interval=[0,1]) 286 276 287 277 288 assert len(domain.quantities_to_be_monitored) == 3 … … 279 290 assert domain.quantities_to_be_monitored.has_key('xmomentum') 280 291 assert domain.quantities_to_be_monitored.has_key('ymomentum') 281 assert domain.monitor_polygon is None 282 assert domain.monitor_time_interval is None 292 283 293 284 294 sww = get_dataobject(domain) … … 287 297 pass 288 298 #print domain.timestepping_statistics() 289 #print domain.quantity_statistics(precision = '%.8f')299 domain.quantity_statistics(precision = '%.8f') # Silent 290 300 291 301 … … 312 322 assert allclose(extrema,[0.00, 0.06241221]) 313 323 324 time_interval = fid.variables['extrema:time_interval'][:] 325 assert allclose(time_interval, [0,1]) 326 327 polygon = fid.variables['extrema:polygon'][:] 328 assert allclose(polygon, domain.get_boundary_polygon()) 314 329 315 330 fid.close()
Note: See TracChangeset
for help on using the changeset viewer.