@@ -905,26 +905,6 @@ class PolarGrid(Grid2d):
905905
906906 # pylint: disable=too-many-instance-attributes
907907
908-
909- # def face_area(self):
910- # """
911- # Return an array of the face areas.
912- # The shape of the returned array is (ni, nj).
913- # """
914- # tr = lambda arr: arr.transpose(1, 2, 0)
915- # x = self.cell_vertices()[:,0]
916- # y = self.cell_vertices()[0,:]
917- # r0 = x[:-1, :-1]
918- # r1 = x[+1:, :-1]
919- # t0 = y[:-1, :-1]
920- # t1 = y[+1:, +1:]
921-
922- # # ** the area of the arc
923-
924- # area_i = np.pi * (r0 * np.sin(t0) + r0 * np.sin(t1)) * np.sqrt(np.square(r0 * np.sin(t1) - r0 * np.sin(t0)) + np.square(r0 * np.cos(t1) - r0 * np.cos(t0)))
925- # area_j = np.pi * (r0 * np.sin(t0) + r1 * np.sin(t0)) * np.sqrt(np.square(r1 * np.sin(t0) - r0 * np.sin(t0)) + np.square(r1 * np.cos(t0) - r0 * np.cos(t0)))
926- # return tr(np.array([area_i, area_j]))
927-
928908 def area_x (self ):
929909 """
930910 Return an array of the face areas.
@@ -952,7 +932,6 @@ def area_y(self):
952932 area = t1 - t0
953933 return area
954934
955-
956935 def cell_volumes (self ):
957936 """
958937 Return an array of the cell volume data for the given coordinate box
@@ -968,31 +947,5 @@ def cell_volumes(self):
968947
969948 return 0.5 * (r1 ** 2 - r0 ** 2 ) * (t1 - t0 )
970949
971- def cell_vertices (self ):
972- """
973- Return the coordinates of cell vertices
974- The arrays range from 0 to 1 for now
975- """
976- # if self.ng == 0:
977- # xv = np.linspace(0, 1, self.nx + 1)[:-1]
978- # yv = np.linspace(0, 1, self.ny + 1)[:-1]
979- # else:
980- # xv = np.linspace(0, 1, self.nx + 1)
981- # yv = np.linspace(0, 1, self.ny + 1)
982-
983- xv = np .linspace (0 , 1 , self .nx + 1 )[:- 1 ]
984- yv = np .linspace (0 , 1 , self .ny + 1 )[:- 1 ]
985-
986-
987- tr = lambda arr : arr .transpose (1 , 2 , 0 )
988- x , y = np .meshgrid (xv , yv , indexing = "ij" )
989- return tr (np .array ([x , y ]))
990-
991-
992-
993-
994-
995-
996-
997950if __name__ == "__main__" :
998951 do_demo ()
0 commit comments