REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_DogboneAnalytic.H
Go to the documentation of this file.
1
2 // Whether this run carries a passive dye tracer. nComp() cannot answer this: with
3 // biology active and no dye, Tracer_comp is the first biology component, so testing
4 // nComp() would write the dye initial value into NO3.
5 const bool l_do_dye = (remora.num_passive_scalars() > 0);
6 ParmParse pp_prob("remora.prob");
7 bool traditional = true;
8 pp_prob.query("traditional", traditional);
9 // Equal to the eastern value leaves temperature uniform, which a test needs if its
10 // exact solution is rest.
11 Real temp_west = Real(5.0);
12 pp_prob.query("temp_west", temp_west);
13
14 bool l_use_salt = m_solverChoice.use_salt;
15
16 auto geomdata = geom.data();
17 const int khi = geomdata.Domain().bigEnd()[2];
18 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
19 {
20 const Box &bx = mfi.tilebox();
21 AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
22
23 Array4< Real> const& state = mf_cons.array(mfi);
24 Array4< Real> const& x_vel = mf_xvel.array(mfi);
25 Array4< Real> const& y_vel = mf_yvel.array(mfi);
26
27 Array4<const Real> const& x_r = coords.x_r->const_array(mfi);
28 if (traditional) {
29 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
30 {
31 if (l_use_salt) {
32 state(i, j, k, Salt_comp) = Real(35.0);
33 }
34
35 state(i,j,k,Temp_comp)= (x_r(i,j,0) < Real(1000.)) ? temp_west : Real(10.0);
36
37 // Set tracer = 0 everywhere
38 if (l_do_dye) { state(i, j, k,Tracer_comp) = zero; }
39 });
40 } else {
41 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
42 {
43 [[maybe_unused]] const Real x = x_r(i,j,0);
44
45 if (l_use_salt) {
46 state(i, j, k, Salt_comp) = Real(10.0) - Real(10.0) * (x_r(i,j,0) - Real(8400.0)) / Real(8400.0);
47 }
48
49 state(i,j,k,Temp_comp)= Real(10.0);
50
51 // Set tracer = 0 everywhere
52 if (l_do_dye) { state(i, j, k,Tracer_comp) = zero; }
53 });
54 }
55
56 const Box& xbx = surroundingNodes(bx,0);
57 const Box& ybx = surroundingNodes(bx,1);
58 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
59 {
60 x_vel(i, j, k) = zero;
61 });
62 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
63 {
64 y_vel(i, j, k) = zero;
65 });
66 }
67 Gpu::streamSynchronize();
constexpr amrex::Real zero
#define Temp_comp
#define Tracer_comp
#define Salt_comp
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
ParmParse pp_prob("remora.prob")