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

Function ca_derpi

Exec/reacting_tests/reacting_bubble/Problem_Derive.cpp:9–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace amrex;
8
9void ca_derpi(const Box& bx, FArrayBox& derfab, int dcomp, int /*ncomp*/,
10 const FArrayBox& datfab, const Geometry& geomdata,
11 Real /*time*/, const int* /*bcrec*/, int /*level*/)
12{
13
14 // derive the dynamic pressure
15
16 const auto dx = geomdata.CellSizeArray();
17 const auto problo = geomdata.ProbLoArray();
18
19 auto const dat = datfab.array();
20 auto const der = derfab.array();
21
22 amrex::ParallelFor(bx,
23 [=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
24 {
25
26 Real x = problo[0] + dx[0] * (static_cast<Real>(i) + 0.5_rt);
27
28 Real y = 0.0;
29#if AMREX_SPACEDIM >= 2
30 y = problo[1] + dx[1] * (static_cast<Real>(j) + 0.5_rt);
31#endif
32
33 Real z = 0.0;
34#if AMREX_SPACEDIM == 3
35 z = problo[2] + dx[2] * (static_cast<Real>(k) + 0.5_rt);
36#endif
37
38#if AMREX_SPACEDIM == 2
39 Real height = y;
40#else
41 Real height = z;
42#endif
43
44 Real pres = interpolate(height, model::ipres);
45
46 eos_t eos_state;
47
48 eos_state.rho = dat(i,j,k,URHO);
49 eos_state.T = dat(i,j,k,UTEMP);
50 eos_state.e = dat(i,j,k,UEINT) / dat(i,j,k,URHO);
51 for (int n = 0; n < NumSpec; n++) {
52 eos_state.xn[n] = dat(i,j,k,UFS+n) / dat(i,j,k,URHO);
53 }
54#if NAUX_NET > 0
55 for (int n = 0; n < NumAux; n++) {
56 eos_state.aux[n] = dat(i,j,k,UFX+n) / dat(i,j,k,URHO);
57 }
58#endif
59
60 eos(eos_input_rt, eos_state);
61 der(i,j,k,0) = eos_state.p - pres;
62
63 });
64
65}
66

Callers

nothing calls this directly

Calls 1

interpolateFunction · 0.85

Tested by

no test coverage detected