Changeset 5536 for anuga_work/development/anuga_1d/quantity.py
- Timestamp:
- Jul 18, 2008, 4:37:03 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/anuga_1d/quantity.py
r5535 r5536 22 22 #from domain import Domain 23 23 #from domain_order2 import Domain 24 from domain _t2import Domain24 from domain import Domain 25 25 from Numeric import array, zeros, Float 26 26 … … 56 56 #Intialise centroid values 57 57 self.interpolate() 58 59 60 from Numeric import zeros, Float 61 62 #Allocate space for boundary values 63 #L = len(domain.boundary) 64 self.boundary_values = zeros(2, Float) #assumes no parrellism 65 66 #Allocate space for updates of conserved quantities by 67 #flux calculations and forcing functions 68 69 N = domain.number_of_elements 70 self.explicit_update = zeros(N, Float ) 71 self.semi_implicit_update = zeros(N, Float ) 72 73 self.gradients = zeros(N, Float) 74 self.qmax = zeros(self.centroid_values.shape, Float) 75 self.qmin = zeros(self.centroid_values.shape, Float) 76 77 self.beta = domain.beta 58 78 59 79 #Methods for operator overloading … … 381 401 return integral 382 402 383 class Conserved_quantity(Quantity):384 """Class conserved quantity adds to Quantity:385 386 storage and method for updating, and387 methods for extrapolation from centropid to vertices inluding388 gradients and limiters389 """390 391 def __init__(self, domain, vertex_values=None):392 Quantity.__init__(self, domain, vertex_values)393 394 from Numeric import zeros, Float395 396 #Allocate space for boundary values397 #L = len(domain.boundary)398 self.boundary_values = zeros(2, Float) #assumes no parrellism399 400 #Allocate space for updates of conserved quantities by401 #flux calculations and forcing functions402 403 N = domain.number_of_elements404 self.explicit_update = zeros(N, Float )405 self.semi_implicit_update = zeros(N, Float )406 407 self.gradients = zeros(N, Float)408 self.qmax = zeros(self.centroid_values.shape, Float)409 self.qmin = zeros(self.centroid_values.shape, Float)410 411 self.beta = domain.beta412 403 413 404 def update(self, timestep): … … 863 854 else: 864 855 qv[k,i] = qc[k] 856 857 858 class Conserved_quantity(Quantity): 859 """Class conserved quantity adds to Quantity: 860 861 storage and method for updating, and 862 methods for extrapolation from centropid to vertices inluding 863 gradients and limiters 864 """ 865 866 def __init__(self, domain, vertex_values=None): 867 Quantity.__init__(self, domain, vertex_values) 868 869 print "Use Quantity instead of Conserved_quantity" 870 865 871 866 872 … … 884 890 if __name__ == "__main__": 885 891 #from domain import Domain 886 from shallow_water_ 1dimport Domain892 from shallow_water_domain import Domain 887 893 from Numeric import arange 888 894 … … 892 898 D1 = Domain(points1) 893 899 894 Q1 = Conserved_quantity(D1, vertex_values)900 Q1 = Quantity(D1, vertex_values) 895 901 896 902 print Q1.vertex_values … … 941 947 D2 = Domain(points2) 942 948 943 Q2 = Conserved_quantity(D2)949 Q2 = Quantity(D2) 944 950 Q2.set_values(fun,'vertices') 945 951 Xc = Q2.domain.vertices
Note: See TracChangeset
for help on using the changeset viewer.