Skip to content

Commit 87c4312

Browse files
committed
simplify avg sph surf class
1 parent 636a322 commit 87c4312

File tree

1 file changed

+3
-43
lines changed

1 file changed

+3
-43
lines changed

festim/exports/derived_quantities/average_surface.py

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -105,48 +105,8 @@ def compute(self):
105105

106106
class AverageSurfaceSpherical(AverageSurface):
107107
"""
108-
Computes the average value of a field in a given volume
109-
int(f ds) / int (1 * ds)
110-
ds is the surface measure in cylindrical coordinates.
111-
ds = r^2 sin(theta) dtheta dphi
112-
113-
Args:
114-
field (str, int): the field ("solute", 0, 1, "T", "retention")
115-
surface (int): the surface id
116-
117-
Attributes:
118-
field (str, int): the field ("solute", 0, 1, "T", "retention")
119-
surface (int): the surface id
120-
title (str): the title of the derived quantity
121-
show_units (bool): show the units in the title in the derived quantities
122-
file
123-
function (dolfin.function.function.Function): the solution function of
124-
the field
125-
r (ufl.indexed.Indexed): the radius of the sphere
126-
127-
Notes:
128-
Units are in H/m3 for hydrogen concentration and K for temperature
108+
Computes the average on a spherical "surface" in 1D.
109+
Behaves identically to `AverageSurface`.
129110
"""
130111

131-
def __init__(self, field, surface) -> None:
132-
super().__init__(field=field, surface=surface)
133-
self.r = None
134-
135-
def compute(self):
136-
137-
if self.r is None:
138-
mesh = (
139-
self.function.function_space().mesh()
140-
) # get the mesh from the function
141-
rthetaz = f.SpatialCoordinate(mesh) # get the coordinates from the mesh
142-
self.r = rthetaz[0] # only care about r here
143-
144-
# dV_z = r dr dtheta , assuming axisymmetry dV_z = theta r dr
145-
# dV_r = r dz dtheta , assuming axisymmetry dV_r = theta r dz
146-
# in both cases the expression with self.dx is the same
147-
148-
avg_surf = f.assemble(
149-
self.function * self.r**2 * self.ds(self.surface)
150-
) / f.assemble(1 * self.r**2 * self.ds(self.surface))
151-
152-
return avg_surf
112+
pass

0 commit comments

Comments
 (0)