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

Method modifyRhsForBcs

src/IB/CIBStaggeredStokesOperator.cpp:320–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318} // deallocateOperatorState
319
320void
321CIBStaggeredStokesOperator::modifyRhsForBcs(Vec y)
322{
323 const double half_time = 0.5 * (d_new_time + d_current_time);
324 Pointer<IBStrategy> ib_method_ops = d_cib_strategy;
325
326 // Get vectors corresponding to fluid and Lagrangian velocity.
327 Vec* vy;
328 VecNestGetSubVecs(y, nullptr, &vy);
329 Pointer<SAMRAIVectorReal<NDIM, double>> vy0;
330 IBTK::PETScSAMRAIVectorReal::getSAMRAIVector(vy[0], &vy0);
331 SAMRAIVectorReal<NDIM, double>& b = *vy0;
332 Vec W = vy[1];
333
334 // Modify RHS for fluid Bcs.
335 modifyRhsForBcs(b);
336
337 // Modify RHS for the action of interpolation operator J on 0.
338 if (!d_homogeneous_bc)
339 {
340 Vec V;
341 VecDuplicate(W, &V);
342 Pointer<SAMRAIVectorReal<NDIM, double>> x = b.cloneVector("");
343 x->allocateVectorData();
344 x->setToScalar(0.0);
345 const int U_idx = x->getComponentDescriptorIndex(0);
346 const int P_idx = x->getComponentDescriptorIndex(1);
347 StaggeredStokesPhysicalBoundaryHelper::setupBcCoefObjects(
348 d_U_bc_coefs, d_P_bc_coef, U_idx, P_idx, d_homogeneous_bc);
349 d_bc_helper->enforceNormalVelocityBoundaryConditions(U_idx, P_idx, d_U_bc_coefs, d_new_time, d_homogeneous_bc);
350 StaggeredStokesPhysicalBoundaryHelper::resetBcCoefObjects(d_U_bc_coefs, d_P_bc_coef);
351
352 using InterpolationTransactionComponent = HierarchyGhostCellInterpolation::InterpolationTransactionComponent;
353 std::vector<InterpolationTransactionComponent> U_transaction_comps(1);
354 U_transaction_comps[0] = InterpolationTransactionComponent(U_idx,
355 d_refine_type,
356 d_use_cf_interpolation,
357 d_coarsen_type,
358 d_bdry_extrap_type,
359 d_consistent_type_2_bdry,
360 d_U_bc_coefs,
361 d_U_fill_pattern,
362 d_bdry_interp_type);
363 Pointer<HierarchyGhostCellInterpolation> U_bdry_fill = new IBTK::HierarchyGhostCellInterpolation();
364 U_bdry_fill->initializeOperatorState(U_transaction_comps, x->getPatchHierarchy());
365 U_bdry_fill->setHomogeneousBc(d_homogeneous_bc);
366 U_bdry_fill->fillData(d_solution_time);
367
368 d_cib_strategy->setInterpolatedVelocityVector(V, half_time);
369 ib_method_ops->interpolateVelocity(U_idx,
370 std::vector<Pointer<CoarsenSchedule<NDIM>>>(),
371 std::vector<Pointer<RefineSchedule<NDIM>>>(),
372 half_time);
373
374 d_cib_strategy->getInterpolatedVelocity(V, half_time, -1.0 * d_scale_interp);
375 VecAXPY(W, -1.0, V);
376
377 // Deallocate scratch data.

Callers 3

solveSystemMethod · 0.45
solveSystemMethod · 0.45

Calls 11

modifyRhsForBcsFunction · 0.85
free_vector_componentsFunction · 0.85
fillDataMethod · 0.80
getPatchHierarchyMethod · 0.45
setHomogeneousBcMethod · 0.45
interpolateVelocityMethod · 0.45

Tested by

no test coverage detected