REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_Advection.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
6 bool l_use_salt = m_solverChoice.use_salt;
7
8 auto geomdata = geom.data();
9 const int khi = geomdata.Domain().bigEnd()[2];
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 AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
18
19 Array4< Real> const& state = mf_cons.array(mfi);
20 Array4< Real> const& x_vel = mf_xvel.array(mfi);
21 Array4< Real> const& y_vel = mf_yvel.array(mfi);
22
23 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
24 {
25 const auto prob_lo = geomdata.ProbLo();
26 const auto prob_hi = geomdata.ProbHi();
27 const auto dx = geomdata.CellSize();
28
29 state(i, j, k, Temp_comp) = 1.;
30
31 state(i,j,k,Temp_comp)=T0; //+8.0*std::exp(z/50.0_rt);
32
33 // Set tracer = 0 everywhere
34 const Real xcent = 0.5*(prob_lo[0] + prob_hi[0]);
35 const Real ycent = 0.5*(prob_lo[1] + prob_hi[1]);
36
37 const Real x = prob_lo[0] + (i + 0.5) * dx[0] - xcent;
38 const Real y = prob_lo[1] + (j + 0.5) * dx[1] - ycent;
39 const Real r2 = x*x + y*y;
40 const Real rad = 0.1 * (prob_hi[0]-prob_lo[0]);
41 const Real radsq = rad*rad;
42 const Real rad_inner = 0.05 * (prob_hi[0]-prob_lo[0]);
43 [[maybe_unused]] const Real rad_inner_sq = rad_inner*rad_inner;
44
45 if (l_use_salt) {
46 state(i,j,k,Salt_comp)= S0;
47 }
48
49 // Single circle of tracer (default)
50 state(i, j, k, Tracer_comp) = std::exp(-r2/(2.*radsq));
51
52 // Donut of tracer
53 //state(i, j, k, Tracer_comp) = 1.25 * (std::exp(-r2/(2.*radsq)) - std::exp(-r2/(2*rad_inner_sq)));
54 });
55
56 // Construct a box that is on x-faces
57 const Box& xbx = surroundingNodes(bx,0);
58 // Set the x-velocity
59 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
60 {
61 x_vel(i, j, k) = u_0;
62 });
63
64 // Construct a box that is on y-faces
65 const Box& ybx = surroundingNodes(bx,1);
66
67 // Set the y-velocity
68 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
69 {
70 y_vel(i, j, k) = v_0;
71 });
72 }
73 Gpu::streamSynchronize();
#define Temp_comp
#define Tracer_comp
#define Salt_comp
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)
ParmParse pp_prob("remora.prob")