Changeset 8877
- Timestamp:
- May 27, 2013, 8:17:08 PM (11 years ago)
- Location:
- trunk/anuga_core/source/anuga_parallel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py
r8875 r8877 3 3 import math 4 4 import parallel_inlet_enquiry 5 import pypar 5 6 6 7 from anuga.utilities.system_tools import log_to_file … … 57 58 enquiry_proc = None): 58 59 59 import pypar 60 60 61 self.myid = pypar.rank() 61 62 self.num_procs = pypar.size() … … 210 211 211 212 def __call__(self): 212 213 import pypar214 213 215 214 timestep = self.domain.get_timestep() … … 424 423 # with this structure 425 424 426 import pypar427 428 425 message = ' ' 429 426 … … 588 585 # Should be called from all processors associated with operator 589 586 590 import pypar591 587 enq0 = None 588 enq1 = None 592 589 593 590 get0 = 'self.inlets[0].get_enquiry_stage()' … … 622 619 # Should be called from all processors associated with operator 623 620 624 import pypar625 621 enq0 = None 622 enq1 = None 626 623 627 624 get0 = 'self.inlets[0].get_enquiry_depth()' … … 657 654 def get_enquiry_positions(self): 658 655 659 import pypar 656 enq0 = None 657 enq1 = None 660 658 661 659 get0 = 'self.inlets[0].get_enquiry_position()' … … 691 689 def get_enquiry_xmoms(self): 692 690 691 enq0 = None 692 enq1 = None 693 693 694 get0 = 'self.inlets[0].get_enquiry_xmom()' 694 695 get1 = 'self.inlets[1].get_enquiry_xmom()' 695 696 696 import pypar697 698 697 699 698 if self.myid == self.master_proc: … … 723 722 724 723 def get_enquiry_ymoms(self): 724 725 enq0 = None 726 enq1 = None 725 727 726 728 get0 = 'self.inlets[0].get_enquiry_ymom()' 727 729 get1 = 'self.inlets[1].get_enquiry_ymom()' 728 730 729 import pypar730 731 731 732 732 if self.myid == self.master_proc: … … 757 757 758 758 def get_enquiry_elevations(self): 759 760 enq0 = None 761 enq1 = None 759 762 760 763 get0 = 'self.inlets[0].get_enquiry_elevation()' 761 764 get1 = 'self.inlets[1].get_enquiry_elevation()' 762 765 763 import pypar764 765 766 766 767 if self.myid == self.master_proc: … … 792 793 793 794 def get_enquiry_water_depths(self): 795 796 enq0 = None 797 enq1 = None 794 798 795 799 get0 = 'self.inlets[0].get_enquiry_water_depth()' 796 800 get1 = 'self.inlets[1].get_enquiry_water_depth()' 797 801 798 import pypar799 800 802 801 803 if self.myid == self.master_proc: … … 826 828 827 829 def get_enquiry_invert_elevations(self): 830 831 enq0 = None 832 enq1 = None 828 833 829 834 get0 = 'self.inlets[0].get_enquiry_invert_elevation()' 830 835 get1 = 'self.inlets[1].get_enquiry_invert_elevation()' 831 836 832 import pypar833 834 837 835 838 if self.myid == self.master_proc: … … 860 863 861 864 def get_enquiry_velocitys(self): 865 866 enq0 = None 867 enq1 = None 862 868 863 869 get0 = 'self.inlets[0].get_enquiry_velocity()' 864 870 get1 = 'self.inlets[1].get_enquiry_velocity()' 865 871 866 import pypar867 868 869 872 if self.myid == self.master_proc: 870 873 … … 894 897 895 898 def get_enquiry_xvelocitys(self): 899 900 enq0 = None 901 enq1 = None 896 902 897 903 get0 = 'self.inlets[0].get_enquiry_xvelocity()' 898 904 get1 = 'self.inlets[1].get_enquiry_xvelocity()' 899 905 900 import pypar901 902 903 906 if self.myid == self.master_proc: 904 907 … … 927 930 928 931 def get_enquiry_yvelocitys(self): 932 933 enq0 = None 934 enq1 = None 929 935 930 936 get0 = 'self.inlets[0].get_enquiry_yvelocity()' 931 937 get1 = 'self.inlets[1].get_enquiry_yvelocity()' 932 938 933 import pypar934 939 935 940 if self.myid == self.master_proc: … … 960 965 961 966 def get_enquiry_speeds(self): 967 968 enq0 = None 969 enq1 = None 962 970 963 971 get0 = 'self.inlets[0].get_enquiry_speed()' 964 972 get1 = 'self.inlets[1].get_enquiry_speed()' 965 973 966 import pypar 967 968 974 969 975 if self.myid == self.master_proc: 970 976 … … 994 1000 995 1001 def get_enquiry_velocity_heads(self): 1002 1003 enq0 = None 1004 enq1 = None 996 1005 997 1006 get0 = 'self.inlets[0].get_enquiry_velocity_head()' 998 1007 get1 = 'self.inlets[1].get_enquiry_velocity_head()' 999 1008 1000 import pypar1001 1002 1003 1009 if self.myid == self.master_proc: 1004 1010 … … 1028 1034 1029 1035 def get_enquiry_total_energys(self): 1036 1037 enq0 = None 1038 enq1 = None 1030 1039 1031 1040 get0 = 'self.inlets[0].get_enquiry_total_energy()' 1032 1041 get1 = 'self.inlets[1].get_enquiry_total_energy()' 1033 1042 1034 import pypar1035 1036 1037 1043 if self.myid == self.master_proc: 1038 1044 … … 1062 1068 1063 1069 def get_enquiry_specific_energys(self): 1070 1071 enq0 = None 1072 enq1 = None 1064 1073 1065 1074 get0 = 'self.inlets[0].get_enquiry_specific_energy()' 1066 1075 get1 = 'self.inlets[1].get_enquiry_specific_energy()' 1067 1076 1068 import pypar 1069 1070 1071 if self.myid == self.master_proc: 1072 1073 if self.myid == self.enquiry_proc[0]: 1074 enq0 = eval(get0) 1075 else: 1076 enq0 = pypar.receive(self.enquiry_proc[0]) 1077 1078 1079 if self.myid == self.enquiry_proc[1]: 1080 enq1 = eval(get1) 1081 else: 1082 enq1 = pypar.receive(self.enquiry_proc[1]) 1083 1084 else: 1085 if self.myid == self.enquiry_proc[0]: 1086 enq0 = eval(get0) 1087 pypar.send(enq0, self.master_proc) 1088 1089 if self.myid == self.enquiry_proc[1]: 1090 enq1 = eval(get1) 1091 pypar.send(enq1, self.master_proc) 1092 1093 1094 return [enq0, enq1] 1095 1096 1077 if self.myid == self.master_proc: 1078 1079 if self.myid == self.enquiry_proc[0]: 1080 enq0 = eval(get0) 1081 else: 1082 enq0 = pypar.receive(self.enquiry_proc[0]) 1083 1084 1085 if self.myid == self.enquiry_proc[1]: 1086 enq1 = eval(get1) 1087 else: 1088 enq1 = pypar.receive(self.enquiry_proc[1]) 1089 1090 else: 1091 if self.myid == self.enquiry_proc[0]: 1092 enq0 = eval(get0) 1093 pypar.send(enq0, self.master_proc) 1094 1095 if self.myid == self.enquiry_proc[1]: 1096 enq1 = eval(get1) 1097 pypar.send(enq1, self.master_proc) 1098 1099 1100 return [enq0, enq1] 1101 1102 -
trunk/anuga_core/source/anuga_parallel/run_parallel_gate_operator.py
r8875 r8877 12 12 13 13 14 #from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model15 16 14 from math import pi, pow, sqrt 17 15 … … 82 80 domain.set_name('run_gate_operator') # Output name 83 81 domain.set_flow_algorithm('2_0') 84 #domain.set_beta(1.5) 82 85 83 86 84 … … 116 114 117 115 # Close the gate 118 gate.set_culvert_height(0.0) 116 if gate is not None: 117 gate.set_culvert_height(0.0) 119 118 120 119 line = [[0.0, 5.0], [0.0, 10.0]] … … 162 161 [w0, w1] = gate.get_enquiry_water_depths() 163 162 163 output = gate.discharge_routine() 164 164 165 165 if myid == gate.get_master_proc(): … … 170 170 print 'myid ', myid, w0,w1 171 171 172 173 print gate.discharge_routine() 172 print 'myid ',myid, output 173 174 174 175 175 if d0 > 0.2: gate.set_culvert_height(10.0)
Note: See TracChangeset
for help on using the changeset viewer.