"""Simple water flow example using ANUGA Water flowing down a channel """ #------------------------------------------------------------------------------ # Import necessary modules #------------------------------------------------------------------------------ # Import standard shallow water domain and standard boundaries. import anuga import subprocess import csv import os import time import liststore from anuga.utilities import system_tools, log from anuga.abstract_2d_finite_volumes.util import add_directories #------------------------------------------------------------------------------ # Setup computational domain #------------------------------------------------------------------------------ a = [] #SpaceUsed = 0.0 #number = 0 home1 = os.getenv('INUNDATIONHOME') scenariodir = add_directories(home1, ["data","mem_time_test", "triangles","area"]) file1 = 'ex1.csv' file_path = os.path.join(scenariodir, file1) storel ='storel.txt' file_path_storel = os.path.join(scenariodir, storel) storea ='storea.txt' file_path_storea = os.path.join(scenariodir, storea) store ='store.txt' file_path_store = os.path.join(scenariodir, store) storen ='storen.txt' file_path_storen = os.path.join(scenariodir, storen) log.log_filename = os.path.join(scenariodir, 'log.txt') spamWriter = csv.writer(open(file_path, 'wb')) spamWriter.writerow(['Number Of Triangles' ,'Max Triangle Area', 'Extent', 'Space Used MB' , 'Time Taken s']) e = open(file_path_store,'a') e.close() e = open(file_path_storea,'a') e.close() e = open(file_path_storel,'a') e.close() e = open(file_path_storen,'a') e.close() def rum(d): f = 4 for l in range(400,500,100): g = open(file_path_storel,'r+') g.write(str(l)) h = open(file_path_storea,'r+') h.write(str(d)) z = time.time() subprocess.call(['mpirun', '-np', str(f), '-hostfile' ,'~/machinefiles/t.machines_tornado', '-x','PYTHONPATH','-x','INUNDATIONHOME','python2.5', 'runcairns.py']) #subprocess.call(['python2.5', 'runcairns.py']) y = time.time() f = open(file_path_store,'r+') x = float(f.readline()) f.close() f = open(file_path_storen,'r+') i = float(f.readline()) f.close() spamWriter.writerow([i,d,(l*l),x ,(y-z)]) liststore.store = [0,0,0,0] for m in range(90,100,10): rum(m) print 'Done'