| 14 | using namespace amrex; |
| 15 | |
| 16 | void Radiation::single_group_update(int level, int iteration, int ncycle) |
| 17 | { |
| 18 | BL_PROFILE("Radiation::single_group_update"); |
| 19 | if (verbose && ParallelDescriptor::IOProcessor()) { |
| 20 | std::cout << "Radiation implicit update, level " << level << "..." << std::endl; |
| 21 | } |
| 22 | |
| 23 | bool has_dcoefs = (Radiation::SolverType == Radiation::SGFLDSolver && |
| 24 | Radiation::Er_Lorentz_term); |
| 25 | |
| 26 | int group = 0; |
| 27 | int fine_level = parent->finestLevel(); |
| 28 | |
| 29 | // Allocation and initialization: |
| 30 | |
| 31 | Castro *castro = dynamic_cast<Castro*>(&parent->getLevel(level)); |
| 32 | const BoxArray& grids = castro->boxArray(); |
| 33 | const DistributionMapping& dmap = castro->DistributionMap(); |
| 34 | Real delta_t = parent->dtLevel(level); |
| 35 | Real time = castro->get_state_data(Rad_Type).curTime(); |
| 36 | |
| 37 | MultiFab& S_new = castro->get_new_data(State_Type); |
| 38 | MultiFab& Er_new = castro->get_new_data(Rad_Type); |
| 39 | |
| 40 | MultiFab Er_old(grids, dmap, Er_new.nComp(), Er_new.nGrow()); |
| 41 | MultiFab::Copy(Er_old, Er_new, 0, 0, Er_new.nComp(), 0); |
| 42 | |
| 43 | Array<MultiFab, AMREX_SPACEDIM> Ff_new; |
| 44 | |
| 45 | for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { |
| 46 | Ff_new[idim].define(castro->getEdgeBoxArray(idim), dmap, 1, 0); |
| 47 | } |
| 48 | |
| 49 | MultiFab Dterm; |
| 50 | if (has_dcoefs) { |
| 51 | Dterm.define(grids, dmap, AMREX_SPACEDIM, 0); |
| 52 | } |
| 53 | |
| 54 | MultiFab frhoem(grids,dmap,1,0); |
| 55 | MultiFab frhoes(grids,dmap,1,0); |
| 56 | |
| 57 | MultiFab temp(grids,dmap,1,0); |
| 58 | MultiFab fkp(grids,dmap,1,0); |
| 59 | |
| 60 | MultiFab& dflux_old = *dflux[level]; |
| 61 | MultiFab dflux_new(grids,dmap,1,0); |
| 62 | |
| 63 | MultiFab Er_lim; // will only be allocated if needed |
| 64 | |
| 65 | #ifdef _OPENMP |
| 66 | #pragma omp parallel |
| 67 | #endif |
| 68 | for (MFIter mfi(frhoem,true); mfi.isValid(); ++mfi) { |
| 69 | const Box& reg = mfi.tilebox(); |
| 70 | |
| 71 | auto frhoem_arr = frhoem[mfi].array(); |
| 72 | auto S_new_arr = S_new[mfi].array(); |
| 73 |
no test coverage detected