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

Method levelSPas

Source/radiation/RadSolve.cpp:245–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245void RadSolve::levelSPas(int level, Array<MultiFab, AMREX_SPACEDIM>& lambda, int igroup,
246 int lo_bc[3], int hi_bc[3])
247{
248 const BoxArray& grids = parent->boxArray(level);
249 const DistributionMapping& dmap = parent->DistributionMap(level);
250 const Geometry& geom = parent->Geom(level);
251 const Box& domainBox = geom.Domain();
252
253 MultiFab spa(grids, dmap, 1, 0);
254#ifdef _OPENMP
255#pragma omp parallel
256#endif
257 for (MFIter mfi(spa,true); mfi.isValid(); ++mfi) {
258 const Box& reg = mfi.tilebox();
259
260 spa[mfi].setVal<RunOn::Host>(1.e210,reg,0);
261
262 bool nexttoboundary=false;
263 for (int idim=0; idim<AMREX_SPACEDIM; idim++) {
264 if (lo_bc[idim] == AMREX_LO_SANCHEZ_POMRANING &&
265 reg.smallEnd(idim) == domainBox.smallEnd(idim)) {
266 nexttoboundary=true;
267 break;
268 }
269 if (hi_bc[idim] == AMREX_LO_SANCHEZ_POMRANING &&
270 reg.bigEnd(idim) == domainBox.bigEnd(idim)) {
271 nexttoboundary=true;
272 break;
273 }
274 }
275
276 if (nexttoboundary) {
277 auto spa_arr = spa[mfi].array();
278
279 auto lmx = lambda[0][mfi].array();
280#if AMREX_SPACEDIM >= 2
281 auto lmy = lambda[1][mfi].array();
282#endif
283#if AMREX_SPACEDIM == 3
284 auto lmz = lambda[2][mfi].array();
285#endif
286
287 amrex::ParallelFor(reg,
288 [=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
289 {
290 Real lam;
291
292 if (i == reg.loVect()[0] || i == reg.hiVect()[0] ||
293 j == reg.loVect()[1] || j == reg.hiVect()[1] ||
294 k == reg.hiVect()[2] || k == reg.hiVect()[2]) {
295#if AMREX_SPACEDIM == 1
296 if (i == reg.loVect()[0]) {
297 lam = lmx(i,j,k,igroup);
298 }
299 else {
300 lam = lmx(i+1,j,k,igroup);
301 }
302#elif AMREX_SPACEDIM == 2

Callers 2

single_group_updateMethod · 0.80
MGFLD_implicit_updateMethod · 0.80

Calls 3

FLDalphaFunction · 0.85
isValidMethod · 0.80
SPalphaMethod · 0.45

Tested by

no test coverage detected