@@ -1016,13 +1016,15 @@ def area_x(self):
10161016 Return an array of the face areas.
10171017 The shape of the returned array is (ni, nj).
10181018 """
1019- tr = lambda arr : arr .transpose (1 , 2 , 0 )
1020- x = self .cell_vertices ()[:,0 ]
1021- y = self .cell_vertices ()[0 ,:]
1022- r0 = x [:- 1 , :- 1 ]
1023- r1 = x [+ 1 :, :- 1 ]
1024- t0 = y [:- 1 , :- 1 ]
1025- t1 = y [+ 1 :, + 1 :]
1019+ # tr = lambda arr: arr.transpose(1, 2, 0)
1020+ # x = self.cell_vertices()[:,0]
1021+ # y = self.cell_vertices()[0,:]
1022+ # r0 = x[:-1, :-1]
1023+ # r1 = x[+1:, :-1]
1024+ # t0 = y[:-1, :-1]
1025+ # t1 = y[+1:, +1:]
1026+ r1 = self .xl
1027+ r0 = self .xr
10261028
10271029 area = r1 - r0
10281030 return area
@@ -1032,13 +1034,16 @@ def area_y(self):
10321034 Return an array of the face areas.
10331035 The shape of the returned array is (ni, nj).
10341036 """
1035- tr = lambda arr : arr .transpose (1 , 2 , 0 )
1036- x = self .cell_vertices ()[:,0 ]
1037- y = self .cell_vertices ()[0 ,:]
1038- r0 = x [:- 1 , :- 1 ]
1039- r1 = x [+ 1 :, :- 1 ]
1040- t0 = y [:- 1 , :- 1 ]
1041- t1 = y [+ 1 :, + 1 :]
1037+ # tr = lambda arr: arr.transpose(1, 2, 0)
1038+ # x = self.cell_vertices()[:,0]
1039+ # y = self.cell_vertices()[0,:]
1040+ # r0 = x[:-1, :-1]
1041+ # r1 = x[+1:, :-1]
1042+ # t0 = y[:-1, :-1]
1043+ # t1 = y[+1:, +1:]
1044+
1045+ r1 , t1 = np .meshgrid (self .xl , self .yl )
1046+ r0 , t0 = np .meshgrid (self .xr , self .yr )
10421047
10431048 # ** the area of a part of an annulus
10441049
@@ -1052,13 +1057,18 @@ def cell_volumes(self):
10521057 The shape of the returned array is (ni, nj).
10531058 """
10541059
1055- x = self .cell_vertices ()[:,0 ]
1056- y = self .cell_vertices ()[0 ,:]
1060+ # x = self.cell_vertices()[:,0]
1061+ # y = self.cell_vertices()[0,:]
10571062
1058- r0 = x [:- 1 , :- 1 ]
1059- r1 = x [+ 1 :, :- 1 ]
1060- t0 = y [:- 1 , :- 1 ]
1061- t1 = y [+ 1 :, + 1 :]
1063+ # r0 = x[:-1, :-1]
1064+ # r1 = x[+1:, :-1]
1065+ # t0 = y[:-1, :-1]
1066+ # t1 = y[+1:, +1:]
1067+
1068+ r1 = self .xl
1069+ r0 = self .xr
1070+ t1 = self .yl
1071+ t0 = self .yr
10621072
10631073 return 0.5 * (r1 ** 2 - r0 ** 2 ) * (t1 - t0 ) * (r1 - r0 )
10641074
0 commit comments