Skip to content

Feature: Add absolute tolerance (AbsTol) configuration for linear solver#734

Open
jpsimas wants to merge 8 commits into
awslabs:mainfrom
jpsimas:feature/add-linear-abstol
Open

Feature: Add absolute tolerance (AbsTol) configuration for linear solver#734
jpsimas wants to merge 8 commits into
awslabs:mainfrom
jpsimas:feature/add-linear-abstol

Conversation

@jpsimas

@jpsimas jpsimas commented May 18, 2026

Copy link
Copy Markdown

No description provided.

@hughcars hughcars left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @jpsimas,

Thank you for the submission, two minor things. I'm also interested in why you needed this tolerance setting? What were you doing that a tighter "Tol", aka RelTol, was insufficient?

Comment thread palace/linalg/ksp.cpp Outdated
}
ksp->SetInitialGuess(linear.initial_guess);
ksp->SetRelTol(linear.tol);
ksp->SetAbsTol(iodata.solver.linear.abs_tol);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This needs to be linear.abs_tol, in the inner constructors we no longer pass the whole of IoData through.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sorry! I was working with 0.16 and didnt see that got changed. how do I fix this, should I do another pull request?

Comment on lines 23 to +24
"Tol": { "type": "number", "minimum": 0.0 },
"AbsTol": { "type": "number", "minimum": 0.0 },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This slightly suggests changing the previous to "RelTol", which would be a breaking change. We could introduce it as an alias for the time being and then mark deprecated.

@jpsimas

jpsimas commented May 19, 2026

Copy link
Copy Markdown
Author

Hi @jpsimas,

Thank you for the submission, two minor things. I'm also interested in why you needed this tolerance setting? What were you doing that a tighter "Tol", aka RelTol, was insufficient?

Yes, when running some simulations with a particular tricky antenna geometry, the initial absolute residue sometimes gets really high, so I find myself needing to do I dry run to see what is the initial absolute residual to tune the relative tolerance so the simulation stops at a low-enough residue value. This is relatively ok, until you get to AMR runs where the initial residue can value a lot between iterations. Setting the absolute tolerance to some fixed value like 1e-3 makes it a lot easier to run this type of automated runs unattended without having to worry that the initial absolute residual jumped up and ended up generating bad results

@hughcars

Copy link
Copy Markdown
Collaborator

Hi @jpsimas,
Thank you for the submission, two minor things. I'm also interested in why you needed this tolerance setting? What were you doing that a tighter "Tol", aka RelTol, was insufficient?

Yes, when running some simulations with a particular tricky antenna geometry, the initial absolute residue sometimes gets really high, so I find myself needing to do I dry run to see what is the initial absolute residual to tune the relative tolerance so the simulation stops at a low-enough residue value. This is relatively ok, until you get to AMR runs where the initial residue can value a lot between iterations. Setting the absolute tolerance to some fixed value like 1e-3 makes it a lot easier to run this type of automated runs unattended without having to worry that the initial absolute residual jumped up and ended up generating bad results

Ok, sounds reasonable. You need to also add an entry to the documentation for the new config entry.

jpsimas and others added 5 commits June 22, 2026 19:23
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
@jpsimas

jpsimas commented Jun 22, 2026

Copy link
Copy Markdown
Author

@hughcars – I've addressed the review comments. Summary of changes:

• palace/linalg/ksp.cpp : Changed iodata.solver.linear.abs_tol → linear.abs_tol as requested.
• palace/utils/configfile.cpp : Added backward‑compatible "RelTol" alias: if "RelTol" is present it takes precedence
over the deprecated "Tol".
• palace/utils/configfile.hpp : Added double abs_tol = 1.0e-50; member to LinearSolverData.
• scripts/schema/config/solver.json : Added "RelTol" and "AbsTol" under "Linear"; marked "Tol" as deprecated.
• docs/src/config/solver.md : Added documentation for "RelTol" and "AbsTol" under the solver["Linear"] section.

Please let me know if any further changes are needed. Thanks!

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