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

Method problem_post_simulation

Exec/unit_tests/diffusion_test/Prob.cpp:8–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7#ifdef DO_PROBLEM_POST_SIMULATION
8void Castro::problem_post_simulation(Vector<std::unique_ptr<AmrLevel> >& amr_level) {
9
10 // compute the norm of the solution vs. the analytic solution
11
12 int nlevels = static_cast<int>(amr_level.size());
13
14 Real L0 = -1.e30;
15 Real L2 = -1.e30;
16
17 for (int n = 0; n < nlevels; ++n) {
18
19 // the Castro object for this level
20 auto& castro = dynamic_cast<Castro&>(*amr_level[n]);
21 Real time = castro.get_state_data(State_Type).curTime();
22
23 // the state data
24 MultiFab& S = castro.get_new_data(State_Type);
25
26 // derive the analytic solution
27 const int ngrow = 1;
28 auto analytic = castro.derive("analytic", time, ngrow);
29
30#ifdef TRUE_SDC
31 // if we are fourth-order, we need to convert to averages
32 if (sdc_order == 4) {
33 auto domain_lo = castro.geom.Domain().loVect3d();
34 auto domain_hi = castro.geom.Domain().hiVect3d();
35
36 FArrayBox tmp;
37
38 for (MFIter mfi(*analytic); mfi.isValid(); ++mfi) {
39
40 const Box& bx = mfi.tilebox();
41 tmp.resize(bx, 1);
42 auto tmp_arr = tmp.array();
43
44 castro.make_fourth_in_place(bx,
45 analytic->array(mfi),
46 tmp_arr,
47 domain_lo, domain_hi);
48
49 }
50 }
51#endif
52
53 // compute the norm of the error
54 MultiFab::Subtract(*analytic, S, UTEMP, 0, 1, 0);
55
56 L0 = std::max(L0, analytic->norm0());
57 L2 = std::max(L2, analytic->norm2());
58
59 }
60
61 const std::string stars(78,'*');
62 amrex::Print() << stars << "\n"
63 << " diffusion problem post_simulation() \n"
64 << " L-inf error against analytic solution: " << L0 << "\n"
65 << " L-2 error against analytic solution: " << L2 << "\n"

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
deriveMethod · 0.80
isValidMethod · 0.80
make_fourth_in_placeMethod · 0.80

Tested by

no test coverage detected