source: trunk/anuga_work/development/mem_time_tests/scenarios/stage/main.py @ 8304

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

adding more files from the resource experiments

  • 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 random
10import subprocess
11import ex1
12import csv
13import os
14import time
15from anuga.utilities import system_tools, log
16from anuga.abstract_2d_finite_volumes.util import add_directories
17
18
19#------------------------------------------------------------------------------
20# Setup computational domain
21#------------------------------------------------------------------------------
22a = []
23
24home = os.getenv('INUNDATIONHOME')
25scenariodir = add_directories(home, ["data","mem_time_test", "scenarios",
26                                     "stage"])
27
28log.log_filename = os.path.join(scenariodir, 'log.txt')
29file = 'ex1.csv'
30file_path = os.path.join(scenariodir, file)
31
32spamWriter = csv.writer(open(file_path, 'wb'))
33spamWriter.writerow(['Stage','Extent','Time','Space'])
34
35
36def onevar(b):
37    for n in range(1,100,10):
38        system_tools.MemoryUpdate()
39        z = time.time()
40        ex1.runex(b,n)
41        y = time.time()
42        a = system_tools.MemoryUpdate()[0]
43        spamWriter.writerow([n ,((b**2)/2),(y-z),a])
44    print a
45
46for m in range(100,1000,100):
47    onevar(m)
48
Note: See TracBrowser for help on using the repository browser.