-
Notifications
You must be signed in to change notification settings - Fork 107
snes: Print a warning if the coloring is non-symmetric. #3159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -377,8 +377,8 @@ int SNESSolver::init() { | |||||
| auto n_cross = (*options)["stencil:cross"] | ||||||
| .doc("Extent of stencil (cross)") | ||||||
| .withDefault<int>(0); | ||||||
| //Set n_taxi 2 if nothing else is set | ||||||
| //Probably a better way to do this | ||||||
| // Set n_taxi 2 if nothing else is set | ||||||
| // Probably a better way to do this | ||||||
| if (n_square == 0 && n_taxi == 0 && n_cross == 0) { | ||||||
| output_info.write("Setting solver:stencil:taxi = 2\n"); | ||||||
| n_taxi = 2; | ||||||
|
|
@@ -485,7 +485,7 @@ int SNESSolver::init() { | |||||
| d_nnz.reserve(nlocal); | ||||||
|
|
||||||
| for (int i = 0; i < nlocal; ++i) { | ||||||
| //Assume all elements in the z direction are potentially coupled | ||||||
| // Assume all elements in the z direction are potentially coupled | ||||||
| d_nnz.emplace_back(d_nnz_map3d[i].size() * mesh->LocalNz | ||||||
| + d_nnz_map2d[i].size()); | ||||||
| o_nnz.emplace_back(o_nnz_map3d[i].size() * mesh->LocalNz | ||||||
|
|
@@ -598,9 +598,22 @@ int SNESSolver::init() { | |||||
| MatAssemblyBegin(Jfd, MAT_FINAL_ASSEMBLY); | ||||||
| MatAssemblyEnd(Jfd, MAT_FINAL_ASSEMBLY); | ||||||
|
|
||||||
| //The above will probably miss some non-zero entries at process boundaries | ||||||
| //Making sure the colouring matrix is symmetric will in some/all(?) | ||||||
| //of the missing non-zeros | ||||||
| { | ||||||
| // Test if the matrix is symmetric | ||||||
| // Values are 0 or 1 so tolerance (1e-5) shouldn't matter | ||||||
| PetscBool symmetric; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'symmetric' is not initialized [cppcoreguidelines-init-variables] PetscBool symmetric;
^ |
||||||
| ierr = MatIsSymmetric(Jfd, 1e-5, &symmetric); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "MatIsSymmetric" is directly included [misc-include-cleaner] ierr = MatIsSymmetric(Jfd, 1e-5, &symmetric); CHKERRQ(ierr);
^ |
||||||
| CHKERRQ(ierr); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: implicit conversion 'PetscBool' -> 'bool' [readability-implicit-bool-conversion]
Suggested change
|
||||||
| if (!symmetric) { | ||||||
| output_warn.write("Jacobian pattern is not symmetric\n"); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // The above can miss entries around the X-point branch cut: | ||||||
| // The diagonal terms are complicated because moving in X then Y | ||||||
| // is different from moving in Y then X at the X-point. | ||||||
| // Making sure the colouring matrix is symmetric does not | ||||||
| // necessarily give the correct stencil but may help. | ||||||
| if ((*options)["force_symmetric_coloring"] | ||||||
| .doc("Modifies coloring matrix to force it to be symmetric") | ||||||
| .withDefault<bool>(false)) { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "PetscBool" is directly included [misc-include-cleaner]
PetscBool symmetric; ^