PLUTO
get_nghost.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Return the number of ghost zones.
5 
6  Return the number of ghost zones employed by the selected numerical
7  algorithm.
8  The minimum number for a 2nd-order algorithm is 2.
9  Higher-order interpolation scheme may require more zones.
10 
11  \authors A. Mignone (mignone@ph.unito.it)
12  \date Aug 24, 2015
13 */
14 /* ///////////////////////////////////////////////////////////////////// */
15 #include "pluto.h"
16 
17 /* ********************************************************************* */
18 int GetNghost (void)
19 /*!
20  * Compute the number of ghost zones, depending on the selected
21  * scheme.
22  *
23  *********************************************************************** */
24 {
25  int nv, nghost ;
26  Limiter *limiter[NVAR];
27 
28  #if RECONSTRUCTION == FLAT
29 
30  nghost = 2;
31 
32  #elif RECONSTRUCTION == LINEAR || RECONSTRUCTION == LimO3\
33  || RECONSTRUCTION == WENO3
34  #if LIMITER == FOURTH_ORDER_LIM
35  nghost = 3;
36  #else
37  nghost = 2;
38  #endif
39 
40  #elif RECONSTRUCTION == LINEAR_MULTID
41 
42  nghost = 2;
43 
44  #elif RECONSTRUCTION == PARABOLIC
45 
46  #if PHYSICS == HD || PHYSICS == RHD
47  nghost = 4; /* -- since HD makes use of contact steepener -- */
48  #else
49  nghost = 3;
50  #endif
51 
52  #elif RECONSTRUCTION == WENO3_FD || RECONSTRUCTION == LIMO3_FD
53 
54  nghost = 2;
55 
56  #elif RECONSTRUCTION == WENOZ_FD || \
57  RECONSTRUCTION == MP5_FD
58 
59  nghost = 3;
60 
61  #endif
62 
63  #if SHOCK_FLATTENING == ONED
64 
65  nghost = MAX(4, nghost);
66 
67  #elif SHOCK_FLATTENING == MULTID
68 
69 /* ------------------------------------------------------
70  The MULTID shock flattening only need 2 ghost zones.
71  However for axisymmetric simulations with CTU
72  3 zones will ensure that flag[][][] will remain
73  symmetric around the axis.
74  ------------------------------------------------------ */
75 
76  nghost = MAX(3, nghost);
77  #endif
78 
79 /* ----------------------------------------------------
80  The following should operate on the static grid
81  version of the code. Add an extra row of boundary
82  zones if CTU+CT is selected.
83  At least 3 ghost zones.
84  ---------------------------------------------------- */
85 
86  #ifdef CTU
87  #ifdef STAGGERED_MHD
88  nghost++;
89  #endif
90  #endif
91 
92 /* ----------------------------------------
93  FARGO PPM needs at least 3 ghost zones
94  ---------------------------------------- */
95 
96  #ifdef FARGO
97  #if FARGO_ORDER == 3
98  nghost = MAX(3,nghost);
99  #endif
100  #endif
101 
102  #if (defined CH_SPACEDIM) && (TIME_STEPPING == RK_MIDPOINT)
103  nghost++; /* AMR + RK_MIDPOINT */
104  #endif
105 
106  return (nghost);
107 }
108 
#define MAX(a, b)
Definition: macros.h:101
int GetNghost(void)
Definition: get_nghost.c:18
PLUTO main header file.
void Limiter(double *, double *, double *, int, int, Grid *)
Definition: pluto.h:490
#define NVAR
Definition: pluto.h:609