MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / initializeSolverState

Method initializeSolverState

src/IB/CIBSaddlePointSolver.cpp:475–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473} // solveSystem
474
475void
476CIBSaddlePointSolver::initializeSolverState(Vec x, Vec b)
477{
478 IBTK_TIMER_START(t_initialize_solver_state);
479
480 // Deallocate the solver state if the solver is already initialized.
481 if (d_is_initialized)
482 {
483 d_reinitializing_solver = true;
484 deallocateSolverState();
485 }
486
487 // Create RHS Vec to be used in KSP object
488 VecDuplicate(b, &d_petsc_b);
489
490 // Get components of x and b.
491 Vec *vx, *vb;
492 VecNestGetSubVecs(x, nullptr, &vx);
493 VecNestGetSubVecs(b, nullptr, &vb);
494
495 Pointer<SAMRAIVectorReal<NDIM, double>> vx0, vb0;
496 IBTK::PETScSAMRAIVectorReal::getSAMRAIVectorRead(vx[0], &vx0);
497 IBTK::PETScSAMRAIVectorReal::getSAMRAIVectorRead(vb[0], &vb0);
498 d_hierarchy = vx0->getPatchHierarchy();
499 const int u_data_idx = vx0->getComponentDescriptorIndex(0);
500 const int coarsest_ln = vx0->getCoarsestLevelNumber();
501 const int finest_ln = vx0->getFinestLevelNumber();
502
503 // Initialize various operators and solvers.
504 d_A->initializeOperatorState(*vx0, *vb0);
505 initializeStokesSolver(*vx0, *vb0);
506
507 // Restore the SAMRAI vectors.
508 IBTK::PETScSAMRAIVectorReal::restoreSAMRAIVectorRead(vx[0], &vx0);
509 IBTK::PETScSAMRAIVectorReal::restoreSAMRAIVectorRead(vb[0], &vb0);
510
511 // Initialize the mobility solver.
512 d_mob_solver->initializeSolverState(x, b);
513
514 // Initialize the KSP.
515 initializeKSP();
516
517 // Setup the interpolation transaction information.
518 d_fill_pattern = nullptr;
519 using InterpolationTransactionComponent = IBTK::HierarchyGhostCellInterpolation::InterpolationTransactionComponent;
520 InterpolationTransactionComponent component(u_data_idx,
521 DATA_REFINE_TYPE,
522 USE_CF_INTERPOLATION,
523 DATA_COARSEN_TYPE,
524 BDRY_EXTRAP_TYPE,
525 CONSISTENT_TYPE_2_BDRY,
526 d_u_bc_coefs,
527 d_fill_pattern);
528 d_transaction_comps.push_back(component);
529
530 // Initialize the interpolation operators.
531 d_hier_bdry_fill = new IBTK::HierarchyGhostCellInterpolation();
532 d_hier_bdry_fill->initializeOperatorState(d_transaction_comps, d_hierarchy, coarsest_ln, finest_ln);

Callers 1

Calls 5

getPatchHierarchyMethod · 0.45
getFinestLevelNumberMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected