Changeset 5394
 Timestamp:
 Jun 5, 2008, 1:42:01 PM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r5306 r5394 56 56 self.domain = domain 57 57 58 # Allocate space for other quantities58 # Allocate space for other quantities 59 59 self.centroid_values = zeros(N, Float) 60 60 self.edge_values = zeros((N, 3), Float) 61 61 62 # Allocate space for Gradient62 # Allocate space for Gradient 63 63 self.x_gradient = zeros(N, Float) 64 64 self.y_gradient = zeros(N, Float) 65 65 66 # Allocate space for Limiter Phi66 # Allocate space for Limiter Phi 67 67 self.phi = zeros(N, Float) 68 68 69 # Intialise centroid and edge_values69 # Intialise centroid and edge_values 70 70 self.interpolate() 71 71 72 # Allocate space for boundary values72 # Allocate space for boundary values 73 73 L = len(domain.boundary) 74 74 self.boundary_values = zeros(L, Float) 75 75 76 # Allocate space for updates of conserved quantities by77 # flux calculations and forcing functions78 79 # Allocate space for update fields76 # Allocate space for updates of conserved quantities by 77 # flux calculations and forcing functions 78 79 # Allocate space for update fields 80 80 self.explicit_update = zeros(N, Float ) 81 81 self.semi_implicit_update = zeros(N, Float ) … … 86 86 87 87 88 # Methods for operator overloading88 # Methods for operator overloading 89 89 def __len__(self): 90 90 return self.centroid_values.shape[0] … … 247 247 248 248 def interpolate_from_vertices_to_edges(self): 249 # Call correct module function250 # (either from this module or Cextension)249 # Call correct module function 250 # (either from this module or Cextension) 251 251 interpolate_from_vertices_to_edges(self) 252 252 253 253 def interpolate_from_edges_to_vertices(self): 254 # Call correct module function255 # (either from this module or Cextension)254 # Call correct module function 255 # (either from this module or Cextension) 256 256 interpolate_from_edges_to_vertices(self) 257 257 … … 526 526 527 527 528 # Specific functions for setting values528 # Specific functions for setting values 529 529 def set_values_from_constant(self, X, 530 530 location, indices, verbose): … … 787 787 verbose = False, 788 788 use_cache = False): 789 # FIXME: Use this function for the time being. Later move code in here789 # FIXME: Use this function for the time being. Later move code in here 790 790 791 791 points = geospatial_data.get_data_points(absolute = False) … … 1140 1140 indices=range(self.domain.number_of_nodes) 1141 1141 vert_values = [] 1142 #Go through list of unique vertices 1142 1143 # Go through list of unique vertices 1143 1144 for unique_vert_id in indices: 1144 1145 triangles = self.domain.get_triangles_and_vertices_per_node(node=unique_vert_id) 1145 1146 1146 # In case there are unused points1147 # In case there are unused points 1147 1148 if len(triangles) == 0: 1148 1149 msg = 'Unique vertex not associated with triangles' … … 1177 1178 from Numeric import array, Float 1178 1179 1179 # Assert that A can be converted to a Numeric array of appropriate dim1180 A = array(A, Float)1181 1182 # print 'SHAPE A', A.shape1180 # Assert that A can be converted to a Numeric array of appropriate dim 1181 A = ensure_numeric(A, Float) 1182 1183 # print 'SHAPE A', A.shape 1183 1184 assert len(A.shape) == 1 1184 1185 … … 1190 1191 vertex_list = indices 1191 1192 1192 #Go through list of unique vertices 1193 1193 # Go through list of unique vertices 1194 1194 for i_index, unique_vert_id in enumerate(vertex_list): 1195 1195 … … 1197 1197 triangles = self.domain.get_triangles_and_vertices_per_node(node=unique_vert_id) 1198 1198 1199 # In case there are unused points1199 # In case there are unused points 1200 1200 if len(triangles) == 0: continue 1201 1201 1202 # Go through all triangle, vertex pairs1203 # touching vertex unique_vert_id and set corresponding vertex value1202 # Go through all triangle, vertex pairs 1203 # touching vertex unique_vert_id and set corresponding vertex value 1204 1204 for triangle_id, vertex_id in triangles: 1205 1205 self.vertex_values[triangle_id, vertex_id] = A[i_index] 1206 1206 1207 # Intialise centroid and edge_values1207 # Intialise centroid and edge_values 1208 1208 self.interpolate() 1209 1209 … … 1374 1374 1375 1375 def update(self, timestep): 1376 # Call correct module function1377 # (either from this module or Cextension)1376 # Call correct module function 1377 # (either from this module or Cextension) 1378 1378 return update(self, timestep) 1379 1379 1380 1380 def compute_gradients(self): 1381 # Call correct module function1382 # (either from this module or Cextension)1381 # Call correct module function 1382 # (either from this module or Cextension) 1383 1383 return compute_gradients(self) 1384 1384 1385 1385 def limit(self): 1386 # Call correct module depending on whether1387 # basing limit calculations on edges or vertices1386 # Call correct module depending on whether 1387 # basing limit calculations on edges or vertices 1388 1388 limit_old(self) 1389 1389 1390 1390 def limit_vertices_by_all_neighbours(self): 1391 # Call correct module function1392 # (either from this module or Cextension)1391 # Call correct module function 1392 # (either from this module or Cextension) 1393 1393 limit_vertices_by_all_neighbours(self) 1394 1394 1395 1395 def limit_edges_by_all_neighbours(self): 1396 # Call correct module function1397 # (either from this module or Cextension)1396 # Call correct module function 1397 # (either from this module or Cextension) 1398 1398 limit_edges_by_all_neighbours(self) 1399 1399 1400 1400 def limit_edges_by_neighbour(self): 1401 # Call correct module function1402 # (either from this module or Cextension)1401 # Call correct module function 1402 # (either from this module or Cextension) 1403 1403 limit_edges_by_neighbour(self) 1404 1404 1405 1405 def extrapolate_second_order(self): 1406 # Call correct module function1407 # (either from this module or Cextension)1406 # Call correct module function 1407 # (either from this module or Cextension) 1408 1408 compute_gradients(self) 1409 1409 extrapolate_from_gradient(self) 1410 1410 1411 1411 def extrapolate_second_order_and_limit_by_edge(self): 1412 # Call correct module function1413 # (either from this module or Cextension)1412 # Call correct module function 1413 # (either from this module or Cextension) 1414 1414 extrapolate_second_order_and_limit_by_edge(self) 1415 1415 1416 1416 1417 1417 def extrapolate_second_order_and_limit_by_vertex(self): 1418 # Call correct module function1419 # (either from this module or Cextension)1418 # Call correct module function 1419 # (either from this module or Cextension) 1420 1420 extrapolate_second_order_and_limit_by_vertex(self) 1421 1421 1422 1422 def bound_vertices_below_by_constant(self, bound): 1423 # Call correct module function1424 # (either from this module or Cextension)1423 # Call correct module function 1424 # (either from this module or Cextension) 1425 1425 bound_vertices_below_by_constant(self, bound) 1426 1426 1427 1427 def bound_vertices_below_by_quantity(self, quantity): 1428 # Call correct module function1429 # (either from this module or Cextension)1430 1431 # check consistency1428 # Call correct module function 1429 # (either from this module or Cextension) 1430 1431 # check consistency 1432 1432 assert self.domain == quantity.domain 1433 1433 bound_vertices_below_by_quantity(self, quantity) 1434 1434 1435 1435 def backup_centroid_values(self): 1436 # Call correct module function1437 # (either from this module or Cextension)1436 # Call correct module function 1437 # (either from this module or Cextension) 1438 1438 backup_centroid_values(self) 1439 1439 1440 1440 def saxpy_centroid_values(self,a,b): 1441 # Call correct module function1442 # (either from this module or Cextension)1441 # Call correct module function 1442 # (either from this module or Cextension) 1443 1443 saxpy_centroid_values(self,a,b) 1444 1444
Note: See TracChangeset
for help on using the changeset viewer.