| 1223 | } // spreadFluidSource |
| 1224 | |
| 1225 | void |
| 1226 | IBMethod::interpolatePressure(int p_data_idx, |
| 1227 | const std::vector<Pointer<CoarsenSchedule<NDIM>>>& /*p_synch_scheds*/, |
| 1228 | const std::vector<Pointer<RefineSchedule<NDIM>>>& /*p_ghost_fill_scheds*/, |
| 1229 | const double data_time) |
| 1230 | { |
| 1231 | if (!d_ib_source_fcn) return; |
| 1232 | |
| 1233 | const int coarsest_ln = 0; |
| 1234 | const int finest_ln = d_hierarchy->getFinestLevelNumber(); |
| 1235 | |
| 1236 | // Get the present source locations. |
| 1237 | std::vector<Pointer<LData>>* X_data; |
| 1238 | bool* X_needs_ghost_fill; |
| 1239 | getLECouplingPositionData(&X_data, &X_needs_ghost_fill, data_time); |
| 1240 | |
| 1241 | // Compute the normalization pressure (if needed). |
| 1242 | double p_norm = 0.0; |
| 1243 | if (d_normalize_source_strength) |
| 1244 | { |
| 1245 | const int wgt_idx = getHierarchyMathOps()->getCellWeightPatchDescriptorIndex(); |
| 1246 | Pointer<CartesianGridGeometry<NDIM>> grid_geom = d_hierarchy->getGridGeometry(); |
| 1247 | #if !defined(NDEBUG) |
| 1248 | TBOX_ASSERT(grid_geom->getDomainIsSingleBox()); |
| 1249 | #endif |
| 1250 | const Box<NDIM> domain_box = grid_geom->getPhysicalDomain()[0]; |
| 1251 | Box<NDIM> interior_box = domain_box; |
| 1252 | for (unsigned int d = 0; d < NDIM - 1; ++d) |
| 1253 | { |
| 1254 | interior_box.grow(d, -1); |
| 1255 | } |
| 1256 | BoxList<NDIM> bdry_boxes; |
| 1257 | bdry_boxes.removeIntersections(domain_box, interior_box); |
| 1258 | double vol = 0.0; |
| 1259 | for (int ln = coarsest_ln; ln <= finest_ln; ++ln) |
| 1260 | { |
| 1261 | Pointer<PatchLevel<NDIM>> level = d_hierarchy->getPatchLevel(ln); |
| 1262 | BoxList<NDIM> level_bdry_boxes(bdry_boxes); |
| 1263 | level_bdry_boxes.refine(level->getRatio()); |
| 1264 | for (PatchLevel<NDIM>::Iterator p(level); p; p++) |
| 1265 | { |
| 1266 | Pointer<Patch<NDIM>> patch = level->getPatch(p()); |
| 1267 | const Box<NDIM>& patch_box = patch->getBox(); |
| 1268 | const Pointer<CellData<NDIM, double>> p_data = patch->getPatchData(p_data_idx); |
| 1269 | const Pointer<CellData<NDIM, double>> wgt_data = patch->getPatchData(wgt_idx); |
| 1270 | for (BoxList<NDIM>::Iterator blist(level_bdry_boxes); blist; blist++) |
| 1271 | { |
| 1272 | for (Box<NDIM>::Iterator b(blist() * patch_box); b; b++) |
| 1273 | { |
| 1274 | const hier::Index<NDIM>& i = b(); |
| 1275 | p_norm += (*p_data)(i) * (*wgt_data)(i); |
| 1276 | vol += (*wgt_data)(i); |
| 1277 | } |
| 1278 | } |
| 1279 | } |
| 1280 | } |
| 1281 | IBTK_MPI::sumReduction(&p_norm, 1); |
| 1282 | IBTK_MPI::sumReduction(&vol, 1); |
no test coverage detected