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

Function deranalytic

Exec/unit_tests/diffusion_test/Problem_Derive.cpp:11–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11void deranalytic(const Box& bx, FArrayBox& derfab, int /*dcomp*/, int /*ncomp*/,
12 const FArrayBox& /*datfab*/, const Geometry& geomdata,
13 Real time, const int* /*bcrec*/, int /*level*/)
14{
15
16 const auto dx = geomdata.CellSizeArray();
17 const auto problo = geomdata.ProbLoArray();
18
19 const int coord_type = geomdata.Coord();
20
21 auto const der = derfab.array();
22
23 amrex::ParallelFor(bx,
24 [=] AMREX_GPU_HOST_DEVICE (int i, int j, int k)
25 {
26 Real r[3] = {0.0_rt};
27 r[0] = problo[0] + dx[0] * (static_cast<Real>(i) + 0.5_rt);
28#if AMREX_SPACEDIM >= 2
29 r[1] = problo[1] + dx[1] * (static_cast<Real>(j) + 0.5_rt);
30#endif
31#if AMREX_SPACEDIM == 3
32 r[2] = problo[2] + dx[2] * (static_cast<Real>(k) + 0.5_rt);
33#endif
34 if (coord_type <= 1) {
35 for (int n = 0; n < AMREX_SPACEDIM; ++n) {
36 r[n] -= problem::center[n];
37 }
38 }
39
40 der(i,j,k,0) = analytic(r, time, coord_type);
41
42 });
43
44}

Callers

nothing calls this directly

Calls 1

analyticFunction · 0.85

Tested by

no test coverage detected