Changeset 3335
- Timestamp:
- Jul 14, 2006, 2:11:20 PM (18 years ago)
- Location:
- development/pyvolution-1d
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
development/pyvolution-1d/domain.py
r3295 r3335 557 557 Q = self.create_quantity_from_expression(expression) 558 558 kwargs['quantity'] = Q 559 560 561 print "self.vertices1"562 print self.vertices563 559 564 560 #Assign values 565 561 self.quantities[name].set_values(*args, **kwargs) 566 567 print "self.vertices2"568 print self.vertices569 562 570 563 def set_boundary(self, boundary_map): … … 663 656 ##assert hasattr(self, 'boundary_objects') 664 657 658 def write_time(self): 659 print self.timestepping_statistics() 660 661 def timestepping_statistics(self): 662 """Return string with time stepping statistics for printing or logging 663 """ 664 665 msg = '' 666 if self.min_timestep == self.max_timestep: 667 msg += 'Time = %.4f, delta t = %.8f, steps=%d (%d)'\ 668 %(self.time, self.min_timestep, self.number_of_steps, 669 self.number_of_first_order_steps) 670 elif self.min_timestep > self.max_timestep: 671 msg += 'Time = %.4f, steps=%d (%d)'\ 672 %(self.time, self.number_of_steps, 673 self.number_of_first_order_steps) 674 else: 675 msg += 'Time = %.4f, delta t in [%.8f, %.8f], steps=%d (%d)'\ 676 %(self.time, self.min_timestep, 677 self.max_timestep, self.number_of_steps, 678 self.number_of_first_order_steps) 679 680 return msg 681 665 682 def get_name(self): 666 683 return self.filename … … 676 693 677 694 #Main components of evolve 678 679 695 def evolve(self, yieldstep = None, finaltime = None, 680 696 skip_initial_step = False): … … 721 737 #update ghosts 722 738 #self.update_ghosts() 723 739 724 740 #Initial update of vertex and edge values 725 741 self.distribute_to_vertices_and_edges() 726 742 727 743 #Initial update boundary values 728 744 self.update_boundary() … … 861 877 else: 862 878 #Try to overcome situation by switching to 1 order 879 print "changing Order 1" 863 880 self.order = 1 864 881 -
development/pyvolution-1d/quantity.py
r3322 r3335 134 134 Default is "vertices" 135 135 """ 136 137 print "In set_function value"138 print self.domain.vertices139 136 140 137 if location == 'centroids': 141 142 print "In set at centroid" 138 143 139 P = self.domain.centroids 144 140 self.set_values(f(P), location) … … 146 142 #Vertices 147 143 P = self.domain.get_vertices() 148 149 print "P" 150 print P 151 print P[:,0] 152 print f(P[:,0]) 153 154 print P[:,1] 155 print f(P[:,1]) 144 156 145 for i in range(2): 157 self.vertex_values[:,i] = f(P[:,i]) 158 159 160 161 162 print "In set at vertices" 163 print self.vertex_values 164 165 print "Out set_function value" 166 print self.domain.vertices 167 146 self.vertex_values[:,i] = f(P[:,i]) 168 147 169 148 def set_array_values(self, values, location='vertices'): … … 564 543 vertex values are updated 565 544 """ 566 545 print "in Q.limit" 567 546 from Numeric import zeros, Float 568 547 … … 706 685 print Q2.centroid_values 707 686 print Qc 708 687 raw_input('press_return') 688 709 689 g3 = newLinePlot('plot 3') 710 690 linePlot(g3,Xc,Qc) … … 720 700 raw_input('press return') 721 701 722 723 724 725 726 727 -
development/pyvolution-1d/shallow_water_1d.py
r3293 r3335 63 63 64 64 #forcing terms not included in 1d domain ?WHy? 65 #self.forcing_terms.append(gravity)66 #self.forcing_terms.append(manning_friction)65 self.forcing_terms.append(gravity) 66 self.forcing_terms.append(manning_friction) 67 67 #print "\nI have Removed forcing terms line 64 1dsw" 68 68 … … 174 174 #and or visualisation 175 175 self.distribute_to_vertices_and_edges() 176 176 177 177 #Initialise real time viz if requested 178 178 #if self.visualise is True and self.time == 0.0: … … 432 432 #Loop 433 433 timestep = float(sys.maxint) 434 enter = True 434 435 for k in range(N): 435 436 … … 473 474 # flux = edgefluxleft - edgefluxright 474 475 flux -= edgeflux #* domain.edgelengths[k,i] 475 476 476 #Update optimal_timestep 477 477 try: 478 478 #timestep = min(timestep, 0.5*domain.radii[k]/max_speed) 479 479 #timestep = 0.01 480 480 481 timestep = min(timestep, 0.5*domain.areas[k]/max_speed) 481 if timestep < 0.00001: 482 #print 'max_speed', max_speed 482 if (timestep < 1e-6) & (enter == True): 483 #print "domain.order", domain.order 484 #domain.write_time() 485 print "cell number", k 486 print "timestep", timestep 487 print 'max_speed', max_speed 483 488 s = domain.quantities['stage'] 484 489 s = s.centroid_values 485 490 xm = domain.quantities['xmomentum'] 486 491 xm = xm.centroid_values 487 #print 'h', s[k] 488 #print 'xm', xm[k] 489 #print 'u', xm[k]/s[k] 490 #break 491 #timestep = 0.01 492 #print 'areas', domain.areas[k] 493 #print "timestep", timestep 492 print 'h', s[k] 493 print 'xm', xm[k] 494 print 'u', xm[k]/s[k] 495 enter = False 496 494 497 except ZeroDivisionError: 495 498 pass … … 497 500 #Normalise by area and store for when all conserved 498 501 #quantities get updated 499 #flux /= domain.areas[k]502 flux /= domain.areas[k] 500 503 # ADD ABOVE LINE AGAIN 501 504 Stage.explicit_update[k] = flux[0] … … 599 602 """ 600 603 601 from config import optimised_gradient_limiter604 #from config import optimised_gradient_limiter 602 605 603 606 #Remove very thin layers of water
Note: See TracChangeset
for help on using the changeset viewer.