Changeset 8209
- Timestamp:
- Sep 8, 2011, 5:30:37 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/file/sww.py
r8144 r8209 45 45 self.domain = domain 46 46 47 # Exclude ghosts in case this is a parallel domain 48 self.number_of_nodes = domain.number_of_full_nodes 49 self.number_of_volumes = domain.number_of_full_triangles 47 # Probably should exclude ghosts in case this is a parallel domain 48 49 self.number_of_nodes = domain.number_of_nodes 50 self.number_of_volumes = domain.number_of_triangles 50 51 #self.number_of_volumes = len(domain) 51 52 … … 109 110 domain.starttime, 110 111 self.number_of_volumes, 111 self.domain.number_of_ full_nodes,112 self.domain.number_of_nodes, 112 113 description=description, 113 114 smoothing=domain.smooth, -
trunk/anuga_core/source/anuga/operators/kinematic_viscosity_operator.py
r8166 r8209 9 9 import anuga.utilities.log as log 10 10 11 from anuga.operators. base_operator import Operator11 from anuga.operators.elliptic_operator import Operator 12 12 13 13 … … 18 18 operator using centroid values. 19 19 20 div ( diffusivity grad ) 21 22 where diffusvity is scalar quantity (defaults to quantity with values = 1) 23 boundary values of f are used to setup entries associated with cells with boundaries 24 25 There are procedures to apply this operator, ie 26 27 (1) Calculate div( diffusivity grad u ) 28 using boundary values stored in u 29 30 (2) Calculate ( u + dt div( diffusivity grad u ) 31 using boundary values stored in u 32 33 (3) Solve div( diffusivity grad u ) = f 34 for quantity f and using boundary values stored in u 35 36 (4) Solve ( u + dt div( diffusivity grad u ) = f 37 for quantity f using boundary values stored in u 20 21 As an anuga operator, when the __call__ method is called one step of the parabolic 22 step is applied. In particular the x and y velocities are updated using 23 24 du/dt = div( h grad u ) 25 dv/dt = div( h grad v ) 38 26 39 27 """ … … 41 29 def __init__(self, domain, use_triangle_areas=True, verbose=False): 42 30 if verbose: log.critical('Kinematic Viscosity: Beginning Initialisation') 31 32 33 Operator.__init__(self,domain) 34 43 35 #Expose the domain attributes 44 45 Operator.__init__(self,domain)46 47 36 self.mesh = self.domain.mesh 48 37 self.boundary = domain.boundary 49 38 self.boundary_enumeration = domain.boundary_enumeration 50 39 51 # Pick up height as diffusivity 40 # Setup a quantity as diffusivity 41 # FIXME SR: Could/Should pass a quantity which already exists 52 42 self.diffusivity = Quantity(self.domain) 53 43 self.diffusivity.set_values(1.0) … … 159 149 def statistics(self): 160 150 161 message = ' You need to implement operator statistics for your operator'151 message = 'Kinematic_viscosity_operator ' 162 152 return message 163 153 -
trunk/anuga_core/source/anuga_parallel/parallel_generic_communications.py
r8107 r8209 18 18 """Buffers for synchronisation of timesteps 19 19 """ 20 20 21 21 domain.local_timestep = num.zeros(1, num.float) 22 22 domain.global_timestep = num.zeros(1, num.float) … … 24 24 domain.local_timesteps = num.zeros(domain.numproc, num.float) 25 25 26 27 26 domain.communication_time = 0.0 28 27 domain.communication_reduce_time = 0.0 29 28 domain.communication_broadcast_time = 0.0 30 29 31 32 30 33 31 def communicate_flux_timestep(domain, yieldstep, finaltime): -
trunk/anuga_core/source/anuga_parallel/parallel_meshes.py
r8026 r8209 42 42 43 43 44 44 import pypar 45 45 m_low, m_high = pypar.balance(m_g, numprocs, myid) 46 46 -
trunk/anuga_core/source/anuga_parallel/parallel_shallow_water.py
r8200 r8209 26 26 full_send_dict=None, 27 27 ghost_recv_dict=None, 28 #number_of_full_nodes=None,29 #number_of_full_triangles=None,28 number_of_full_nodes=None, 29 number_of_full_triangles=None, 30 30 geo_reference=None): #jj added this 31 31 … … 38 38 processor=pypar.rank(), 39 39 numproc=pypar.size(), 40 #number_of_full_nodes=number_of_full_nodes,41 #number_of_full_triangles=number_of_full_triangles,40 number_of_full_nodes=number_of_full_nodes, 41 number_of_full_triangles=number_of_full_triangles, 42 42 geo_reference=geo_reference) #jj added this 43 43 -
trunk/anuga_core/source/anuga_parallel/run_parallel_sw_rectangle.py
r8011 r8209 29 29 # Parallel interface 30 30 #--------------------------- 31 from anuga_parallel .interfaceimport Parallel_shallow_water_domain32 from anuga_parallel .interfaceimport parallel_rectangle33 from anuga_parallel .interfaceimport myid, numprocs, finalize, get_processor_name31 from anuga_parallel import Parallel_shallow_water_domain 32 from anuga_parallel import parallel_rectangle 33 from anuga_parallel import myid, numprocs, finalize, get_processor_name 34 34 35 ############################### 36 # Read in processor information 37 ############################### 38 #numprocs = numprocs() 39 #myid = myid() 35 40 36 processor_name = get_processor_name() 41 37 … … 62 58 63 59 64 60 print 'after parallel domain' 65 61 66 62 … … 75 71 domain.set_boundary( {'left': R, 'right': R, 'bottom': R, 'top': R, 'ghost': None} ) 76 72 73 74 print 'after set_boundary' 77 75 78 76 … … 95 93 return self.h0 + self.h*((x>self.x0)&(x<self.x1)&(y>self.y0)&(y<self.y1)) 96 94 95 print 'after check_integrity' 96 97 97 domain.set_quantity('stage', Set_Stage(0.2, 0.4, 0.25, 0.75, 1.0, 0.00)) 98 98 99 100 print 'after set quantity' 99 101 100 102 # Set Evolve parameters … … 110 112 111 113 114 print 'after evolve parameters' 112 115 113 116 117 import pdb; pdb.set_trace() 114 118 115 119 if myid == 0: -
trunk/anuga_validation/validation_tests/periodic_wave.py
r8155 r8209 51 51 # Setup Algorithm 52 52 #------------------------------------------------------------------------------ 53 domain.set_timestepping_method( 'rk2')53 domain.set_timestepping_method(2) 54 54 domain.set_default_order(2) 55 55 … … 59 59 domain.tight_slope_limiters = False 60 60 domain.use_centroid_velocities = False 61 domain.set_beta(1.5) 61 62 62 63 domain.CFL = 1.0 … … 73 74 # Setup initial conditions 74 75 #------------------------------------------------------------------------------ 75 domain.set_quantity('elevation',-10 .0)76 domain.set_quantity('elevation',-100.0) 76 77 domain.set_quantity('friction', 0.00) 77 78 domain.set_quantity('stage', 0.0) … … 87 88 Bw = anuga.Time_boundary(domain=domain, # Time dependent boundary 88 89 ## Sine wave 89 f=lambda t: [(-amplitude*sin((1./ 600.)*t*2*pi)), 0.0, 0.0])90 f=lambda t: [(-amplitude*sin((1./900.)*t*2*pi)), 0.0, 0.0]) 90 91 ## Sawtooth? 91 92 # f=lambda t: [(-8.0*(sin((1./180.)*t*2*pi))+(1./2.)*sin((2./180.)*t*2*pi)+(1./3.)*sin((3./180.)*t*2*pi)), 0.0, 0.0]) -
trunk/anuga_work/development/2010-projects/anuga_1d/channel/channel_domain.py
r8195 r8209 140 140 #Call correct module function 141 141 #(either from this module or C-extension) 142 distribute_to_vertices_and_edges_limit_s_v_h(self)143 #distribute_to_vertices_and_edges_limit_s_v(self)142 #distribute_to_vertices_and_edges_limit_s_v_h(self) 143 distribute_to_vertices_and_edges_limit_s_v(self) 144 144 145 145 -
trunk/anuga_work/development/2010-projects/anuga_1d/channel/test_padarn.py
r8194 r8209 47 47 48 48 # Set final time and yield time for simulation 49 finaltime = 200.049 finaltime = 1000.0 50 50 yieldstep = 10.0 51 51 -
trunk/anuga_work/development/2010-projects/anuga_1d/pipe/pipe_domain.py
r8196 r8209 140 140 #Call correct module function 141 141 #(either from this module or C-extension) 142 distribute_to_vertices_and_edges_limit_s_v_h(self)143 #distribute_to_vertices_and_edges_limit_s_v(self)142 #distribute_to_vertices_and_edges_limit_s_v_h(self) 143 distribute_to_vertices_and_edges_limit_s_v(self) 144 144 145 145 -
trunk/anuga_work/development/2010-projects/anuga_1d/pipe/test_pipe.py
r8197 r8209 36 36 37 37 def top(x): 38 return 4.038 return 20.0 39 39 40 40 def initial_area(x): … … 52 52 53 53 # Set final time and yield time for simulation 54 finaltime = 1 30.054 finaltime = 100.0 55 55 yieldstep = 1.0 56 56 -
trunk/anuga_work/development/2010-projects/anuga_1d/sww/run_tsunami_model.py
r8206 r8209 27 27 return y 28 28 29 tsunami_centre = - 20000029 tsunami_centre = -400000 30 30 tsunami_radius = 100000 31 31 tsunami_height = 2.0 … … 40 40 import time 41 41 42 # Set final time and yield time for simulation 43 finaltime = 60*10 44 yieldstep = finaltime 42 45 43 46 44 # Length of channel (m) … … 67 65 #domain.set_boundary({'exterior': Dirichlet_boundary([14,20,0,1.4,20/14,9])}) 68 66 Br = Reflective_boundary(domain) 69 domain.set_boundary({'left': Br, 'right' : Br }) 67 Bt = Transmissive_boundary(domain) 68 domain.set_boundary({'left': Bt, 'right' : Br }) 70 69 #domain.set_boundary({'exterior': Br}) 71 70 … … 80 79 t0 = time.time() 81 80 82 finaltime= 60*60*8 81 # Set final time and yield time for simulation 82 finaltime= 60*60*6 83 yieldstep = finaltime 84 83 85 84 86 #=================================================================== -
trunk/anuga_work/development/2010-projects/anuga_1d/sww/sww_boundary_conditions.py
r7884 r8209 36 36 This class is specific to the shallow water equation as it 37 37 works with the momentum quantities assumed to be the second 38 and thirdconserved quantities.38 conserved quantities. 39 39 """ 40 40 … … 78 78 79 79 80 class Transmissive_boundary(Boundary): 81 """Transmissive boundary returns same conserved quantities as 82 those present in its neighbour volume but reflected. 83 84 This class is specific to the shallow water equation as it 85 works with the momentum quantities assumed to be the second 86 quantities. 87 """ 88 89 def __init__(self, domain = None): 90 Boundary.__init__(self) 91 92 if domain is None: 93 msg = 'Domain must be specified for transmissive boundary' 94 raise msg 95 96 #Handy shorthands 97 self.normals = domain.normals 98 self.stage = domain.quantities['stage'].vertex_values 99 self.xmom = domain.quantities['xmomentum'].vertex_values 100 self.bed = domain.quantities['elevation'].vertex_values 101 self.height = domain.quantities['height'].vertex_values 102 self.velocity = domain.quantities['velocity'].vertex_values 103 104 105 self.quantities = numpy.zeros(5, numpy.float) 106 107 def __repr__(self): 108 return 'Transmissive_boundary' 109 110 111 def evaluate(self, vol_id, edge_id): 112 """Transmissive boundaries mimics the outward momentum 113 of the volume they serve. 114 """ 115 116 q = self.quantities 117 q[0] = self.stage[vol_id, edge_id] 118 q[1] = self.xmom[vol_id, edge_id] 119 q[2] = self.bed[vol_id, edge_id] 120 q[3] = self.height[vol_id, edge_id] 121 q[4] = self.velocity[vol_id, edge_id] 122 123 #normal = self.normals[vol_id,edge_id] 124 125 return q 126 80 127 81 128 -
trunk/anuga_work/development/2010-projects/anuga_1d/sww/sww_domain.py
r8206 r8209 244 244 h_C[:] = w_C - z_C 245 245 246 247 u_C[:] = uh_C/(h_C + h0/(h_C + h0))246 #h0 = 1.0e-12 247 u_C[:] = uh_C/(h_C + h0/(h_C + 1.0e-16)) 248 248 249 249 #print 'domain.order', domain.order
Note: See TracChangeset
for help on using the changeset viewer.