Block-Structured AMR Software Framework
AMReX_YAFluxRegister_1D_K.H
Go to the documentation of this file.
1 #ifndef AMREX_YAFLUXREGISTER_1D_K_H_
2 #define AMREX_YAFLUXREGISTER_1D_K_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_BaseFab.H>
6 
7 namespace amrex {
8 
9 template <typename T>
11 void yafluxreg_crseadd (Box const& bx, Array4<T> const& d, Array4<int const> const& flag,
12  Array4<T const> const& fx, T dtdx, int nc) noexcept
13 {
14  auto const lo = amrex::lbound(bx);
15  auto const hi = amrex::ubound(bx);
16 
17  for (int i = lo.x; i <= hi.x; ++i) {
18  if (flag(i,0,0) == amrex_yafluxreg_crse_fine_boundary_cell)
19  {
20  if (flag(i-1,0,0) == amrex_yafluxreg_fine_cell) {
21  for (int n = 0; n < nc; ++n) {
22  d(i,0,0,n) -= dtdx*fx(i,0,0,n);
23  }
24  }
25  if (flag(i+1,0,0) == amrex_yafluxreg_fine_cell) {
26  for (int n = 0; n < nc; ++n) {
27  d(i,0,0,n) += dtdx*fx(i+1,0,0,n);
28  }
29  }
30  }
31  }
32 }
33 
34 template <typename T>
36 void yafluxreg_fineadd (Box const& bx, Array4<T> const& d, Array4<T const> const& f,
37  T dtdx, int nc, int dirside, Dim3 const& rr) noexcept
38 {
39  const auto lo = amrex::lbound(bx);
40 
41  switch (dirside) {
42  case 0 :
43  {
44  for (int n = 0; n < nc; ++n) {
45  const int i = lo.x;
46  const int ii = (i+1)*rr.x;
47  T* AMREX_RESTRICT dp = &(d(i,0,0,n));
48  T tmp = -dtdx*f(ii,0,0,n);
50  }
51  break;
52  }
53  default:
54  {
55  for (int n = 0; n < nc; ++n) {
56  const int i = lo.x;
57  const int ii = i*rr.x;
58  T* AMREX_RESTRICT dp = &(d(i,0,0,n));
59  T tmp = dtdx*f(ii,0,0,n);
61  }
62  }
63  }
64 }
65 
66 }
67 #endif
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_RESTRICT
Definition: AMReX_Extension.H:37
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
constexpr int amrex_yafluxreg_fine_cell
Definition: AMReX_YAFluxRegister_K.H:8
constexpr int amrex_yafluxreg_crse_fine_boundary_cell
Definition: AMReX_YAFluxRegister_K.H:7
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void Add(T *const sum, T const value) noexcept
Definition: AMReX_GpuAtomic.H:619
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:315
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void yafluxreg_fineadd(Box const &bx, Array4< T > const &d, Array4< T const > const &f, T dtdx, int nc, int dirside, Dim3 const &rr) noexcept
Definition: AMReX_YAFluxRegister_1D_K.H:36
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void yafluxreg_crseadd(Box const &bx, Array4< T > const &d, Array4< int const > const &flag, Array4< T const > const &fx, T dtdx, int nc) noexcept
Definition: AMReX_YAFluxRegister_1D_K.H:11
integer, parameter dp
Definition: AMReX_SDCquadrature.F90:8
Definition: AMReX_Array4.H:61
Definition: AMReX_Dim3.H:12