OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
AmrDirichletBoundary.h
Go to the documentation of this file.
1 //
2 // Class AmrDirichletBoundary
3 // Dirichlet boundary is on faces of physical domain the boundary
4 // value would be at different locations depending on the level.
5 //
6 // Copyright (c) 2017 - 2020, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
7 // All rights reserved
8 //
9 // Implemented as part of the PhD thesis
10 // "Precise Simulations of Multibunches in High Intensity Cyclotrons"
11 //
12 // This file is part of OPAL.
13 //
14 // OPAL is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
21 //
22 #ifndef AMR_DIRICHLET_BOUNDARY_H
23 #define AMR_DIRICHLET_BOUNDARY_H
24 
25 #include "AmrBoundary.h"
26 
27 template <class Level>
28 class AmrDirichletBoundary : public AmrBoundary<Level> {
29 
30 public:
31  typedef typename Level::umap_t umap_t;
32  typedef typename Level::lo_t lo_t;
33  typedef typename Level::go_t go_t;
34  typedef typename Level::scalar_t scalar_t;
36 
37 public:
38 
40 
41  void apply(const AmrIntVect_t& iv,
42  const lo_t& dir,
43  umap_t& map,
44  const scalar_t& value,
45  Level* mglevel,
46  const go_t* /*nr*/);
47 };
48 
49 
50 template <class Level>
52  const lo_t& dir,
53  umap_t& map,
54  const scalar_t& value,
55  Level* mglevel,
56  const go_t* /*nr*/)
57 {
58  // find interior neighbour cell
59  AmrIntVect_t niv = iv;
60  niv[dir] = (iv[dir] == -1) ? iv[dir] + 1 : iv[dir] - 1;
61  map[mglevel->serialize(niv)] -= value;
62 }
63 
64 
65 
66 
67 #endif
amrex::IntVect AmrIntVect_t
Definition: AmrDefs.h:48
double scalar_t
Level::umap_t umap_t
Definition: AmrBoundary.h:32
Level::scalar_t scalar_t
Definition: AmrBoundary.h:35
Level::lo_t lo_t
Definition: AmrBoundary.h:33
Level::go_t go_t
Definition: AmrBoundary.h:34
amr::AmrIntVect_t AmrIntVect_t
Definition: AmrBoundary.h:37
amr::AmrIntVect_t AmrIntVect_t
void apply(const AmrIntVect_t &iv, const lo_t &dir, umap_t &map, const scalar_t &value, Level *mglevel, const go_t *)