REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_ParticleAdvectionFlat.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 Real u_0 = Real(0.0); pp_prob.query("u_0", u_0);
8 Real v_0 = Real(0.0); pp_prob.query("v_0", v_0);
9 Real z0 = Real(0.1); pp_prob.query("z0", z0); // Surface Roughness
10 Real zRef = Real(80.); pp_prob.query("zRef", zRef); // Reference Height
11 Real uRef = Real(0.0); pp_prob.query("uRef", uRef); // Reference Wind Speed
12
13 auto geomdata = geom.data();
14 const int khi = geomdata.Domain().bigEnd()[2];
15
16 bool l_use_salt = m_solverChoice.use_salt;
17
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& z_r = remora.vec_z_r[lev]->const_array(mfi);
28
29 Real S0 = m_solverChoice.S0;
30 Real T0 = m_solverChoice.T0;
31 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
32 {
33 // Geometry (note we must include these here to get the data on device)
34 // const auto prob_lo = geomdata.ProbLo();
35 // const auto dx = geomdata.CellSize();
36
37 // const Real x = prob_lo[0] + (i + 0.5) * dx[0];
38 // const Real y = prob_lo[1] + (j + 0.5) * dx[1];
39 const Real z = z_r(i,j,k);
40
41 state(i, j, k, Temp_comp) = one;
42
43 state(i,j,k,Temp_comp)=T0+Real(8.0)*std::exp(z/Real(50.0));
44 if (l_use_salt) {
46 }
47
48 // Set tracer = 0 everywhere
49 if (l_do_dye) { state(i, j, k,Tracer_comp) = zero; }
50 });
51
52 // Construct a box that is on x-faces
53 const Box& xbx = surroundingNodes(bx,0);
54 // Set the x-velocity
55 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
56 {
57 const Real z = -z_r(i,j,k);
58
59 // Set the x-velocity
60 x_vel(i, j, k) = u_0 + uRef * std::log((z + z0)/z0) / std::log((zRef +z0)/z0);
61 });
62
63 // Construct a box that is on y-faces
64 const Box& ybx = surroundingNodes(bx,1);
65
66 // Set the y-velocity
67 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
68 {
69 y_vel(i, j, k) = zero;
70 });
71 }
constexpr amrex::Real one
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")