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 ParmParse pp_prob("remora.prob");
3 Real u_0 = Real(0.0); pp_prob.query("u_0", u_0);
4 Real v_0 = Real(0.0); pp_prob.query("v_0", v_0);
5 Real z0 = Real(0.1); pp_prob.query("z0", z0); // Surface Roughness
6 Real zRef = Real(80.); pp_prob.query("zRef", zRef); // Reference Height
7 Real velRef = Real(0.0); pp_prob.query("velRef", velRef); // Reference Wind Speed
8
9 bool l_use_salt = m_solverChoice.use_salt;
10
11 auto T0 = m_solverChoice.T0;
12 auto S0 = m_solverChoice.S0;
13
14 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
15 {
16 const Box &bx = mfi.tilebox();
17
18 auto geomdata = geom.data();
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 const Real z = z_r(i,j,k);
32
33 state(i, j, k, Temp_comp) = 1.;
34
35 state(i,j,k,Temp_comp)=T0+8.0_rt*std::exp(z/50.0_rt);
36 if (l_use_salt) {
37 state(i,j,k,Salt_comp)=S0;
38 }
39
40 const Real xcent = 0.5*(prob_lo[0] + prob_hi[0]);
41 const Real ycent = 0.5*(prob_lo[1] + prob_hi[1]);
42
43 const Real x = prob_lo[0] + (i + 0.5) * dx[0] - xcent;
44 const Real y = prob_lo[1] + (j + 0.5) * dx[1] - ycent/2.;
45 const Real r2 = x*x + y*y;
46 const Real rad = 0.1 * (prob_hi[0]-prob_lo[0]);
47 const Real radsq = rad*rad;
48
49 // Set tracer = 0 everywhere
50 state(i, j, k, Tracer_comp) = std::exp(-r2/(2.*radsq));
51 });
52
53 const Box& xbx = surroundingNodes(bx,0);
54 const Box& ybx = surroundingNodes(bx,1);
55 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
56 {
57 const Real z = -z_r(i,j,k);
58 x_vel(i, j, k) = u_0 + velRef * std::log((z + z0)/z0) / std::log((zRef +z0)/z0);
59 });
60 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
61 {
62 y_vel(i, j, k) = 0.0_rt;
63 });
64 }
#define Temp_comp
#define Tracer_comp
#define Salt_comp
ParmParse pp_prob("remora.prob")