Repository: openmc-dev/openmc

Issue:
Improve docstrings for Cones (and possibly others)
This pertains to the Cone docstrings: https://docs.openmc.org/en/stable/pythonapi/generated/openmc.Cone.html, and others.

The documentation for `openmc.Cone` lacks a quadric surface equation, and more importantly, an intuitive explanation of `r2`. `[X|Y|Z]Cone` does include the equation, but `r2` is still not super intuitive.

In general many surfaces' documentation probably needs more intuitive explanations. 

Thanks @pshriwise for making me find this. 


Discussion:
I can do this. I just can't assign myself.
Other thought. Example figures from @gridley's work (i.e., 3D renders) might be helpful. 
It was discovered that `r2` is `r^2` and not `r_2`, which isn't very intuitive. How bad would a refactor break things? I'm thinking either: `r`, `r_squared`, or `r_sq`. To prevent breaking things we could keep `r2` as a backup kwarg. 

I think also the fact that this is a double cone needs to be clearer. 

Third thought: an angle is a lot more intuitive. So I think a constructor that takes theta would be good. I'm thinking either: 
1. adding a `theta` kw-arg to `__init__`
2. Or adding a `@staticmethod` that is essentially a factory. 

What's the most openMC-ic way?
"Parameter related to the aperture" Lol what. That isn't the best! Is this the radius squared one unit along the cone's axis? I agree it'd be good to include a sketch. A 3D rendering would be nice, but perhaps convey only marginally more info!
> "Parameter related to the aperture" Lol what. That isn't the best! Is this the radius squared one unit along the cone's axis?

We found out that it is the square of the radius 1 unit along the axis. The square of the slope of the edge works quite nicely.

> A 3D rendering would be nice, but perhaps convey only marginally more info!

Touche. Time to either get good at inkscape (@tjlaboss) or scour wikimedia. 



Thanks for taking this on, @MicahGale! Let's get the documentation updated for now and revisit the parameter naming.

