| 15 | using namespace amrex; |
| 16 | |
| 17 | void Radiation::MGFLD_implicit_update(int level, int iteration, int ncycle) |
| 18 | { |
| 19 | BL_PROFILE("Radiation::MGFLD_implicit_update"); |
| 20 | if (verbose) { |
| 21 | amrex::Print() << "Radiation MGFLD implicit update, level " << level << "..." << std::endl; |
| 22 | } |
| 23 | |
| 24 | BL_ASSERT(Radiation::nGroups > 0); |
| 25 | |
| 26 | int fine_level = parent->finestLevel(); |
| 27 | |
| 28 | // allocation and initialization |
| 29 | Castro *castro = dynamic_cast<Castro*>(&parent->getLevel(level)); |
| 30 | const BoxArray& grids = castro->boxArray(); |
| 31 | const DistributionMapping& dmap = castro->DistributionMap(); |
| 32 | Real delta_t = parent->dtLevel(level); |
| 33 | |
| 34 | int ngrow = 1; |
| 35 | |
| 36 | Real time = castro->get_state_data(Rad_Type).curTime(); |
| 37 | Real oldtime = castro->get_state_data(Rad_Type).prevTime(); |
| 38 | |
| 39 | MultiFab& S_new = castro->get_new_data(State_Type); |
| 40 | FillPatchIterator fpi_new(*castro, S_new, ngrow, time, State_Type, 0, S_new.nComp()); |
| 41 | MultiFab& S_new_border = fpi_new.get_mf(); |
| 42 | |
| 43 | Array<MultiFab, AMREX_SPACEDIM> lambda; |
| 44 | if (radiation::limiter > 0) { |
| 45 | for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { |
| 46 | lambda[idim].define(castro->getEdgeBoxArray(idim), dmap, nGroups, 0); |
| 47 | } |
| 48 | |
| 49 | if (inner_update_limiter == -1) { |
| 50 | MultiFab& Er_lag = castro->get_old_data(Rad_Type); |
| 51 | Er_lag.setBndry(-1.0); |
| 52 | Er_lag.FillBoundary(parent->Geom(level).periodicity()); |
| 53 | |
| 54 | MultiFab& S_old = castro->get_old_data(State_Type); |
| 55 | FillPatchIterator fpi_old(*castro, S_old, ngrow, oldtime, State_Type, 0, S_old.nComp()); |
| 56 | MultiFab& S_lag = fpi_old.get_mf(); |
| 57 | |
| 58 | MultiFab kpr_lag(grids,dmap,nGroups,1); |
| 59 | MGFLD_compute_rosseland(kpr_lag, S_lag); |
| 60 | |
| 61 | for (int igroup=0; igroup<nGroups; ++igroup) { |
| 62 | scaledGradient(level, lambda, kpr_lag, igroup, Er_lag, igroup, 1, igroup); |
| 63 | // lambda now contains scaled gradient |
| 64 | fluxLimiter(level, lambda, igroup); |
| 65 | // lambda now contains flux limiter |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | else { |
| 70 | for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { |
| 71 | lambda[idim].define(castro->getEdgeBoxArray(idim), dmap, 1, 0); |
| 72 | lambda[idim].setVal(1./3.); |
| 73 | } |
| 74 | } |
no test coverage detected