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

Method interpolatePressure

src/IB/IBMethod.cpp:1225–1348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1223} // spreadFluidSource
1224
1225void
1226IBMethod::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);

Callers 1

Calls 12

sumReductionFunction · 0.85
fillFunction · 0.85
cos_kernelFunction · 0.85
getPatchLevelMethod · 0.80
setSourcePressuresMethod · 0.80
floorFunction · 0.50
getFinestLevelNumberMethod · 0.45
refineMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected