| 585 | } // getFromInput |
| 586 | |
| 587 | void |
| 588 | KrylovMobilitySolver::initializeStokesSolver(const SAMRAIVectorReal<NDIM, double>& sol_vec, |
| 589 | const SAMRAIVectorReal<NDIM, double>& rhs_vec) |
| 590 | { |
| 591 | Pointer<PatchHierarchy<NDIM>> patch_hier = sol_vec.getPatchHierarchy(); |
| 592 | const int coarsest_ln = sol_vec.getCoarsestLevelNumber(); |
| 593 | const int finest_ln = sol_vec.getFinestLevelNumber(); |
| 594 | |
| 595 | // Set the nullspace of the LInv and subdomain solvers |
| 596 | const double rho = d_ins_integrator->getStokesSpecifications()->getRho(); |
| 597 | const bool has_velocity_nullspace = d_normalize_velocity && IBTK::abs_equal_eps(rho, 0.0); |
| 598 | const bool has_pressure_nullspace = d_normalize_pressure; |
| 599 | |
| 600 | for (const auto& nul_vec : d_nul_vecs) |
| 601 | { |
| 602 | if (nul_vec) free_vector_components(*nul_vec); |
| 603 | } |
| 604 | const int n_nul_vecs = (has_pressure_nullspace ? 1 : 0) + (has_velocity_nullspace ? NDIM : 0); |
| 605 | d_nul_vecs.resize(n_nul_vecs); |
| 606 | |
| 607 | for (const auto& U_nul_vec : d_U_nul_vecs) |
| 608 | { |
| 609 | if (U_nul_vec) free_vector_components(*U_nul_vec); |
| 610 | } |
| 611 | const int n_U_nul_vecs = (has_velocity_nullspace ? NDIM : 0); |
| 612 | d_U_nul_vecs.resize(n_U_nul_vecs); |
| 613 | |
| 614 | if (has_velocity_nullspace) |
| 615 | { |
| 616 | for (unsigned int k = 0; k < NDIM; ++k) |
| 617 | { |
| 618 | d_nul_vecs[k] = sol_vec.cloneVector(d_object_name + "::nul_vec_U_" + std::to_string(k)); |
| 619 | d_nul_vecs[k]->allocateVectorData(d_current_time); |
| 620 | d_nul_vecs[k]->setToScalar(0.0); |
| 621 | |
| 622 | SAMRAIVectorReal<NDIM, double> svr_u( |
| 623 | d_object_name + "::U_nul_vec_U_" + std::to_string(k), patch_hier, coarsest_ln, finest_ln); |
| 624 | svr_u.addComponent(sol_vec.getComponentVariable(0), |
| 625 | sol_vec.getComponentDescriptorIndex(0), |
| 626 | sol_vec.getControlVolumeIndex(0)); |
| 627 | |
| 628 | d_U_nul_vecs[k] = svr_u.cloneVector(svr_u.getName()); |
| 629 | d_U_nul_vecs[k]->allocateVectorData(d_current_time); |
| 630 | d_U_nul_vecs[k]->setToScalar(0.0); |
| 631 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 632 | { |
| 633 | Pointer<PatchLevel<NDIM>> level = patch_hier->getPatchLevel(ln); |
| 634 | for (PatchLevel<NDIM>::Iterator p(level); p; p++) |
| 635 | { |
| 636 | Pointer<Patch<NDIM>> patch = level->getPatch(p()); |
| 637 | Pointer<SideData<NDIM, double>> nul_data = |
| 638 | patch->getPatchData(d_nul_vecs[k]->getComponentDescriptorIndex(0)); |
| 639 | nul_data->getArrayData(k).fillAll(1.0); |
| 640 | Pointer<SideData<NDIM, double>> U_nul_data = |
| 641 | patch->getPatchData(d_U_nul_vecs[k]->getComponentDescriptorIndex(0)); |
| 642 | U_nul_data->getArrayData(k).fillAll(1.0); |
| 643 | } |
| 644 | } |
nothing calls this directly
no test coverage detected