Skip to content

Conversation

@knelli2
Copy link
Contributor

@knelli2 knelli2 commented Feb 15, 2025

Proposed changes

If a control system is inactive, it doesn't make a ton of sense to have to specify parameters that will never be used. This implements a similar system to the time dependent options for the BCO and Sphere where you can specify None for a control system to disable it. This also decreases the length in input files like BNS which won't use most control systems.

There was no functionality change in how the control system works. This was purely cosmetic.

Upgrade instructions

To turn a control system off in the input file, use

ControlSystems:
  Expansion: None

When keeping a control system active, keep all the same previous options, except remove the IsActive: option. I.e.

ControlSystems:
  Expansion:
    Averager:
      AverageTimescaleFraction: 0.25
      Average0thDeriv: false
    Controller:
      UpdateFraction: 0.03
    TimescaleTuner:
      InitialTimescales: [0.2]
      MinTimescale: 1.0e-2
      MaxTimescale: 10.0
      IncreaseThreshold: 2.5e-4
      DecreaseThreshold: 1.0e-3
      IncreaseFactor: 1.01
      DecreaseFactor: 0.98
    ControlError:

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

@knelli2 knelli2 requested a review from wthrowe February 15, 2025 22:26
[](const auto&... option) {
return Tag::template create_from_options<Metavariables>(option...);
return Tag::template create_from_options<Metavariables>(
get_option(option)...);
Copy link
Member

Choose a reason for hiding this comment

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

I don't like special-casing Auto here. It isn't explicitly converted in the more common option parsing locations, and this should be kept consistent with those.

It is unfortunate that C++ can't figure out to do the implicit conversion in some cases, but I think it is the job of the class requesting an Auto to be able to handle receiving one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this was very unfortunate that it couldn't figure it out. I'll remove this commit and try some other magic in the tags themselves.

DataVector timescale_;
bool timescales_have_been_set_{false};
double initial_timescale_{std::numeric_limits<double>::signaling_NaN()};
double initial_timescale_;
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what this commit is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you default constructed a TimescaleTuner and then compared it with ==, you'd get an FPE because of the signaling NaN.

Copy link
Member

Choose a reason for hiding this comment

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

So now you're comparing uninintialized memory instead?

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'll set it to 0

@knelli2 knelli2 force-pushed the control_sys_input_file branch 2 times, most recently from 59c6ec0 to 51ad0b6 Compare February 18, 2025 01:38
const OptionHolders&... option_holders) {
return create_from_options<Metavariables>(
domain_creator, measurements_per_update, initial_time,
detail::get_option_holder(option_holders)...);
Copy link
Member

Choose a reason for hiding this comment

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

Are these ever going to be anything except Autos? If not, just cast them to optionals, or add a method to Auto to do the cast so you don't have to deal with the template argument.

@knelli2 knelli2 mentioned this pull request Feb 19, 2025
3 tasks
@wthrowe
Copy link
Member

wthrowe commented Feb 19, 2025

Looks good. Squash.

This simplifies the input files that don't use control systems a lot
@knelli2 knelli2 force-pushed the control_sys_input_file branch from 5c92b5f to 35f13a8 Compare February 19, 2025 20:18
@wthrowe wthrowe merged commit cbc7bdf into sxs-collaboration:develop Feb 20, 2025
23 of 24 checks passed
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.

2 participants