source: trunk/anuga_work/development/mem_time_tests/parameters/timelen-over-timestep/main.py @ 8315

Last change on this file since 8315 was 8315, checked in by pittj, 12 years ago

updating all so that they create the temporary files they use

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1"""Simple water flow example using ANUGA
2Water flowing down a channel
3"""
4#------------------------------------------------------------------------------
5# Import necessary modules
6#------------------------------------------------------------------------------
7# Import standard shallow water domain and standard boundaries.
8import anuga
9import time
10import random
11import subprocess
12import ex1
13import csv
14import os
15from anuga.utilities import system_tools, log
16from anuga.abstract_2d_finite_volumes.util import add_directories
17#------------------------------------------------------------------------------
18# Setup computational domain
19#------------------------------------------------------------------------------
20a = []
21home = os.getenv('INUNDATIONHOME')
22
23
24scenariodir = add_directories(home, ["data","mem_time_test", "parameters",
25                                     "timelen-over-timestep"])
26file = 'ex1.csv'
27
28log.log_filename = os.path.join(scenariodir, 'log.txt')
29
30file_path = os.path.join(scenariodir, file)
31
32spamWriter = csv.writer(open(file_path, 'wb'))
33
34spamWriter.writerow(['Time Length', 'Time Step' , 'Time Taken','Space Used'])
35
36for m in range(1,1000,50):
37
38    for n in range(1,1000,5):
39        n = n/1000.0
40        system_tools.MemoryUpdate()
41        x = time.clock()
42        ex1.runex(float(m),n)
43        y = time.clock() 
44        b = system_tools.MemoryUpdate()[0]
45        spamWriter.writerow([m,n ,(y-x),b])
46        a.append((n,y-x,b))
47print a
48
Note: See TracBrowser for help on using the repository browser.