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 // Whether this run carries a passive dye tracer. nComp() cannot answer this: with
3 // biology active and no dye, Tracer_comp is the first biology component, so testing
4 // nComp() would write the dye initial value into NO3.
5 const bool l_do_dye = (remora.num_passive_scalars() > 0);
6 const bool l_use_salt = m_solverChoice.use_salt;
7
8 auto geomdata = geom.data();
9 const int khi = geomdata.Domain().bigEnd()[2];
10
11 for (MFIter mfi(mf_cons, TilingIfNotGPU()); mfi.isValid(); ++mfi)
12 {
13 const Box &bx = mfi.tilebox();
14 amrex::Print() << "Box is " << bx << "comparing to khi+1 " << khi+1 << std::endl;
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 ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
23 {
24 // Convert model z coordinate to positive depth below the surface.
25 const Real depth = amrex::max(Real(0.0), -z_r(i, j, k));
26
27 Real temp = Real(6.5);
28 if (depth <= Real(20.0)) {
29 temp = Real(14.0);
30 } else if (depth <= Real(50.0)) {
31 const Real alpha = (depth - Real(20.0)) / (Real(50.0) - Real(20.0));
32 temp = Real(14.0) + alpha * (Real(10.0) - Real(14.0));
33 } else if (depth <= Real(300.0)) {
34 const Real alpha = (depth - Real(50.0)) / (Real(300.0) - Real(50.0));
35 temp = Real(10.0) + alpha * (Real(6.5) - Real(10.0));
36 }
37
38 Real salt = Real(33.5);
39 if (depth <= Real(50.0)) {
40 salt = Real(33.5);
41 } else if (depth <= Real(150.0)) {
42 const Real alpha = (depth - Real(50.0)) / (Real(150.0) - Real(50.0));
43 salt = Real(33.5) + alpha * (Real(34.3) - Real(33.5));
44 } else {
45 const Real alpha = amrex::min((depth - Real(150.0)) / (Real(300.0) - Real(150.0)), Real(1.0));
46 salt = Real(34.3) + alpha * (Real(34.6) - Real(34.3));
47 }
48
49 state(i, j, k, Temp_comp) = temp;
50 if (l_use_salt) {
51 state(i, j, k, Salt_comp) = salt;
52 }
53
54 if (l_do_dye) { state(i, j, k,Tracer_comp) = Real(0.0); }
55 });
56
57 const Box& xbx = surroundingNodes(bx,0);
58 const Box& ybx = surroundingNodes(bx,1);
59
60 ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
61 {
62 x_vel(i, j, k) = zero;
63 });
64 ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
65 {
66 y_vel(i, j, k) = zero;
67 });
68 }
constexpr amrex::Real zero
#define Temp_comp
#define Tracer_comp
#define Salt_comp
mf_h setVal(geomdata.ProbHi(2))
AMREX_ALWAYS_ASSERT(!NSPeriodic||!EWPeriodic)