Mention of the [`XConeOneSided`](https://github.com/openmc-dev/openmc/blob/b75ccd598e8442c97eed315b965736a31b6a67c8/openmc/model/surface_composite.py#L617) and similar composite surfaces here is probably appropriate 
Good idea. Best not to make this monolithic. Should I open a separate issue to discuss the possible refactor?

Resolving patch:
diff --git a/openmc/model/surface_composite.py b/openmc/model/surface_composite.py
--- a/openmc/model/surface_composite.py
+++ b/openmc/model/surface_composite.py
@@ -617,7 +617,7 @@ def __pos__(self):
 class XConeOneSided(CompositeSurface):
     """One-sided cone parallel the x-axis
 
-    A one-sided cone is composed of a normal cone surface and an "ambiguity"
+    A one-sided cone is composed of a normal cone surface and a "disambiguation"
     surface that eliminates the ambiguity as to which region of space is
     included. This class acts as a proper surface, meaning that unary `+` and
     `-` operators applied to it will produce a half-space. The negative side is
@@ -634,7 +634,9 @@ class XConeOneSided(CompositeSurface):
     z0 : float, optional
         z-coordinate of the apex. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperture [:math:`\\rm cm^2`].
+        It can be interpreted as the increase in the radius squared per cm along 
+        the cone's axis of revolution.
     up : bool
         Whether to select the side of the cone that extends to infinity in the
         positive direction of the coordinate axis (the positive half-space of
@@ -647,7 +649,7 @@ class XConeOneSided(CompositeSurface):
     cone : openmc.XCone
         Regular two-sided cone
     plane : openmc.XPlane
-        Ambiguity surface
+        Disambiguation surface
     up : bool
         Whether to select the side of the cone that extends to infinity in the
         positive direction of the coordinate axis (the positive half-space of
@@ -675,7 +677,7 @@ def __pos__(self):
 class YConeOneSided(CompositeSurface):
     """One-sided cone parallel the y-axis
 
-    A one-sided cone is composed of a normal cone surface and an "ambiguity"
+    A one-sided cone is composed of a normal cone surface and a "disambiguation"
     surface that eliminates the ambiguity as to which region of space is
     included. This class acts as a proper surface, meaning that unary `+` and
     `-` operators applied to it will produce a half-space. The negative side is
@@ -692,7 +694,9 @@ class YConeOneSided(CompositeSurface):
     z0 : float, optional
         z-coordinate of the apex. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperture [:math:`\\rm cm^2`].
+        It can be interpreted as the increase in the radius squared per cm along 
+        the cone's axis of revolution.
     up : bool
         Whether to select the side of the cone that extends to infinity in the
         positive direction of the coordinate axis (the positive half-space of
@@ -705,7 +709,7 @@ class YConeOneSided(CompositeSurface):
     cone : openmc.YCone
         Regular two-sided cone
     plane : openmc.YPlane
-        Ambiguity surface
+        Disambiguation surface
     up : bool
         Whether to select the side of the cone that extends to infinity in the
         positive direction of the coordinate axis (the positive half-space of
@@ -727,7 +731,7 @@ def __init__(self, x0=0., y0=0., z0=0., r2=1., up=True, **kwargs):
 class ZConeOneSided(CompositeSurface):
     """One-sided cone parallel the z-axis
 
-    A one-sided cone is composed of a normal cone surface and an "ambiguity"
+    A one-sided cone is composed of a normal cone surface and a "disambiguation"
     surface that eliminates the ambiguity as to which region of space is
     included. This class acts as a proper surface, meaning that unary `+` and
     `-` operators applied to it will produce a half-space. The negative side is
@@ -744,7 +748,9 @@ class ZConeOneSided(CompositeSurface):
     z0 : float, optional
         z-coordinate of the apex. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperture [:math:`\\rm cm^2`].
+        It can be interpreted as the increase in the radius squared per cm along 
+        the cone's axis of revolution.
     up : bool
         Whether to select the side of the cone that extends to infinity in the
         positive direction of the coordinate axis (the positive half-space of
@@ -757,7 +763,7 @@ class ZConeOneSided(CompositeSurface):
     cone : openmc.ZCone
         Regular two-sided cone
     plane : openmc.ZPlane
-        Ambiguity surface
+        Disambiguation surface
     up : bool
         Whether to select the side of the cone that extends to infinity in the
         positive direction of the coordinate axis (the positive half-space of
diff --git a/openmc/surface.py b/openmc/surface.py
--- a/openmc/surface.py
+++ b/openmc/surface.py
@@ -1748,6 +1748,11 @@ def evaluate(self, point):
 class Cone(QuadricMixin, Surface):
     """A conical surface parallel to the x-, y-, or z-axis.
 
+    .. Note::
+        This creates a double cone, which is two one-sided cones that meet at their apex.
+        For a one-sided cone see :class:`~openmc.model.XConeOneSided`,
+        :class:`~openmc.model.YConeOneSided`, and :class:`~openmc.model.ZConeOneSided`.
+
     Parameters
     ----------
     x0 : float, optional
@@ -1757,7 +1762,9 @@ class Cone(QuadricMixin, Surface):
     z0 : float, optional
         z-coordinate of the apex in [cm]. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperture [:math:`\\rm cm^2`].
+        It can be interpreted as the increase in the radius squared per cm along 
+        the cone's axis of revolution.
     dx : float, optional
         x-component of the vector representing the axis of the cone.
         Defaults to 0.
@@ -1791,7 +1798,7 @@ class Cone(QuadricMixin, Surface):
     z0 : float
         z-coordinate of the apex in [cm]
     r2 : float
-        Parameter related to the aperature
+        Parameter related to the aperature [cm^2]
     dx : float
         x-component of the vector representing the axis of the cone.
     dy : float
@@ -1900,6 +1907,10 @@ class XCone(QuadricMixin, Surface):
     """A cone parallel to the x-axis of the form :math:`(y - y_0)^2 + (z - z_0)^2 =
     r^2 (x - x_0)^2`.
 
+    .. Note::
+        This creates a double cone, which is two one-sided cones that meet at their apex.
+        For a one-sided cone see :class:`~openmc.model.XConeOneSided`.
+
     Parameters
     ----------
     x0 : float, optional
@@ -1909,7 +1920,9 @@ class XCone(QuadricMixin, Surface):
     z0 : float, optional
         z-coordinate of the apex in [cm]. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperture [:math:`\\rm cm^2`].
+        It can be interpreted as the increase in the radius squared per cm along 
+        the cone's axis of revolution.
     boundary_type : {'transmission, 'vacuum', 'reflective', 'white'}, optional
         Boundary condition that defines the behavior for particles hitting the
         surface. Defaults to transmissive boundary condition where particles
@@ -1995,6 +2008,10 @@ class YCone(QuadricMixin, Surface):
     """A cone parallel to the y-axis of the form :math:`(x - x_0)^2 + (z - z_0)^2 =
     r^2 (y - y_0)^2`.
 
+    .. Note::
+        This creates a double cone, which is two one-sided cones that meet at their apex.
+        For a one-sided cone see :class:`~openmc.model.YConeOneSided`.
+
     Parameters
     ----------
     x0 : float, optional
@@ -2004,7 +2021,9 @@ class YCone(QuadricMixin, Surface):
     z0 : float, optional
         z-coordinate of the apex in [cm]. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperture [:math:`\\rm cm^2`].
+        It can be interpreted as the increase in the radius squared per cm along 
+        the cone's axis of revolution.
     boundary_type : {'transmission, 'vacuum', 'reflective', 'white'}, optional
         Boundary condition that defines the behavior for particles hitting the
         surface. Defaults to transmissive boundary condition where particles
@@ -2090,6 +2109,10 @@ class ZCone(QuadricMixin, Surface):
     """A cone parallel to the z-axis of the form :math:`(x - x_0)^2 + (y - y_0)^2 =
     r^2 (z - z_0)^2`.
 
+    .. Note::
+        This creates a double cone, which is two one-sided cones that meet at their apex.
+        For a one-sided cone see :class:`~openmc.model.ZConeOneSided`.
+
     Parameters
     ----------
     x0 : float, optional
@@ -2099,7 +2122,9 @@ class ZCone(QuadricMixin, Surface):
     z0 : float, optional
         z-coordinate of the apex in [cm]. Defaults to 0.
     r2 : float, optional
-        Parameter related to the aperature. Defaults to 1.
+        Parameter related to the aperature [cm^2].
+        This is the square of the radius of the cone 1 cm from.
+        This can also be treated as the square of the slope of the cone relative to its axis.
     boundary_type : {'transmission, 'vacuum', 'reflective', 'white'}, optional
         Boundary condition that defines the behavior for particles hitting the
         surface. Defaults to transmissive boundary condition where particles


Test patch: