Changeset 8396
- Timestamp:
- Apr 12, 2012, 9:00:47 PM (13 years ago)
- Location:
- trunk/anuga_work/development/gareth
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/balanced_basic/swb2_domain.py
r8302 r8396 69 69 self.forcing_terms.remove(gravity) 70 70 print 'Using shallow_water_balanced2 solver in /balanced_basic/' 71 72 73 71 print 'I SUGGEST YOU DO NOT USE THIS ONE -- THE BALANCED DEV SOLVER SEEMS BETTER,' 72 print 'AND IS BETTER TESTED (as of 6/4/2012)' 73 print 'IT PRESENTLY LIVES IN anuga_work/development/gareth/experimental/balanced_dev' 74 print ' ' 75 print 'The following error is intended to draw your attention to the message above' 76 77 assert 0==1 74 78 #----------------- 75 79 # Flux computation -
trunk/anuga_work/development/gareth/experimental/balanced_dev/__init__.py
r8385 r8396 325 325 326 326 return domain 327 327 328 328 import logging as log 329 329 -
trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_boundary_conditions.py
r8385 r8396 1 1 2 2 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions\ 3 import Boundary 3 import Boundary, File_boundary 4 4 5 5 #from swb2_domain_ext import rotate 6 7 class Transmissive_boundary(Boundary):8 """Transmissive boundary returns same conserved quantities as9 those present in its neighbour volume.10 11 Underlying domain must be specified when boundary is instantiated12 """13 14 def __init__(self, domain = None):15 Boundary.__init__(self)16 17 if domain is None:18 msg = 'Domain must be specified for transmissive boundary'19 raise Exception, msg20 21 self.domain = domain22 23 def __repr__(self):24 return 'Transmissive_boundary(%s)' %self.domain25 26 def evaluate(self, vol_id, edge_id):27 """Transmissive boundaries return the edge values28 of the volume they serve.29 """30 31 if self.domain.get_centroid_transmissive_bc() :32 q = self.domain.get_evolved_quantities(vol_id)33 else:34 q = self.domain.get_evolved_quantities(vol_id, edge = edge_id)35 return q36 37 6 ##### 38 7 … … 153 122 154 123 return q 124 125 126 class zero_mass_flux_zero_t_transmissive_n_momentum_boundary(Boundary): 127 """ Boundary which operates directly on the fluxes 128 Sets boundary values of h=neighbour_h, uh=neighbour_uh, vh=0. 129 and ensure that: 130 flux[0] = 0.0 131 """ 132 def __init__(self, domain = None): 133 Boundary.__init__(self) 134 135 if domain is None: 136 msg = 'Domain must be specified for zero_mass_flux_zero_t_transmissive_n_momentum_boundary' 137 raise Exception, msg 138 139 self.domain = domain 140 141 def __repr__(self): 142 return 'zero_mass_flux_zero_t_transmissive_n_momentum_boundary(%s)' %self.domain 143 144 def evaluate(self, vol_id, edge_id): 145 """ Apply chosen values to q[1], q[2] 146 """ 147 148 if self.domain.get_centroid_transmissive_bc() : 149 q = self.domain.get_evolved_quantities(vol_id) 150 else: 151 q = self.domain.get_evolved_quantities(vol_id, edge = edge_id) 152 153 normal = self.domain.normals[vol_id, 2*edge_id:2*edge_id+2] 154 155 r = rotate(q, normal, direction = 1) 156 #r[1] = -r[1] 157 tdamp=0.0 158 ndamp=1.0 159 r[1]=r[1]*ndamp 160 r[2]=r[2]*tdamp 161 q = rotate(r, normal, direction = -1) 162 163 # q[1]=0. 164 # q[2]=0. 165 166 return q 167 168 155 169 ### 156 170 def rotate(q,normal,direction=1): … … 170 184 171 185 return out 172 -
trunk/anuga_work/development/gareth/tests/merimbula_steve/run_sw_merimbula.py
r8354 r8396 36 36 37 37 from anuga import rectangular_cross 38 from balanced_dev import create_domain_from_file38 #from balanced_dev import create_domain_from_file 39 39 #from balanced_basic import create_domain_from_file 40 40 #from anuga import create_domain_from_file -
trunk/anuga_work/development/gareth/tests/parabolic/parabolaplot.py
r8353 r8396 4 4 # Import Modules 5 5 #--------------- 6 import anuga6 #import anuga 7 7 #import struct 8 8 import numpy -
trunk/anuga_work/development/gareth/tests/urban_flow/ideal_urban.py
r8384 r8396 13 13 14 14 from balanced_dev import * 15 from balanced_dev import create_domain_from_regions as create_domain_from_regions15 #from balanced_dev import create_domain_from_regions as create_domain_from_regions 16 16 #------------------------------------------------------------------------------ 17 17 # Useful parameters for controlling this case -
trunk/anuga_work/development/gareth/tests/util.py
r8385 r8396 13 13 transect (e.g. a channel cross-section) -- see example below 14 14 15 15 util.sort_sww_filenames -- match sww filenames by a wildcard, and order 16 them according to their 'time'. This means that 17 they can be stuck together using 'combine_outputs' correctly 18 16 19 17 20 Here is an example ipython session which uses some of these functions: … … 24 27 > pyplot.ion() # Interactive plotting 25 28 > pyplot.scatter(xxx[1],p.vel[140,xxx[0]],color='red') # Plot along the transect 29 30 FIXME: TODO -- Convert to a single function 'get_output', which can either take a 31 single filename, a list of filenames, or a wildcard defining a number of 32 filenames, and ensure that in each case, the output will be as desired. 26 33 27 34 """ … … 80 87 p1.yvel, p1.vel, p1.minimum_allowed_height 81 88 82 89 #################### 90 91 def sort_sww_filenames(sww_wildcard): 92 # Function to take a 'wildcard' sww filename, 93 # and return a list of all filenames of this type, 94 # sorted by their time. 95 # This can then be used efficiently in 'combine_outputs' 96 # if you have many filenames starting with the same pattern 97 import glob 98 filenames=glob.glob(sww_wildcard) 99 100 # Extract time from filenames 101 file_time=range(len(filenames)) # Predefine 102 103 for i,filename in enumerate(filenames): 104 filesplit=filename.rsplit('_time_') 105 if(len(filesplit)>1): 106 file_time[i]=int(filesplit[1].split('_0.sww')[0]) 107 else: 108 file_time[i]=0 109 110 name_and_time=zip(file_time,filenames) 111 name_and_time.sort() # Sort by file_time 112 113 output_times, output_names = zip(*name_and_time) 114 115 return list(output_names) 116 117 ############## 83 118 84 119 class get_output: -
trunk/anuga_work/development/gareth/tests/wave/run_wave.py
r8384 r8396 12 12 import sys 13 13 import anuga 14 from anuga import Domain14 #from anuga import Domain 15 15 16 16 from balanced_dev import * 17 from balanced_dev import Domain as Domain17 #from balanced_dev import Domain as Domain 18 18 19 19 from math import cos … … 81 81 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 82 82 Bt = anuga.Transmissive_boundary(domain) # Continue all values on boundary 83 Bz = swb2_boundary_conditions.zero_mass_flux_zero_momentum_boundary(domain) # Strong reflections 84 Bz1 = swb2_boundary_conditions.zero_mass_flux_zero_t_transmissive_n_momentum_boundary(domain) # Strong reflections 85 Bz2 = swb2_boundary_conditions.zero_mass_flux_zero_n_transmissive_t_momentum_boundary(domain) # Strong reflections 86 Bs = anuga.Transmissive_stage_zero_momentum_boundary(domain) # Strong reflections 83 87 Bd = anuga.Dirichlet_boundary([1,0.,0.]) # Constant boundary values 84 88 amplitude = 1 … … 97 101 98 102 Bw2 = anuga.shallow_water.boundaries.Transmissive_n_momentum_zero_t_momentum_set_stage_boundary(domain, waveform) 103 #Bw3 = swb2_boundary_conditions.Transmissive_momentum_nudge_stage_boundary(domain, waveform) 99 104 100 105
Note: See TracChangeset
for help on using the changeset viewer.