Respond to @pshriwise comments on #1933

This commit is contained in:
Paul Romano 2021-12-29 10:18:02 -05:00
parent 374e9f7107
commit b517d2967d
4 changed files with 28 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -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 {

View file

@ -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_;