diff --git a/docs/source/methods/geometry.rst b/docs/source/methods/geometry.rst index c087290225..2da0c02112 100644 --- a/docs/source/methods/geometry.rst +++ b/docs/source/methods/geometry.rst @@ -980,7 +980,7 @@ Dxy + Eyz + Fxz + Gx + Hy + Jz + K = 0`. Thus, the gradient to the surface is Torus Parallel to an Axis ------------------------- -A cone parallel to, for example, the x-axis has the form +A torus parallel to, for example, the x-axis has the form .. math:: :label: reflection-torus-1 diff --git a/docs/source/usersguide/geometry.rst b/docs/source/usersguide/geometry.rst index 2b6a6fef2f..68ecfce95c 100644 --- a/docs/source/usersguide/geometry.rst +++ b/docs/source/usersguide/geometry.rst @@ -78,10 +78,23 @@ classes are listed in the following table. | Cone parallel to the | :math:`(x-x_0)^2 + (y-y_0)^2 | :class:`openmc.ZCone` | | :math:`z`-axis | - R^2(z-z_0)^2 = 0` | | +----------------------+------------------------------+---------------------------+ - | General quadric | :math:`Ax^2 + By^2 + Cz^2 + | :class:`openmc.Quadric` | + | General quadric | :math:`Ax^2 + By^2 + Cz^2 + | :class:`openmc.Quadric` | | surface | Dxy + Eyz + Fxz + Gx + Hy + | | | | Jz + K = 0` | | +----------------------+------------------------------+---------------------------+ + | Torus parallel to the| :math:`(x-x_0)^2/B^2+\frac{( | :class:`openmc.XTorus` | + | :math:`x`-axis | \sqrt{(y-y_0)^2+(z-z_0)^2} - | | + | | A)^2}{C^2} - 1 = 0` | | + +----------------------+------------------------------+---------------------------+ + | Torus parallel to the| :math:`(y-y_0)^2/B^2+\frac{( | :class:`openmc.YTorus` | + | :math:`y`-axis | \sqrt{(x-x_0)^2+(z-z_0)^2} - | | + | | A)^2}{C^2} - 1 = 0` | | + +----------------------+------------------------------+---------------------------+ + | Torus parallel to the| :math:`(z-z_0)^2/B^2+\frac{( | :class:`openmc.ZTorus` | + | :math:`z`-axis | \sqrt{(x-x_0)^2+(y-y_0)^2} - | | + | | A)^2}{C^2} - 1 = 0` | | + +----------------------+------------------------------+---------------------------+ + Each surface is characterized by several parameters. As one example, the parameters for a sphere are the :math:`x,y,z` coordinates of the center of the diff --git a/include/openmc/surface.h b/include/openmc/surface.h index a92550c605..84a2ed1134 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -374,7 +374,7 @@ public: //============================================================================== //! A toroidal surface described by the quartic torus lies in the x direction // -//! \f$(x-x_0)^2 + (\sqrt{(y-y_0)^2 + (z-z_0)^2} - A)^2/C^2 -1 \f$ +//! \f$(x-x_0)^2/B^2 + (\sqrt{(y-y_0)^2 + (z-z_0)^2} - A)^2/C^2 -1 \f$ //============================================================================== class SurfaceXTorus : public CSGSurface { @@ -391,7 +391,7 @@ public: //============================================================================== //! A toroidal surface described by the quartic torus lies in the y direction // -//! \f$(x-x_0)^2 + (\sqrt{(y-y_0)^2 + (z-z_0)^2} - A)^2/C^2 -1 \f$ +//! \f$(y-y_0)^2/B^2 + (\sqrt{(x-x_0)^2 + (z-z_0)^2} - A)^2/C^2 -1 \f$ //============================================================================== class SurfaceYTorus : public CSGSurface { @@ -408,7 +408,7 @@ public: //============================================================================== //! A toroidal surface described by the quartic torus lies in the z direction // -//! \f$(x-x_0)^2 + (\sqrt{(y-y_0)^2 + (z-z_0)^2} - A)^2/C^2 -1 \f$ +//! \f$(z-z_0)^2/B^2 + (\sqrt{(x-x_0)^2 + (y-y_0)^2} - A)^2/C^2 -1 \f$ //============================================================================== class SurfaceZTorus : public CSGSurface { diff --git a/src/surface.cpp b/src/surface.cpp index 10a0026108..872bd6cb07 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -47,7 +47,8 @@ void read_coeffs(pugi::xml_node surf_node, int surf_id, double& c1) // Parse the coefficients. int stat = sscanf(coeffs.c_str(), "%lf", &c1); if (stat != 1) { - fatal_error("Something went wrong reading surface coeffs"); + fatal_error(fmt::format( + "Something went wrong reading coeffs for surface {}", surf_id)); } } @@ -65,7 +66,8 @@ void read_coeffs( // Parse the coefficients. int stat = sscanf(coeffs.c_str(), "%lf %lf %lf", &c1, &c2, &c3); if (stat != 3) { - fatal_error("Something went wrong reading surface coeffs"); + fatal_error(fmt::format( + "Something went wrong reading coeffs for surface {}", surf_id)); } } @@ -83,7 +85,8 @@ void read_coeffs(pugi::xml_node surf_node, int surf_id, double& c1, double& c2, // Parse the coefficients. int stat = sscanf(coeffs.c_str(), "%lf %lf %lf %lf", &c1, &c2, &c3, &c4); if (stat != 4) { - fatal_error("Something went wrong reading surface coeffs"); + fatal_error(fmt::format( + "Something went wrong reading coeffs for surface {}", surf_id)); } } @@ -102,7 +105,8 @@ void read_coeffs(pugi::xml_node surf_node, int surf_id, double& c1, double& c2, int stat = sscanf( coeffs.c_str(), "%lf %lf %lf %lf %lf %lf", &c1, &c2, &c3, &c4, &c5, &c6); if (stat != 6) { - fatal_error("Something went wrong reading surface coeffs"); + fatal_error(fmt::format( + "Something went wrong reading coeffs for surface {}", surf_id)); } } @@ -122,7 +126,8 @@ void read_coeffs(pugi::xml_node surf_node, int surf_id, double& c1, double& c2, int stat = sscanf(coeffs.c_str(), "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf", &c1, &c2, &c3, &c4, &c5, &c6, &c7, &c8, &c9, &c10); if (stat != 10) { - fatal_error("Something went wrong reading surface coeffs"); + fatal_error(fmt::format( + "Something went wrong reading coeffs for surface {}", surf_id)); } } @@ -1065,8 +1070,6 @@ void SurfaceXTorus::to_hdf5_inner(hid_t group_id) const write_dataset(group_id, "coefficients", coeffs); } -// todo should do some alebgra first to get rid of the sqrt - double SurfaceXTorus::evaluate(Position r) const { double x = r.x - x0_;