Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdark committed Jul 26, 2024
1 parent cd7c930 commit e82da3a
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions festim/exports/derived_quantities/average_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ def compute(self):
# dS_r = r dz dtheta , assuming axisymmetry dS_r = theta r dz
# in both cases the expression with self.dx is the same

avg_surf = f.assemble(
self.function * self.r * self.ds(self.surface)
) / f.assemble(1 * self.r * self.ds(self.surface))
values = f.assemble(self.function * self.r * self.ds(self.surface)) * (
self.azimuth_range[1] - self.azimuth_range[0]
)

avg_surf *= self.azimuth_range[1] - self.azimuth_range[0]
surface_area = f.assemble(1 * self.r * self.ds(self.surface)) * (
self.azimuth_range[1] - self.azimuth_range[0]
)
avg_surf = values / surface_area

return avg_surf

Expand Down Expand Up @@ -170,12 +173,18 @@ def compute(self):
# dV_r = r dz dtheta , assuming axisymmetry dV_r = theta r dz
# in both cases the expression with self.dx is the same

avg_vol = f.assemble(
self.function * self.r**2 * self.dx(self.volume)
) / f.assemble(1 * self.r**2 * self.dx(self.volume))
values = (
f.assemble(self.function * self.r**2 * self.dx(self.volume))
* (self.polar_range[1] - self.polar_range[0])
* (-np.cos(self.azimuth_range[1]) + np.cos(self.azimuth_range[0]))
)

avg_vol *= (self.polar_range[1] - self.polar_range[0]) * (
-np.cos(self.azimuth_range[1]) + np.cos(self.azimuth_range[0])
surface_area = (
f.assemble(1 * self.r**2 * self.dx(self.volume))
* (self.polar_range[1] - self.polar_range[0])
* (-np.cos(self.azimuth_range[1]) + np.cos(self.azimuth_range[0]))
)

return avg_vol
avg_surf = values / surface_area

return avg_surf

0 comments on commit e82da3a

Please sign in to comment.