Skip to content

Commit

Permalink
Added trap so that if PPM reconstruction is selected, NGHOST must be …
Browse files Browse the repository at this point in the history
…set to 3 or

larger.  Also made nghost an option in configure script.
  • Loading branch information
jmstone committed Mar 3, 2018
1 parent e1e95d9 commit 5721084
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
19 changes: 14 additions & 5 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
# The following options are implememted:
# -h --help help message
# --prob=name use src/pgen/name.cpp as the problem generator
# --coord=choice use choice as the coordinate system
# --eos=choice use choice as the equation of state
# --flux=choice use choice as the Riemann solver
# --coord=xxx use xxx as the coordinate system
# --eos=xxx use xxx as the equation of state
# --flux=xxx use xxx as the Riemann solver
# --nghost=xxx set NGHOST=xxx
# -b enable magnetic fields
# -s enable special relativity
# -g enable general relativity
Expand All @@ -24,8 +25,8 @@
# --hdf5_path=path path to HDF5 libraries (requires the HDF5 library)
# -fft enable FFT (requires the FFTW library)
# --fftw_path=path path to FFTW libraries (requires the FFTW library)
# --grav=choice use choice as the self-gravity solver
# --cxx=choice use choice as the C++ compiler
# --grav=xxx use xxx as the self-gravity solver
# --cxx=xxx use xxx as the C++ compiler
# --ccmd=name use name as the command to call the C++ compiler
# --include=path use -Ipath when compiling
# --lib=path use -Lpath when linking
Expand Down Expand Up @@ -75,6 +76,11 @@
choices=['default','hlle','hllc','hlld','roe','llf'],
help='select Riemann solver')

# --nghost=[value] argument
parser.add_argument('--nghost',
default='2',
help='set number of ghost zones')

# -b argument
parser.add_argument('-b',
action='store_true',
Expand Down Expand Up @@ -245,6 +251,9 @@
# --flux=[name] argument
definitions['RSOLVER'] = makefile_options['RSOLVER_FILE'] = args['flux']

# --nghost=[value] argument
definitions['NUMBER_GHOST_CELLS'] = args['nghost']

# -b argument
# set variety of macros based on whether MHD/hydro or adi/iso are defined
if args['b']:
Expand Down
2 changes: 1 addition & 1 deletion src/defs.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#define NHYDRO @NHYDRO_VARIABLES@
#define NFIELD @NFIELD_VARIABLES@
#define NWAVE @NWAVE_VALUE@
#define NGHOST 2
#define NGHOST @NUMBER_GHOST_CELLS@
#define MAX_NSTEP 4

//----------------------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions src/reconstruct/reconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ Reconstruction::Reconstruction(MeshBlock *pmb, ParameterInput *pin)
throw std::runtime_error(msg.str().c_str());
}

// check that there are the necessary number of ghost zones
if (xorder == 3 && (NGHOST) < 3) {
std::stringstream msg;
msg << "### FATAL ERROR in Reconstruction constructor" << std::endl
<< "xorder=" << xorder << " (PPM) reconstruction selected, but nghost=" <<
NGHOST << std::endl << "Reconfigure with --nghost=XXX with XXX > 2" << std::endl;
throw std::runtime_error(msg.str().c_str());
}

// Allocate memory for scratch arrays used in PLM and PPM
int ncells1 = pmb->block_size.nx1 + 2*(NGHOST);
scr01_i_.NewAthenaArray(ncells1);
Expand Down
1 change: 1 addition & 0 deletions src/utils/show_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void ShowConfig(void)
} else {
std::cout<<" Floating point precision: double" << std::endl;
}
std::cout<<" Number of ghost cells: " << NGHOST << std::endl;
#ifdef MPI_PARALLEL
std::cout<<" MPI parallelism: ON" << std::endl;
#else
Expand Down

0 comments on commit 5721084

Please sign in to comment.