Skip to content

Comments

Add sweeper implementation guide without type checking infrastructure#612

Draft
Copilot wants to merge 5 commits intomasterfrom
copilot/expand-api-documentation-sweeper
Draft

Add sweeper implementation guide without type checking infrastructure#612
Copilot wants to merge 5 commits intomasterfrom
copilot/expand-api-documentation-sweeper

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Address PR review comments on sweeper guide

Addressed feedback from @brownbaerchen on the sweeper documentation guide and code docstrings.

Documentation Changes (docs/contrib/08_sweeper_guide.md) ✅

  • Line 30: Changed MIN description from "Minimal correction" to "Diagonal"
  • Line 82: Removed redundant point about CFL conditions
  • Lines 86, 123, 200, 239, 281: Added missing quad_type parameter to examples
  • Line 195: Clarified statement about different preconditioners for components
  • Line 219: Added pointer to datatype_classes.particles for example
  • Line 232-239: Clarified verlet sweeper parameters as preconditioners
  • Line 245: Added QI/QE to verlet example parameters
  • Line 257, 262: Changed "integration matrices" to "preconditioners"
  • Line 284: Added QI/QE and quad_type to boris example parameters
  • Line 309: Removed redundant line about embedded methods
  • Line 331: Fixed maxiter parameter - specified both step and level params
  • Line 389-403: Clarified Multistep usage with num_nodes=1 explanation
  • Line 436: Fixed suggestion for two-component systems (added imex_1st_order)
  • Line 458: Clarified "All SDC sweepers (not RK or Multistep)" support parameters
  • Lines 553-558: Added MIN-SR-S/NS/FLEX with proper descriptions

Code Docstring Changes ✅

  • generic_implicit.py line 9: Changed "integration matrix" to "preconditioner"
  • generic_implicit.py line 13: Removed redundant bullet point
  • generic_implicit.py line 31: Changed "integration matrix" to "preconditioner"
  • explicit.py line 14: Removed redundant line about implicit system solves
  • explicit.py line 35: Changed "integration matrix" to "preconditioner"
  • imex_1st_order.py lines 39-40: Changed "integration matrix" to "preconditioner"

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 7, 2026 16:01
Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com>
Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com>
Copilot AI changed the title [WIP] Expand API documentation for sweeper implementations Add sweeper implementation guide and type checking infrastructure Feb 7, 2026
Copilot AI requested a review from pancetta February 7, 2026 16:12
Copy link
Contributor

@brownbaerchen brownbaerchen left a comment

Choose a reason for hiding this comment

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

Personally, I am not a fan of type hints. In my opinion, they clutter the code and make it less readable. Python and pySDC are about having the code look similar to the equations. I find that type hints are detracting from this.

In particular, I find it inhibiting for newcomers rather than the other way around. With type hints, you need to know what type something has, which may be some class in the code that you are just starting to learn. Without type hints, you can focus on the patch of code you're working with, without understanding the inputs and outputs fully. I know that this is precisely the goal of type hints. Again, I just don't like it. It doesn't help me understand code and I have an easier time coding without.

But I am aware that plenty of people like type hints. So go ahead with this if you want ;)

Unrelated side remark: Less is more.


