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

Function ca_derxash

Exec/science/flame_wave/Problem_Derive.cpp:10–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8using namespace amrex;
9
10void ca_derxash(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int /*ncomp*/,
11 const FArrayBox& datfab, const Geometry& /*geomdata*/,
12 Real /*time*/, const int* /*bcrec*/, int /*level*/)
13{
14
15 // determine which species should be considered ash
16
17 std::bitset<NumSpec> is_ash{};
18
19 for (int i = 0; i < NumSpec; ++i) {
20 // include all elements beyond oxygen
21 if (zion[i] > 8.0) {
22 is_ash.set(i);
23 }
24 }
25
26 // exclude all of the "ash" species from the input file; they're actually
27 // used for the star composition and hiding them helps make the flame more
28 // visible
29 for (const std::string& ash_name : {problem::ash1_name,
30 problem::ash2_name,
31 problem::ash3_name}) {
32 int i = network_spec_index(ash_name);
33 if (i != -1) {
34 is_ash.reset(i);
35 }
36 }
37
38 auto const dat = datfab.array();
39 auto const der = derfab.array();
40
41 amrex::ParallelFor(bx,
42 [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
43 {
44 Real sum = 0.0_rt;
45 for (int n = 0; n < NumSpec; ++n) {
46 if (is_ash[n]) {
47 sum += dat(i,j,k,1+n)/dat(i,j,k,0);
48 }
49 }
50 der(i,j,k,0) = sum;
51 });
52}
53

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected