source: trunk/anuga_work/development/mem_time_tests/triangles/rectanglecross/runcairns.py @ 8342

Last change on this file since 8342 was 8342, checked in by pittj, 13 years ago

all variables now have the correct name

  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#------------------------------------------------------------------------------
2# Import necessary modules
3#------------------------------------------------------------------------------
4import os
5import time
6import sys
7import anuga
8from anuga.abstract_2d_finite_volumes.util import add_directories
9from anuga.utilities import log
10
11#set up the variables for the simulation out put and log files
12a = int(sys.argv[1])
13l = float(sys.argv[2])
14
15home = os.getenv('INUNDATIONHOME')
16scenariodirV = add_directories(home, ["data","mem_time_test", "triangles",
17                                       "rectanglecross", "triangles-" + str(a) +"-"+ str(l)])
18log.log_filename = os.path.join(scenariodirV, "anuga.log")
19log._setup = False
20
21log.timingInfo(msg=('matrixsize,'+str(a))) #write the variable to be measured to file
22log.timingInfo(msg=('extent,'+str(l**2))) #write the variable to be measured to file
23log.timingInfo(msg=('beforetime,'+str(log.TimeStamp()))) #get the time at the beginning of the simulation
24
25log.resource_usage_timing(prefix = 'beforesimulation')#get memory usage
26#------------------------------------------------------------------------------
27# Create the triangular mesh and domain
28#------------------------------------------------------------------------------
29points, vertices, boundary = anuga.rectangular_cross(a, a,len1 = l,len2 = l) # Basic mesh
30domain = anuga.Domain(points, vertices, boundary) # Create
31domain.set_name('CAIRNS.sww') # Name of sww file
32domain.set_datadir(scenariodirV)# Store sww output here
33log.resource_usage_timing(prefix = 'aftermesh') #get memory usage
34log.timingInfo(msg=('aftermeshtime,'+str(log.TimeStamp()))) #get the time at the beginning of the simulation
35#------------------------------------------------------------------------------
36# Setup initial conditions
37#------------------------------------------------------------------------------
38
39#get the number of triangles
40number=len(domain)
41log.timingInfo(msg=('numberoftriangles,'+str(number))) #write the variable to be measured to file
42
43def topography(x,y):
44    return 0.0
45
46tide = 100.0
47friction = 0.0
48domain.set_quantity('stage', tide)
49domain.set_quantity('friction', friction) 
50domain.set_quantity('elevation',topography,alpha=0.1)
51
52log.resource_usage_timing(prefix='afterinitialconditions')#get memory usage
53#------------------------------------------------------------------------------
54# Setup boundary conditions
55#------------------------------------------------------------------------------
56Bi = anuga.Dirichlet_boundary([tide, 223.52, 0]) # inflow
57Bo = anuga.Dirichlet_boundary([-tide, 223.52, 0]) # outflow
58Br = anuga.Reflective_boundary(domain)
59domain.set_boundary({'right': Bo,'bottom': Br,'left': Bi,'top': Br})
60
61log.resource_usage_timing(prefix='afterboundary')#get memory usage
62#------------------------------------------------------------------------------
63# Evolve system through time
64#------------------------------------------------------------------------------
65for t in domain.evolve(yieldstep=120, finaltime=2000): 
66    print domain.timestepping_statistics()
67
68log.resource_usage_timing(prefix='aftersimulation')#get memory usage
69log.timingInfo(msg=('aftertime,'+str(log.TimeStamp()))) #get the time at the end of the simulation
Note: See TracBrowser for help on using the repository browser.