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

Method smoothError

src/IB/StaggeredStokesIBLevelRelaxationFACOperator.cpp:344–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342} // computeResidual
343
344void
345StaggeredStokesIBLevelRelaxationFACOperator::smoothError(SAMRAIVectorReal<NDIM, double>& error,
346 const SAMRAIVectorReal<NDIM, double>& residual,
347 int level_num,
348 int num_sweeps,
349 bool /*performing_pre_sweeps*/,
350 bool /*performing_post_sweeps*/)
351{
352 if (num_sweeps == 0) return;
353
354 Pointer<PatchLevel<NDIM>> level = d_hierarchy->getPatchLevel(level_num);
355 const int U_error_idx = error.getComponentDescriptorIndex(0);
356 const int P_error_idx = error.getComponentDescriptorIndex(1);
357 const int U_scratch_idx = d_side_scratch_idx;
358 const int P_scratch_idx = d_cell_scratch_idx;
359
360 Pointer<SAMRAIVectorReal<NDIM, double>> e_level = getLevelSAMRAIVectorReal(error, level_num);
361 Pointer<SAMRAIVectorReal<NDIM, double>> r_level = getLevelSAMRAIVectorReal(residual, level_num);
362
363 // Cache coarse-fine interface ghost cell values in the "scratch" data.
364 if (level_num > d_coarsest_ln && num_sweeps > 1)
365 {
366 int patch_counter = 0;
367 for (PatchLevel<NDIM>::Iterator p(level); p; p++, ++patch_counter)
368 {
369 Pointer<Patch<NDIM>> patch = level->getPatch(p());
370
371 Pointer<SideData<NDIM, double>> U_error_data = error.getComponentPatchData(0, *patch);
372 Pointer<SideData<NDIM, double>> U_scratch_data = patch->getPatchData(U_scratch_idx);
373#if !defined(NDEBUG)
374 const Box<NDIM>& U_ghost_box = U_error_data->getGhostBox();
375 TBOX_ASSERT(U_ghost_box == U_scratch_data->getGhostBox());
376 TBOX_ASSERT(U_error_data->getGhostCellWidth() == SIDEG);
377 TBOX_ASSERT(U_scratch_data->getGhostCellWidth() == SIDEG);
378#endif
379 for (unsigned int axis = 0; axis < NDIM; ++axis)
380 {
381 U_scratch_data->getArrayData(axis).copy(U_error_data->getArrayData(axis),
382 d_patch_side_bc_box_overlap[level_num][patch_counter][axis],
383 IntVector<NDIM>(0));
384 }
385
386 Pointer<CellData<NDIM, double>> P_error_data = error.getComponentPatchData(1, *patch);
387 Pointer<CellData<NDIM, double>> P_scratch_data = patch->getPatchData(P_scratch_idx);
388#if !defined(NDEBUG)
389 const Box<NDIM>& P_ghost_box = P_error_data->getGhostBox();
390 TBOX_ASSERT(P_ghost_box == P_scratch_data->getGhostBox());
391 TBOX_ASSERT(P_error_data->getGhostCellWidth() == CELLG);
392 TBOX_ASSERT(P_scratch_data->getGhostCellWidth() == CELLG);
393#endif
394 P_scratch_data->getArrayData().copy(P_error_data->getArrayData(),
395 d_patch_cell_bc_box_overlap[level_num][patch_counter],
396 IntVector<NDIM>(0));
397 }
398 }
399
400 // Smooth the error by the specified number of sweeps.
401 for (int isweep = 0; isweep < num_sweeps; ++isweep)

Callers

nothing calls this directly

Calls 9

getPatchLevelMethod · 0.80
copyMethod · 0.45
setPatchDataIndexMethod · 0.45
setSolutionTimeMethod · 0.45
setTimeIntervalMethod · 0.45
solveSystemMethod · 0.45

Tested by

no test coverage detected