REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_InitAnalyticBathymetry_DoublyPeriodic.H
Go to the documentation of this file.
1
2 mf_h.setVal(geomdata.ProbHi(2));
3
4 const int Lm = geom.Domain().size()[0];
5 const int Mm = geom.Domain().size()[1];
6
7 for ( MFIter mfi(mf_h, TilingIfNotGPU()); mfi.isValid(); ++mfi )
8 {
9 Array4<Real> const& h = (mf_h).array(mfi);
10
11 Box bx = mfi.tilebox();
12 Box gbx2 = bx;
13 gbx2.grow(IntVect(NGROW,NGROW,0));
14
15 // auto N = geom.Domain().length(2); // Number of vertical "levels" aka, NZ
16
17 Box gbx2D = gbx2;
18 gbx2D.makeSlab(2,0);
19
20 if(!m_solverChoice.flat_bathymetry) {
21 Gpu::streamSynchronize();
22 ParallelFor(gbx2D, [=] AMREX_GPU_DEVICE (int i, int j, int )
23 {
24 Real val1;
25 [[maybe_unused]] Real val2;
26 int iFort = i+1;
27 int jFort = j+1;
28 if (NSPeriodic) {
29 if (iFort<=Lm/2.0) {
30 val1=iFort;
31 } else {
32 val1=Lm+1-iFort;
33 }
34 h(i,j,0) = std::min(-geomdata.ProbLo(2),(84.5_rt+66.526_rt*std::tanh((val1-10.0_rt)/7.0_rt)));
35 }
36 else if(EWPeriodic) {
37 if (jFort<=Mm/2.0) {
38 val1=jFort;
39 } else {
40 val1=Mm+1-jFort;
41 }
42 h(i,j,0) = std::min(-geomdata.ProbLo(2),(84.5_rt+66.526_rt*std::tanh((val1-10.0_rt)/7.0_rt)));
43 }
44 });
45 } else { // Flat
46 Gpu::streamSynchronize();
47 ParallelFor(gbx2, [=] AMREX_GPU_DEVICE (int i, int j, int k)
48 {
49 h(i,j,0,0) = -geomdata.ProbLo(2);
50 if (k==0) {
51 h(i,j,0,1) = h(i,j,0,0);
52 }
53 });
54 }
55 } // mfi
#define NGROW