Changeset 1835 for inundation/validation/Completed/LWRU2/lwru2.py
- Timestamp:
- Sep 15, 2005, 5:32:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/validation/Completed/LWRU2/lwru2.py
r1817 r1835 15 15 16 16 17 18 17 import sys 19 18 from os import sep … … 21 20 22 21 def prepare_timeboundary(filename): 23 """Converting benchmark 2 time series to NetCDF sww file. 22 """Converting benchmark 2 time series to NetCDF tms file. 23 This is a 'throw-away' code taylor made for files like 24 'Benchmark_2_input.txt' from the LWRU2 benchmark 24 25 """ 25 26 26 27 27 print 'Preparing time boundary from %s' %filename … … 33 33 line = fid.readline() 34 34 35 #Read remaining lines 35 36 lines = fid.readlines() 36 37 fid.close() 37 38 39 38 40 N = len(lines) 39 40 41 T = zeros(N, Float) #Time 41 42 Q = zeros(N, Float) #Values … … 47 48 Q[i] = float(fields[1]) 48 49 49 #Create sww file 50 51 #Create tms file 50 52 from Scientific.IO.NetCDF import NetCDFFile 51 53 52 outfile = filename[:-4] + '. sww'54 outfile = filename[:-4] + '.tms' 53 55 print 'Writing to', outfile 54 56 fid = NetCDFFile(outfile, 'w') … … 91 93 92 94 95 93 96 ####################### 94 # Domain97 # Create Domain 95 98 if use_variable_mesh is True: 96 99 print 'Creating domain from', project.mesh_filename … … 99 102 (project.mesh_filename, Domain), 100 103 dependencies = [project.mesh_filename]) 101 102 103 104 104 105 else: … … 114 115 115 116 116 print "Number of triangles = ", len(domain) 117 import sys, os 118 base = os.path.basename(sys.argv[0]) 119 domain.filename, _ = os.path.splitext(base) 120 domain.default_order = 2 121 domain.store = True #Store for visualisation purposes 122 123 domain.check_integrity() 124 print 'Number of triangles = ', len(domain) 117 125 print 'The extent is ', domain.get_extent() 118 126 119 127 120 #domain.check_integrity()121 domain.default_order = 2122 128 123 print "Number of triangles = ", len(domain) 124 domain.store = True #Store for visualisation purposes 125 126 import sys, os 127 base = os.path.basename(sys.argv[0]) 128 domain.filename, _ = os.path.splitext(base) 129 129 ####################### 130 # Initial Conditions 130 131 print 'Initial values' 131 132 … … 142 143 143 144 ###################### 144 # Boundary conditions145 # Boundary Conditions 145 146 # 146 147 print 'Boundaries' … … 148 149 149 150 from pyvolution.util import file_function 150 function = file_function(project.boundary_filename[:-4] + '.sww', domain, 151 function = file_function(project.boundary_filename[:-4] + '.tms', 152 domain, 151 153 verbose = True) 152 154 Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) … … 159 161 160 162 161 #Evolve 163 164 ####################### 165 # Evolve 162 166 import time 163 167 t0 = time.time()
Note: See TracChangeset
for help on using the changeset viewer.