-
Notifications
You must be signed in to change notification settings - Fork 34
New Angular Quadrature types added into OpenSn. #899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
f967aa2 to
a2f3d2a
Compare
|
Would y'all mind reviewing this code? This PR should also close out the last milestone on Issue #245. |
ragusa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making good progress. several things need adjustments, maybe the biggest one is creating a dedicated triangular class. @wdhawkins can you concur or amend this statement?
| class LebedevQuadrature2DXY : public AngularQuadrature | ||
| { | ||
| public: | ||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrsd @wdhawkins what are our standards for doxygen tags/doco?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no detailed instructions for all doxygen comments, but roughly this.
The use of brief is not enforced, but should be since JAVADOC_AUTOBRIEF = NO in the Doxyfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to JAVADOC_AUTOBRIEF = YES in PR 902. \brief and \details usage should be removed in the future.
test/python/framework/math/quadrature/gold/triangular_quad_2d_xy.py.gold
Outdated
Show resolved
Hide resolved
test/python/framework/math/quadrature/gold/triangular_quad_3d_xyz.py.gold
Show resolved
Hide resolved
6d8b695 to
f933ceb
Compare
ragusa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for using tquad and not pquad in examples :-)
b15ff5c to
463c446
Compare
| // Calculate number of azimuthal angles per polar level | ||
| // At equator: Nazimuthal angles | ||
| // Each level away from equator: 4 less azimuthal angles (1 less per octant) | ||
| // This maintains octant symmetry in the triangular pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these kind of comments allowed? @ragusa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the issue // versus /// or the text itself (too basic)? maybe @wdhawkins can chime in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// is allowed for in-code comments. Even if they were /// they would be ignored by doxygen.
| class LebedevQuadrature2DXY : public AngularQuadrature | ||
| { | ||
| public: | ||
| /** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to JAVADOC_AUTOBRIEF = YES in PR 902. \brief and \details usage should be removed in the future.
| * Return a reference to the precomputed discrete-to-moment operator. | ||
| * | ||
| * The operator is accessed as [m][d], where m is the moment index and d is the direction index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a setter/getter? @andrsd @wdhawkins
If yes, we don't need any documentation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the function name is GetDiscreteToMomentOperator. In code, we access it via [d][m], so the comment has it wrong :-) Plus, telling the users how to access the 2D array is useful, so I would fix the comment, at minimum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to bring this to @wdhawkins 's attention. Andrew's implementation followed the math derivation at first, until I remember that we likely have M and D indexed similarly, like [d][m] whereas D should be [m][d], so Andrew did a transpose operation to abide by how it is implemented in the code. But once D and M are exposed to the user, the user will also be confused about [d][m] versus [m][d], unless we return the object to them in python with indexing that abides with the math notation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I missed these related comment when I went back through and transposed the D2M matrix back to how OpenSn stores it. I can fix the comment to read [d][m].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the function name is
GetDiscreteToMomentOperator. In code, we access it via[d][m], so the comment has it wrong :-) Plus, telling the users how to access the 2D array is useful, so I would fix the comment, at minimum.
Sorry, looking back over this, this fix is specific to the next section regarding the D2M operator right? The M2D operator in OpenSn is stored equivalently to its definition in literature, so this comment is correct since the GetMomentToDiscreteOperator is still accessed as [m][d] unless I'm misunderstanding how it is used in the sweeper. The issue is the * Return a reference to the precomputed discrete-to-moment operator. since this is getting the M2D operator, not the D2M operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore the above, I somehow read the comments upside down :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed to be [d][m] for now. Leaving this thread open.
| * direction index. | ||
| * Return a reference to the precomputed moment-to-discrete operator. | ||
| * | ||
| * The operator is accessed as [m][d], where m is the moment index and d is the direction index. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be fixed too. The indexing is really [d][m]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pinging @wdhawkins here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed to be [d][m] for now. I'm going to leave this thread open so that it isn't hidden.
463c446 to
f58cebf
Compare
3 new angular quadrature types have been introduced, along with corresponding regression tests. 2D Lebedev, a modification of its 3D variant, as well as 2D and 3D GLC Triangular Sets.
f58cebf to
2dc948f
Compare
|
Be sure to update |
| Vector3 new_omega; | ||
| new_omega.x = sin(qpoint.theta) * cos(qpoint.phi); | ||
| new_omega.y = sin(qpoint.theta) * sin(qpoint.phi); | ||
| new_omega.z = cos(qpoint.theta); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In lebedev_quadrature.cc, you use the C++ versions of math functions, so you may want to do it here as well.
sin->std::sincos->std::cos
| std::vector<double> polar; | ||
| polar.reserve(Npolar); | ||
| for (unsigned int j = 0; j < Npolar; ++j) | ||
| polar.emplace_back(M_PI - acos(gl_polar.qpoints[j][0])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
acos -> std::acos
| Vector3 new_omega; | ||
| new_omega.x = sin(qpoint.theta) * cos(qpoint.phi); | ||
| new_omega.y = sin(qpoint.theta) * sin(qpoint.phi); | ||
| new_omega.z = cos(qpoint.theta); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::sin, std::cos here as well
| { | ||
| static const std::vector<std::string> required_keys = {"n_polar", "scattering_order"}; | ||
| static const std::vector<std::pair<std::string, py::object>> optional_keys = {{"verbose", py::bool_(false)}}; | ||
| return construct_from_kwargs<GLCTriangularQuadrature3DXYZ, int, int, bool>(params, required_keys, optional_keys); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The types after the class name should match the types of the class constructor arguments. Since we changed that to unsigned int, these need to be changed as well.
Also, update on line 295, 581.
3 new angular quadrature types have been introduced, along with corresponding regression tests. 2D Lebedev, a modification of its 3D variant, as well as 2D and 3D GLC Triangular Sets.