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

Method construct_old_react_source

Source/sdc/Castro_sdc.cpp:296–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294
295#ifdef REACTIONS
296void
297Castro::construct_old_react_source(MultiFab& U_state,
298 MultiFab& R_source,
299 const bool input_is_average)
300{
301
302 // note: there is a side effect here. If we are fourth-order and
303 // coming in with input_is_average = true, then we make a backup
304 // of R_source when it is on cell-centers and store it in Sburn.
305
306 BL_PROFILE("Castro::construct_old_react_source()");
307
308 auto domain_lo = geom.Domain().loVect3d();
309 auto domain_hi = geom.Domain().hiVect3d();
310
311 if (sdc_order == 4 && input_is_average)
312 {
313 // we have cell-averages
314 // Note: we cannot tile these operations
315
316 FArrayBox U_center(The_Async_Arena());
317 FArrayBox R_center(The_Async_Arena());
318 FArrayBox tmp(The_Async_Arena());
319
320 for (MFIter mfi(U_state); mfi.isValid(); ++mfi)
321 {
322
323 const Box& bx = mfi.tilebox();
324 const Box& obx = mfi.growntilebox(1);
325
326 // Convert to centers
327 U_center.resize(obx, NUM_STATE);
328 auto const U_center_arr = U_center.array();
329
330 make_cell_center(obx, U_state.array(mfi), U_center_arr, domain_lo, domain_hi);
331
332 // sometimes the Laplacian can make the species go
333 // negative near discontinuities
334 amrex::ParallelFor(obx,
335 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
336 {
337 normalize_species_sdc(i, j, k, U_center_arr);
338 });
339
340 // burn, including one ghost cell
341 R_center.resize(obx, NUM_STATE);
342 auto const R_center_arr = R_center.array();
343
344 amrex::ParallelFor(obx,
345 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
346 {
347 instantaneous_react(i, j, k, U_center_arr, R_center_arr);
348 });
349
350 // at this point, we have the reaction term on centers,
351 // including a ghost cell. Save this into Sburn so we can
352 // use it later for the plotfile filling
353 Sburn[mfi].copy(R_center, obx, 0, obx, 0, NUM_STATE);

Callers

nothing calls this directly

Calls 3

normalize_species_sdcFunction · 0.85
instantaneous_reactFunction · 0.85
isValidMethod · 0.80

Tested by

no test coverage detected