|
| 1 | +# Install SHUD and SHUD-tools |
| 2 | + |
| 3 | +## SUNDIALS/CVODE |
| 4 | +The SHUD model requires the support of SUNDIALS or CVODE library. |
| 5 | +[**SUNDIALS**](https://computation.llnl.gov/projects/sundials) is a SUite of Nonlinear and DIfferential/ALgebraic equation Solvers, consists of six solvers. [**CVODE**](https://computation.llnl.gov/projects/sundials/cvode) is a solver for stiff and nonstiff ordinary differential equation (ODE) systems (initial value problem) given in explicit form $y' = f(t,y)$. The methods used in CVODE are variable-order, variable-step multistep methods. You can install the entire SUNDIALS suite or CVODE only. |
| 6 | + |
| 7 | +Since the SUNDIALS/CVODE keeps updating periodically and significantly, the function names and structure are changed accordingly, we suggest to use the specific version of the solver, rather than the latest solver. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +SUNDIALS/CVODE is available in [LLNL: https://computation.llnl.gov/projects/sundials/sundials-software](https://computation.llnl.gov/projects/sundials/sundials-software) |
| 12 | + |
| 13 | +The installation of CVODE v3.x: |
| 14 | + |
| 15 | + |
| 16 | +1. Go to your Command Line and enter your workspace and unzip your CVODE source code here. |
| 17 | +1. make directories for CVODE, including *builddir*, *instdir* and *srcdir* |
| 18 | +``` |
| 19 | +mkdir builddir |
| 20 | +mkdir instdir |
| 21 | +mkdir srcdir |
| 22 | +cd builddir/ |
| 23 | +``` |
| 24 | +1. Try ccmake. Install ``cmake`` if you don't have one. |
| 25 | +``` |
| 26 | +ccmake |
| 27 | +``` |
| 28 | + |
| 29 | +1. Run ccmake to configure your compile environment. |
| 30 | +``` |
| 31 | +ccmake ../sundials/cvode-5.0.0 |
| 32 | +``` |
| 33 | + |
| 34 | +This is an empty configure. Press `c` to start the configuration. |
| 35 | + |
| 36 | + |
| 37 | +The default configuration. Make sure the value for three lines: |
| 38 | +``` |
| 39 | +BUILD_CVODE = ON |
| 40 | +CMAKE_INSTALL_PREFIX = ~/sundials |
| 41 | +EXAMPLES_INSTALL_PATH = ~/sundials/examples |
| 42 | +``` |
| 43 | +After the modification of values, press `c` to confirm configuration. |
| 44 | + |
| 45 | + |
| 46 | +The ccmake configures the environment automatically. When the configuration is ready, press `g` to generate and exit. |
| 47 | + |
| 48 | +1. Then you run commands below: |
| 49 | +``` |
| 50 | +make |
| 51 | +make install |
| 52 | +``` |
| 53 | + |
| 54 | +## SHUD |
| 55 | + |
| 56 | +Configuration in *Makefile*: |
| 57 | + |
| 58 | +1. Path of *SUNDIALS_DIR.* [**CRITICAL**]. If you install SUNDIALS into *~/sundials*, you don't change this line.. |
| 59 | +1. Path of OpenMP if the parallel is preferred. |
| 60 | +1. Path of SRC_DIR, default is `SRC_DIR = .` |
| 61 | +1. Path of BUILT_DIR, default is `BUILT_DIR = .` |
| 62 | + |
| 63 | +After updating the SUNDIALS path in the *Makefile*, user can compile the SHUD with: |
| 64 | +``` |
| 65 | +make clean |
| 66 | +make shud |
| 67 | +``` |
| 68 | + |
| 69 | +There are more options to compile the SHUD code: |
| 70 | + |
| 71 | +- `make all` - clean, then make both shud and shud_omp |
| 72 | +- `make help` - help information |
| 73 | +- `make SHUD` - make SHUD executable |
| 74 | +- `make SHUD_omp` - make shud_omp with OpenMP support |
| 75 | + |
| 76 | + |
| 77 | +### OpenMP |
| 78 | +If parallel-computing is prefered, please install OpenMP. For mac: |
| 79 | +``` |
| 80 | +brew install llvm clang |
| 81 | +brew install libomp |
| 82 | +compile flags for OpenMP: |
| 83 | + -Xpreprocessor -fopenmp -lomp |
| 84 | +Library/Include paths: |
| 85 | + -L/usr/local/opt/libomp/lib |
| 86 | + -I/usr/local/opt/libomp/include |
| 87 | +``` |
| 88 | +### Run SHUD executables. |
| 89 | +After the successful installation and compile, you can run SHUD models using |
| 90 | +``` |
| 91 | +./shud <projectname> |
| 92 | +``` |
| 93 | + |
| 94 | + |
| 95 | +Command line pattern is: |
| 96 | +``` |
| 97 | +./shud [-0][-p projectfile] [-o output] [-n Num_Threads] <project_name> |
| 98 | +``` |
| 99 | +- `-0` Dummy simulation. Load input and write output, but no calculation. |
| 100 | + |
| 101 | +- `<project name>` is the name of the project. |
| 102 | + |
| 103 | +- `[-p projectfile]` Specify the project file, which includes the path to input files and output path. |
| 104 | + |
| 105 | +- `[-o output_folder]` Output directory. Default is output/projname.out |
| 106 | + |
| 107 | +- `[-n Num_Threads]` Number of threads to run with OpenMP, which works with `pihm_omp` only. |
| 108 | + Usage: |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | +When the `shud` program starts to run, the screen should look like this: |
| 113 | + |
| 114 | + |
| 115 | +## SHUD-tools |
| 116 | +This SHUD-tools is an R package. What you need is to install the package as a source code package. |
| 117 | +For example: |
| 118 | + |
| 119 | +``` |
| 120 | +install_github('SHUD-System/shud-tools') |
| 121 | +``` |
| 122 | + |
| 123 | +That is all you need to deploy the SHUD-tools. |
| 124 | + |
0 commit comments