1 /* ----------------------------------------------------------------------
2    SPARTA - Stochastic PArallel Rarefied-gas Time-accurate Analyzer
3    http://sparta.sandia.gov
4    Steve Plimpton, sjplimp@sandia.gov, Michael Gallis, magalli@sandia.gov
5    Sandia National Laboratories
6 
7    Copyright (2014) Sandia Corporation.  Under the terms of Contract
8    DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
9    certain rights in this software.  This software is distributed under
10    the GNU General Public License.
11 
12    See the README file in the top-level SPARTA directory.
13 ------------------------------------------------------------------------- */
14 
15 #include "stdlib.h"
16 #include "string.h"
17 #include "create_box.h"
18 #include "domain.h"
19 #include "update.h"
20 #include "error.h"
21 
22 using namespace SPARTA_NS;
23 
24 /* ---------------------------------------------------------------------- */
25 
CreateBox(SPARTA * sparta)26 CreateBox::CreateBox(SPARTA *sparta) : Pointers(sparta) {}
27 
28 /* ---------------------------------------------------------------------- */
29 
command(int narg,char ** arg)30 void CreateBox::command(int narg, char **arg)
31 {
32   if (domain->box_exist)
33     error->all(FLERR,"Cannot create_box after simulation box is defined");
34 
35   //if (domain->dimension == 2 && domain->zperiodic == 0)
36   //  error->all(FLERR,"Cannot run 2d simulation with nonperiodic Z dimension");
37 
38   domain->box_exist = 1;
39 
40   if (narg != 6) error->all(FLERR,"Illegal create_box command");
41 
42   domain->boxlo[0] = atof(arg[0]);
43   domain->boxhi[0] = atof(arg[1]);
44   domain->boxlo[1] = atof(arg[2]);
45   domain->boxhi[1] = atof(arg[3]);
46   domain->boxlo[2] = atof(arg[4]);
47   domain->boxhi[2] = atof(arg[5]);
48 
49   if (domain->dimension == 2) {
50     if (domain->boxlo[2] >= 0.0 || domain->boxhi[2] <= 0.0)
51       error->all(FLERR,
52 		 "Create_box z box bounds must straddle 0.0 "
53                  "for 2d simulations");
54   }
55   if (domain->axisymmetric && domain->boxlo[1] != 0.0)
56     error->all(FLERR,"Box ylo must be 0.0 for axi-symmetric model");
57 
58   // problem setup using info from header
59 
60   update->ntimestep = 0;
61 
62   domain->print_box("Created ");
63   domain->set_initial_box();
64   domain->set_global_box();
65 }
66