REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_coriolis.cpp
Go to the documentation of this file.
1#include <REMORA.H>
2
3using namespace amrex;
4
5/**
6 * @param[in ] xbx nodal box in x-direction
7 * @param[in ] ybx nodal box in y-direction
8 * @param[in ] uold u-direction velocity
9 * @param[in ] vold v-direction velocity
10 * @param[inout] ru u-direction velocity RHS
11 * @param[inout] rv v-direction velocity RHS
12 * @param[in ] Hz vertical cell height
13 * @param[in ] fomn scaled coriolis factor
14 * @param[in ] nrhs which velocity component to use
15 * @param[in ] nr which RHS component to update
16 */
17
18void
19REMORA::coriolis (const Box& xbx, const Box& ybx,
20 const Array4<Real const>& uold,
21 const Array4<Real const>& vold,
22 const Array4<Real >& ru,
23 const Array4<Real >& rv,
24 const Array4<Real const>& Hz,
25 const Array4<Real const>& fomn,
26 int nrhs, int nr)
27{
28 BL_PROFILE("REMORA::coriolis()");
29 //
30 //-----------------------------------------------------------------------
31 // Add in Coriolis terms.
32 //-----------------------------------------------------------------------
33 //
34
35 ParallelFor(xbx,
36 [=] AMREX_GPU_DEVICE (int i, int j, int k)
37 {
38 Real UFx_i = 0.5_rt * Hz(i ,j,k) * fomn(i ,j,0) * (vold(i ,j,k,nrhs)+vold(i ,j+1,k,nrhs));
39 Real UFx_im1 = 0.5_rt * Hz(i-1,j,k) * fomn(i-1,j,0) * (vold(i-1,j,k,nrhs)+vold(i-1,j+1,k,nrhs));
40 ru(i,j,k,nr) += 0.5_rt*(UFx_i + UFx_im1);
41 });
42
43 ParallelFor(ybx,
44 [=] AMREX_GPU_DEVICE (int i, int j, int k)
45 {
46 Real VFe_j = 0.5_rt * Hz(i,j ,k) * fomn(i,j ,0) * (uold(i,j ,k,nrhs)+uold(i+1,j ,k,nrhs));
47 Real VFe_jm1 = 0.5_rt * Hz(i,j-1,k) * fomn(i,j-1,0) * (uold(i,j-1,k,nrhs)+uold(i+1,j-1,k,nrhs));
48 rv(i,j,k,nr) -= 0.5_rt*(VFe_j + VFe_jm1);
49 });
50}
void coriolis(const amrex::Box &xbx, const amrex::Box &ybx, const amrex::Array4< amrex::Real const > &uold, const amrex::Array4< amrex::Real const > &vold, const amrex::Array4< amrex::Real > &ru, const amrex::Array4< amrex::Real > &rv, const amrex::Array4< amrex::Real const > &Hz, const amrex::Array4< amrex::Real const > &fomn, int nrhs, int nr)
Calculate Coriolis terms.