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

Method flame_width_properties

Exec/science/flame/Prob.cpp:7–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace amrex;
6
7void
8Castro::flame_width_properties (amrex::Real time,
9 amrex::Real& T_max, amrex::Real& T_min,
10 amrex::Real& grad_T_max)
11{
12 BL_PROFILE("Castro::flame_width_properties()");
13
14 const auto dx = geom.CellSizeArray();
15
16 auto mf = derive("Temp",time,1);
17
18 BL_ASSERT(mf != nullptr);
19
20 ReduceOps<ReduceOpMax, ReduceOpMin, ReduceOpMax> reduce_op;
21 ReduceData<amrex::Real, amrex::Real, amrex::Real> reduce_data(reduce_op);
22 using ReduceTuple = typename decltype(reduce_data)::Type;
23
24#ifdef _OPENMP
25#pragma omp parallel
26#endif
27 for (MFIter mfi(*mf, TilingIfNotGPU()); mfi.isValid(); ++mfi)
28 {
29 const Box& box = mfi.tilebox();
30
31 const auto temp = (*mf)[mfi].array();
32
33 reduce_op.eval(box, reduce_data,
34 [=] AMREX_GPU_HOST_DEVICE (int i, int j, int k) -> ReduceTuple
35 {
36 // Assumes 1D simulation, right now. Also assumes that
37 // we have at least one ghost cell in the x dimension.
38
39 amrex::Real T = temp(i,j,k);
40 amrex::Real grad_T = std::abs(temp(i+1,j,k) - temp(i-1,j,k)) / (2.0_rt * dx[0]);
41
42 // Ignore problem zones where we have a negative temperature
43
44 if (T < 0.0_rt) {
45 T = 0.0_rt;
46 grad_T = 0.0_rt;
47 }
48
49 return {T, T, grad_T};
50 });
51 }
52
53 ReduceTuple hv = reduce_data.value();
54 T_max = amrex::max(T_max, amrex::get<0>(hv));
55 T_min = amrex::min(T_min, amrex::get<1>(hv));
56 grad_T_max = amrex::max(grad_T_max, amrex::get<2>(hv));
57}
58
59
60

Callers 1

problem_diagnosticsMethod · 0.45

Calls 2

isValidMethod · 0.80
valueMethod · 0.80

Tested by

no test coverage detected