Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ $\|\mathbf{r}\|_2 \le \max(\mathrm{rtol}\,\|\mathbf{b}\|_2, \mathrm{atol})$.
| Parameter | Description |
|-----------|-------------|
| `comm` | `Communicator` used for the global reductions. |
| `fc` | Collection (`GlobalFieldCollection`, `LocalFieldCollection` or `CartesianDecomposition`) on which temporary work fields are created and removed again. |
| `fc` | Collection (`GlobalFieldCollection`, `LocalFieldCollection` or `CartesianDecomposition`) holding the solver's work fields. They stay registered after the solve, so the next solve on the same collection reuses them instead of allocating anew; their names start with `cg-work`. |
| `b` | Right-hand side field. Its dtype sets the working precision. |
| `x` | Initial guess; overwritten with the solution. |
| `hessp` | Callable `hessp(x, Ax)` writing $\mathbf{A}\mathbf{x}$ into `Ax`. |
Expand All @@ -649,6 +649,10 @@ preconditioner is found not to be positive definite, or if a residual becomes
NaN or infinite. With a `float32` right-hand side, an `rtol` below
`muGrid.Solvers.FLOAT32_RTOL_FLOOR` (`1e-6`) triggers a `RuntimeWarning`.

Since the work fields remain in `fc`, a `register_field_collection` of that
collection without `field_names` would write them to the file as well; name
the fields you want written.

### conjugate_gradients_pipelined

```python
Expand Down
9 changes: 6 additions & 3 deletions language_bindings/python/muGrid/Solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,11 @@ def conjugate_gradients(
Communicator for parallel processing.
fc : muGrid.GlobalFieldCollection, muGrid.LocalFieldCollection, or
muGrid.CartesianDecomposition
Collection for creating temporary fields used by the CG algorithm.
They are named ``cg#<call>-<role>`` and removed again on return.
Collection holding the work fields of the CG algorithm. They are
named ``cg-work<depth>-<role>-...`` and stay registered in the
collection after the solve for the next one to reuse; pass
``field_names`` to ``FileIONetCDF.register_field_collection`` to
leave them out of a file.
b : muGrid.Field
Right-hand side vector.
x : muGrid.Field
Expand Down Expand Up @@ -641,7 +644,7 @@ def conjugate_gradients_pipelined(
----------
comm, fc, b, x, hessp, prec, tol, maxiter, timer, rtol, atol
As for :func:`conjugate_gradients`. Work fields are named
``pcg#<call>-<role>``.
``pcg-work<depth>-<role>-...`` and stay in the collection as well.
callback : callable, optional
Called as ``callback(iteration, state_dict)`` at the start of every
iteration, after the reduction completes, with keys "x", "r", "p",
Expand Down
Loading