Skip to content

Fixed Step IDA#332

Draft
Steven-Roberts wants to merge 23 commits intodevelopfrom
fixed-step-IDA
Draft

Fixed Step IDA#332
Steven-Roberts wants to merge 23 commits intodevelopfrom
fixed-step-IDA

Conversation

@Steven-Roberts
Copy link
Collaborator

@Steven-Roberts Steven-Roberts commented Jan 9, 2026

Description

Adds option to run IDA with fixed time steps

Closes #326

Proposed changes

Adds dt argument to IDA constructor. If nonzero, that fixed time step will be used, otherwise the time step is adaptive.

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

Any preference on passing dt via constructor versus getter/setter @pelesh? Whatever we decide for dt I can do for tolerances and max steps too.

@Steven-Roberts
Copy link
Collaborator Author

Relative tolerances are now specified by IDA::setTolerance (and IDA::setBackwardTolerance), and absolute tolerances are specified by each Evaluator instance similar using an approach similar to tagging of differential vs algebraic variables. Currently, I have all the abs tols defaulted to 0. If this approach looks ok, I will need some help with determining reasonable defaults for each Evaluator subclass @pelesh.

Comment on lines +332 to +333
idas->setTolerance(rel_tol);
idas->setMaxSteps(SCALE_MICROGRID_MAX_STEPS);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not provide option to set global absolute tolerance?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to other instances in the code.

Comment on lines 146 to 150
template <class ScalarT, typename IdxT>
int Branch<ScalarT, IdxT>::setAbsoluteTolerance()
{
return 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to provide an instance of setting absolute tolerances. My suggestion would be to have nominal values for variables defined in each component model and then absolute tolerance computed as abs_tol[i] = rel_tol*y_nominal[i].

There should be an option to set global absolute tolerance directly in the solver circumventing component local settings imho.

Comment on lines +61 to 64
const std::vector<ScalarT>& absoluteTolerance() const override
{
msa = max_steps_;
return abs_tol_;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if component does not set its absolute values?

My suggestion would be to return default abs_tol_[i] == rel_tol, i.e. assuming that the nominal value of the variable is ~1.

@pelesh
Copy link
Collaborator

pelesh commented Feb 17, 2026

Any preference on passing dt via constructor versus getter/setter @pelesh? Whatever we decide for dt I can do for tolerances and max steps too.

I am in favor of getter/setters.

@pelesh
Copy link
Collaborator

pelesh commented Feb 17, 2026

Currently, I have all the abs tols defaulted to 0. If this approach looks ok, I will need some help with determining reasonable defaults for each Evaluator subclass @pelesh.

I would suggest abs_tol to default to rel_tol or 0.1*rel_tol.

@pelesh pelesh added the enhancement New feature or request label Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDA Fixed Time Step Support

2 participants