```toml
[tool.mypy]
python_version = "3.10"
Copy link
Contributor

Choose a reason for hiding this comment

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

why 3.10? This will be out of support next year, I think.

pyproject.toml Outdated

[tool.mypy]
# Start with permissive settings for gradual adoption
python_version = "3.10"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the place where I would like to see version >=3.13. The other page should maybe point here.

@pancetta
Copy link
Member

pancetta commented Feb 9, 2026

I agree. I wanted to see how type hints might look like and I am not happy with what I see. Plus, I don't think this is helping anyone.

Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com>
Copilot AI changed the title Add sweeper implementation guide and type checking infrastructure Add sweeper implementation guide without type checking infrastructure Feb 9, 2026
@pancetta
Copy link
Member

pancetta commented Feb 9, 2026

Got rid of type hinting. Now left with new sweeper doc strings. I don't know why this was mixed up here, most likely a user fault.

@tlunet
Copy link
Member

tlunet commented Feb 9, 2026

If I may ... I think type hints can be useful sometimes to help documentation (like, one argument is supposed to be a sweeper class). But systematically adding those is indeed too much, so I would recommend using it with care : add them from time to time when it effectively improves documentation.

Copy link
Contributor

@brownbaerchen brownbaerchen left a comment

Choose a reason for hiding this comment

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

I am not a huge fan. I understand the problem that the different kinds of sweeps and their implementations are confusing to newcomers. However, this struggles with the classic challenges of documentation.
My main problem is that some statements are vague, some are slightly false, some are a bit misleading.
The other issue is that this may get out of date. I know that pySDC developments is slowing down, but if somebody changes the code, they will probably not update this.
If we want something like this, we should give it another thorough read and fix all the small details and remember that documentation is lying a lot..

- `'IE'`: Implicit Euler
- `'EE'`: Explicit Euler
- `'LU'`: LU decomposition
- `'MIN'`: Minimal correction
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `'MIN'`: Minimal correction
- `'MIN'`: Diagonal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - changed MIN description to "Diagonal"

Comment on lines +43 to +44
- When you want full control over the integration matrix
- As a base for understanding how SDC works
Copy link
Contributor

Choose a reason for hiding this comment

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

is that not true for all of the sweepers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, all sweepers need to implement integrate() and update_nodes(). This section describes the base Sweeper class that all implementations inherit from.

Copy link
Contributor

@brownbaerchen brownbaerchen Feb 9, 2026

Choose a reason for hiding this comment

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

I meant lines 43 and 44 apply to all sweepers

**When to Use**:
- Non-stiff problems where explicit methods are stable
- Fast computations without implicit solves
- Problems where CFL conditions are easily satisfied
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Problems where CFL conditions are easily satisfied

somewhat redundant with the the first point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - removed redundant CFL condition point

Comment on lines 544 to 545
- **MIN**: Minimal correction
- **MIN3**: Minimal correction variant
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- **MIN**: Minimal correction
- **MIN3**: Minimal correction variant
- **MIN-SR-S**: Diagonal, optimized for stiff problems
- **MIN-SR-S**: Diagonal, optimized for non-stiff problems
- **MIN-SR-FLEX**: Diagonal, optimized for stiff problems, coefficients change between iterations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - added MIN-SR-S (stiff), MIN-SR-NS (non-stiff), and MIN-SR-FLEX (stiff with changing coefficients)


**When to use:**
- Non-stiff problems where explicit methods are stable
- Fast computations without implicit system solves
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Fast computations without implicit system solves

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - removed redundant line about implicit system solves

Generic implicit sweeper, expecting lower triangular matrix type as input.

This is the foundational sweeper for standard SDC methods with implicit time integration.
It uses a single lower triangular integration matrix (QI) to update collocation nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
It uses a single lower triangular integration matrix (QI) to update collocation nodes.
It uses a single lower triangular preconditioner (QI) to update collocation nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - changed "integration matrix" to "preconditioner"


**When to use:**
- Standard SDC with implicit time integration
- When you want full control over the integration matrix type
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- When you want full control over the integration matrix type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - removed redundant bullet point about full control

Comment on lines 39 to 41
QI (numpy.ndarray): Implicit Euler integration matrix for implicit terms
QE (numpy.ndarray): Explicit Euler integration matrix for explicit terms
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
QI (numpy.ndarray): Implicit Euler integration matrix for implicit terms
QE (numpy.ndarray): Explicit Euler integration matrix for explicit terms
"""
QI (numpy.ndarray): Preconditioner for implicit terms
QE (numpy.ndarray): Preconditioner for explicit terms
"""

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 9078b16 - changed "integration matrix" to "preconditioner" in attributes

Co-authored-by: brownbaerchen <39156931+brownbaerchen@users.noreply.github.com>
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.

4 participants