REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticProb_Upwelling_Coupling.H
Go to the documentation of this file.
1
2 const bool l_use_salt = m_solverChoice.use_salt;
3
4 auto geomdata = geom.data();
5 const int khi = geomdata.Domain().bigEnd()[2];
6
7 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
8 {
9 const Box &bx = mfi.tilebox();
10 amrex::Print() << "Box is " << bx << "comparing to khi+1 " << khi+1 << std::endl;
11 AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1);
12
13 Array4<Real> const& state = mf_cons.array(mfi);
14 Array4<Real> const& x_vel = mf_xvel.array(mfi);
15 Array4<Real> const& y_vel = mf_yvel.array(mfi);
16
17 Array4<const Real> const& z_r = remora.vec_z_r[lev]->const_array(mfi);
18 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
19 {
20 // Convert model z coordinate to positive depth below the surface.
21 const Real depth = amrex::max(Real(0.0), -z_r(i, j, k));
22
23 Real temp = Real(6.5);
24 if (depth <= Real(20.0)) {
25 temp = Real(14.0);
26 } else if (depth <= Real(50.0)) {
27 const Real alpha = (depth - Real(20.0)) / (Real(50.0) - Real(20.0));
28 temp = Real(14.0) + alpha * (Real(10.0) - Real(14.0));
29 } else if (depth <= Real(300.0)) {
30 const Real alpha = (depth - Real(50.0)) / (Real(300.0) - Real(50.0));
31 temp = Real(10.0) + alpha * (Real(6.5) - Real(10.0));
32 }
33
34 Real salt = Real(33.5);
35 if (depth <= Real(50.0)) {
36 salt = Real(33.5);
37 } else if (depth <= Real(150.0)) {
38 const Real alpha = (depth - Real(50.0)) / (Real(150.0) - Real(50.0));
39 salt = Real(33.5) + alpha * (Real(34.3) - Real(33.5));
40 } else {
41 const Real alpha = amrex::min((depth - Real(150.0)) / (Real(300.0) - Real(150.0)), Real(1.0));
42 salt = Real(34.3) + alpha * (Real(34.6) - Real(34.3));
43 }
44
45 state(i, j, k, Temp_comp) = temp;
46 if (l_use_salt) {
47 state(i, j, k, Salt_comp) = salt;
48 }
49
50 state(i, j, k, Tracer_comp) = Real(0.0);
51 });
52
53 const Box& xbx = surroundingNodes(bx,0);
54 const Box& ybx = surroundingNodes(bx,1);
55
56 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
57 {
58 x_vel(i, j, k) = zero;
59 });
60 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
61 {
62 y_vel(i, j, k) = zero;
63 });
64 }
constexpr amrex::Real zero
#define Temp_comp
#define Tracer_comp
#define Salt_comp
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)