Skip to content

WIP: Calculate Jacobian coloring using PetscOperator matrices#3350

Open
bendudson wants to merge 5 commits intopetsc-operatorsfrom
petsc-operators-snes
Open

WIP: Calculate Jacobian coloring using PetscOperator matrices#3350
bendudson wants to merge 5 commits intopetsc-operatorsfrom
petsc-operators-snes

Conversation

@bendudson
Copy link
Copy Markdown
Contributor

Builds on #3330 , using PetscOperator matrices to infer connectivity between cells.

The aim is to accelerate transport simulations with FCI by inferring the sparsity pattern of the Jacobian in SNESSolver and PetscSolver. This will enable coloring to efficiently calculate finite difference Jacobian approximations for LU-like preconditioners. This is the method used for structured grid (e.g. Tokamak) simulations, that so far has not been possible with FCI.

This function should create an index set of the evolving cells.
It will be used to extract the part of the PetscOperator that
represents coupling between evolving cells.

Implementation to follow.
Creates an index set of global PETSc rows that correspond
to evolving cells.

Passes unit tests.
Method that will extract the part of a PetscCellOperator that
couples evolving cells to other evolving cells.

Dummy implementation with failing tests.
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

// Collect global PETSc indices in mapOwnedInteriorCells order.
// Reserve the known count up front to avoid reallocation.
std::vector<PetscInt> indices;
indices.reserve(static_cast<std::size_t>(evolving_region.size()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: no header providing "std::size_t" is directly included [misc-include-cleaner]

src/mesh/petsc_operators.cxx:1:

+ #include <cstddef>

mapOwnedInteriorCells(
[&](PetscInt row, const Ind3D& /*i*/, int /*stored*/) { indices.push_back(row); });

IS is;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: variable 'is' is not initialized [cppcoreguidelines-init-variables]

Suggested change
IS is;
IS is = nullptr;

const PetscOperator<CellSpaceTag, CellSpaceTag>& op) const {
IS is = makeEvolvingIS();

Mat sub;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: variable 'sub' is not initialized [cppcoreguidelines-init-variables]

Suggested change
Mat sub;
Mat sub = nullptr;

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.

1 participant