Skip to content

Commit 7405339

Browse files
committed
changed areas and the cell volume
1 parent f0f089b commit 7405339

File tree

1 file changed

+11
-29
lines changed

1 file changed

+11
-29
lines changed

pyro/mesh/patch.py

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -930,15 +930,10 @@ def area_x(self):
930930
Return an array of the face areas.
931931
The shape of the returned array is (ni, nj).
932932
"""
933-
# tr = lambda arr: arr.transpose(1, 2, 0)
934-
# x = self.cell_vertices()[:,0]
935-
# y = self.cell_vertices()[0,:]
936-
# r0 = x[:-1, :-1]
937-
# r1 = x[+1:, :-1]
938-
# t0 = y[:-1, :-1]
939-
# t1 = y[+1:, +1:]
940-
r1 = self.xl
941-
r0 = self.xr
933+
r1 = self.xr
934+
r0 = self.xl
935+
936+
# ** this is just \Delta r
942937

943938
area = r1 - r0
944939
return area
@@ -948,20 +943,13 @@ def area_y(self):
948943
Return an array of the face areas.
949944
The shape of the returned array is (ni, nj).
950945
"""
951-
# tr = lambda arr: arr.transpose(1, 2, 0)
952-
# x = self.cell_vertices()[:,0]
953-
# y = self.cell_vertices()[0,:]
954-
# r0 = x[:-1, :-1]
955-
# r1 = x[+1:, :-1]
956-
# t0 = y[:-1, :-1]
957-
# t1 = y[+1:, +1:]
958946

959-
r1, t1 = np.meshgrid(self.xl, self.yl)
960-
r0, t0 = np.meshgrid(self.xr, self.yr)
947+
t1 = self.yr
948+
t0 = self.yl
961949

962-
# ** the area of a part of an annulus
950+
# ** this is just \Delta \theta
963951

964-
area = 0.5 * (r1 ** 2 - r0 ** 2) * (t1 - t0)
952+
area = t1 - t0
965953
return area
966954

967955

@@ -971,20 +959,14 @@ def cell_volumes(self):
971959
The shape of the returned array is (ni, nj).
972960
"""
973961

974-
# x = self.cell_vertices()[:,0]
975-
# y = self.cell_vertices()[0,:]
976-
977-
# r0 = x[:-1, :-1]
978-
# r1 = x[+1:, :-1]
979-
# t0 = y[:-1, :-1]
980-
# t1 = y[+1:, +1:]
981-
982962
r1 = self.xl
983963
r0 = self.xr
984964
t1 = self.yl
985965
t0 = self.yr
986966

987-
return 0.5 * (r1 ** 2 - r0 ** 2) * (t1 - t0) * (r1 - r0)
967+
# ** this is just the face area
968+
969+
return 0.5 * (r1 ** 2 - r0 ** 2) * (t1 - t0)
988970

989971
def cell_vertices(self):
990972
"""

0 commit comments

Comments
 (0)