REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_DoubleGyre.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 bool l_use_salt = m_solverChoice.use_salt;
7
8 auto geomdata = geom.data();
9 const int khi = geomdata.Domain().bigEnd()[2];
10
11 auto T0 = m_solverChoice.T0;
12 Real val1 = (Real(44.69) / Real(39.382)) * (Real(44.69) / Real(39.382));
13 Real val2 = val1 * (m_solverChoice.rho0 * Real(100.0)/g) * (Real(5.0e-5)/((Real(42.689)/Real(44.69)) * (Real(42.689)/Real(44.69))));
14
15 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
16 {
17 const Box &bx = mfi.tilebox();
18 AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
19
20 Array4< Real> const& state = mf_cons.array(mfi);
21 Array4< Real> const& x_vel = mf_xvel.array(mfi);
22 Array4< Real> const& y_vel = mf_yvel.array(mfi);
23
24 Array4<const Real> const& z_r = remora.vec_z_r[lev]->const_array(mfi);
25
26 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
27 {
28 const auto prob_lo = geomdata.ProbLo();
29 const auto prob_hi = geomdata.ProbHi();
30 const auto dx = geomdata.CellSize();
31
32 const Real y = prob_lo[1] + (j + Real(Real(0.5))) * dx[1];
33 const Real z = z_r(i,j,k);
34 const Real yextent = prob_hi[1] - prob_lo[1];
35
36 const Real val3 = T0 + val2 * std::exp(z/Real(100.0)) * (Real(10.0) - Real(0.4) * std::tanh(z / Real(100.0)));
37 const Real val4 = y / yextent;
38
39 state(i,j,k,Temp_comp)=val3 - Real(3.0) * val4;
40 if (l_use_salt) {
41 state(i,j,k,Salt_comp)=Real(34.5) - Real(0.001) * z - val4;
42 }
43
44 // Set scalar = 0 everywhere
45 if (l_do_dye) { state(i, j, k,Tracer_comp) = zero; }
46 });
47
48 const Box& xbx = surroundingNodes(bx,0);
49 const Box& ybx = surroundingNodes(bx,1);
50 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
51 {
52 x_vel(i,j,k) = zero;
53 });
54 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
55 {
56 y_vel(i, j, k) = zero;
57 });
58 }
59 Gpu::streamSynchronize();
constexpr amrex::Real zero
constexpr amrex::Real g
#define Temp_comp
#define Tracer_comp
#define Salt_comp
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)