REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_ChannelTest.H
Go to the documentation of this file.
1
2 bool l_use_salt = m_solverChoice.use_salt;
3
4 auto geomdata = geom.data();
5 const int khi = geomdata.Domain().bigEnd()[2];
6
7 [[maybe_unused]] bool EWPeriodic = geomdata.isPeriodic(1);
8 [[maybe_unused]] bool NSPeriodic = geomdata.isPeriodic(0);
9
10 auto T0 = m_solverChoice.T0;
11 auto S0 = m_solverChoice.S0;
12 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
13 {
14 const Box &bx = mfi.tilebox();
15 AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
16
17 Array4< Real> const& state = mf_cons.array(mfi);
18 Array4< Real> const& x_vel = mf_xvel.array(mfi);
19 Array4< Real> const& y_vel = mf_yvel.array(mfi);
20
21 Array4<const Real> const& z_r = remora.vec_z_r[lev]->const_array(mfi);
22
23 ParallelFor(grow(grow(bx,0,1),1,1), [=] 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 const Real z = z_r(i,j,k);
30
31 // Create bounding box for x and y to make spatially-dependent T and S
32 const Real xcent = 0.5*(prob_lo[0] + prob_hi[0]);
33 [[maybe_unused]] const Real ycent = 0.5*(prob_lo[1] + prob_hi[1]);
34
35 [[maybe_unused]] const Real x = prob_lo[0] + (i + 0.5) * dx[0] - xcent;
36 const Real y = prob_lo[1] + (j + 0.5) * dx[1];
37
38 state(i,j,k,Temp_comp)=T0 + z / (9.8_rt * 1.7_rt);
39 if (l_use_salt) {
40 state(i,j,k,Salt_comp)=S0 + y / (9.8_rt * 760.0_rt);
41 }
42
43 // Set tracer = 0 everywhere
44 state(i, j, k, Tracer_comp) = 0.0_rt;
45 });
46
47 const Box& xbx = surroundingNodes(bx,0);
48 const Box& ybx = surroundingNodes(bx,1);
49 ParallelFor(grow(grow(xbx,1,1),0,1), [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
50 {
51 // Create bounding box for x and y to make spatially-dependent T and S
52 const auto prob_lo = geomdata.ProbLo();
53 const auto prob_hi = geomdata.ProbHi();
54 const auto dx = geomdata.CellSize();
55
56 [[maybe_unused]] const Real xcent = 0.5*(prob_lo[0] + prob_hi[0]);
57 [[maybe_unused]] const Real ycent = 0.5*(prob_lo[1] + prob_hi[1]);
58
59 const Real z = z_r(i,j,k);
60 // h(i,j,0) = -geomdata.ProbLo(2);
61 const Real depth = 50.0_rt;
62
63 const Real x = prob_lo[0] + (i + 0.5) * dx[0];// - xcent;
64 const Real y = prob_lo[1] + (j + 0.5) * dx[1];// - ycent;
65
66 const Real val1 = x * 6.28318530718_rt * 1.0e-5_rt;
67 const Real val2 = y * 6.28318530718_rt * 1.0e-5_rt;
68 x_vel(i, j, k) = (depth + z) * 0.01_rt + 0.05_rt * std::sin(val1) * std::sin(val2);
69 });
70 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
71 {
72 y_vel(i, j, k) = 0.0_rt;
73 });
74 }
75 Gpu::streamSynchronize();
#define Temp_comp
#define Tracer_comp
#define Salt_comp
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)