- Timestamp:
- Feb 10, 2012, 10:34:08 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/mem_time_tests/parameters/timelen/ex1.py
r8328 r8331 11 11 #set up variables to store the results and the log files of each experiment 12 12 f = sys.argv[1] 13 g = float(f)/100.0 13 14 home = os.getenv('INUNDATIONHOME') 14 15 scenariodirV = add_directories(home, ["data","mem_time_test", "parameters", … … 17 18 log._setup = False 18 19 19 log.resource_usage_timing(prefix = 'BeforeSimulation') #get memory usage here 20 log.timingInfo(msg=('variable1,'+str(f))) #write the variable to be measured to file 21 22 log.timingInfo(msg=('beforetime,'+str(log.TimeStamp()))) #get the time at the beginning of the simulation 23 24 log.resource_usage_timing(prefix = 'beforesimulation') #get memory usage here 20 25 21 26 #------------------------------------------------------------------------------ … … 27 32 domain.set_datadir(scenariodirV) 28 33 29 log.resource_usage_timing(prefix = ' AfterMesh') #get memory usage here34 log.resource_usage_timing(prefix = 'aftermesh') #get memory usage here 30 35 #------------------------------------------------------------------------------ 31 36 # Setup initial conditions 32 37 #------------------------------------------------------------------------------ 33 38 def topography(x, y): 34 return -x/10 # linear bed slope39 return 0 # linear bed slope 35 40 domain.set_quantity('elevation', topography) # Use function for elevation 36 41 domain.set_quantity('friction', 0.01) # Constant friction 37 domain.set_quantity('stage', expression='elevation')42 domain.set_quantity('stage', 10) 38 43 39 44 log.resource_usage_timing(prefix='afterinitialconditions')#get memory usage here … … 42 47 # Setup boundary conditions 43 48 #------------------------------------------------------------------------------ 44 Bi = anuga.Dirichlet_boundary([0.4, 0, 0]) # Inflow45 49 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 46 domain.set_boundary({'left': B i, 'right': Br, 'top': Br, 'bottom': Br})50 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br}) 47 51 48 52 log.resource_usage_timing(prefix='afterboundary')#get memory usage here … … 51 55 # Evolve system through time 52 56 #------------------------------------------------------------------------------ 53 for t in domain.evolve(yieldstep= 0.2, finaltime=f):57 for t in domain.evolve(yieldstep=g, finaltime=f): 54 58 print domain.timestepping_statistics() 55 59 56 60 57 61 log.resource_usage_timing(prefix='aftersimulation') #get memory usage here 58 62 log.timingInfo(msg=('aftertime,'+str(log.TimeStamp()))) #get the time at the end of the simulation
Note: See TracChangeset
for help on using the changeset viewer.