source: trunk/anuga_work/development/mem_time_tests/hardware/template/runcairns.py @ 8326

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

formatted the experiment scripts

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1"""
2This experiment was based heavily on the cairns demo given in the user manual and found in
3the anuga repository.
4
5However, it has been simplified so that it doesnt require all the files the cairns demo does
6"""
7
8#------------------------------------------------------------------------------
9# Import necessary modules
10#------------------------------------------------------------------------------
11import os
12import time
13import sys
14import anuga
15from anuga_parallel import distribute, myid, numprocs
16from anuga.abstract_2d_finite_volumes.util import add_directories
17from anuga.utilities import log
18
19#set up variables for the correct I/O directories for data storage
20home = os.getenv('INUNDATIONHOME')
21scenariodir = add_directories(home, ["data", "mem_time_test", "parallel", "template"])
22scenariodirV = add_directories(home, ["data","mem_time_test", "parallel",
23                                       "template", "template-" + str(numprocs) +"-"+ str(myid)])
24h = 'CAIRNS.msh'
25file_pathh = os.path.join(scenariodirV, h)
26log.log_filename = os.path.join(scenariodirV, "anuga.log")
27log._setup = False
28
29log.resource_usage_timing(prefix = 'BeforeSimulation')#get memory statistics here
30#------------------------------------------------------------------------------
31#Create the domain and mesh for the resource experiment on only one processor
32#------------------------------------------------------------------------------
33
34if myid == 0:
35    domain = anuga.create_domain_from_regions([(0.0,0.0),(10000.0,10000.0),(0.0,10000.0),(10000.0,0.0)],
36                                    boundary_tags={'top': [0],
37                                                   'right': [1],
38                                                   'bottom': [2],
39                                                   'left': [3]},
40                                    maximum_triangle_area=100.0,
41                                    mesh_filename=file_pathh)
42else:
43    domain = None
44
45#parallel   
46domain = distribute(domain)
47domain.set_name('CAIRNS') # Name of sww file
48domain.set_datadir(scenariodirV)# Store sww output here
49log.resource_usage_timing(prefix = 'AfterMesh')#get memory statistics here
50
51#------------------------------------------------------------------------------
52# Setup initial conditions
53#------------------------------------------------------------------------------
54
55def topography(x,y):
56    return 0.0
57
58tide = 100.0
59friction = 0.0
60domain.set_quantity('stage', tide)
61domain.set_quantity('friction', friction) 
62domain.set_quantity('elevation',topography,alpha=0.1)
63
64log.resource_usage_timing(prefix='afterinitialconditions') #get memory statistics here
65
66#------------------------------------------------------------------------------
67# Setup boundary conditions
68#------------------------------------------------------------------------------
69
70Bi = anuga.Dirichlet_boundary([tide, 223.52, 0]) # inflow
71Bo = anuga.Dirichlet_boundary([-tide, 223.52, 0]) # inflow
72Br = anuga.Reflective_boundary(domain)
73domain.set_boundary({'right': Bo,'bottom': Br,'left': Bi,'top': Br})
74
75log.resource_usage_timing(prefix='afterboundary') #get memory statistics here
76#------------------------------------------------------------------------------
77# Evolve system through time
78#------------------------------------------------------------------------------
79for t in domain.evolve(yieldstep=120, finaltime=2000): 
80    print domain.timestepping_statistics()
81
82log.resource_usage_timing(prefix='aftersimulation')#get memory statistics here 
Note: See TracBrowser for help on using the repository browser.