MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / solve_for_phi

Method solve_for_phi

Source/gravity/Gravity.cpp:395–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395void
396Gravity::solve_for_phi (int level,
397 MultiFab& phi,
398 const Vector<MultiFab*>& grad_phi,
399 int is_new)
400{
401 BL_PROFILE("Gravity::solve_for_phi()");
402
403 if (gravity::verbose > 1) {
404 amrex::Print() << " ... solve for phi at level " << level << std::endl;
405 }
406
407 const Real strt = ParallelDescriptor::second();
408
409 if (is_new == 0) {
410 sanity_check(level);
411 }
412
413 Real time;
414 if (is_new == 1) {
415 time = LevelData[level]->get_state_data(PhiGrav_Type).curTime();
416 } else {
417 time = LevelData[level]->get_state_data(PhiGrav_Type).prevTime();
418 }
419
420 // If we are below the max_solve_level, do the Poisson solve.
421 // Otherwise, interpolate using a fillpatch from max_solve_level.
422
423 if (level <= gravity::max_solve_level) {
424
425 Vector<MultiFab*> phi_p(1, &phi);
426
427 const auto& g_rhs = get_rhs(level, 1, is_new);
428
429 Vector< Vector<MultiFab*> > grad_phi_p(1);
430 grad_phi_p[0].resize(AMREX_SPACEDIM);
431 for (int i = 0; i < AMREX_SPACEDIM ; i++) {
432 grad_phi_p[0][i] = grad_phi[i];
433 }
434
435 Vector<MultiFab*> res_null;
436
437 level_solver_resnorm[level] = solve_phi_with_mlmg(level, level,
438 phi_p,
439 amrex::GetVecOfPtrs(g_rhs),
440 grad_phi_p,
441 res_null,
442 time);
443
444 }
445 else {
446
447 LevelData[level]->FillCoarsePatch(phi, 0, time, PhiGrav_Type, 0, 1, 1);
448
449 }
450
451 if (gravity::verbose)
452 {

Callers 2

construct_old_gravityMethod · 0.80
construct_new_gravityMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected