| 1066 | } // computeLagrangianFluidSource |
| 1067 | |
| 1068 | void |
| 1069 | IBMethod::spreadFluidSource(const int q_data_idx, |
| 1070 | RobinPhysBdryPatchStrategy* /*q_phys_bdry_op*/, |
| 1071 | const std::vector<Pointer<RefineSchedule<NDIM>>>& /*q_prolongation_scheds*/, |
| 1072 | const double data_time) |
| 1073 | { |
| 1074 | if (!d_ib_source_fcn) return; |
| 1075 | |
| 1076 | const int coarsest_ln = 0; |
| 1077 | const int finest_ln = d_hierarchy->getFinestLevelNumber(); |
| 1078 | |
| 1079 | // Get the present source locations. |
| 1080 | std::vector<Pointer<LData>>* X_data; |
| 1081 | bool* X_needs_ghost_fill; |
| 1082 | getLECouplingPositionData(&X_data, &X_needs_ghost_fill, data_time); |
| 1083 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 1084 | { |
| 1085 | if (d_n_src[ln] == 0) continue; |
| 1086 | d_ib_source_fcn->getSourceLocations( |
| 1087 | d_X_src[ln], d_r_src[ln], (*X_data)[ln], d_hierarchy, ln, data_time, d_l_data_manager); |
| 1088 | } |
| 1089 | |
| 1090 | // Spread the sources/sinks onto the Cartesian grid. |
| 1091 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 1092 | { |
| 1093 | if (d_n_src[ln] == 0) continue; |
| 1094 | #if !defined(NDEBUG) |
| 1095 | TBOX_ASSERT(ln == d_hierarchy->getFinestLevelNumber()); |
| 1096 | #endif |
| 1097 | Pointer<PatchLevel<NDIM>> level = d_hierarchy->getPatchLevel(ln); |
| 1098 | const IntVector<NDIM>& ratio = level->getRatio(); |
| 1099 | const Pointer<CartesianGridGeometry<NDIM>> grid_geom = level->getGridGeometry(); |
| 1100 | for (PatchLevel<NDIM>::Iterator p(level); p; p++) |
| 1101 | { |
| 1102 | Pointer<Patch<NDIM>> patch = level->getPatch(p()); |
| 1103 | const Box<NDIM>& patch_box = patch->getBox(); |
| 1104 | const hier::Index<NDIM>& patch_lower = patch_box.lower(); |
| 1105 | const Pointer<CartesianPatchGeometry<NDIM>> pgeom = patch->getPatchGeometry(); |
| 1106 | const double* const xLower = pgeom->getXLower(); |
| 1107 | const double* const dx = pgeom->getDx(); |
| 1108 | const Pointer<CellData<NDIM, double>> q_data = patch->getPatchData(q_data_idx); |
| 1109 | for (int n = 0; n < d_n_src[ln]; ++n) |
| 1110 | { |
| 1111 | // The source radius must be an integer multiple of the grid |
| 1112 | // spacing. |
| 1113 | std::array<double, NDIM> r; |
| 1114 | for (unsigned int d = 0; d < NDIM; ++d) |
| 1115 | { |
| 1116 | r[d] = std::max(std::floor(d_r_src[ln][n] / dx[d] + 0.5), 2.0) * dx[d]; |
| 1117 | } |
| 1118 | |
| 1119 | // Determine the approximate source stencil box. |
| 1120 | const hier::Index<NDIM> i_center = IndexUtilities::getCellIndex(d_X_src[ln][n], grid_geom, ratio); |
| 1121 | Box<NDIM> stencil_box(i_center, i_center); |
| 1122 | for (unsigned int d = 0; d < NDIM; ++d) |
| 1123 | { |
| 1124 | stencil_box.grow(d, static_cast<int>(r[d] / dx[d]) + 1); |
| 1125 | } |
no test coverage detected