Skip to content

Commit

Permalink
swarm - use diagonal assembly in BPSSwarm
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Apr 26, 2024
1 parent fb133d4 commit 9c67464
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions examples/petsc/bpsswarm.c
Expand Up @@ -209,6 +209,7 @@ int main(int argc, char **argv) {
PetscCall(MatCreateShell(comm, l_size, l_size, g_size, g_size, op_apply_ctx, &mat_O));
PetscCall(MatSetDM(mat_O, dm_mesh));
PetscCall(MatShellSetOperation(mat_O, MATOP_MULT, (void (*)(void))MatMult_Ceed));
PetscCall(MatShellSetOperation(mat_O, MATOP_GET_DIAGONAL, (void (*)(void))MatGetDiag));

// Set up libCEED
CeedInit(ceed_resource, &ceed);
Expand Down Expand Up @@ -302,14 +303,9 @@ int main(int argc, char **argv) {
PetscCall(KSPGetPC(ksp, &pc));
if (bp_choice == CEED_BP1 || bp_choice == CEED_BP2) {
PetscCall(PCSetType(pc, PCJACOBI));
PetscCall(PCJacobiSetType(pc, PC_JACOBI_ROWSUM));
PetscCall(PCJacobiSetType(pc, PC_JACOBI_DIAGONAL));
} else {
PetscCall(PCSetType(pc, PCNONE));
MatNullSpace nullspace;

PetscCall(MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, 0, &nullspace));
PetscCall(MatSetNullSpace(mat_O, nullspace));
PetscCall(MatNullSpaceDestroy(&nullspace));
}
PetscCall(KSPSetType(ksp, KSPCG));
PetscCall(KSPSetNormType(ksp, KSP_NORM_NATURAL));
Expand Down

0 comments on commit 9c67464

Please sign in to comment.