REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_Upwelling_ML.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 = zero; pp_prob.query("u_0", u_0);
8 Real v_0 = zero; 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 velRef = zero; pp_prob.query("velRef", velRef); // Reference Wind Speed
12
13 bool l_use_salt = m_solverChoice.use_salt;
14
15 auto T0 = m_solverChoice.T0;
16 auto S0 = m_solverChoice.S0;
17
18 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
19 {
20 const Box &bx = mfi.tilebox();
21
22 auto geomdata = geom.data();
23
24 Array4< Real> const& state = mf_cons.array(mfi);
25 Array4< Real> const& x_vel = mf_xvel.array(mfi);
26 Array4< Real> const& y_vel = mf_yvel.array(mfi);
27
28 Array4<const Real> const& z_r = remora.vec_z_r[lev]->const_array(mfi);
29
30 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
31 {
32 const auto prob_lo = geomdata.ProbLo();
33 const auto prob_hi = geomdata.ProbHi();
34 const auto dx = geomdata.CellSize();
35 const Real z = z_r(i,j,k);
36
37 state(i, j, k, Temp_comp) = one;
38
39 state(i,j,k,Temp_comp)=T0+Real(8.0)*std::exp(z/Real(50.0));
40 if (l_use_salt) {
42 }
43
44 const Real xcent = Real(0.5)*(prob_lo[0] + prob_hi[0]);
45 const Real ycent = Real(0.5)*(prob_lo[1] + prob_hi[1]);
46
47 const Real x = prob_lo[0] + (i + Real(0.5)) * dx[0] - xcent;
48 const Real y = prob_lo[1] + (j + Real(0.5)) * dx[1] - ycent*Real(0.5);
49 const Real r2 = x*x + y*y;
50 const Real rad = Real(0.1) * (prob_hi[0]-prob_lo[0]);
51 const Real radsq = rad*rad;
52
53 // Set tracer = 0 everywhere
54 if (l_do_dye) { state(i, j, k,Tracer_comp) = std::exp(-r2/(two*radsq)); }
55 });
56
57 const Box& xbx = surroundingNodes(bx,0);
58 const Box& ybx = surroundingNodes(bx,1);
59 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
60 {
61 const Real z = -z_r(i,j,k);
62 x_vel(i, j, k) = u_0 + velRef * std::log((z + z0)/z0) / std::log((zRef +z0)/z0);
63 });
64 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
65 {
66 y_vel(i, j, k) = zero;
67 });
68 }
constexpr amrex::Real two
constexpr amrex::Real one
constexpr amrex::Real zero
#define Temp_comp
#define Tracer_comp
#define Salt_comp
mf_h setVal(geomdata.ProbHi(2))
ParmParse pp_prob("remora.prob")