Skip to content

Conversation

@geoffrey4444
Copy link
Contributor

Proposed changes

Add a function in StrahlkorperFunctions.cpp that takes a Strahlkorper and computes a power monitor, using the same method as SpEC does in SpEC's SurfacePowerDiagnostics.cpp. This function is an ingredient for the "Shape" criteria for adaptive horizon finding. The existing power_monitor functionality in NumericalAlgorithms/LinearOperators/PowerMonitors.?pp works on meshes, but not on Strahlkorpers.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

@geoffrey4444 geoffrey4444 requested review from knelli2 and nilsvu May 22, 2025 17:30
@geoffrey4444
Copy link
Contributor Author

The macOS arm64 unit test failure tests/Unit/Visualization/Python/Test_TransformVolumeData.py looks unrelated to this PR to me

Copy link
Contributor

@knelli2 knelli2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. You can squash in the dox changes.

Don't worry about the macOS tests. It's something unrelated that we haven't looked into yet.

@geoffrey4444 geoffrey4444 force-pushed the StrahlkorperPowerMonitor branch from e242666 to 356ee49 Compare May 22, 2025 20:37
@geoffrey4444
Copy link
Contributor Author

Thanks for the quick review, Kyle! Just squashed my docs changes, as you requested

template <typename Frame>
void power_monitor(gsl::not_null<DataVector*> result,
const Strahlkorper<Frame>& strahlkorper) {
*result = DataVector(strahlkorper.l_max() + 1, 0.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use destructive_resize()

for (size_t l = 0; l <= strahlkorper.l_max(); ++l) {
const double normalization =
2.0 * static_cast<double>(
l < strahlkorper.m_max() ? l : strahlkorper.m_max()) +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this std::min(l, m_max)?

* \param strahlkorper The Strahlkorper surface.
*/
template <typename Frame>
DataVector power_monitor(const Strahlkorper<Frame>& strahlkorper);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please return ModalVector. We should have the DG power monitors also do that. (not sure if we have bound ModalVector in Python yet)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be consistent with what the DG power monitors do right now. So I'd say either leave this as DataVector and switch the power monitor return type in a separate PR, or add a separate commit that does the switch before adding this power monitor. I prefer the former as it's fairly unrelated to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used DataVector for consistency with AMR, so I could potentially reuse AMR functions. I'd rather change mesh and domain power monitors to ModalVector all at once in a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also concerned that ModalVector doesn't support as many math operations as DataVector. Are we sure that we even can change the power monitors for AMR to ModalVectors without just having to convert them back to do whatever operations we do on them? I think we should discuss on a future spectre call

Copy link
Member

@nilsvu nilsvu May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can leave things as DataVector in this PR. It doesn't matter very much, so let's not worry about it too much.

Power monitors are modes, so they should be stored as ModalVector, so they are not confused as data on grid points (that's a DataVector). The math operations are only restricted to avoid the mixing between modal and nodal data.

@geoffrey4444 geoffrey4444 force-pushed the StrahlkorperPowerMonitor branch from 356ee49 to ab64994 Compare May 23, 2025 02:20
@geoffrey4444
Copy link
Contributor Author

Thanks for the review @nilsvu ... I pushed and squashed the two small changes you requested but (as I said above) would prefer to put switching this and the existing AMR power monitors to modal vectors in a different PR

@knelli2 knelli2 merged commit b15e8c7 into sxs-collaboration:develop May 23, 2025
22 of 24 checks passed
@geoffrey4444 geoffrey4444 added this to the Improve horizon finder milestone May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants