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