| 502 | } |
| 503 | |
| 504 | void RadSolve::levelRhs(int level, MultiFab& rhs, |
| 505 | MultiFab& temp, |
| 506 | MultiFab& fkp, MultiFab& eta, MultiFab& etainv, |
| 507 | MultiFab& rhoem, MultiFab& rhoes, |
| 508 | MultiFab& dflux_old, MultiFab& Er_old, MultiFab& Edot, |
| 509 | Real delta_t, Real sigma, Real c, Real theta, |
| 510 | FluxRegister* fine_corr, Real scale, |
| 511 | int igroup, Real nu, Real dnu) |
| 512 | { |
| 513 | BL_PROFILE("RadSolve::levelRhs"); |
| 514 | BL_ASSERT(rhs.nGrow() == 0); |
| 515 | |
| 516 | const Geometry& geom = parent->Geom(level); |
| 517 | auto geomdata = geom.data(); |
| 518 | |
| 519 | rhs.setVal(0.0); |
| 520 | if (fine_corr) { |
| 521 | // This works trivially for a multilevel solve since the finer level is |
| 522 | // present in the rhs to overwrite the junk produced under it. |
| 523 | // In a single-level version we have to be sure that fine_corr |
| 524 | // has been cleaned up using ClearInternalBorders. |
| 525 | |
| 526 | // Hack: For the single group case igroup defaults to -1, which is |
| 527 | // significant later in this routine. So we have to construct the |
| 528 | // correct component number here: |
| 529 | |
| 530 | int igrouptmp = (igroup < 0) ? 0 : igroup; |
| 531 | |
| 532 | fine_corr->Reflux(rhs, scale, igrouptmp, 0, 1, parent->Geom(level)); |
| 533 | } |
| 534 | |
| 535 | #ifdef _OPENMP |
| 536 | #pragma omp parallel |
| 537 | #endif |
| 538 | for (MFIter mfi(rhs, TilingIfNotGPU()); mfi.isValid(); ++mfi) { |
| 539 | const Box& bx = mfi.tilebox(); |
| 540 | |
| 541 | auto rhs_arr = rhs[mfi].array(); |
| 542 | auto temp_arr = temp[mfi].array(); |
| 543 | auto fkp_arr = fkp[mfi].array(); |
| 544 | auto eta_arr = eta[mfi].array(); |
| 545 | auto etainv_arr = etainv[mfi].array(); |
| 546 | auto rhoem_arr = rhoem[mfi].array(); |
| 547 | auto rhoes_arr = rhoes[mfi].array(); |
| 548 | auto dflux_old_arr = dflux_old[mfi].array(); |
| 549 | auto Er_old_arr = Er_old[mfi].array(0); |
| 550 | auto Edot_arr = Edot[mfi].array(); |
| 551 | |
| 552 | const Real dtm = 1.0_rt / delta_t; |
| 553 | |
| 554 | amrex::ParallelFor(bx, |
| 555 | [=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) |
| 556 | { |
| 557 | Real ek = fkp_arr(i,j,k) * eta_arr(i,j,k); |
| 558 | Real bs = etainv_arr(i,j,k) * 4.e0_rt * sigma * fkp_arr(i,j,k) * std::pow(temp_arr(i,j,k), 4); |
| 559 | Real es = eta_arr(i,j,k) * (rhoem_arr(i,j,k) - rhoes_arr(i,j,k)); |
| 560 | Real ekt = (1.0_rt - theta) * eta_arr(i,j,k); |
| 561 |
no test coverage detected