REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_DoublyPeriodic.H
Go to the documentation of this file.
1
2 ParmParse pp_prob("remora.prob");
3 Real u_0 = 0.0; pp_prob.query("u_0", u_0);
4 Real v_0 = 0.0; pp_prob.query("v_0", v_0);
5 Real z0 = 0.1; pp_prob.query("z0", z0); // Surface Roughness
6 Real zRef = 80.; pp_prob.query("zRef", zRef); // Reference Height
7 Real uRef = 0.0; pp_prob.query("uRef", uRef); // Reference Wind Speed
8
9 bool l_use_salt = m_solverChoice.use_salt;
10
11 auto geomdata = geom.data();
12 const int khi = geomdata.Domain().bigEnd()[2];
13
14 auto T0 = m_solverChoice.T0;
15 auto S0 = m_solverChoice.S0;
16 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
17 {
18 const Box &bx = mfi.tilebox();
19 AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
20
21 Array4< Real> const& state = mf_cons.array(mfi);
22 Array4< Real> const& x_vel = mf_xvel.array(mfi);
23 Array4< Real> const& y_vel = mf_yvel.array(mfi);
24
25 Array4<const Real> const& z_r = remora.vec_z_r[lev]->const_array(mfi);
26
27 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
28 {
29 const auto prob_lo = geomdata.ProbLo();
30 const auto prob_hi = geomdata.ProbHi();
31 const auto dx = geomdata.CellSize();
32
33 const Real z = z_r(i,j,k);
34
35 state(i, j, k, Temp_comp) = 1.;
36
37 state(i,j,k,Temp_comp)=T0+8.0_rt*std::exp(z/50.0_rt);
38 if (l_use_salt) {
39 state(i,j,k,Salt_comp)=S0;
40 }
41
42 // Set tracer = 0 everywhere
43 const Real xcent = 0.5*(prob_lo[0] + prob_hi[0]);
44 const Real ycent = 0.5*(prob_lo[1] + prob_hi[1]);
45
46 const Real x = prob_lo[0] + (i + 0.5) * dx[0] - xcent;
47 const Real y = prob_lo[1] + (j + 0.5) * dx[1] - ycent;
48 const Real r2 = x*x + y*y;
49 const Real rad = 0.1 * (prob_hi[0]-prob_lo[0]);
50 const Real radsq = rad*rad;
51
52 state(i, j, k, Tracer_comp) = (r2 < radsq) ? 1.0_rt : 0.0_rt;
53 });
54
55 // Construct a box that is on x-faces
56 const Box& xbx = surroundingNodes(bx,0);
57 // Set the x-velocity
58 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
59 {
60 // const auto prob_lo = geomdata.ProbLo();
61 // const auto dx = geomdata.CellSize();
62
63 // const Real x = prob_lo[0] + (i + 0.5) * dx[0];
64 // const Real y = prob_lo[1] + (j + 0.5) * dx[1];
65 const Real z = -z_r(i,j,k);
66
67 // Set the x-velocity
68 x_vel(i, j, k) = u_0 + uRef * std::log((z + z0)/z0) / std::log((zRef +z0)/z0);
69 });
70
71 // Construct a box that is on y-faces
72 const Box& ybx = surroundingNodes(bx,1);
73
74 // Set the y-velocity
75 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
76 {
77 //const auto prob_lo = geomdata.ProbLo();
78 //const auto dx = geomdata.CellSize();
79
80 // const Real x = prob_lo[0] + (i + 0.5) * dx[0];
81 // const Real y = prob_lo[1] + (j + 0.5) * dx[1];
82 y_vel(i, j, k) = v_0; });
83 }
84 Gpu::streamSynchronize();
#define Temp_comp
#define Tracer_comp
#define Salt_comp
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
ParmParse pp_prob("remora.prob")