diff --git a/.gitignore b/.gitignore
index da410996594428dc0eee9f8abc3e5a5c8942d5b1..9c3347b6ba3e7492740051e15a04a7514db21a1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,6 @@ bin/state.png
 bin/submission_script_array.sh
 build/source/testing/containers/output_container/out.txt
 build/summa_old
+bin/config.json
+bin/summa_sundials
+build/cmake_build/
diff --git a/.vscode/caf-application.conf b/.vscode/caf-application.conf
deleted file mode 100644
index 3e1e4479dbe11afb9ba9bf8bd0e7d564b6010a35..0000000000000000000000000000000000000000
--- a/.vscode/caf-application.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-caf {
-    max-threads = 1
-}
\ No newline at end of file
diff --git a/README.md b/README.md
index c1daf2984ce00a0bc2e86aebe502256c275ebf2d..84b4d3a24f245bfd3f62287dca9d8eee63777233 100644
--- a/README.md
+++ b/README.md
@@ -1,100 +1,141 @@
 # SUMMA-Actors: Structure for Unifying Multiple Modeling Alternatives with Actors
 
-SUMMA-Actors is a modified version of the already existing SUMMA software that can be 
-found [here](https://github.com/CH-Earth/summa#readme). SUMMA-Actors uses the Actor Model to increase scalability and fault-tolerance. It is built using the [C++ Actor Framework](https://github.com/actor-framework/actor-framework). 
+SUMMA-Actors is a modified version of the already existing SUMMA software that can be found [here](https://github.com/CH-Earth/summa#readme). SUMMA-Actors uses the Actor Model to increase scalability and fault-tolerance. It is built using the [C++ Actor Framework](https://github.com/actor-framework/actor-framework). 
 
 ## Documentation
-A more in-depth documentation can be found [here](https://git.cs.usask.ca/numerical_simulations_lab/actors/Summa-Actors/-/wikis/home). SUMMA-Actors depends on many files from the [original SUMMA repo](https://github.com/CH-Earth/summa). Below is a quick start guide for compiling and running SUMMA-Actors, please consult our wiki for more in-depth documentation. Consider creating an issue for any missing documentaion, asking questions, or providing suggestions.
+A more in-depth documentation can be found [here](https://git.cs.usask.ca/numerical_simulations_lab/actors/Summa-Actors/-/wikis/home). SUMMA-Actors depends on many files from the [original SUMMA repo](https://github.com/CH-Earth/summa). Below is a quick start guide for compiling and running SUMMA-Actors, please consult our wiki for more in-depth documentation. Consider creating an issue for any missing documentation, asking questions, or providing suggestions.
+
+## Preliminaries
+SUMMA-Actors is meant to wrap around the existing SUMMA implementation. Therefore you will need to clone the SUMMA repo into the SUMMA-Actors build directory. SUMMA-Actors works with the master branch of SUMMA, which can be found [here](https://github.com/CH-Earth/summa). Below the directory structure is explained in more detail and the steps to compiling SUMMA-Actors are explained.
 
 ## Directory Structure
-SummaActors is set up with the following sub-directoies, we will consider the top level Summa Actors directory the `root_dir`:
+SUMMA-Actors is set up with the following sub-directories, we will consider the top level Summa Actors directory the `root_dir`:
  - bin
  - build
-   - cmake 
    - includes
-   - makefiles
    - source
-   - summa (https://github.com/CH-Earth/summa)
+   - summa (https://github.com/KyleKlenk/summa/tree/summa-actors, summa-actors branch)
+   - CMakeLists.txt
  - utils
  - README.md
 
- First clone Summa-Actors to your workstation. Then cd into `build/` and clone `summa` or `summa-sundials` into Summa-Actor's build directory. 
+First clone Summa-Actors to your workstation. Then cd into `build/` and clone `summa` into Summa-Actor's build directory as folder summa.
+
+## Compiling SUMMA-Actors
 
-## Compiling Summa-Actors
-To compile SUMMA-Actors, use `cmake` with the `CMakeLists.txt` located in `build/cmake/`. You have the option to compile with or without the sundials library, definded by the line `option(SUNDIALS "Use SUNDIALS" ON)` in the `CMakeLists.txt` file. If set to `ON`, it compiles with sundials. If set to `OFF`, it compiles without sundials.
+### Dependencies
+SUMMA-Actors has only one additional dependency, the [C++ Actor Framework](https://github.com/actor-framework/actor-framework), specifically the [0.18.6 
+release](https://github.com/actor-framework/actor-framework/archive/refs/tags/0.18.6.tar.gz).
 
-If compiling with sundials make sure to install the `sundials IDA solver version 6.3.0` before attempting to compile SUMMA-Actors. Once installed specifiy the instalation directory of sundials by modifying the line `set(DIR_SUNDIALS "/path/to/sundials/libs")` in the `CMakeLists.txt` file.
+The following steps can be used to install the C++ Actor Framework on a Linux system:
+```bash
+wget https://github.com/actor-framework/actor-framework/archive/refs/tags/0.18.6.tar.gz
+tar -xzf 0.18.6.tar.gz
+cd actor-framework-0.18.6/
+./configure --prefix=/path/to/install
+cd build
+make # [-j]
+make install # [as root if necessary]
+```
 
-Before compiling, make sure to install the following dependencies:
+Additional dependencies required by both SUMMA and SUMMA actors are:
  * g++
  * gfortran
  * [NetCDF-Fortran](https://github.com/Unidata/netcdf-fortran)
  * [OpenBLAS](https://github.com/xianyi/OpenBLAS)
- * [C++ Actor Framework](https://github.com/actor-framework/actor-framework)
-
-Here are the steps to compile SUMMA-Actors:
- - cd into `build/cmake/`
- - create a build directory within the `build/cmake/` directory
- - cd into `build/cmake/build`
- - run `cmake ..`
- - run `make -j`
- - The `summa_actors` executable is created in the `bin/` directory.
-
-SUMMA-Actors supports four build types: Debug, Cluster, Release, and Cluster_Debug. The default build type is Release. You can set the build type by using the `-DCMAKE_BUILD_TYPE=build_type` option, where `build_typ`e is one of the four options listed above. To compile with the Cluster build type, make sure to load the following modules with `module load` before compiling when working on clusters:
- - gcc/9.3.0
- - netcdf-fortran
- - openblas
- - caf
+ * [SUNDIALS V6.6](https://github.com/LLNL/sundials/releases/tag/v6.6.0) (optional)
+
+### Steps To Compile
+ ```
+ git clone https://git.cs.usask.ca/numerical_simulations_lab/actors/Summa-Actors.git
+ cd Summa-Actors/build
+ git clone https://github.com/KyleKlenk/summa.git
+ cd summa/
+ git checkout summa-actors
+ cd ../
+ cd build_dir/
+ cmake -B cmake_build -S . -DCMAKE_BUILD_TYPE=Actors_Cluster
+ cmake --build cmake_build --target all -j
+ ```
 
 ## Running SUMMA-Actors
-Running SUMMA-Actors is done with the following command:
-    ./summa_actor -g startGRU -n numGRU -c path_to_config_file
-
-If you are running SUMMA-Actors on a cluster, you will need to specify the number of threads when not using whole nodes.
-  This can be done with the --caf.scheduler.max-threads option
-    ./summa_actor -g startGRU -n numGRU -c path_to_config_file --caf.scheduler.max-threads $SLURM_CPUS_PER_TASK
-
-The values for -g and -n are integers where -c is the full path to the configuraiton file for summa actors.
-
-The configuration file is a json file. The contents of the JSON file are below:
-
-{
-    "Distributed_Settings": {
-        "distributed_mode": false,
-        "servers_list": [{"hostname": "cnic-giws-cpu-19001-04"}, {"hostname": "cnic-giws-utl-19002"}, {"hostname": "cnic-giws-utl-19003"}],
-        "port": 4444,
-        "total_hru_count": 800,
-        "num_hru_per_batch": 50
-    },
-  
-    "Summa_Actor": {
-        "max_gru_per_job": 4000
-    },
-  
-    "File_Access_Actor": {
-      "num_partitions_in_output_buffer": 8,
-      "num_timesteps_in_output_buffer": 500
-    },
-    
-    "Job_Actor": {
-        "file_manager_path": "/scratch/gwf/gwf_cmt/kck540/Summa-Actors/settings/file_manager_actors.txt",
-        "max_run_attempts": 3
-    },
-  
-    "HRU_Actor": {
-        "print_output": true,
-        "output_frequency": 100000,
-        "dt_init_factor": 1
-    }
-}
-
-
-The settings above should work for most use cases, some of the feautures we want to automate such as max_gru_per_job. However, the only field that you should have to adjust is the `file_manager_path`. This is the path to the file that manages the complete configuration of the SUMMA simulation. The summa confiuration files are explained in more depth in the follwoing (documentation)[https://summa.readthedocs.io/en/latest/input_output/SUMMA_input/]
-
-
+SUMMA-Actors can be run in two modes, distributed and non-distributed. The distributed mode used to create ad-hoc clusters. The command line arguments are kept as close to the original SUMMA as possible. However, there are options not yet available in SUMMA-Actors that are in the original SUMMA. Here is a full list of the available and unavailable options:
+```   
+Usage: summa_actors -m master_file [-g startGRU countGRU] [-c config_file] [-b backup_server] [-s server_mode]
+  Available options:
+    -m, --master:         Define path/name of master file (can be specified in config)
+    -g, --gru:            Run a subset of countGRU GRUs starting from index startGRU 
+    -c, --config:         Path name of the Summa-Actors config file (optional but recommended)
+        --gen-config:     Generate a config file
+    -b, --backup-server:  Start backup server, requires a server and config_file
+    -s, --server-mode:    Enable server mode
+    -h, --help:           Print this help message
+  Unimplemented Options:
+    -n --newFile          Define frequency [noNewFiles,newFileEveryOct1] of new output files
+    -s --suffix           Add fileSuffix to the output files
+    -h --hru              Run a single HRU with index of iHRU
+    -r --restart          Define frequency [y,m,d,e,never] to write restart files
+    -p --progress         Define frequency [m,d,h,never] to print progress
+    -v --version          Display version information of the current build
+```
+Instructions for using each mode are provided below, if you just want to skip ahead and get started using the default options.
+
+
+### Non-Distributed Mode (Similar to original SUMMA)
+Using SUMMA-Actors in non-distributed mode is like running the normal SUMMA. The difference is that HRUs will run concurrently in SUMMA-Actors and maximize resource use. Usage is very close to SUMMA, and the same input files are required. In depth documentation for configuring a SUMMA run can be found [here](https://summa.readthedocs.io/en/latest/).
+
+Usage is as follows: ./summa_actors -m master_file [-g startGRU countGRU] [-c config_file]
+
+The master_file for SUMMA-Actors can either be defined explicitly on the command line or it can be included in the new to SUMMA-Actors config_file. The config_file is optional but it is highly recommended as it does allow users to fine tune how SUMMA-Actor will perform. We are working to automate these aspects but for now its best to define it for the domain and compute environment in use. Using `./summa_actors --gen-config` will generate a configuration file that can then be filled in. See the section on config_file in this readme for more information. 
+
+
+### Distributed Mode
+Using SUMMA-Actors in distributed mode allows SUMMA-Actors to solve batches and dymically assign them to nodes and reassign them in the event of node failures.
+
+To use this feature there are 3 actors that can be spawned to cluster nodes together and add additional redundancy to the system. All settings are to be defined in the config_file for this mode. In the config file the user must set `distributed_mode` to true, define a `port`, and configure the domain to run. The domain is defined by how many total GRUs the user wishes to compute and the number of GRUs that should be assembled into a batch. Finally, the `server_list` should be set to the hostname of the backup_servers that are started.
+
+To start the system one start the server first with `./summa_actors -c -s`
+Backup servers can be added with `./summa_actors -c -b`
+Clients can simply be added with `./summa_actors -c`
+
+NOTE: Each system will need a copy of the forcing data or input data, or the data should be in a singular location like on a cluster system.
+
+
+### Config File
+The config file is a JSON file that is used to configure SUMMA-Actors. It is highly recommended to use a config file as it allows the user to fine tune how SUMMA-Actors will perform. Using `./summa_actors --gen-config` will generate a configuration file that can then be filled in. Below is a list of the available options and their descriptions.
+
+#### Distributed_Settings
+The distributed settings are used to configure the distributed mode of SUMMA-Actors. The following options are available:
+  - distributed_mode: (true/false) Enables distributed mode
+  - servers_list: (list of strings) List of hostnames for backup servers
+  - port: (int) Port to use for communication
+  - total_hru_count: (int) Total number of HRUs in the entire domain
+  - num_hru_per_batch: (int) Number of HRUs to assemble into a batches
+
+#### Summa_Actor
+The Summa_Actor settings are used to restrict how many HRU actor can run at once. The following options are available:
+  - max_gru_per_job: (int) Maximum number of HRUs that can be run at once
+
+#### Job_Actor
+The Job_Actor settings can specify the file manager path so it does not need to be specified on the command line, and the maximum number of times to attempt an HRU before giving up. The following options are available:
+  - file_manager_path: (string) Path to the file manager file
+  - max_run_attempts: (int) Maximum number of times to attempt an HRU before giving up
+
+#### File_Access_Actor
+The File_Access_Actor settings are used to configure the file access actor. The following options are available:
+  - num_partitions_in_output_buffer: (int) Number of partitions in the output buffer
+  - num_timesteps_in_output_buffer: (int) Number of timesteps in the output buffer
+
+#### HRU_Actor
+The HRU_Actor settings are used to configure the HRU actor. The following options are available:
+  - print_output: (true/false) Print output to the screen
+  - output_frequency: (int) Frequency to print output to the screen
+  - dt_init_factor: (int) Factor to multiply dt_init by
+  - rel_tol: (float) Relative tolerance for the HRU actor (Requires Sundials)
+  - abs_tol: (float) Absolute tolerance for the HRU actor (Requires Sundials)
 
 ## Credits
-The inital implementation of SUMMA is credited to the inital publications below. These 
+The initial implementation of SUMMA is credited to the initial publications below. These 
 publications can be found in [Water Resources Research](http://onlinelibrary.wiley.com/journal/10.1002/(ISSN)1944-7973).
 
  * Clark, M. P., B. Nijssen, J. D. Lundquist, D. Kavetski, D. E. Rupp, R. A. Woods, J. E. Freer, E. D. Gutmann, A. W. Wood, L. D. Brekke, J. R. Arnold, D. J. Gochis, R. M. Rasmussen, 2015a: A unified approach for process-based hydrologic modeling: Part 1. Modeling concept. _Water Resources Research_, [doi:10.1002/2015WR017198](http://dx.doi.org/10.1002/2015WR017198).<a id="clark_2015a"></a>
diff --git a/actorsChanges.txt b/actorsChanges.txt
new file mode 100644
index 0000000000000000000000000000000000000000..24fb4fb8b2e51538787f073bbedf9ec1ae9e3b1a
--- /dev/null
+++ b/actorsChanges.txt
@@ -0,0 +1,71 @@
+driver
+/summaActors_alarms.f90 -- remove
+/summaActors_globalData.-- could combine and remove, renamed for now
+/summaActors_type.f90   -- could combine and remove, renamed for now, adds a new function, but don't use both
+/summaActors_util.f90   -- could combine and remove, renamed for now, adds a new function, but don't use both
+/summaversion.inc       -- remove
+
+
+dshare
+/csv_file_1d.f90 -- remove?? not seeing it used anywhere?
+/csv_file_2d.f90 -- remove?? not seeing it used anywhere?
+/csv_file.f90   -- remove?? IS this only in kinsol? do we need?
+/data_types.f90 -- has a lot
+/globalData.f90 -- remove with ACTORS_ACTIVE adds forcing stuff and tmZoneOffsetFracDay, fracJulDay, yearLength not as global
+/varLookup.f90  -- remove with ACTORS_ACTIVE uses a iso_c binding call
+
+
+engine
+can remove sundials folder shouldn't need with SUNDIALS_ACTIVE
+/sundials/coupled_em.f90 -- remove with ACTORS_ACTIVE needs fracJulDay, yearLength
+/sundials/mDecisions.f90 -- remove with ACTORS_ACTIVE called with iso_c binding
+/sundials/t2enthalpy.f90 -- remove
+/alloc_fileAccess.f90 -- new
+/allocspace[Actors].f90 -- this is a replacement, rename, and see how changes CHECK IF NECESSARY!
+/check_icondActors.f90-- could combine and remove, renamed for now, adds a new function, but don't use both
+/checkStruc.f90 -- remove
+/coupled_em.f90 -- remove shouldn't need the non-sundials version
+/derivforce.f90 -- remove with ACTORS_ACTIVE tmZoneOffsetFracDay needs to be variable not global
+/ffile_info.f90 -- very different, call this ffile_infoActors?
+/mDecisions.f90 -- remove shouldn't need the non-sundials version
+/read_dimension.-- remove, part of read_attrb, - some deallocation changes, use this in all (not actually used in actors, ??)
+
+ - also Actors assumes don't have aspect variable .. why?
+/read_pinit.f90 -- remove
+/vegPhenlgy.f90 -- remove with ACTORS_ACTIVE needs fracJulDay, yearLength
+
+SUMMA_FILEACCESS_INTERFACE = \
+		output_structure.f90 \
+		cppwrap_fileAccess.f90 \
+		read_attrb.f90 \
+		read_force.f90 \
+		read_param.f90 \
+		read_icondFromStructure.f90 \
+ARE THESE ALL SORT OF REPEATS?? DO WE EVEN USE ALL OF THEM? specifically read_icondFromStructure ... what is that ... do we call its
+Can we give them the same names as the regular summa files if they are repeats, so we know to change them??
+
+
+
+changed calls in run_oneHRU so can use (modded) currently in actors /derivforce.f90 /coupled_em.f90 /vegPhenlgy.f90 as is
+
+
+
+hookup
+/ascii_util.f90          -- use Kyle's version everywhere!! (so remove)
+/summaActors_FileManager.-- could combine and remove, renamed for now??
+
+
+lapack    -- remove
+/Makefile -- remove
+/README   -- remove
+
+
+netcdf
+/def_output.f90   -- has a lot ... use Kyle's? Hard to tell which is Actors specific and which is just changed
+/netcdf_util.f90  -- remove
+/read_icondActors.-- has a lot ... could combine and remove, renamed for now,
+/writeOutput.f90  -- part of modelwrite.f90 -- renamed to modelwrite so can replace, and then IS THIS VERSION BETTER can we change the other version and put a few compiler directives in?
+/writeRestart.f90 -- remove, same in modelwrite, part of it
+
+
+
diff --git a/bin/Summa_Actors_Settings.json b/bin/Summa_Actors_Settings.json
new file mode 100644
index 0000000000000000000000000000000000000000..193db1fdb8c108610b7ae494e244b8d96c0b5999
--- /dev/null
+++ b/bin/Summa_Actors_Settings.json
@@ -0,0 +1,29 @@
+{
+    "Distributed_Settings": {
+        "distributed_mode": false,
+        "servers_list": [{"hostname": "cnic-giws-cpu-19001-04"}, {"hostname": "cnic-giws-utl-19002"}, {"hostname": "cnic-giws-utl-19003"}],
+        "port": 4444,
+        "total_hru_count": 800,
+        "num_hru_per_batch": 50
+    },
+  
+    "Summa_Actor": {
+        "max_gru_per_job": 4000
+    },
+  
+    "File_Access_Actor": {
+      "num_partitions_in_output_buffer": 16,
+      "num_timesteps_in_output_buffer": 1000
+    },
+    
+    "Job_Actor": {
+        "file_manager_path": "/project/gwf/gwf_cmt/kck540/domain_NorthAmerica/Summa-Projects/input_data/summa_actors_input/fileManager.txt",
+        "max_run_attempts": 3
+    },
+  
+    "HRU_Actor": {
+        "print_output": true,
+        "output_frequency": 10000,
+        "dt_init_factor": 1
+    }
+}
diff --git a/bin/submit_summa_actors_32.sh b/bin/submit_summa_actors_32.sh
new file mode 100644
index 0000000000000000000000000000000000000000..91470b77f721ffbab839ea7aa648f383fea73cf3
--- /dev/null
+++ b/bin/submit_summa_actors_32.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#SBATCH --nodes=1
+#SBATCH --exclusive
+#SBATCH --time=1:00:00
+#SBATCH --mem=0
+#SBATCH --job-name=Summa-Actors
+#SBATCH --output=/scratch/gwf/gwf_cmt/kck540/Summa-Sundials-Output/slurm/slurm-%A.out
+#SBATCH --account=hpc_c_giws_clark
+
+module load StdEnv/2020
+module load gcc/9.3.0
+module load openblas/0.3.17
+module load netcdf-fortran/4.5.2
+
+# for Actors
+module load caf
+
+export LD_LIBRARY_PATH=/globalhome/kck540/HPC/Libraries/sundials/v6.6/instdir/lib64:$LD_LIBRARY_PATH
+
+
+gru_max=12000
+gru_count=25
+max_job=3
+summa_exe=/globalhome/kck540/HPC/Summa-Projects/Summa-Actors/bin/summa_actors
+# config_summa=/globalhome/kck540/HPC/Summa-Projects/Summa-Actors/bin/config.json
+file_manager=/project/gwf/gwf_cmt/kck540/domain_NorthAmerica/Summa-Projects/input_data/summa_actors_input/fileManager.txt
+config_summa=/globalhome/kck540/HPC/Summa-Projects/Summa-Actors/bin/Summa_Actors_Settings.json
+
+offset=$SLURM_ARRAY_TASK_ID
+gru_start=$(( 1 + gru_count*offset ))
+check=$(( $gru_start + $gru_count ))
+
+# Adust the number of grus for the last job
+# if [ $check -gt $gru_max ] || [ $offset -eq $(( max_job-1 )) ] 
+# then
+#     gru_count=$(( gru_max-gru_start+1 ))
+# fi
+
+$summa_exe -g $gru_start $gru_count -c $config_summa --caf.scheduler.max-threads=32
\ No newline at end of file
diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4152b68221362012e2af34d398a2fa6f38bf4b07
--- /dev/null
+++ b/build/CMakeLists.txt
@@ -0,0 +1,316 @@
+cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
+project(summa_actors LANGUAGES CXX Fortran)
+enable_language(C)
+SET (CMAKE_Fortran_COMPILER  gfortran)
+include(FortranCInterface)
+FortranCInterface_VERIFY(CXX)
+
+get_filename_component(PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY)
+set(EXEC_DIR ${PARENT_DIR}/bin) # set the output directory for executables
+SET(F_MASTER ${PARENT_DIR}/build/summa)
+# Add options for build type
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXEC_DIR})
+set(CMAKE_CONFIGURATION_TYPES BE BE_Cluster BE_Cluster_Debug)
+
+# Set Compiler Options
+if(CMAKE_BUILD_TYPE MATCHES Debug)
+    message("\nSetting Debug Options\n")
+    add_compile_definitions(DEBUG)
+    set(FLAGS_NOAH -g -O0 -fbacktrace -fbounds-check -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors ${FLAGS_OPT})
+    set(FLAGS_ALL  -g -O0 -fbacktrace -fbounds-check -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors -cpp ${FLAGS_OPT})
+    set(FLAGS_CXX  -g -O0 -fbounds-check -Wfatal-errors -std=c++17 ${FLAGS_OPT})
+else()
+    message("\nSetting Release Options")
+    set(FLAGS_NOAH -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors ${FLAGS_OPT})
+    set(FLAGS_ALL  -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors -cpp ${FLAGS_OPT})
+    set(FLAGS_CXX  -O3 -Wfatal-errors -std=c++17 ${FLAGS_OPT})
+endif()
+
+find_package(OpenBLAS REQUIRED)
+set(EXEC_NAME summa_be)
+
+if (CMAKE_BUILD_TYPE MATCHES Cluster)    
+    # Set include directories
+    set(INCLUDES $ENV{EBROOTNETCDFMINFORTRAN}/include ${netCDF_INCLUDES} ${OpenBLAS_INCLUDES})
+    set(LIBRARIES SUMMA_NOAHMP  ${OpenBLAS_LIBRARIES} -lnetcdff)
+
+    set(INC_ACTORS 
+        ${CAF_INCLUDES} 
+        ${PARENT_DIR}/build/includes/global 
+        ${PARENT_DIR}/build/includes/summa_actor 
+        ${PARENT_DIR}/build/includes/job_actor 
+        ${PARENT_DIR}/build/includes/file_access_actor 
+        ${PARENT_DIR}/build/includes/hru_actor)
+    set(LIB_ACTORS 
+        ${CAF_LIBRARIES} 
+        -lcaf_core 
+        -lcaf_io)
+
+else()
+    set(CMAKE_BUILD_RPATH "/usr/local/lib")
+    set(SUMMA_INCLUDES
+        "/usr/include"
+        ${netCDF_INCLUDES}
+        ${OpenBLAS_INCLUDES})
+    
+    set(SUMMA_LIBS
+        -lnetcdff
+        -lopenblas
+        SUMMA_NOAHMP)
+
+    set(SUMMA_ACTORS_INCLUDES
+        "/usr/local/actor-framework/debug/include"
+        ${CAF_INCLUDES}
+        ${OpenBLAS_INCLUDES}
+        "${PARENT_DIR}/build/includes/global"
+        "${PARENT_DIR}/build/includes/summa_actor"
+        "${PARENT_DIR}/build/includes/job_actor"
+        "${PARENT_DIR}/build/includes/file_access_actor"
+        "${PARENT_DIR}/build/includes/hru_actor")
+    
+    link_directories("/usr/local/actor-framework/debug/lib")
+    set(SUMMA_ACTORS_LIBS   
+        -lopenblas
+        -lcaf_core
+        -lcaf_io
+        summa
+        -lnetcdff)
+endif()
+
+# Define directories that contains source code
+set(DRIVER_DIR ${F_MASTER}/build/source/driver)
+set(DSHARE_DIR ${F_MASTER}/build/source/dshare)
+set(ENGINE_DIR ${F_MASTER}/build/source/engine)
+set(HOOKUP_DIR ${F_MASTER}/build/source/hookup)
+set(NETCDF_DIR ${F_MASTER}/build/source/netcdf)
+set(NOAHMP_DIR ${F_MASTER}/build/source/noah-mp)
+
+# Define Actors specific directories
+set(ACTORS_DIR ${PARENT_DIR}/build/source/actors)
+set(FILE_ACCESS_DIR ${ACTORS_DIR}/file_access_actor)
+set(JOB_ACTOR_DIR   ${ACTORS_DIR}/job_actor)
+set(HRU_ACTOR_DIR   ${ACTORS_DIR}/hru_actor)
+
+# NOAHMP modules
+set(NOAHMP
+    ${NOAHMP_DIR}/module_model_constants.F
+    ${NOAHMP_DIR}/module_sf_noahutl.F
+    ${NOAHMP_DIR}/module_sf_noahlsm.F
+    ${NOAHMP_DIR}/module_sf_noahmplsm.F)
+
+# Free versions of numerical recipes utilities for NOAH-MP modules
+set(NRUTIL
+    ${ENGINE_DIR}/f2008funcs.f90
+    ${ENGINE_DIR}/nr_utility.f90
+    ${ENGINE_DIR}/nrtype.f90)
+
+# Free versions of numerical recipes procedures for SUMMA modules
+set(NRPROC
+    ${ENGINE_DIR}/expIntegral.f90
+    ${ENGINE_DIR}/spline_int.f90)
+
+# Hook-up modules
+set(HOOKUP
+    ${HOOKUP_DIR}/ascii_util.f90
+    ${HOOKUP_DIR}/summaFileManager.f90)
+
+# Data modules
+set(DATAMS
+    ${DSHARE_DIR}/data_types.f90
+    ${ACTORS_DIR}/global/actor_data_types.f90
+    ${DSHARE_DIR}/flxMapping.f90
+    ${DSHARE_DIR}/get_ixname.f90
+    ${DSHARE_DIR}/globalData.f90
+    ${DSHARE_DIR}/multiconst.f90
+    ${DSHARE_DIR}/outpt_stat.f90
+    ${DSHARE_DIR}/popMetadat.f90
+    ${DSHARE_DIR}/var_lookup.f90)
+
+# Utility modules
+set(UTILMS
+    ${ENGINE_DIR}/matrixOper.f90
+    ${ENGINE_DIR}/mDecisions.f90
+    ${ENGINE_DIR}/snow_utils.f90
+    ${ENGINE_DIR}/soil_utils.f90
+    ${ENGINE_DIR}/time_utils.f90
+    ${ENGINE_DIR}/updatState.f90)
+
+# NetCDF routines
+set(NETCDF
+    ${NETCDF_DIR}/def_output.f90
+    ${NETCDF_DIR}/netcdf_util.f90
+    ${NETCDF_DIR}/read_icond.f90)
+
+# Preliminary modules
+set(PRELIM
+    ${ENGINE_DIR}/allocspace.f90
+    ${ENGINE_DIR}/check_icond.f90
+    ${ENGINE_DIR}/checkStruc.f90
+    ${ENGINE_DIR}/childStruc.f90
+    ${ENGINE_DIR}/conv_funcs.f90
+    ${ENGINE_DIR}/convE2Temp.f90
+    ${FILE_ACCESS_DIR}/ffile_info.f90
+    ${ENGINE_DIR}/read_pinit.f90
+    ${ENGINE_DIR}/read_attrb.f90
+    ${ENGINE_DIR}/paramCheck.f90
+    ${ENGINE_DIR}/pOverwrite.f90
+    ${ENGINE_DIR}/sunGeomtry.f90
+    ${ENGINE_DIR}/read_param.f90)
+
+    # Model run support modules
+set(MODRUN
+    ${ENGINE_DIR}/canopySnow.f90
+    ${ENGINE_DIR}/derivforce.f90
+    ${ENGINE_DIR}/getVectorz.f90
+    ${ENGINE_DIR}/indexState.f90
+    ${ENGINE_DIR}/layerMerge.f90
+    ${ENGINE_DIR}/layerDivide.f90
+    ${ENGINE_DIR}/qTimeDelay.f90
+    ${ENGINE_DIR}/snowAlbedo.f90
+    ${ENGINE_DIR}/snwCompact.f90
+    ${ENGINE_DIR}/tempAdjust.f90
+    ${ENGINE_DIR}/updateVars.f90
+    ${ENGINE_DIR}/var_derive.f90
+    ${ENGINE_DIR}/volicePack.f90)
+
+# Solver main modules
+set(SOLVER
+    ${ENGINE_DIR}/bigAquifer.f90
+    ${ENGINE_DIR}/computFlux.f90
+    ${ENGINE_DIR}/computJacob.f90
+    ${ENGINE_DIR}/computResid.f90
+    ${ENGINE_DIR}/coupled_em.f90
+    ${ENGINE_DIR}/diagn_evar.f90
+    ${ENGINE_DIR}/eval8summa.f90
+    ${ENGINE_DIR}/groundwatr.f90
+    ${ENGINE_DIR}/opSplittin.f90
+    ${ENGINE_DIR}/snowLiqFlx.f90
+    ${ENGINE_DIR}/soilLiqFlx.f90
+    ${ENGINE_DIR}/ssdNrgFlux.f90
+    ${ENGINE_DIR}/stomResist.f90
+    ${ENGINE_DIR}/summaSolve.f90
+    ${ENGINE_DIR}/systemSolv.f90
+    ${ENGINE_DIR}/varSubstep.f90
+    ${ENGINE_DIR}/vegLiqFlux.f90
+    ${ENGINE_DIR}/vegNrgFlux.f90
+    ${ENGINE_DIR}/vegPhenlgy.f90
+    ${ENGINE_DIR}/vegSWavRad.f90)
+
+set(DRIVER
+    ${DRIVER_DIR}/summa_alarms.f90
+    ${DRIVER_DIR}/summa_globalData.f90)
+
+
+# Actors interface modules
+set(INTERFACE
+    ${ACTORS_DIR}/global/cppwrap_auxiliary.f90
+    ${ACTORS_DIR}/global/cppwrap_datatypes.f90
+    ${ACTORS_DIR}/global/cppwrap_metadata.f90)
+set(FILE_ACCESS_INTERFACE
+    ${FILE_ACCESS_DIR}/cppwrap_fileAccess.f90
+    ${FILE_ACCESS_DIR}/output_structure.f90
+    ${FILE_ACCESS_DIR}/read_force.f90
+    ${FILE_ACCESS_DIR}/fileAccess_writeOutput.f90)
+set(JOB_INTERFACE
+    ${JOB_ACTOR_DIR}/job_actor.f90)
+set(HRU_INTERFACE
+    ${HRU_ACTOR_DIR}/hru_init.f90
+    ${HRU_ACTOR_DIR}/hru_read.f90
+    ${HRU_ACTOR_DIR}/hru_modelRun.f90
+    ${HRU_ACTOR_DIR}/hru_writeOutput.f90)
+
+# Actors actual actor modules
+set(ACTORS_GLOBAL
+    ${ACTORS_DIR}/global/auxiliary.cpp
+    ${ACTORS_DIR}/global/global.cpp
+    ${ACTORS_DIR}/global/message_atoms.cpp
+    ${ACTORS_DIR}/global/settings_functions.cpp
+    ${ACTORS_DIR}/global/timing_info.cpp)
+set(SUMMA_ACTOR
+    ${ACTORS_DIR}/summa_actor/batch.cpp
+    ${ACTORS_DIR}/summa_actor/batch_container.cpp
+    ${ACTORS_DIR}/summa_actor/client.cpp
+    ${ACTORS_DIR}/summa_actor/client_container.cpp
+    ${ACTORS_DIR}/summa_actor/summa_actor.cpp
+    ${ACTORS_DIR}/summa_actor/summa_backup_server.cpp
+    ${ACTORS_DIR}/summa_actor/summa_client.cpp
+    ${ACTORS_DIR}/summa_actor/summa_server.cpp)
+set(FILE_ACCESS_ACTOR
+    ${ACTORS_DIR}/file_access_actor/file_access_actor.cpp
+    ${ACTORS_DIR}/file_access_actor/forcing_file_info.cpp
+    ${ACTORS_DIR}/file_access_actor/output_container.cpp)
+set(JOB_ACTOR
+    ${ACTORS_DIR}/job_actor/GRU.cpp
+    ${ACTORS_DIR}/job_actor/job_actor.cpp)
+set(HRU_ACTOR
+    ${ACTORS_DIR}/hru_actor/hru_actor.cpp)
+
+#=========================================================================================
+# COMPILE PART 3: Collect the subroutines into build groups depending on build type
+#=========================================================================================
+set(COMM_ALL
+    ${NRPROC}
+    ${HOOKUP}
+    ${DATAMS}
+    ${UTILMS}
+    ${INTERFACE})
+
+set(SUMMA_ALL
+    ${NETCDF}
+    ${PRELIM}
+    ${MODRUN}
+    ${SOLVER}
+    ${DRIVER})
+
+set(SUMMA_ALL 
+    ${SUMMA_ALL}
+    ${FILE_ACCESS_INTERFACE}
+    ${JOB_INTERFACE}
+    ${HRU_INTERFACE})
+
+set(MAIN_ACTOR ${ACTORS_DIR}/main.cpp)
+
+# Define version number, not working correctly
+set(VERSIONFILE     ${DRIVER_DIR}/summaversion.inc)
+execute_process(COMMAND "    ${GIT_EXECUTABLE} tag | tail -n 1" OUTPUT_VARIABLE VERSION)
+execute_process(COMMAND "date" OUTPUT_VARIABLE BULTTIM)
+execute_process(COMMAND "    ${GIT_EXECUTABLE} describe --long --all --always | sed -e's/heads\///'" OUTPUT_VARIABLE GITBRCH)
+execute_process(COMMAND "    ${GIT_EXECUTABLE} rev-parse HEAD" OUTPUT_VARIABLE GITHASH)
+
+
+#=========================================================================================
+# COMPILE PART 4: Do the compilation
+#=========================================================================================
+# update version information, not working correctly
+file(WRITE  ${VERSIONFILE} "character(len=64), parameter     :: summaVersion = '${VERSION}'\n")
+file(APPEND ${VERSIONFILE} "character(len=64), parameter     :: buildTime = ''\n")
+file(APPEND ${VERSIONFILE} "character(len=64), parameter     :: gitBranch = '${GITBRCH}'\n")
+file(APPEND ${VERSIONFILE} "character(len=64), parameter     :: gitHash = '${GITHASH}'")
+
+# Build SUMMA_NOAHMP Object
+add_library(SUMMA_NOAHMP OBJECT ${NOAHMP} ${NRUTIL})
+target_compile_options(SUMMA_NOAHMP PRIVATE ${FLAGS_NOAH})
+
+# Build SUMMA_COMM Object
+add_library(SUMMA_COMM OBJECT ${COMM_ALL})
+target_compile_options(SUMMA_COMM PRIVATE ${FLAGS_ALL})
+target_include_directories(SUMMA_COMM PRIVATE ${INCLUDES})
+target_link_libraries(SUMMA_COMM PUBLIC SUMMA_NOAHMP ${FLAGS_ALL}) # added flags to the link step
+
+add_library(summaactors SHARED ${SUMMA_ALL})
+target_compile_options(summaactors PRIVATE ${FLAGS_ALL})
+target_include_directories(summaactors PUBLIC ${INCLUDES})
+target_link_libraries(summaactors PUBLIC ${LIBRARIES} SUMMA_NOAHMP SUMMA_COMM)
+add_executable(${EXEC_NAME} 
+               ${MAIN_ACTOR}
+               ${ACTORS_GLOBAL}
+               ${FILE_ACCESS_ACTOR}
+               ${JOB_ACTOR}
+               ${HRU_ACTOR}
+               ${SUMMA_ACTOR}
+               ${SUMMA_CLIENT}
+               ${SUMMA_SERVER})
+set_property(TARGET ${EXEC_NAME} PROPERTY LINKER_LANGUAGE Fortran)
+target_compile_options(${EXEC_NAME} PUBLIC ${FLAGS_CXX})
+target_include_directories(${EXEC_NAME} PUBLIC ${INC_ACTORS})
+target_link_libraries( ${EXEC_NAME} ${LIB_ACTORS} summaactors)
\ No newline at end of file
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
deleted file mode 100644
index 44f345b142da8c422195d1664c85a450bb5eaac0..0000000000000000000000000000000000000000
--- a/build/cmake/CMakeLists.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
-
-set(PARENT_DIR ../../)
-set(EXEC_DIR ${PARENT_DIR}../bin)
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXEC_DIR}) # set the output directory for executables
-project(summa_actors LANGUAGES CXX Fortran)
-enable_language(C)
-SET (CMAKE_Fortran_COMPILER  gfortran)
-include(FortranCInterface)
-FortranCInterface_VERIFY(CXX)
-
-# SUMMA-Actors can be built in three configurations:
-# 1. SUMMA-Actors with SUNDIALS (Kinsol) solver
-# 2. SUMMA-Actors with SUNDIALS (IDA) solver
-# 3. SUMMA-Actors without SUNDIALS solver, using the original SUMMA home coded solver
-# --------------------------------------------------------------------------------------------
-# Each configuration of Summa has a corresponding CMakeLists.txt file in the build directory
-include(kinsol.cmake)
-include(be.cmake)
-include(ida.cmake)
-# --------------------------------------------------------------------------------------------
-# When compiling Summa-Actors each configuration can be compiled in a Cluster or Debug mode,
-# which is set by the CMAKE_BUILD_TYPE variable. The default is Release, non-cluster mode.
-
-######### SET THE PATHS TO THE SUNDIALS LIBRARIES AND INCLUDE FILES #########
-#############################################################################
-set(DIR_SUNDIALS "")
-foreach(dir IN ITEMS 
-    "/globalhome/kck540/HPC/Libraries/sundials/instdir"
-    "/home/kklenk/projects/rpp-kshook/CompHydCore/SummaSundials/sundials/sundials/instdir"
-    "/usr/local/sundials-6.3.0")
-    if(EXISTS ${dir})
-        set(DIR_SUNDIALS ${dir})
-        break()
-    endif()
-endforeach()
-#############################################################################
-
-# Set default build type to Release
-if(NOT CMAKE_BUILD_TYPE)
-  set(CMAKE_BUILD_TYPE Release)
-endif()
-
-# Add options for build type
-set(CMAKE_CONFIGURATION_TYPES BE BE_Debug BE_Cluster BE_Cluster_Debug
-                              Kinsol Kinsol_Debug Kinsol_Cluster Kinsol_Cluster_Debug
-                              IDA IDA_Debug IDA_Cluster IDA_Cluster_Debug)
-message("\nSelected Bulid Type: ${CMAKE_BUILD_TYPE}\n")
-
-
-# Set Compiler Options
-if(CMAKE_BUILD_TYPE MATCHES Debug)
-    message("\nSetting Debug Options\n")
-    add_definitions(-DDEBUG)
-    set(SUMMA_NOAHMP_OPTIONS -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors)
-    set(SUMMA_ALL_OPTIONS -g -O0 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors)
-    set(CMAKE_CXX_FLAGS "-g -O0 -Wfatal-errors -std=c++17")
-    set(CMAKE_CXX_LINK_FLAGS "-g -O0 -Wfatal-errors -std=c++17")
-else()
-    message("\nSetting Release Options\n")
-    set(SUMMA_NOAHMP_OPTIONS -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors)
-    set(SUMMA_ALL_OPTIONS -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors)
-    set(CMAKE_CXX_FLAGS "-O3 -Wfatal-errors -std=c++17")
-endif()
-
-# Build Correct Summa-Actors Configuration
-if(CMAKE_BUILD_TYPE MATCHES BE)
-    message("\nBuilding BE\n")
-    compile_with_be(${PARENT_DIR})
-
-elseif(CMAKE_BUILD_TYPE MATCHES IDA)
-    message("\nBuilding IDA\n")
-    compile_with_ida(PARENT_DIR, ${DIR_SUNDIALS})
-
-elseif(CMAKE_BUILD_TYPE MATCHES Kinsol)
-    message("\nBuilding Kinsol\n")
-    compile_with_kinsol(PARENT_DIR, ${DIR_SUNDIALS})
-
-else()
-    message("Valid build types are: ${CMAKE_CONFIGURATION_TYPES}")
-    message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
-endif()
\ No newline at end of file
diff --git a/build/cmake/be.cmake b/build/cmake/be.cmake
deleted file mode 100644
index 98bc842acad0ee51e8706f85cd23838fdadbf808..0000000000000000000000000000000000000000
--- a/build/cmake/be.cmake
+++ /dev/null
@@ -1,308 +0,0 @@
-function (compile_with_be PARENT_DIR)
-    find_package(LAPACK REQUIRED)
-    set(EXEC_NAME summa_be)
-
-    if (CMAKE_BUILD_TYPE MATCHES Cluster)    
-        set(SUMMA_INCLUDES 
-            "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-            ${netCDF_INCLUDES}
-            ${LAPACK_INCLUDES})
-
-        set(SUMMA_LIBS
-            -lnetcdff
-            ${netCDF_LIBRARIES}
-            ${LAPACK_LIBRARIES}
-            SUMMA_NOAHMP)
-
-        set(SUMMA_ACTORS_INCLUDES
-            ${CAF_INCLUDES}
-            "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-            ${LAPACK_INCLUDES}
-            "${PARENT_DIR}/build/includes/global"
-            "${PARENT_DIR}/build/includes/summa_actor"
-            "${PARENT_DIR}/build/includes/gru_actor"
-            "${PARENT_DIR}/build/includes/job_actor"
-            "${PARENT_DIR}/build/includes/file_access_actor"
-            "${PARENT_DIR}/build/includes/hru_actor")
-
-        set(SUMMA_ACTORS_LIBS   
-            ${CAF_LIBRARIES}
-            ${netCDF_LIBRARIES}
-            ${LAPACK_LIBRARIES}
-            -lcaf_core
-            -lcaf_io
-            summa
-            -lnetcdff)
-    else()
-        set(CMAKE_BUILD_RPATH "/usr/local/lib")
-        set(SUMMA_INCLUDES
-            "/usr/include"
-            ${netCDF_INCLUDES}
-            ${LAPACK_INCLUDES})
-        
-        set(SUMMA_LIBS
-            -lnetcdff
-            -lopenblas
-            SUMMA_NOAHMP)
-
-        set(SUMMA_ACTORS_INCLUDES
-            "/usr/local/actor-framework/debug/include"
-            ${CAF_INCLUDES}
-            ${LAPACK_INCLUDES}
-            "${PARENT_DIR}/build/includes/global"
-            "${PARENT_DIR}/build/includes/summa_actor"
-            "${PARENT_DIR}/build/includes/gru_actor"
-            "${PARENT_DIR}/build/includes/job_actor"
-            "${PARENT_DIR}/build/includes/file_access_actor"
-            "${PARENT_DIR}/build/includes/hru_actor")
-        
-        link_directories("/usr/local/actor-framework/debug/lib")
-        set(SUMMA_ACTORS_LIBS   
-            -lopenblas
-            -lcaf_core
-            -lcaf_io
-            summa
-            -lnetcdff)
-    endif()
-
-    set(ACTORS_DIR ${PARENT_DIR}/build/source/actors)
-    set(DRIVER_DIR ${PARENT_DIR}/build/source/driver)
-    set(DSHARE_DIR ${PARENT_DIR}/build/source/dshare)
-    set(ENGINE_DIR ${PARENT_DIR}/build/source/engine)
-    set(HOOKUP_DIR ${PARENT_DIR}/build/source/hookup)
-    set(NETCDF_DIR ${PARENT_DIR}/build/source/netcdf)
-    set(NOAHMP_DIR ${PARENT_DIR}/build/source/noah-mp)
-    set(FILE_ACCESS_DIR ${ACTORS_DIR}/file_access_actor)
-    set(JOB_ACTOR_DIR ${ACTORS_DIR}/job_actor)
-    set(HRU_ACTOR_DIR ${ACTORS_DIR}/hru_actor)
-    set(GRU_ACTOR_DIR ${ACTORS_DIR}/gru_actor)
-    set(SUMMA_DSHARE_DIR ${PARENT_DIR}/build/summa/build/source/dshare)
-    set(SUMMA_ENGINE_DIR ${PARENT_DIR}/build/summa/build/source/engine)
-    set(SUMMA_NOAHMP_DIR ${PARENT_DIR}/build/summa/build/source/noah-mp)
-
-    set(NRUTIL
-        ${SUMMA_ENGINE_DIR}/nrtype.f90
-        ${SUMMA_ENGINE_DIR}/f2008funcs.f90
-        ${SUMMA_ENGINE_DIR}/nr_utility.f90)
-
-    set(NRPROC
-        ${SUMMA_ENGINE_DIR}/expIntegral.f90
-        ${SUMMA_ENGINE_DIR}/spline_int.f90)
-
-    SET(HOOKUP
-        ${HOOKUP_DIR}/ascii_util.f90
-        ${HOOKUP_DIR}/summaActors_FileManager.f90)
-
-    SET(DATAMS 
-        ${SUMMA_DSHARE_DIR}/multiconst.f90
-        ${DSHARE_DIR}/csv_file.f90
-        ${DSHARE_DIR}/var_lookup.f90
-        ${DSHARE_DIR}/data_types.f90
-        ${DSHARE_DIR}/globalData.f90
-        ${SUMMA_DSHARE_DIR}/flxMapping.f90)
-
-    SET(DEPENDS_ON_FILEMANAGER
-        ${SUMMA_DSHARE_DIR}/get_ixname.f90
-        ${SUMMA_DSHARE_DIR}/popMetadat.f90
-        ${SUMMA_DSHARE_DIR}/outpt_stat.f90)
-
-    SET(UTILMS
-        ${SUMMA_ENGINE_DIR}/time_utils.f90
-        ${ENGINE_DIR}/mDecisions.f90
-        ${SUMMA_ENGINE_DIR}/snow_utils.f90
-        ${SUMMA_ENGINE_DIR}/soil_utils.f90
-        ${SUMMA_ENGINE_DIR}/updatState.f90
-        ${SUMMA_ENGINE_DIR}/matrixOper.f90)
-
-    set(SOLVER
-        ${ENGINE_DIR}/vegPhenlgy.f90
-        ${SUMMA_ENGINE_DIR}/diagn_evar.f90
-        ${SUMMA_ENGINE_DIR}/stomResist.f90
-        ${SUMMA_ENGINE_DIR}/groundwatr.f90
-        ${SUMMA_ENGINE_DIR}/vegSWavRad.f90
-        ${SUMMA_ENGINE_DIR}/vegNrgFlux.f90
-        ${SUMMA_ENGINE_DIR}/ssdNrgFlux.f90
-        ${SUMMA_ENGINE_DIR}/vegLiqFlux.f90
-        ${SUMMA_ENGINE_DIR}/snowLiqFlx.f90
-        ${SUMMA_ENGINE_DIR}/soilLiqFlx.f90
-        ${SUMMA_ENGINE_DIR}/bigAquifer.f90
-        ${SUMMA_ENGINE_DIR}/computFlux.f90
-        ${SUMMA_ENGINE_DIR}/computResid.f90
-        ${SUMMA_ENGINE_DIR}/computJacob.f90
-        ${SUMMA_ENGINE_DIR}/eval8summa.f90
-        ${SUMMA_ENGINE_DIR}/summaSolve.f90
-        ${SUMMA_ENGINE_DIR}/systemSolv.f90
-        ${SUMMA_ENGINE_DIR}/varSubstep.f90
-        ${SUMMA_ENGINE_DIR}/opSplittin.f90
-        ${ENGINE_DIR}/coupled_em.f90)
-
-    set(INTERFACE
-        ${ACTORS_DIR}/global/cppwrap_datatypes.f90
-        ${ACTORS_DIR}/global/cppwrap_auxiliary.f90
-        ${ACTORS_DIR}/global/cppwrap_metadata.f90)
-
-    set(FILE_ACCESS_INTERFACE
-        ${FILE_ACCESS_DIR}/fortran_code/output_structure.f90
-        ${FILE_ACCESS_DIR}/fortran_code/cppwrap_fileAccess.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_attribute.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_forcing.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_param.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_initcond.f90
-        ${FILE_ACCESS_DIR}/fortran_code/writeOutputFromOutputStructure.f90
-        ${FILE_ACCESS_DIR}/fortran_code/write_to_netcdf.f90)
-
-    set(JOB_INTERFACE
-        ${JOB_ACTOR_DIR}/job_actor.f90)
-
-    set(HRU_INTERFACE
-        ${HRU_ACTOR_DIR}/fortran_code/model_run.f90
-        ${HRU_ACTOR_DIR}/fortran_code/setup_hru.f90
-        ${HRU_ACTOR_DIR}/fortran_code/restart.f90
-        ${HRU_ACTOR_DIR}/fortran_code/hru_actor.f90
-        ${HRU_ACTOR_DIR}/fortran_code/init_hru_actor.f90
-        ${HRU_ACTOR_DIR}/fortran_code/outputStrucWrite.f90
-        ${HRU_ACTOR_DIR}/fortran_code/hru_writeOutput.f90)
-
-    set(GRU_INTERFACE
-        ${GRU_ACTOR_DIR}/gru_actor.f90)
-
-    set(PRELIM
-        ${SUMMA_ENGINE_DIR}/conv_funcs.f90
-        ${SUMMA_ENGINE_DIR}/sunGeomtry.f90
-        ${SUMMA_ENGINE_DIR}/convE2Temp.f90
-        ${ENGINE_DIR}/allocspaceActors.f90
-        ${ENGINE_DIR}/alloc_fileAccess.f90
-        ${ENGINE_DIR}/checkStruc.f90
-        ${SUMMA_ENGINE_DIR}/childStruc.f90
-        ${ENGINE_DIR}/ffile_info.f90
-        ${ENGINE_DIR}/read_dimension.f90
-        ${ENGINE_DIR}/read_pinit.f90
-        ${SUMMA_ENGINE_DIR}/pOverwrite.f90
-        ${SUMMA_ENGINE_DIR}/paramCheck.f90
-        ${ENGINE_DIR}/check_icondActors.f90)
-
-    set(NOAHMP
-        ${SUMMA_NOAHMP_DIR}/module_model_constants.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahutl.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahlsm.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahmplsm.F)
-
-    set(MODRUN
-        ${SUMMA_ENGINE_DIR}/indexState.f90
-        ${SUMMA_ENGINE_DIR}/getVectorz.f90
-        ${SUMMA_ENGINE_DIR}/updateVars.f90
-        ${SUMMA_ENGINE_DIR}/var_derive.f90
-        ${ENGINE_DIR}/derivforce.f90
-        ${ENGINE_DIR}/sundials/t2enthalpy.f90
-        ${SUMMA_ENGINE_DIR}/snowAlbedo.f90
-        ${SUMMA_ENGINE_DIR}/canopySnow.f90
-        ${SUMMA_ENGINE_DIR}/tempAdjust.f90
-        ${SUMMA_ENGINE_DIR}/snwCompact.f90
-        ${SUMMA_ENGINE_DIR}/layerMerge.f90
-        ${SUMMA_ENGINE_DIR}/layerDivide.f90
-        ${SUMMA_ENGINE_DIR}/volicePack.f90
-        ${SUMMA_ENGINE_DIR}/qTimeDelay.f90)
-
-    set(NETCDF
-        ${NETCDF_DIR}/netcdf_util.f90
-        ${NETCDF_DIR}/def_output.f90
-        ${NETCDF_DIR}/writeOutput.f90
-        ${NETCDF_DIR}/read_icondActors.f90)
-
-    set(DRIVER
-        ${DRIVER_DIR}/summaActors_type.f90
-        ${DRIVER_DIR}/summaActors_util.f90
-        ${DRIVER_DIR}/summaActors_globalData.f90
-        ${DRIVER_DIR}/summaActors_alarms.f90)
-
-    set(COMM_ALL
-        ${NRPROC}
-        ${DATAMS}
-        ${INTERFACE}
-        ${HOOKUP}
-        ${DEPENDS_ON_FILEMANAGER}
-        ${UTILMS})
-
-    set(SUMMA_ALL
-        ${NETCDF}
-        ${PRELIM}
-        ${MODRUN}
-        ${SOLVER}
-        ${DRIVER}
-        ${JOB_INTERFACE}
-        ${FILE_ACCESS_INTERFACE}
-        ${HRU_INTERFACE}
-        ${GRU_INTERFACE})
-
-    set(ACTORS_GLOBAL
-        ${ACTORS_DIR}/global/global.cpp
-        ${ACTORS_DIR}/global/timing_info.cpp
-        ${ACTORS_DIR}/global/message_atoms.cpp
-        ${ACTORS_DIR}/global/settings_functions.cpp
-        ${ACTORS_DIR}/global/auxiliary.cpp)
-
-    set(SUMMA_ACTOR
-        ${ACTORS_DIR}/summa_actor/summa_actor.cpp
-        ${ACTORS_DIR}/summa_actor/summa_client.cpp
-        ${ACTORS_DIR}/summa_actor/summa_server.cpp
-        ${ACTORS_DIR}/summa_actor/summa_backup_server.cpp
-        ${ACTORS_DIR}/summa_actor/batch/batch.cpp
-        ${ACTORS_DIR}/summa_actor/batch/batch_container.cpp
-        ${ACTORS_DIR}/summa_actor/client/client.cpp
-        ${ACTORS_DIR}/summa_actor/client/client_container.cpp)
-
-    set(HRU_ACTOR
-        ${ACTORS_DIR}/hru_actor/cpp_code/hru_actor.cpp)
-
-    set(GRU_ACTOR
-        ${ACTORS_DIR}/gru_actor/gru_actor.cpp)
-
-    set(FILE_ACCESS_ACTOR
-        ${ACTORS_DIR}/file_access_actor/cpp_code/file_access_actor.cpp
-        ${ACTORS_DIR}/file_access_actor/cpp_code/forcing_file_info.cpp
-        ${ACTORS_DIR}/file_access_actor/cpp_code/output_container.cpp)
-
-    set(JOB_ACTOR
-        ${ACTORS_DIR}/job_actor/job_actor.cpp
-        ${ACTORS_DIR}/job_actor/GRU.cpp)
-
-    set(MAIN
-        ${ACTORS_DIR}/main.cpp)
-
-    ####################### START OF COMPILATION ###########################################
-    # Build NOAH_MP Object
-    add_library(SUMMA_NOAHMP OBJECT
-        ${NOAHMP}
-        ${NRUTIL})
-        target_compile_options(SUMMA_NOAHMP PRIVATE ${SUMMA_NOAHMP_OPTIONS})
-        target_link_options(SUMMA_NOAHMP PRIVATE ${SUMMA_NOAHMP_OPTIONS})
-    # Build SUMMA_COMM Object
-    add_library(SUMMA_COMM OBJECT
-        ${COMM_ALL})
-        target_compile_options(SUMMA_COMM PRIVATE ${SUMMA_ALL_OPTIONS})
-        target_link_options(SUMMA_COMM PRIVATE ${SUMMA_ALL_OPTIONS})
-        target_include_directories(SUMMA_COMM PRIVATE ${SUMMA_INCLUDES})
-        target_link_libraries(SUMMA_COMM PUBLIC ${SUMMA_LIBS})
-    # Build SUMMA Shared Library
-    add_library(summa SHARED
-        ${SUMMA_ALL})
-    target_compile_options(summa PRIVATE ${SUMMA_ALL_OPTIONS})
-    target_link_options(summa PRIVATE ${SUMMA_ALL_OPTIONS})
-    target_include_directories(summa PUBLIC ${SUMMA_INCLUDES})
-    target_link_libraries(summa PUBLIC ${SUMMA_LIBS} SUMMA_COMM)
-    # Build SUMMA Executable
-    add_executable(${EXEC_NAME}
-        ${ACTORS_GLOBAL}
-        ${HRU_ACTOR}
-        ${GRU_ACTOR}
-        ${FILE_ACCESS_ACTOR}
-        ${JOB_ACTOR}
-        ${SUMMA_ACTOR}
-        ${SUMMA_CLIENT}
-        ${SUMMA_SERVER}
-        ${MAIN})
-        set_property(TARGET ${EXEC_NAME} PROPERTY LINKER_LANGUAGE Fortran)
-        target_include_directories(${EXEC_NAME} PUBLIC ${SUMMA_ACTORS_INCLUDES})
-        target_link_libraries( ${EXEC_NAME} ${SUMMA_ACTORS_LIBS})
-
-endfunction()
\ No newline at end of file
diff --git a/build/cmake/ida.cmake b/build/cmake/ida.cmake
deleted file mode 100644
index 248f1311408af165d903e3c9f6ec10cd1a9cd035..0000000000000000000000000000000000000000
--- a/build/cmake/ida.cmake
+++ /dev/null
@@ -1,296 +0,0 @@
-function(compile_with_ida PARENT_DIR, DIR_SUNDIALS)
-    find_package(LAPACK REQUIRED)
-    set(EXEC_NAME summa_sundials)
-
-    link_directories(${DIR_SUNDIALS}/lib64)
-    set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib64")
-    set(SUMMA_INCLUDES 
-        "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-        "${DIR_SUNDIALS}/include"
-        "${DIR_SUNDIALS}/fortran"
-        ${netCDF_INCLUDES}
-        ${LAPACK_INCLUDES})
-    
-    set(SUMMA_LIBS
-        -lsundials_fnvecmanyvector_mod 
-        -lsundials_fida_mod 
-        -lsundials_fnvecserial_mod 
-        -lsundials_fsunlinsoldense_mod 
-        -lsundials_fsunmatrixdense_mod 
-        -lnetcdff
-        -lopenblas
-        ${netCDF_LIBRARIES}
-        ${LAPACK_LIBRARIES}
-        SUMMA_NOAHMP)
-    
-    set(SUMMA_ACTORS_INCLUDES 
-        ${CAF_INCLUDES}
-        "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-        ${LAPACK_INCLUDES}
-        "${DIR_SUNDIALS}/include"
-        "${PARENT_DIR}/build/includes/global"
-        "${PARENT_DIR}/build/includes/summa_actor"
-        "${PARENT_DIR}/build/includes/gru_actor"
-        "${PARENT_DIR}/build/includes/job_actor"
-        "${PARENT_DIR}/build/includes/file_access_actor"
-        "${PARENT_DIR}/build/includes/hru_actor")
-
-    set(SUMMA_ACTORS_LIBS   
-        ${CAF_LIBRARIES}
-        ${netCDF_LIBRARIES}
-        ${LAPACK_LIBRARIES}
-        -lopenblas
-        -lcaf_core
-        -lcaf_io
-        summa
-        -lnetcdff
-        -lsundials_fnvecmanyvector_mod 
-        -lsundials_fida_mod 
-        -lsundials_fnvecserial_mod 
-        -lsundials_fsunlinsoldense_mod 
-        -lsundials_fsunmatrixdense_mod)
-
-
-    set(ACTORS_DIR ${PARENT_DIR}/build/source/actors)
-    set(DRIVER_DIR ${PARENT_DIR}/build/source/driver)
-    set(DSHARE_DIR ${PARENT_DIR}/build/source/dshare)
-    set(ENGINE_DIR ${PARENT_DIR}/build/source/engine)
-    set(HOOKUP_DIR ${PARENT_DIR}/build/source/hookup)
-    set(NETCDF_DIR ${PARENT_DIR}/build/source/netcdf)
-    set(NOAHMP_DIR ${PARENT_DIR}/build/source/noah-mp)
-    set(FILE_ACCESS_DIR ${ACTORS_DIR}/file_access_actor)
-    set(JOB_ACTOR_DIR ${ACTORS_DIR}/job_actor)
-    set(HRU_ACTOR_DIR ${ACTORS_DIR}/hru_actor)
-    set(GRU_ACTOR_DIR ${ACTORS_DIR}/gru_actor)
-    set(SUMMA_DSHARE_DIR ${PARENT_DIR}/build/summa-sundials/build/source/dshare)
-    set(SUMMA_ENGINE_DIR ${PARENT_DIR}/build/summa-sundials/build/source/engine)
-    set(SUMMA_NOAHMP_DIR ${PARENT_DIR}/build/summa-sundials/build/source/noah-mp)
-
-    set(NRUTIL
-        ${SUMMA_ENGINE_DIR}/nrtype.f90
-        ${SUMMA_ENGINE_DIR}/f2008funcs.f90
-        ${SUMMA_ENGINE_DIR}/nr_utility.f90)
-    
-    set(NRPROC
-        ${SUMMA_ENGINE_DIR}/expIntegral.f90
-        ${SUMMA_ENGINE_DIR}/spline_int.f90)
-    
-    SET(HOOKUP
-        ${HOOKUP_DIR}/ascii_util.f90
-        ${HOOKUP_DIR}/summaActors_FileManager.f90)
-    
-    SET(DATAMS
-        ${SUMMA_DSHARE_DIR}/multiconst.f90
-        ${SUMMA_DSHARE_DIR}/var_lookup.f90
-        ${DSHARE_DIR}/data_types.f90
-        ${DSHARE_DIR}/globalData.f90
-        ${SUMMA_DSHARE_DIR}/flxMapping.f90)
-    
-    SET(DEPENDS_ON_FILEMANAGER
-        ${SUMMA_DSHARE_DIR}/get_ixname.f90
-        ${SUMMA_DSHARE_DIR}/popMetadat.f90
-        ${SUMMA_DSHARE_DIR}/outpt_stat.f90)
-    
-    SET(UTILMS
-        ${SUMMA_ENGINE_DIR}/time_utils.f90
-        ${ENGINE_DIR}/sundials/mDecisions.f90
-        ${SUMMA_ENGINE_DIR}/snow_utils.f90
-        ${SUMMA_ENGINE_DIR}/soil_utils.f90
-        ${SUMMA_ENGINE_DIR}/soil_utilsAddSundials.f90
-        ${SUMMA_ENGINE_DIR}/updatState.f90
-        ${SUMMA_ENGINE_DIR}/updatStateSundials.f90
-        ${SUMMA_ENGINE_DIR}/matrixOper.f90)
-    
-    set(SOLVER
-        ${ENGINE_DIR}/vegPhenlgy.f90
-        ${SUMMA_ENGINE_DIR}/diagn_evar.f90
-        ${SUMMA_ENGINE_DIR}/stomResist.f90
-        ${SUMMA_ENGINE_DIR}/groundwatr.f90
-        ${SUMMA_ENGINE_DIR}/vegSWavRad.f90
-        ${SUMMA_ENGINE_DIR}/vegNrgFlux.f90
-        ${SUMMA_ENGINE_DIR}/ssdNrgFlux.f90
-        ${SUMMA_ENGINE_DIR}/vegLiqFlux.f90
-        ${SUMMA_ENGINE_DIR}/snowLiqFlx.f90
-        ${SUMMA_ENGINE_DIR}/soilLiqFlx.f90
-        ${SUMMA_ENGINE_DIR}/bigAquifer.f90
-        ${SUMMA_ENGINE_DIR}/computFlux.f90
-        ${SUMMA_ENGINE_DIR}/type4IDA.f90
-        ${SUMMA_ENGINE_DIR}/tol4IDA.f90 
-        ${SUMMA_ENGINE_DIR}/computEnthalpy.f90
-        ${SUMMA_ENGINE_DIR}/computHeatCap.f90
-        ${SUMMA_ENGINE_DIR}/computThermConduct.f90
-        ${SUMMA_ENGINE_DIR}/computResid.f90
-        ${SUMMA_ENGINE_DIR}/computJacob.f90
-        ${SUMMA_ENGINE_DIR}/eval8summa.f90
-        ${SUMMA_ENGINE_DIR}/summaSolve.f90
-        ${SUMMA_ENGINE_DIR}/systemSolv.f90
-        ${SUMMA_ENGINE_DIR}/computResidSundials.f90
-        ${SUMMA_ENGINE_DIR}/eval8summaSundials.f90
-        ${SUMMA_ENGINE_DIR}/computJacobSundials.f90
-        ${SUMMA_ENGINE_DIR}/computSnowDepth.f90
-        ${SUMMA_ENGINE_DIR}/summaSolveSundialsIDA.f90
-        ${SUMMA_ENGINE_DIR}/systemSolvSundials.f90
-        ${SUMMA_ENGINE_DIR}/varSubstep.f90
-        ${SUMMA_ENGINE_DIR}/varSubstepSundials.f90
-        ${SUMMA_ENGINE_DIR}/opSplittin.f90
-        ${ENGINE_DIR}/sundials/coupled_em.f90)
-    
-    set(INTERFACE
-        ${ACTORS_DIR}/global/cppwrap_datatypes.f90
-        ${ACTORS_DIR}/global/cppwrap_auxiliary.f90
-        ${ACTORS_DIR}/global/cppwrap_metadata.f90)
-    
-    set(FILE_ACCESS_INTERFACE
-        ${FILE_ACCESS_DIR}/fortran_code/output_structure.f90
-        ${FILE_ACCESS_DIR}/fortran_code/cppwrap_fileAccess.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_attribute.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_forcing.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_param.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_initcond.f90
-        ${FILE_ACCESS_DIR}/fortran_code/writeOutputFromOutputStructure.f90
-        ${FILE_ACCESS_DIR}/fortran_code/write_to_netcdf.f90)
-    
-    set(JOB_INTERFACE
-        ${JOB_ACTOR_DIR}/job_actor.f90)
-
-    set(HRU_INTERFACE
-        ${HRU_ACTOR_DIR}/fortran_code/model_run.f90
-        ${HRU_ACTOR_DIR}/fortran_code/setup_hru.f90
-        ${HRU_ACTOR_DIR}/fortran_code/restart.f90
-        ${HRU_ACTOR_DIR}/fortran_code/hru_actor.f90
-        ${HRU_ACTOR_DIR}/fortran_code/init_hru_actor.f90
-        ${HRU_ACTOR_DIR}/fortran_code/outputStrucWrite.f90
-        ${HRU_ACTOR_DIR}/fortran_code/hru_writeOutput.f90)
-
-    set(PRELIM
-        ${SUMMA_ENGINE_DIR}/conv_funcs.f90
-        ${SUMMA_ENGINE_DIR}/sunGeomtry.f90
-        ${SUMMA_ENGINE_DIR}/convE2Temp.f90
-        ${ENGINE_DIR}/allocspaceActors.f90
-        ${ENGINE_DIR}/alloc_fileAccess.f90
-        ${SUMMA_ENGINE_DIR}/checkStruc.f90
-        ${SUMMA_ENGINE_DIR}/childStruc.f90
-        ${ENGINE_DIR}/ffile_info.f90
-        ${ENGINE_DIR}/read_dimension.f90
-        ${ENGINE_DIR}/read_pinit.f90
-        ${SUMMA_ENGINE_DIR}/pOverwrite.f90
-        ${SUMMA_ENGINE_DIR}/paramCheck.f90
-        ${ENGINE_DIR}/check_icondActors.f90)
-    
-    set(NOAHMP
-        ${SUMMA_NOAHMP_DIR}/module_model_constants.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahutl.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahlsm.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahmplsm.F)
-    
-    set(MODRUN
-        ${SUMMA_ENGINE_DIR}/indexState.f90
-        ${SUMMA_ENGINE_DIR}/getVectorz.f90
-        ${SUMMA_ENGINE_DIR}/t2enthalpy.f90
-        ${SUMMA_ENGINE_DIR}/updateVars.f90
-        ${SUMMA_ENGINE_DIR}/updateVarsSundials.f90
-        ${SUMMA_ENGINE_DIR}/var_derive.f90
-        ${ENGINE_DIR}/derivforce.f90
-        ${SUMMA_ENGINE_DIR}/snowAlbedo.f90
-        ${SUMMA_ENGINE_DIR}/canopySnow.f90
-        ${SUMMA_ENGINE_DIR}/tempAdjust.f90
-        ${SUMMA_ENGINE_DIR}/snwCompact.f90
-        ${SUMMA_ENGINE_DIR}/layerMerge.f90
-        ${SUMMA_ENGINE_DIR}/layerDivide.f90
-        ${SUMMA_ENGINE_DIR}/volicePack.f90
-        ${SUMMA_ENGINE_DIR}/qTimeDelay.f90)
-
-    set(NETCDF
-        ${NETCDF_DIR}/netcdf_util.f90
-        ${NETCDF_DIR}/def_output.f90
-        ${NETCDF_DIR}/writeOutput.f90
-        ${NETCDF_DIR}/read_icondActors.f90)
-
-    set(DRIVER
-        ${DRIVER_DIR}/summaActors_type.f90
-        ${DRIVER_DIR}/summaActors_util.f90
-        ${DRIVER_DIR}/summaActors_globalData.f90
-        ${DRIVER_DIR}/summaActors_alarms.f90)
-
-    set(COMM_ALL
-        ${NRPROC}
-        ${DATAMS}
-        ${INTERFACE}
-        ${HOOKUP}
-        ${DEPENDS_ON_FILEMANAGER}
-        ${UTILMS})
-
-    set(SUMMA_ALL
-        ${NETCDF}
-        ${PRELIM}
-        ${MODRUN}
-        ${SOLVER}
-        ${DRIVER}
-        ${JOB_INTERFACE}
-        ${FILE_ACCESS_INTERFACE}
-        ${HRU_INTERFACE}
-        ${GRU_INTERFACE})
-
-    set(ACTORS_GLOBAL
-        ${ACTORS_DIR}/global/global.cpp
-        ${ACTORS_DIR}/global/timing_info.cpp
-        ${ACTORS_DIR}/global/message_atoms.cpp
-        ${ACTORS_DIR}/global/settings_functions.cpp
-        ${ACTORS_DIR}/global/auxiliary.cpp)
-
-    set(SUMMA_ACTOR
-        ${ACTORS_DIR}/summa_actor/summa_actor.cpp
-        ${ACTORS_DIR}/summa_actor/summa_client.cpp
-        ${ACTORS_DIR}/summa_actor/summa_server.cpp
-        ${ACTORS_DIR}/summa_actor/summa_backup_server.cpp
-        ${ACTORS_DIR}/summa_actor/batch/batch.cpp
-        ${ACTORS_DIR}/summa_actor/batch/batch_container.cpp
-        ${ACTORS_DIR}/summa_actor/client/client.cpp
-        ${ACTORS_DIR}/summa_actor/client/client_container.cpp)
-
-    set(HRU_ACTOR
-        ${ACTORS_DIR}/hru_actor/cpp_code/hru_actor.cpp)
-
-    set(FILE_ACCESS_ACTOR
-        ${ACTORS_DIR}/file_access_actor/cpp_code/file_access_actor.cpp
-        ${ACTORS_DIR}/file_access_actor/cpp_code/forcing_file_info.cpp
-        ${ACTORS_DIR}/file_access_actor/cpp_code/output_container.cpp)
-
-    set(JOB_ACTOR
-        ${ACTORS_DIR}/job_actor/job_actor.cpp
-        ${ACTORS_DIR}/job_actor/GRU.cpp)
-
-    set(MAIN
-        ${ACTORS_DIR}/main.cpp)
-    
-    add_library(SUMMA_NOAHMP OBJECT
-        ${NOAHMP}
-        ${NRUTIL})
-        target_compile_options(SUMMA_NOAHMP PRIVATE ${SUMMA_NOAHMP_OPTIONS})
-    add_library(SUMMA_COMM OBJECT
-        ${COMM_ALL})
-        target_compile_options(SUMMA_COMM PRIVATE ${SUMMA_ALL_OPTIONS})
-        target_include_directories(SUMMA_COMM PRIVATE ${SUMMA_INCLUDES})
-        target_link_libraries(SUMMA_COMM PUBLIC ${SUMMA_LIBS})
-
-    # Build SUMMA Shared Library
-    add_library(summa SHARED
-        ${SUMMA_ALL})
-    target_compile_options(summa PRIVATE ${SUMMA_ALL_OPTIONS})
-    target_include_directories(summa PUBLIC ${SUMMA_INCLUDES})
-    target_link_libraries(summa PUBLIC ${SUMMA_LIBS} SUMMA_COMM)
-
-    # Build Summa-Actors executable
-    add_executable(${EXEC_NAME}
-        ${ACTORS_GLOBAL}
-        ${HRU_ACTOR}
-        ${FILE_ACCESS_ACTOR}
-        ${JOB_ACTOR}
-        ${SUMMA_ACTOR}
-        ${SUMMA_CLIENT}
-        ${SUMMA_SERVER}
-        ${MAIN})
-        set_property(TARGET ${EXEC_NAME} PROPERTY LINKER_LANGUAGE Fortran)
-        target_include_directories(${EXEC_NAME} PUBLIC ${SUMMA_ACTORS_INCLUDES})
-        target_link_libraries( ${EXEC_NAME} ${SUMMA_ACTORS_LIBS})
-endfunction()
\ No newline at end of file
diff --git a/build/cmake/kinsol.cmake b/build/cmake/kinsol.cmake
deleted file mode 100644
index cd86d3ab7c699d2d6d19acc51e26327019822920..0000000000000000000000000000000000000000
--- a/build/cmake/kinsol.cmake
+++ /dev/null
@@ -1,343 +0,0 @@
-#####################################################################
-# Summa-Actors 2023 - Builds the Summa-Actors executable for Kinsol
-#####################################################################
-function(compile_with_kinsol PARENT_DIR, DIR_SUNDIALS)
-    find_package(LAPACK REQUIRED)
-    set(EXEC_NAME summa_kinsol)
-
-    # Set Includes and Libs for Summa-Actors
-    if (CMAKE_BUILD_TYPE MATCHES Cluster)
-        link_directories(${DIR_SUNDIALS}/lib64)
-        set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib64")
-        set(SUMMA_INCLUDES 
-            "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-            "${DIR_SUNDIALS}/include"
-            "${DIR_SUNDIALS}/fortran"
-            ${netCDF_INCLUDES}
-            ${LAPACK_INCLUDES})
-
-
-        set(SUMMA_LIBS
-            -lsundials_fkinsol_mod
-            -lsundials_fnvecserial_mod 
-            -lsundials_fsunmatrixdense_mod 
-            -lsundials_fsunlinsoldense_mod 
-            -lsundials_fsunnonlinsolnewton_mod
-            -lnetcdff
-            ${netCDF_LIBRARIES}
-            ${LAPACK_LIBRARIES}
-            SUMMA_NOAHMP)
-    
-
-        set(SUMMA_ACTORS_INCLUDES 
-            ${CAF_INCLUDES}
-            "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-            ${LAPACK_INCLUDES}
-            "${DIR_SUNDIALS}/include"
-            "${PARENT_DIR}/build/includes/global"
-            "${PARENT_DIR}/build/includes/summa_actor"
-            "${PARENT_DIR}/build/includes/gru_actor"
-            "${PARENT_DIR}/build/includes/job_actor"
-            "${PARENT_DIR}/build/includes/file_access_actor"
-            "${PARENT_DIR}/build/includes/hru_actor")
-    
-
-        set(SUMMA_ACTORS_LIBS   
-            ${CAF_LIBRARIES}
-            ${netCDF_LIBRARIES}
-            ${LAPACK_LIBRARIES}
-            -lcaf_core
-            -lcaf_io
-            summa
-            -lnetcdff
-            -lsundials_fkinsol_mod
-            -lsundials_fnvecserial_mod 
-            -lsundials_fsunmatrixdense_mod 
-            -lsundials_fsunlinsoldense_mod 
-            -lsundials_fsunnonlinsolnewton_mod)
-
-    else()
-        link_directories(${DIR_SUNDIALS}/lib)
-        set(CMAKE_BUILD_RPATH "${DIR_SUNDIALS}/lib:/usr/local/lib")
-        set(SUMMA_INCLUDES
-            "/usr/include"
-            "${DIR_SUNDIALS}/include"
-            "${DIR_SUNDIALS}/fortran"
-            ${netCDF_INCLUDES}
-            ${LAPACK_INCLUDES})
-
-        set(SUMMA_LIBS
-            -lsundials_fkinsol_mod
-            -lsundials_fnvecserial_mod 
-            -lsundials_fsunmatrixdense_mod 
-            -lsundials_fsunlinsoldense_mod 
-            -lsundials_fsunnonlinsolnewton_mod
-            -lnetcdff
-            -lopenblas
-            SUMMA_NOAHMP)
-        
-        set(SUMMA_ACTORS_INCLUDES 
-            ${CAF_INCLUDES}
-            "$ENV{EBROOTNETCDFMINFORTRAN}/include"
-            ${LAPACK_INCLUDES}
-            "${DIR_SUNDIALS}/include"
-            "${PARENT_DIR}/build/includes/global"
-            "${PARENT_DIR}/build/includes/summa_actor"
-            "${PARENT_DIR}/build/includes/gru_actor"
-            "${PARENT_DIR}/build/includes/job_actor"
-            "${PARENT_DIR}/build/includes/file_access_actor"
-            "${PARENT_DIR}/build/includes/hru_actor")
-        
-        set(SUMMA_ACTORS_LIBS   
-            -lopenblas
-            -lcaf_core
-            -lcaf_io
-            summa
-            -lnetcdff
-            -lsundials_fkinsol_mod
-            -lsundials_fnvecserial_mod 
-            -lsundials_fsunmatrixdense_mod 
-            -lsundials_fsunlinsoldense_mod 
-            -lsundials_fsunnonlinsolnewton_mod)
-    endif()
-
-
-
-
-    set(ACTORS_DIR ${PARENT_DIR}/build/source/actors)
-    set(DRIVER_DIR ${PARENT_DIR}/build/source/driver)
-    set(DSHARE_DIR ${PARENT_DIR}/build/source/dshare)
-    set(ENGINE_DIR ${PARENT_DIR}/build/source/engine)
-    set(HOOKUP_DIR ${PARENT_DIR}/build/source/hookup)
-    set(NETCDF_DIR ${PARENT_DIR}/build/source/netcdf)
-    set(NOAHMP_DIR ${PARENT_DIR}/build/source/noah-mp)
-    set(FILE_ACCESS_DIR ${ACTORS_DIR}/file_access_actor)
-    set(JOB_ACTOR_DIR ${ACTORS_DIR}/job_actor)
-    set(HRU_ACTOR_DIR ${ACTORS_DIR}/hru_actor)
-    set(GRU_ACTOR_DIR ${ACTORS_DIR}/gru_actor)
-    set(SUMMA_DSHARE_DIR ${PARENT_DIR}/build/summa_kinsol/build/source/dshare)
-    set(SUMMA_ENGINE_DIR ${PARENT_DIR}/build/summa_kinsol/build/source/engine)
-    set(SUMMA_NOAHMP_DIR ${PARENT_DIR}/build/summa_kinsol/build/source/noah-mp)
-
-    set(NRUTIL
-        ${SUMMA_ENGINE_DIR}/nrtype.f90
-        ${SUMMA_ENGINE_DIR}/f2008funcs.f90
-        ${SUMMA_ENGINE_DIR}/nr_utility.f90)
-
-    set(NRPROC
-        ${SUMMA_ENGINE_DIR}/expIntegral.f90
-        ${SUMMA_ENGINE_DIR}/spline_int.f90)
-
-    SET(HOOKUP
-        ${HOOKUP_DIR}/ascii_util.f90
-        ${HOOKUP_DIR}/summaActors_FileManager.f90)
-
-    SET(DATAMS 
-        ${SUMMA_DSHARE_DIR}/multiconst.f90
-        ${DSHARE_DIR}/csv_file.f90
-        ${DSHARE_DIR}/var_lookup.f90
-        ${DSHARE_DIR}/data_types.f90
-        ${DSHARE_DIR}/globalData.f90
-        ${SUMMA_DSHARE_DIR}/flxMapping.f90
-        ${SUMMA_DSHARE_DIR}/kinsol_user_data_type.f90)
-
-    SET(DEPENDS_ON_FILEMANAGER
-        ${SUMMA_DSHARE_DIR}/get_ixname.f90
-        ${SUMMA_DSHARE_DIR}/popMetadat.f90
-        ${SUMMA_DSHARE_DIR}/outpt_stat.f90)
-
-    SET(UTILMS
-        ${SUMMA_ENGINE_DIR}/time_utils.f90
-        ${ENGINE_DIR}/mDecisions.f90
-        ${SUMMA_ENGINE_DIR}/snow_utils.f90
-        ${SUMMA_ENGINE_DIR}/soil_utils.f90
-        ${SUMMA_ENGINE_DIR}/updatState.f90
-        ${SUMMA_ENGINE_DIR}/matrixOper.f90)
-
-    set(SOLVER
-        ${ENGINE_DIR}/vegPhenlgy.f90
-        ${SUMMA_ENGINE_DIR}/diagn_evar.f90
-        ${SUMMA_ENGINE_DIR}/stomResist.f90
-        ${SUMMA_ENGINE_DIR}/groundwatr.f90
-        ${SUMMA_ENGINE_DIR}/vegSWavRad.f90
-        ${SUMMA_ENGINE_DIR}/vegNrgFlux.f90
-        ${SUMMA_ENGINE_DIR}/ssdNrgFlux.f90
-        ${SUMMA_ENGINE_DIR}/vegLiqFlux.f90
-        ${SUMMA_ENGINE_DIR}/snowLiqFlx.f90
-        ${SUMMA_ENGINE_DIR}/soilLiqFlx.f90
-        ${SUMMA_ENGINE_DIR}/bigAquifer.f90
-        ${SUMMA_ENGINE_DIR}/computFlux.f90
-        ${SUMMA_ENGINE_DIR}/computResid.f90
-        ${SUMMA_ENGINE_DIR}/computJacob.f90
-        ${SUMMA_ENGINE_DIR}/eval8summa.f90
-        ${SUMMA_ENGINE_DIR}/systemSolv.f90
-        ${SUMMA_ENGINE_DIR}/varSubstep.f90
-        ${SUMMA_ENGINE_DIR}/opSplittin.f90
-        ${ENGINE_DIR}/coupled_em.f90)
-
-    set(INTERFACE
-        ${ACTORS_DIR}/global/cppwrap_datatypes.f90
-        ${ACTORS_DIR}/global/cppwrap_auxiliary.f90
-        ${ACTORS_DIR}/global/cppwrap_metadata.f90)
-
-    set(FILE_ACCESS_INTERFACE
-        ${FILE_ACCESS_DIR}/fortran_code/output_structure.f90
-        ${FILE_ACCESS_DIR}/fortran_code/cppwrap_fileAccess.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_attribute.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_forcing.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_param.f90
-        ${FILE_ACCESS_DIR}/fortran_code/read_initcond.f90
-        ${FILE_ACCESS_DIR}/fortran_code/writeOutputFromOutputStructure.f90
-        ${FILE_ACCESS_DIR}/fortran_code/write_to_netcdf.f90)
-
-    set(JOB_INTERFACE
-        ${JOB_ACTOR_DIR}/job_actor.f90)
-
-    set(HRU_INTERFACE
-        ${HRU_ACTOR_DIR}/fortran_code/model_run.f90
-        ${HRU_ACTOR_DIR}/fortran_code/setup_hru.f90
-        ${HRU_ACTOR_DIR}/fortran_code/restart.f90
-        ${HRU_ACTOR_DIR}/fortran_code/hru_actor.f90
-        ${HRU_ACTOR_DIR}/fortran_code/init_hru_actor.f90
-        ${HRU_ACTOR_DIR}/fortran_code/outputStrucWrite.f90
-        ${HRU_ACTOR_DIR}/fortran_code/hru_writeOutput.f90)
-
-    set(GRU_INTERFACE
-        ${GRU_ACTOR_DIR}/gru_actor.f90)
-
-    set(PRELIM
-        ${SUMMA_ENGINE_DIR}/conv_funcs.f90
-        ${SUMMA_ENGINE_DIR}/sunGeomtry.f90
-        ${SUMMA_ENGINE_DIR}/convE2Temp.f90
-        ${ENGINE_DIR}/allocspaceActors.f90
-        ${ENGINE_DIR}/alloc_fileAccess.f90
-        ${ENGINE_DIR}/checkStruc.f90
-        ${SUMMA_ENGINE_DIR}/childStruc.f90
-        ${ENGINE_DIR}/ffile_info.f90
-        ${ENGINE_DIR}/read_dimension.f90
-        ${ENGINE_DIR}/read_pinit.f90
-        ${SUMMA_ENGINE_DIR}/pOverwrite.f90
-        ${SUMMA_ENGINE_DIR}/paramCheck.f90
-        ${ENGINE_DIR}/check_icondActors.f90)
-
-    set(NOAHMP
-        ${SUMMA_NOAHMP_DIR}/module_model_constants.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahutl.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahlsm.F
-        ${SUMMA_NOAHMP_DIR}/module_sf_noahmplsm.F)
-
-    set(MODRUN
-        ${SUMMA_ENGINE_DIR}/indexState.f90
-        ${SUMMA_ENGINE_DIR}/getVectorz.f90
-        ${SUMMA_ENGINE_DIR}/updateVars.f90
-        ${SUMMA_ENGINE_DIR}/var_derive.f90
-        ${ENGINE_DIR}/derivforce.f90
-        ${ENGINE_DIR}/sundials/t2enthalpy.f90
-        ${SUMMA_ENGINE_DIR}/snowAlbedo.f90
-        ${SUMMA_ENGINE_DIR}/canopySnow.f90
-        ${SUMMA_ENGINE_DIR}/tempAdjust.f90
-        ${SUMMA_ENGINE_DIR}/snwCompact.f90
-        ${SUMMA_ENGINE_DIR}/layerMerge.f90
-        ${SUMMA_ENGINE_DIR}/layerDivide.f90
-        ${SUMMA_ENGINE_DIR}/volicePack.f90
-        ${SUMMA_ENGINE_DIR}/qTimeDelay.f90)
-
-    set(NETCDF
-        ${NETCDF_DIR}/netcdf_util.f90
-        ${NETCDF_DIR}/def_output.f90
-        ${NETCDF_DIR}/writeOutput.f90
-        ${NETCDF_DIR}/read_icondActors.f90)
-
-    set(DRIVER
-        ${DRIVER_DIR}/summaActors_type.f90
-        ${DRIVER_DIR}/summaActors_util.f90
-        ${DRIVER_DIR}/summaActors_globalData.f90
-        ${DRIVER_DIR}/summaActors_alarms.f90)
-
-    set(COMM_ALL
-        ${NRPROC}
-        ${DATAMS}
-        ${INTERFACE}
-        ${HOOKUP}
-        ${DEPENDS_ON_FILEMANAGER}
-        ${UTILMS})
-
-    set(SUMMA_ALL
-        ${NETCDF}
-        ${PRELIM}
-        ${MODRUN}
-        ${SOLVER}
-        ${DRIVER}
-        ${JOB_INTERFACE}
-        ${FILE_ACCESS_INTERFACE}
-        ${HRU_INTERFACE}
-        ${GRU_INTERFACE})
-
-    set(ACTORS_GLOBAL
-        ${ACTORS_DIR}/global/global.cpp
-        ${ACTORS_DIR}/global/timing_info.cpp
-        ${ACTORS_DIR}/global/message_atoms.cpp
-        ${ACTORS_DIR}/global/settings_functions.cpp
-        ${ACTORS_DIR}/global/auxiliary.cpp)
-
-    set(SUMMA_ACTOR
-        ${ACTORS_DIR}/summa_actor/summa_actor.cpp
-        ${ACTORS_DIR}/summa_actor/summa_client.cpp
-        ${ACTORS_DIR}/summa_actor/summa_server.cpp
-        ${ACTORS_DIR}/summa_actor/summa_backup_server.cpp
-        ${ACTORS_DIR}/summa_actor/batch/batch.cpp
-        ${ACTORS_DIR}/summa_actor/batch/batch_container.cpp
-        ${ACTORS_DIR}/summa_actor/client/client.cpp
-        ${ACTORS_DIR}/summa_actor/client/client_container.cpp)
-
-    set(HRU_ACTOR
-        ${ACTORS_DIR}/hru_actor/cpp_code/hru_actor.cpp)
-
-    set(GRU_ACTOR
-        ${ACTORS_DIR}/gru_actor/gru_actor.cpp)
-
-    set(FILE_ACCESS_ACTOR
-        ${ACTORS_DIR}/file_access_actor/cpp_code/file_access_actor.cpp
-        ${ACTORS_DIR}/file_access_actor/cpp_code/forcing_file_info.cpp
-        ${ACTORS_DIR}/file_access_actor/cpp_code/output_container.cpp)
-
-    set(JOB_ACTOR
-        ${ACTORS_DIR}/job_actor/job_actor.cpp
-        ${ACTORS_DIR}/job_actor/GRU.cpp)
-
-    set(MAIN
-        ${ACTORS_DIR}/main.cpp)
-
-    ####################### START OF COMPILATION ###########################################
-    # Build NOAH_MP Object
-    add_library(SUMMA_NOAHMP OBJECT
-        ${NOAHMP}
-        ${NRUTIL})
-        target_compile_options(SUMMA_NOAHMP PRIVATE ${SUMMA_NOAHMP_OPTIONS})
-    # Build SUMMA_COMM Object
-    add_library(SUMMA_COMM OBJECT
-        ${COMM_ALL})
-        target_compile_options(SUMMA_COMM PRIVATE ${SUMMA_ALL_OPTIONS})
-        target_include_directories(SUMMA_COMM PRIVATE ${SUMMA_INCLUDES})
-        target_link_libraries(SUMMA_COMM PUBLIC ${SUMMA_LIBS})
-    # Build SUMMA Shared Library
-    add_library(summa SHARED
-        ${SUMMA_ALL})
-    target_compile_options(summa PRIVATE ${SUMMA_ALL_OPTIONS})
-    target_include_directories(summa PUBLIC ${SUMMA_INCLUDES})
-    target_link_libraries(summa PUBLIC ${SUMMA_LIBS} SUMMA_COMM)
-    # Build SUMMA Executable
-    add_executable(${EXEC_NAME}
-        ${ACTORS_GLOBAL}
-        ${HRU_ACTOR}
-        ${GRU_ACTOR}
-        ${FILE_ACCESS_ACTOR}
-        ${JOB_ACTOR}
-        ${SUMMA_ACTOR}
-        ${SUMMA_CLIENT}
-        ${SUMMA_SERVER}
-        ${MAIN})
-        set_property(TARGET ${EXEC_NAME} PROPERTY LINKER_LANGUAGE Fortran)
-        target_include_directories(${EXEC_NAME} PUBLIC ${SUMMA_ACTORS_INCLUDES})
-        target_link_libraries( ${EXEC_NAME} ${SUMMA_ACTORS_LIBS})
-endfunction()
\ No newline at end of file
diff --git a/build/cmake/load_modules.sh b/build/cmake/load_modules.sh
deleted file mode 100755
index 245cd9837dbfe69fae3fa244d5e2b8b007582644..0000000000000000000000000000000000000000
--- a/build/cmake/load_modules.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/bash
-
-#### load modules if using Compute Canada or Copernicus ####
-module load gcc/9.3.0
-module load netcdf-fortran
-module load openblas
-module load caf
\ No newline at end of file
diff --git a/build/includes/file_access_actor/file_access_actor.hpp b/build/includes/file_access_actor/file_access_actor.hpp
index 7bffc19830faec90e1566500b9928ade4ac3f969..051f6e43807d71200c2013d2e23aedbffe6c104c 100644
--- a/build/includes/file_access_actor/file_access_actor.hpp
+++ b/build/includes/file_access_actor/file_access_actor.hpp
@@ -9,36 +9,37 @@
 #include "auxilary.hpp"
 #include "global.hpp"
 
+/*********************************************
+ * File Access Actor Fortran Functions
+ *********************************************/
+extern "C" {
+  void fileAccessActor_init_fortran(void* handle_forcing_file_info, int* num_forcing_files, int* num_timesteps,
+                                    int* num_timesteps_output_buffer, void* handle_output_ncid, int* startGRU,
+                                    int* numGRU, int* numHRU, int* err);
 
-// class Output_Container;
-
-struct netcdf_gru_actor_info {
-    int run_time_var_id;
-    int init_duration_var_id;
-    int forcing_duration_var_id;
-    int run_physics_duration_var_id;
-    int write_output_duration_var_id;
-    
-    int state_var_id; // The success of the GRU 1 = pass, 0 = fail
-    int num_attempts_var_id;
-};
+  void writeOutput_fortran(void* handle_ncid, int* num_steps, int* start_gru, int* max_gru, 
+                           bool* writeParamFlag, int* err);
 
+  void read_forcingFile(void* forcFileInfo, int* currentFile, int* stepsInFile,
+                        int* startGRU, int* numGRU, int* err);
 
-namespace caf {
+  void FileAccessActor_DeallocateStructures(void* handle_forcFileInfo, void* handle_ncid);
+  
+}
 
+/*********************************************
+ * File Access Actor state variables
+ *********************************************/
 
+namespace caf {
 struct file_access_state {
-    // Variables set on Spwan
+    // Variables set on Spawn
     caf::actor parent; 
     int start_gru;
     int num_gru;
 
-    netcdf_gru_actor_info gru_actor_stats;
-
-    // std::vector<hru_output_handles> vector_of_output_handles;
-
-    void *handle_forcing_file_info; // Handle for the forcing file information
-    void *handle_ncid;              // output file ids
+    void *handle_forcing_file_info = new_handle_file_info(); // Handle for the forcing file information
+    void *handle_ncid = new_handle_var_i();                  // output file ids
     int num_vectors_in_output_manager;
     int num_steps;
     int stepsInCurrentFile;
@@ -48,42 +49,11 @@ struct file_access_state {
     int num_output_steps;
 
     Output_Container* output_container;
-    // std::vector<int> failed_gru_index_list;
-    
-
-    // Output_Container *output_container;
-    std::vector<std::shared_ptr<output_partition>> output_partitions;
-    std::vector<std::shared_ptr<output_partition>> output_partitions_for_reruns;
-
 
     File_Access_Actor_Settings file_access_actor_settings;
 
     std::vector<Forcing_File_Info> forcing_file_list; // list of steps in file
 
-    // Variables for handling the inital conditions
-    int init_cond_ncid;
-
-    // Variables for hanlding attributes file
-    int attribute_ncid;
-    int num_var_in_attributes_file;
-    std::vector<std::vector<double>> attr_structs_for_hrus;
-    std::vector<std::vector<int>> type_structs_for_hrus;
-    std::vector<std::vector<long int>> id_structs_for_hrus;
-
-    // Variables for handling parameters file
-    int param_ncid;
-    std::vector<std::vector<std::vector<double>>> mpar_structs_for_hrus;
-    std::vector<std::vector<double>> bpar_structs_for_hrus;
-    std::vector<std::vector<double>> dpar_structs_for_hrus;
-    
-    int dpar_array_size;
-    int bpar_array_size;
-    int type_array_size;
-    bool param_file_exists;
-    int num_var_in_param_file;
-
-    // hru_output_handles output_handles;
-
      // Timing Variables
     TimingInfo file_access_timing;
 };
@@ -92,20 +62,12 @@ struct file_access_state {
 behavior file_access_actor(stateful_actor<file_access_state>* self, int startGRU, int numGRU, 
    File_Access_Actor_Settings file_access_actor_settings, actor parent);
 
-// Call Fortran functions that require file access and intialize the ffile_info structure
-void initalizeFileAccessActor(stateful_actor<file_access_state>* self);
-
-// Read in the attributes for all HRUs that are in the run-domain
-void readAttributes(stateful_actor<file_access_state>* self); 
-
-// read in the parameters for all HRUs that are in the run-domain
-void readParameters(stateful_actor<file_access_state>* self);
-
-// Read in the inital conditions for all the HRUs that are in the run-domain
-void readInitConditions(stateful_actor<file_access_state>* self);
+/*********************************************
+ * Functions for the file access actor
+ *********************************************/
 
-void initalizeOutputHandles(stateful_actor<file_access_state>* self);
+/* Setup and call the fortran routine that writes the output */
+void writeOutput(stateful_actor<file_access_state>* self, Output_Partition* partition);
 
-void deallocateOutputHandles(stateful_actor<file_access_state>* self);
  
 } // end namespace
\ No newline at end of file
diff --git a/build/includes/file_access_actor/file_access_actor_subroutine_wrappers.hpp b/build/includes/file_access_actor/file_access_actor_subroutine_wrappers.hpp
deleted file mode 100644
index 88ce743d0d42c5b748769ed231a59aaed3e6772f..0000000000000000000000000000000000000000
--- a/build/includes/file_access_actor/file_access_actor_subroutine_wrappers.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#pragma once
-#include "file_access_actor.hpp"
-
-extern "C" {
-  // initalizeFileAccessActor
-  void ffile_info(int* indxGRU, void* forcFileInfo, int* numFiles, int* err);
-  void mDecisions(int* numSteps, int* err);
-  void read_pinit_C(int* err);
-  void read_vegitationTables(int* err);
-  void initFailedHRUTracker(int* numGRU);
-  void def_output(void* handle_ncid, int* startGRU, int* numGRU, int* numHRU, 
-       netcdf_gru_actor_info* actor_info, int* err);
-
-  // OutputStructure and Output functions
-  void initOutputStructure(void* handle_forcFileInfo, int* max_steps, int* numGRU, int* err);
-  void deallocateOutputStructure(int* err);
-  void writeOutput(void* handle_ncid, int* num_steps, int* start_gru, int* max_gru, int* err);
-  void initOutputTimeStep(int* num_gru, int* err);
-
-  // Attributes Files- called inside initalizeFileAccessActor
-  void allocateAttributeStructures(int* index_gru, int* index_hru, void* handle_attr_struct, 
-      void* handle_type_struct, void* handle_id_struct, int* err);
-  void openAttributeFile(int* att_ncid, int* err);
-  void getNumVarAttr(int* attr_ncid, int* num_var_attr, int* err);
-  void closeAttributeFile(int* attr_ncid, int* err);
-  void readAttributeFromNetCDF(int* attr_ncid, int* index_gru, int* index_hru, int* num_var,
-    void* attr_array, void* type_array, void* id_array, int* err);
-  
-  // Parameters File - called inside initalizeFileAccessActor
-  void allocateParamStructures(int* index_gru, int* index_hru, void* handle_dpar_struct,
-      void* handle_mpar_struct, void* handle_bpar_struct, int* err);
-  void openParamFile(int* param_ncid, bool* param_file_exists, int* err);
-  void getNumVarParam(int* param_ncid, int* num_var_param, int* err);
-  void closeParamFile(int* param_ncid, int* err);
-  void getParamSizes(int* dpar_array_size, int* bpar_array_size, int* type_array_size);
-  void overwriteParam(int* index_gru, int* index_hru,
-    void* handle_type_struct, void* handle_dpar_struct, void* handle_mpar_struct, 
-    void* handle_bpar_struct, int* err);
-  void readParamFromNetCDF(int* param_ncid, int* index_gru, int* index_hru, int* start_index_gru,
-    int* num_var_param, void* handle_mpar_struct, void* _handle_bpar_struct, int* err);
-
-  // Set up global initial conditions
-  void openInitCondFile(int* init_cond_ncid, int* err);
-  void closeInitCondFile(int* init_cond_ncid, int* err);
-  void readInitCond_prog(int* init_cond_ncid, int* start_gru, int* num_gru, int* err);
-  void readInitCond_bvar(int* init_cond_ncid, int* start_gru, int* num_gru, int* err);
-
-  void updateFailed(int* indxHRU);
-
-  void resetFailedArray();
-
-  void resetOutputCounter(int* indxGRU);
-
-  void read_forcingFile(void* forcFileInfo, int* currentFile, int* stepsInFile,
-         int* startGRU, int* numGRU, int* err);
-
-  void FileAccessActor_DeallocateStructures(void* handle_forcFileInfo, void* handle_ncid);
-  
-
-  // Writing to NETCDF
-  void writeParamToNetCDF(void* handle_ncid, int* index_gru, int* index_hru,
-    void* handle_attr_struct, void* handle_type_struct, void* handle_mpar_struct,
-    void* handle_bpar_struct, int* err);
-
-  void writeDataToNetCDF(void* handle_ncid, int* index_gru, int* index_hru,
-    void* handle_finalize_stats, void* handle_forc_stat, void* handle_forc_struct,
-    void* handle_prog_stat, void* handle_prog_struct, void* handle_diag_stat,
-    void* handle_diag_struct, void* handle_flux_stat, void* handle_flux_struct,
-    void* handle_indx_stat, void* handle_indx_struct, void* handle_output_timestep,
-    int* err);
-
-  void writeBasinToNetCDF(void* handle_ncid, int* index_gru, void* handle_finalize_stats,
-    void* handle_output_timestep, void* handle_bvar_stat, void* handle_bvar_struct, int* err);
-
-  void writeTimeToNetCDF(void* handle_ncid, void* handle_finalize_stats, void* handle_output_timestep,
-    void* handle_time_struct, int* err);
-
-  void WriteGRUStatistics(void* handle_ncid, netcdf_gru_actor_info* actor_info,
-    serializable_netcdf_gru_actor_info* gru_stats_vector, int* num_gru, int* err);
-
-  
-
-
-
-
-
-
-  
-}
diff --git a/build/includes/file_access_actor/output_container.hpp b/build/includes/file_access_actor/output_container.hpp
index ee6419118a747e499753940695029370facbf787..203c94c272255951384d84511a4cd667d3f069c9 100644
--- a/build/includes/file_access_actor/output_container.hpp
+++ b/build/includes/file_access_actor/output_container.hpp
@@ -16,12 +16,13 @@
  */
 class Output_Partition {
   private:
-    int start_local_gru_index; // The index of the first GRU in the partition
-    int end_local_gru_index; // The index of the last GRU in the partition
-    int num_local_grus; // The number of GRUs in the partition
-    int num_active_grus; // The number of GRUs that have not failed
+    int start_local_gru_index;    // The index of the first GRU in the partition
+    int end_local_gru_index;      // The index of the last GRU in the partition
+    int num_local_grus;           // The number of GRUs in the partition
+    int num_active_grus;          // The number of GRUs that have not failed
     int num_timesteps_simulation; // The number of timesteps in the simulation
-    int num_stored_timesteps; // The number of timesteps held within the partition
+    int num_stored_timesteps;     // The number of timesteps held within the partition
+    bool write_params = true;     // Flag to write the parameters to the output file (only performed once)
 
     std::vector<caf::actor> ready_to_write_list;
     std::vector<int> failed_gru_index_list; // The list of GRUs that have failed
@@ -58,13 +59,14 @@ class Output_Partition {
 
     std::vector<int> getFailedGRUIndexList();
 
-
     int getNumActiveGRUs();
 
     int getNumLocalGRUs();
 
     int getRemainingTimesteps();
 
+    bool isWriteParams();
+
 };
 
 
@@ -105,112 +107,3 @@ class Output_Container {
     std::vector<int> getFailedGRUIndexList();
 
 };
-
-
-struct hru_output_handles {
-    // Statistic Structures
-    void* handle_forc_stat        = new_handle_var_dlength();
-    void* handle_prog_stat        = new_handle_var_dlength();
-    void* handle_diag_stat        = new_handle_var_dlength();
-    void* handle_flux_stat        = new_handle_var_dlength();
-    void* handle_indx_stat        = new_handle_var_dlength();
-    void* handle_bvar_stat        = new_handle_var_dlength();
-    // primary data structures (scalars)
-    void* handle_time_struct      = new_handle_var_i();
-    void* handle_forc_struct      = new_handle_var_d();
-    void* handle_attr_struct      = new_handle_var_d();
-    void* handle_type_struct      = new_handle_var_i();
-    void* handle_id_struct        = new_handle_var_i8();
-    // primary data structures (variable length vectors)
-    void* handle_indx_struct      = new_handle_var_ilength();
-    void* handle_mpar_struct      = new_handle_var_dlength();
-    void* handle_prog_struct      = new_handle_var_dlength();
-    void* handle_diag_struct      = new_handle_var_dlength();
-    void* handle_flux_struct      = new_handle_var_dlength();
-    // basin-average structures
-    void* handle_bpar_struct      = new_handle_var_d();
-    void* handle_bvar_struct      = new_handle_var_dlength();
-    // ancillary data structures
-    void* handle_dpar_struct      = new_handle_var_d();
-    void* handle_finalize_stats   = new_handle_var_i();
-    void* handle_output_timestep  = new_handle_var_i();
-
-    ~hru_output_handles() {
-        // statistics structures
-        delete_handle_var_dlength(handle_forc_stat);
-        delete_handle_var_dlength(handle_prog_stat);
-        delete_handle_var_dlength(handle_diag_stat);
-        delete_handle_var_dlength(handle_flux_stat);
-        delete_handle_var_dlength(handle_indx_stat);
-        delete_handle_var_dlength(handle_bvar_stat);
-        // primary data structures (scalars)
-        delete_handle_var_i(handle_time_struct);
-        delete_handle_var_d(handle_forc_struct);
-        delete_handle_var_d(handle_attr_struct);
-        delete_handle_var_i(handle_type_struct);
-        delete_handle_var_i8(handle_id_struct);
-        // primary data structures (variable length vectors)
-        delete_handle_var_ilength(handle_indx_struct);
-        delete_handle_var_dlength(handle_mpar_struct);
-        delete_handle_var_dlength(handle_prog_struct);
-        delete_handle_var_dlength(handle_diag_struct);
-        delete_handle_var_dlength(handle_flux_struct);
-        // basin-average structures
-        delete_handle_var_d(handle_bpar_struct);
-        delete_handle_var_dlength(handle_bvar_struct);
-        // ancillary data structures
-        delete_handle_var_d(handle_dpar_struct);
-        // counter variables
-        delete_handle_var_i(handle_output_timestep);
-        delete_handle_flagVec(handle_finalize_stats);
-    }
-};
-
-struct hru_output_info {
-    caf::actor hru_actor;
-    int index_hru;
-    int index_gru;
-    bool ready_to_write;
-};
-
-
-struct output_partition {
-    int start_gru;
-    int num_gru;
-    int num_active_gru;            
-    int num_timesteps;     
-    int simulation_timesteps_remaining;
-    int grus_ready_to_write;
-    // 2D matrix of output handles
-    std::vector<std::shared_ptr<hru_output_info>> hru_info_and_data;
-};
-
-
-
-// Take an unintialized vector of output partitions and initialize it
-void initArrayOfOuputPartitions(std::vector<std::shared_ptr<output_partition>>& output_partitions, 
-    int num_partitions, int num_gru, int num_timesteps,  int simulation_timesteps_remaining);
-
-// Add a HRU that is ready to write to the output structure
-std::optional<int> addReadyToWriteHRU(std::vector<std::shared_ptr<output_partition>>& output_partitions, 
-    caf::actor hru_actor, int gru_index, int hru_index);
-
-
-// find which partition the HRU belongs to
-int findPatritionIndex(int grus_per_partition, int gru_index, int num_partitions);
-
-// After writing to a file, update the number of timesteps remaining in the simulation
-void updateSimulationTimestepsRemaining(std::shared_ptr<output_partition>& output_partition);
-
-// After writing to a file, check if we need to send the hru a modified timestep value b/c we have less simulation timesteps remaining than 
-// the number of timesteps in the output file
-void updateNumTimeForPartition(std::shared_ptr<output_partition> &output_partition);
-
-void resetReadyToWrite(std::shared_ptr<output_partition> &output_partition);
-
-/*
- * Reduce the number of GRUs the partition is waiting on to write to file by 1
- * Check if the partition is ready to write to file and return the partition index if it is
-*/
-std::optional<int> updatePartitionWithFailedHRU(std::vector<std::shared_ptr<output_partition>>& output_partitions, 
-    int local_gru_index);
diff --git a/build/includes/file_access_actor/partition_actor.hpp b/build/includes/file_access_actor/partition_actor.hpp
deleted file mode 100644
index e4385d8e4bcf6ec20783cf22063b4015ffb487bd..0000000000000000000000000000000000000000
--- a/build/includes/file_access_actor/partition_actor.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-#include "caf/all.hpp"
-namespace caf {
-
-/*
-* This struct stores the information about a specific HRU
-*/
-struct hru_output_info {
-    caf::actor hru_actor;
-    int local_hru_index;
-    int local_gru_index;
-    bool ready_to_write;
-};
-
-
-struct partition_actor_state {
-    int start_local_gru_index; // The index of the first GRU in the partition
-    int num_local_grus; // The number of GRUs in the partition
-    int num_timesteps_simulation; // The number of timesteps in the simulation
-    int num_timesteps_buffer; // The number of timesteps this actor can hold before needing to write
-    int num_non_failed_grus = 0; // The number of GRUs that have not failed
-    bool grus_ready_to_write = false; // Whether or not all GRUs in the partition are ready to write
-
-    std::vector<std::unique_ptr<hru_output_info>> gru_list; // The GRU actors and their data
-
-
-};
-
-
-behavior partition_actor(stateful_actor<partition_actor_state>* self, int start_local_gru_index, 
-    int num_local_grus, int num_timesteps_simulation, int num_timesteps_buffer);
-
-
-}
\ No newline at end of file
diff --git a/build/includes/global/auxilary.hpp b/build/includes/global/auxilary.hpp
index 0a4c8fe220943c3dad402d3c7a96c947a09f0e9f..8dce676017ce4fdbc3f1e1b91aad657e007c944a 100644
--- a/build/includes/global/auxilary.hpp
+++ b/build/includes/global/auxilary.hpp
@@ -22,4 +22,9 @@ std::vector<double> get_dlength(void* handle);
 std::vector<std::vector<int> > get_var_flagVec(void* handle);
 std::vector<std::vector<int> > get_var_ilength(void* handle);
 std::vector<std::vector<long int> > get_var_i8length(void* handle);
-std::vector<std::vector<double> > get_var_dlength(void* handle);
\ No newline at end of file
+std::vector<std::vector<double> > get_var_dlength(void* handle);
+
+std::vector<double> get_attr_struct(void* handle);
+std::vector<int> get_type_struct(void* handle);
+std::vector<std::vector<double>> get_mpar_struct_array(void* handle);
+std::vector<double> get_bpar_struct(void* handle);
\ No newline at end of file
diff --git a/build/includes/global/fortran_data_types.hpp b/build/includes/global/fortran_data_types.hpp
index 1a0ed5412432c522e267f5071dc8e9cba1d4d1be..c8401d577e85590260e69199b99c5a8e07f62fa8 100644
--- a/build/includes/global/fortran_data_types.hpp
+++ b/build/includes/global/fortran_data_types.hpp
@@ -14,6 +14,8 @@ extern "C" {
     void  set_data_var_i(void* handle, const int* array, int size);
     void  get_size_data_var_i(void* handle, int* size);
     void  get_data_var_i(void* handle, int* array);
+    void  get_size_data_typeStruct(void* handle, int* size);
+    void  get_data_typeStruct(void* handle, int* array);
 
     // var_i8 
     void* new_handle_var_i8();
@@ -28,6 +30,10 @@ extern "C" {
     void  set_data_var_d(void* handle, const double* array, int size);
     void  get_size_data_var_d(void* handle, int* size);
     void  get_data_var_d(void* handle, double* array);
+    void  get_data_attrStruct(void* handle, double* array);
+    void  get_size_data_attrStruct(void* handle, int* size);
+    void  get_data_bparStruct(void* handle, double* array);
+    void  get_size_data_bparStruct(void* handle, int* size);
 
     // ilength
     void* new_handle_ilength();
@@ -50,6 +56,7 @@ extern "C" {
     void  get_size_data_dlength(void* handle, int* size);
     void  get_data_dlength(void* handle, double* array);
 
+
     // var_flagVec
     void* new_handle_var_flagVec();
     void  delete_handle_var_flagVec(void* handle);
@@ -81,6 +88,9 @@ extern "C" {
     void  get_size_var_dlength(void* handle, int* num_var);
     void  get_size_data_var_dlength(void* handle, int* num_var, int* num_dat);
     void  get_data_var_dlength(void* handle, double* array);
+    void  get_size_var_mparStruct(void* handle, int* num_var);
+    void  get_size_data_mparStruct(void* handle, int* num_var, int* num_dat);
+    void  get_data_mparStruct(void* handle, double* array);
 
     // var_dlength_array
     void* new_handle_dlength_array();
@@ -100,4 +110,8 @@ extern "C" {
     void* new_handle_z_lookup();
     void* delete_handle_z_lookup(void* handle);
 
+    // hru_type
+    void* new_handle_hru_type();
+    void delete_handle_hru_type(void* handle);
+
 }
\ No newline at end of file
diff --git a/build/includes/global/global.hpp b/build/includes/global/global.hpp
index 4730894760407f87809ef64543ac5ce299d95ea8..c5ac1a0be125b03bd2b2dc87fe4933a304e25875 100644
--- a/build/includes/global/global.hpp
+++ b/build/includes/global/global.hpp
@@ -17,6 +17,9 @@ struct serializable_netcdf_gru_actor_info {
 
     int successful; // 0 = false, 1 = true
     int num_attempts;
+
+    double rel_tol;
+    double abs_tol;
 };
 
 template<class Inspector>
@@ -27,7 +30,9 @@ bool inspect(Inspector& f, serializable_netcdf_gru_actor_info& x) {
                               f.field("run_physics_duration", x.run_physics_duration),
                               f.field("write_output_duration", x.write_output_duration),
                               f.field("successful", x.successful),
-                              f.field("num_attempts", x.num_attempts));
+                              f.field("num_attempts", x.num_attempts),
+                              f.field("rel_tol", x.rel_tol),
+                              f.field("abs_tol", x.abs_tol));
 }
 
 
diff --git a/build/includes/global/message_atoms.hpp b/build/includes/global/message_atoms.hpp
index 7306095c077fbb3098adac1b822673a52bba0172..49c13a5acf39a2fe1a660863849ad08101aee72c 100644
--- a/build/includes/global/message_atoms.hpp
+++ b/build/includes/global/message_atoms.hpp
@@ -1,9 +1,9 @@
 #pragma once
 
-#include "batch/batch.hpp"
-#include "batch/batch_container.hpp"
-#include "client/client.hpp"
-#include "client/client_container.hpp"
+#include "batch.hpp"
+#include "batch_container.hpp"
+#include "client.hpp"
+#include "client_container.hpp"
 #include <vector>
 #include "settings_functions.hpp"
 #include "global.hpp"
@@ -16,6 +16,8 @@ enum class hru_error : uint8_t {
 
 enum class file_access_error : uint8_t {
     writing_error = 1,
+    unhandleable_error = 2,
+    mDecisions_error = 100,
 };
 
 // HRU Errors
@@ -45,6 +47,7 @@ CAF_BEGIN_TYPE_ID_BLOCK(summa, first_custom_type_id)
     // Reciever: 
     // Summary:
     CAF_ADD_ATOM(summa, err)
+    CAF_ADD_ATOM(summa, err_atom)
     // Sender:
     // Reciever: 
     // Summary:
@@ -76,18 +79,6 @@ CAF_BEGIN_TYPE_ID_BLOCK(summa, first_custom_type_id)
     // Sender:
     // Reciever:
     // Summary:
-    CAF_ADD_ATOM(summa, done_file_access_actor_init)
-    // Sender:
-    // Reciever:
-    // Summary:
-    CAF_ADD_ATOM(summa, file_access_actor_done)
-    // Sender:
-    // Reciever:
-    // Summary:
-    CAF_ADD_ATOM(summa, file_access_actor_err)
-    // Sender:
-    // Reciever:
-    // Summary:
     CAF_ADD_ATOM(summa, access_forcing)
     // Sender:
     // Reciever:
@@ -193,6 +184,10 @@ CAF_BEGIN_TYPE_ID_BLOCK(summa, first_custom_type_id)
     // Reciever:
     // Summary:
     CAF_ADD_ATOM(summa, get_num_output_steps)
+    // Sender:
+    // Reciever:
+    // Summary:
+    CAF_ADD_ATOM(summa, finalize)
     
     // Struct Types
     CAF_ADD_TYPE_ID(summa, (Distributed_Settings))
@@ -216,6 +211,17 @@ CAF_BEGIN_TYPE_ID_BLOCK(summa, first_custom_type_id)
     CAF_ADD_TYPE_ID(summa, (std::vector<std::tuple<caf::actor, std::string>>))
     CAF_ADD_TYPE_ID(summa, (std::vector<serializable_netcdf_gru_actor_info>))
 
+    // GRU Parameter/Attribute Vectors
+    CAF_ADD_TYPE_ID(summa, (std::tuple<std::vector<double>, 
+                                       std::vector<int>, 
+                                       std::vector<long int>, 
+                                       std::vector<double>, 
+                                       std::vector<double>, 
+                                       std::vector<std::vector<double>>>))
+    
+    // File_Access_Actor Read/Write times
+    CAF_ADD_TYPE_ID(summa, (std::tuple<double, double>))
+
     CAF_ADD_TYPE_ID(summa, (std::optional<caf::strong_actor_ptr>))
 
     // error types
diff --git a/build/includes/global/settings_functions.hpp b/build/includes/global/settings_functions.hpp
index 706b7cfb383972b7b1931bf25877030a667b7e9e..9fec2fbd36b529c7fce0a7c75ff259cc97d4e2cc 100644
--- a/build/includes/global/settings_functions.hpp
+++ b/build/includes/global/settings_functions.hpp
@@ -1,6 +1,7 @@
 #pragma once
 #include <string>
 #include <vector>
+#include <thread>
 #include <optional>
 #include "json.hpp"
 #include <bits/stdc++.h>
@@ -96,13 +97,29 @@ bool inspect(Inspector& inspector, Job_Actor_Settings& job_actor_settings) {
 Job_Actor_Settings readJobActorSettings(std::string json_settings_file);
 
 // ####################################################################
-//                          SUMMA Actor Settings
+//                          HRU Actor Settings
 // ####################################################################
 
 struct HRU_Actor_Settings {
     bool print_output;
     int output_frequency;
     int dt_init_factor; // factor to multiply the initial timestep by
+    double rel_tol;
+    double abs_tol;
+    double relTolTempCas;
+    double absTolTempCas;
+    double relTolTempVeg;
+    double absTolTempVeg;
+    double relTolWatVeg;
+    double absTolWatVeg;
+    double relTolTempSoilSnow;
+    double absTolTempSoilSnow;
+    double relTolWatSnow;
+    double absTolWatSnow;
+    double relTolMatric;
+    double absTolMatric;
+    double relTolAquifr;
+    double absTolAquifr;
 };
 
 template<class Inspector>
@@ -110,7 +127,9 @@ bool inspect(Inspector& inspector, HRU_Actor_Settings& hru_actor_settings) {
     return inspector.object(hru_actor_settings).fields(
                 inspector.field("print_output",     hru_actor_settings.print_output),
                 inspector.field("output_frequency", hru_actor_settings.output_frequency),
-                inspector.field("dt_init_factor",   hru_actor_settings.dt_init_factor));
+                inspector.field("dt_init_factor",   hru_actor_settings.dt_init_factor),
+                inspector.field("rel_tol",          hru_actor_settings.rel_tol),
+                inspector.field("abs_tol",          hru_actor_settings.abs_tol));
 }
 
 HRU_Actor_Settings readHRUActorSettings(std::string json_settings_file);
@@ -121,12 +140,16 @@ HRU_Actor_Settings readHRUActorSettings(std::string json_settings_file);
 
 int checkFileExists(std::string file_path);
 
-// Read in the settings from JSON
+/**
+ * @brief Get the Settings from json
+ * Template function that can be used with retrieving any singular type from the settings file
+ */
 template <typename T>
 std::optional<T> getSettings(std::string json_settings_file, std::string key_1, std::string key_2, 
     T return_value) {
     json settings;
     std::ifstream settings_file(json_settings_file);
+    if (!settings_file.good()) return {};
     settings_file >> settings;
     settings_file.close();
     
@@ -159,4 +182,7 @@ std::optional<std::vector<std::string>> getSettingsArray(std::string json_settin
 // Check the settings - Print them out to stdout
 void check_settings_from_json(Distributed_Settings &distributed_settings, 
     Summa_Actor_Settings &summa_actor_settings, File_Access_Actor_Settings &file_access_actor_settings, 
-    Job_Actor_Settings &job_actor_settings, HRU_Actor_Settings &hru_actor_settings);
\ No newline at end of file
+    Job_Actor_Settings &job_actor_settings, HRU_Actor_Settings &hru_actor_settings);
+
+// Output a default configuration file
+void generate_config_file();
\ No newline at end of file
diff --git a/build/includes/global/timing_info.hpp b/build/includes/global/timing_info.hpp
index e246a6ca2593eacf94254e8306ebc62354b379da..9244428facaf9cfd19218ef53e7552d651b3a399 100644
--- a/build/includes/global/timing_info.hpp
+++ b/build/includes/global/timing_info.hpp
@@ -2,6 +2,7 @@
 #include <chrono>
 #include <optional>
 #include <vector>
+#include <string>
 
 using chrono_time = std::chrono::time_point<std::chrono::system_clock>;
 /**
diff --git a/build/includes/global/var_lookup.hpp b/build/includes/global/var_lookup.hpp
deleted file mode 100644
index e7dfc23f8f4e8aee020e6579aaa7a70154929720..0000000000000000000000000000000000000000
--- a/build/includes/global/var_lookup.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-struct iLookVarType {
-    // These values should be one index less than the Fortran structure
-    // This is so they align with C++ vectors that start at 0
-    int scalarv      = -9999;
-    int wLength      = -9999;
-    int midSnow      = -9999;
-    int midSoil      = -9999;
-    int midToto      = -9999;
-    int ifcSnow      = -9999;
-    int ifcSoil      = -9999;
-    int ifcToto      = -9999;
-    int parSoil      = -9999;
-    int routing      = -9999;
-    int outstat      = -9999;
-    int unknown      = -9999;
-};
\ No newline at end of file
diff --git a/build/includes/hru_actor/hru_actor.hpp b/build/includes/hru_actor/hru_actor.hpp
index a72ecc31aa4df9f132fbfa640bbc69caac2bf5a1..a71488666bc14b170917db0b2a731dac50d59ed0 100644
--- a/build/includes/hru_actor/hru_actor.hpp
+++ b/build/includes/hru_actor/hru_actor.hpp
@@ -5,12 +5,44 @@
 #include "auxilary.hpp"
 #include "timing_info.hpp"
 #include "settings_functions.hpp"
-#include <chrono>
 #include <string>
+#include "message_atoms.hpp"
+#include "global.hpp"
 
 
+/*********************************************
+ * HRU Actor Fortran Functions
+ *********************************************/
+extern "C" {
+  // Initialize HRU data_structures
+    void initHRU(int* indxGRU, int* num_steps, void* hru_data, int* err);
+    
+    void setupHRUParam( int* indxGRU, int* indxHRU, void* hru_data, double* upArea, int* err);
+    
+    // Setup summa_readRestart File if this option has been chosen 
+    void summa_readRestart(int* indxGRU, int* indxHRU, void* hru_data, double* dtInit, int* err);
+    
+    // Run the model for one timestep
+    void RunPhysics(int* id, int* stepIndex, void* hru_data, double* dt, int* dt_int_factor, int* err);
+    
+    void hru_writeOutput(int* index_hru, int* index_gru, int* timestep, int* output_step, void* hru_data, int* err);
+    
+    void setTimeZoneOffset(int* iFile, void* hru_data, int* err);
 
+    void HRU_readForcing(int* index_gru, int* iStep, int* iRead, int* iFile, void* hru_data,  int* err);
 
+    void get_sundials_tolerances(void* hru_data, double* relTol, double* absTol);
+    void set_sundials_tolerances(void* hru_data, double* relTol, double* absTol);
+
+    void setIDATolerances(void* hru_data, double* relTolTempCas, double* absTolTempCas, double* relTolTempVeg,
+                          double* absTolTempVeg, double* relTolWatVeg, double* absTolWatVeg, double* relTolTempSoilSnow,
+                          double* absTolTempSoilSnow, double* relTolWatSnow, double* absTolWatSnow, double* relTolMatric,
+                          double* absTolMatric, double* relTolAquifr, double* absTolAquifr);
+}
+
+/*********************************************
+ * HRU Actor state variables
+ *********************************************/
 namespace caf {
 struct hru_state {
 	// Actor References
@@ -24,107 +56,33 @@ struct hru_state {
     int refGRU;			// The actual ID of the GRU we are
 
     // Variables for forcing structures
-	int stepsInCurrentFFile;
-    int num_steps_until_write;
-
-    // statistics structures
-    void *handle_forcStat = new_handle_var_dlength();	// model forcing data	
-    void *handle_progStat = new_handle_var_dlength();	// model prognostic (state) variables                   
-    void *handle_diagStat = new_handle_var_dlength();	// model diagnostic variables                  
-    void *handle_fluxStat = new_handle_var_dlength();	// model fluxes                 
-    void *handle_indxStat = new_handle_var_dlength();	// model indices            
-    void *handle_bvarStat = new_handle_var_dlength();	// basin-average variables  
-    // primary data structures (scalars)
-    void *handle_timeStruct = new_handle_var_i();       // model time data
-    void *handle_forcStruct = new_handle_var_d();       // model forcing data
-    void *handle_attrStruct = new_handle_var_d();       // local attributes for each HRU
-    void *handle_typeStruct = new_handle_var_i();       // local classification of soil veg etc. for each HRU
-    void *handle_idStruct   = new_handle_var_i8();		
-    // primary data structures (variable length vectors)
-    void *handle_indxStruct = new_handle_var_ilength();	// model indices
-    void *handle_mparStruct = new_handle_var_dlength();	// model parameters
-    void *handle_progStruct = new_handle_var_dlength();	// model prognostic (state) variables
-    void *handle_diagStruct = new_handle_var_dlength();	// model diagnostic variables
-    void *handle_fluxStruct = new_handle_var_dlength();	// model fluxes
-	// basin-average structures
-    void *handle_bparStruct = new_handle_var_d();		// basin-average parameters
-    void *handle_bvarStruct = new_handle_var_dlength(); // basin-average variables
-    // ancillary data structures
-    void *handle_dparStruct = new_handle_var_d();		// default model parameters
-    // sundials type
-    void *handle_lookupStruct = new_handle_z_lookup();    
-    // Counter variables
-    void *handle_statCounter = new_handle_var_i();
-    void *handle_outputTimeStep = new_handle_var_i();
-    void *handle_resetStats = new_handle_flagVec();
-    void *handle_finalizeStats = new_handle_flagVec();
-    // Time variables
-    void *handle_oldTime = new_handle_var_i();
-    void *handle_refTime = new_handle_var_i();
-    void *handle_finshTime = new_handle_var_i();
-    void *handle_startTime = new_handle_var_i();
+	int stepsInCurrentFFile;        // number of time steps in current forcing file
+    int num_steps_until_write;      // number of time steps until we pause for FA_Actor to write
+
+    // HRU data structures (formerly summa_type)
+    void *hru_data = new_handle_hru_type();
+
     // Misc Variables
-	int 		timestep = 1;	    // Current Timestep of HRU simulation
-    int         computeVegFlux;     // flag to indicate if we are computing fluxes over vegetation
-    double      dt_init;            // used to initialize the length of the sub-step for each HRU
-    double		upArea;             // area upslope of each HRU
-    int         num_steps = 0;      // number of time steps
-    int         forcingStep;    // index of current time step in current forcing file
-    int         iFile;          // index of current forcing file from forcing file list
-    int         dt_init_factor = 1; // factor of dt_init (coupled_em)
-    bool        printOutput;
-    int         outputFrequency;
-    int         output_structure_step_index; // index of current time step in output structure
-
-    // Julian Day variables
-    double      fracJulDay;
-    double      tmZoneOffsetFracDay;
-    int         yearLength;
+	int     timestep = 1;	    // Current Timestep of HRU simulation
+    int     forcingStep = 1;    // index of current time step in current forcing file
+    int     num_steps = 0;      // number of time steps
+    int     iFile = 1;              // index of current forcing file from forcing file list
+    int     dt_init_factor = 1; // factor of dt_init (coupled_em)
+    int     output_structure_step_index = 1; // index of current time step in output structure
+    double  dt_init;            // used to initialize the length of the sub-step for each HRU
+    double	upArea;             // area upslope of each HRU
+    int     err = 0;	
+
+    // Sundials variables
+    double rtol = -9999; // -9999 uses default
+    double atol = -9999; // -9999 uses default		        
+
 
     // Settings
     HRU_Actor_Settings hru_actor_settings;
-    // error control
-    int         err = 0;			        
     
     ~hru_state() {
-        // statistics structures
-        delete_handle_var_dlength(handle_forcStat);
-        delete_handle_var_dlength(handle_progStat);
-        delete_handle_var_dlength(handle_diagStat);
-        delete_handle_var_dlength(handle_fluxStat);
-        delete_handle_var_dlength(handle_indxStat);
-        delete_handle_var_dlength(handle_bvarStat);
-        // primary data structures (scalars)
-        delete_handle_var_i(handle_timeStruct);
-        delete_handle_var_d(handle_forcStruct);
-        delete_handle_var_d(handle_attrStruct);
-        delete_handle_var_i(handle_typeStruct);
-        delete_handle_var_i8(handle_idStruct);
-        // primary data structures (variable length vectors)
-        delete_handle_var_ilength(handle_indxStruct);
-        delete_handle_var_dlength(handle_mparStruct);
-        delete_handle_var_dlength(handle_progStruct);
-        delete_handle_var_dlength(handle_diagStruct);
-        delete_handle_var_dlength(handle_fluxStruct);
-        // basin-average structures
-        delete_handle_var_d(handle_bparStruct);
-        delete_handle_var_dlength(handle_bvarStruct);
-        // ancillary data structures
-        delete_handle_var_d(handle_dparStruct);
-        // sundials type
-        delete_handle_z_lookup(handle_lookupStruct);
-        // counter variables
-        delete_handle_var_i(handle_statCounter);
-        delete_handle_var_i(handle_outputTimeStep);
-        delete_handle_flagVec(handle_resetStats);
-        delete_handle_flagVec(handle_finalizeStats);
-        // time variables
-        delete_handle_var_i(handle_oldTime);
-        delete_handle_var_i(handle_refTime);
-        delete_handle_var_i(handle_finshTime);
-        delete_handle_var_i(handle_startTime);
-
-
+        delete_handle_hru_type(hru_data);
     }
 };
 
@@ -132,23 +90,14 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
     HRU_Actor_Settings hru_actor_settings, caf::actor file_access_actor, 
     caf::actor parent);
 
-/**
- Function to initalize the HRU for running
- */
+/*********************************************
+ * Functions for the HRU Actor
+ *********************************************/
+
+/** Function to initalize the HRU for running */
 void Initialize_HRU(stateful_actor<hru_state>* self);
 
-/**
- Function runs all of the hru time_steps
- */
+/** Function runs all of the hru time_steps */
 int Run_HRU(stateful_actor<hru_state>* self);
 
-bool check_HRU(stateful_actor<hru_state>* self, int err);
-
-// Prints the timestep - the frequency of printing can be set by the user
-void printOutput(stateful_actor<hru_state>* self);
-
-// Get output from fortran into arrays
-// Send the output to the file_access_actor
-void getAndSendOutput(stateful_actor<hru_state>* self);
-
 }
\ No newline at end of file
diff --git a/build/includes/hru_actor/hru_actor_subroutine_wrappers.hpp b/build/includes/hru_actor/hru_actor_subroutine_wrappers.hpp
deleted file mode 100644
index 7333c367885c3aeee7c26de96de57d519669e4e3..0000000000000000000000000000000000000000
--- a/build/includes/hru_actor/hru_actor_subroutine_wrappers.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#pragma once
-
-extern "C" {
-  // Initialize HRU data_structures
-	void initHRU(
-            int* indxGRU, int* num_steps, void* lookupStruct,
-            // Statistics Structures
-            void* forcStat, void* progStat, void* diagStat, void* fluxStat, void* indxStat, void* bvarStat,
-            // Primary Data Structures (scalars) 
-            void* timeStruct, void* forcStruct,
-            // primary data structures (variable length vectors)
-            void* indxStruct, void* progStruct, void* diagStruct, void* fluxStruct,
-            // basin-average structures
-            void* bvarStruct,
-            // local HRU data 
-            void* startTime, void* finshTime, void* refTime, void* oldTime, int* err);
-
-      // Initalize statistics flags
-      void initStatisticsFlags(void* handle_statCounter, void* handle_outputTimeStep, void* handle_resetStats,
-            void* handle_finalizeStats, int* err);
-    
-      void setupHRUParam( int* indxGRU, int* indxHRU,
-            // primary data structures (scalars)
-            void* attrStruct, void* typeStruct, void* idStruct,
-            // primary data structures (variable length vectors)
-            void* mparStruct, void* bparStruct, void* bvarStruct, void* dparStruct,
-            // lookup tables
-            void* lookupStruct,
-            // local HRU data
-            void* startTime, void* oldTime,
-            // miscellaneous
-            double* upArea, int* err);
-
-  
-  // Setup Restart File if this option has been chosen 
-	void Restart(
-            int* indxGRU, int* indxHRU,
-            // primary data structures (variable length vectors) 
-            void* indxStruct, void* mparStruct, void* progStruct, void* diagStruct, void* fluxStruct, 
-            // basin-average structures
-            void* bvarStruct,
-            // misc 
-            double* dtInit, int* err);
-
-
-      // Run the model for one timestep
-      void  RunPhysics(
-            int* id, int* stepIndex,
-            // primary data structures (scalars)
-            void* timeStruct, void* forcStruct, void* attrStruct, void* typeStruct,
-            // primary data structures (variable length vectors) 
-            void* indxStruct, void* mparStruct, void* progStruct, void* diagStruct, void* fluxStruct,
-            // basin-average structures 
-            void* bvarStruct,
-            void* lookupStruct,
-            double* fracJulDay, double* tmZoneOffsetFracDay, int* yearLength,
-            // misc
-            int* flag, double* dt, int* dt_int_factor, int* err);
-
-      void writeHRUToOutputStructure(int* index_hru, int* index_gru, int* output_step, void* handle_forcStat,
-            void* handle_progStat, void* handle_diagStat, void* handle_fluxStat, void* handle_indxStat,
-            void* handle_bvarStat, void* handle_timeStruct, void* handle_forcStruct, void* handle_indxStruct,
-            void* handle_mparStruct, void* handle_progStruct, void* handle_diagStruct, void* handle_fluxStruct,
-            void* handle_bparStruct, void* handle_bvarStruct, void* handle_statCounter, void* handle_outputTimeStep,
-            void* handle_resetStats, void* handle_finalizeStats, void* handle_finshTime, void* handle_oldTime, int* err);
-
-
-      void prepareOutput(int* model_timestep, void* handle_force_stat, void* handle_prog_stat, 
-            void* handle_diag_stat, void* handle_flux_stat, void* handle_indx_stat,
-            void* handle_bvar_stat, void* handle_time_struct, void* handle_forc_struct,
-            void* handle_attr_struct, void* handle_type_struct, void* handle_indx_struct,
-            void* handle_mpar_struct, void* handle_prog_struct, void* handle_diag_struct,
-            void* handle_flux_struct, void* handle_bpar_struct, void* handle_bvar_struct,
-            void* stat_counter, void* output_timestep, void* reset_stats, void* finalize_stats,
-            void* finish_time, void* old_time, int* err);
-      
-      void updateCounters(void* handle_timeStruct, void*  handle_statCounter, void* handle_outputTimeStep,
-            void* handle_resetStats, void* handle_oldTime, void* handle_finalizeStats);
-
-      
-      void setTimeZoneOffset(int* iFile, double* tmZoneOffsetFracDay, int* err);
-
-      void getFirstTimestep(int* iFile, int* forcing_step, int* err);
-
-      void readForcingHRU(int* index_gru, int* iStep, int* iRead, void* handle_timeStruct, 
-            void* handle_forcStruct, int* iFile, int* err);
-
-      void computeTimeForcingHRU(void* handle_timeStruct, void* handle_forcStruct, double* fracJulDay, 
-                              int* yearLength, int* err);
-
-
-}
\ No newline at end of file
diff --git a/build/includes/hru_actor/serialize_data_structure.hpp b/build/includes/hru_actor/serialize_data_structure.hpp
deleted file mode 100644
index c150069a2c7ef550484c4e77edbe0ceb3bdba840..0000000000000000000000000000000000000000
--- a/build/includes/hru_actor/serialize_data_structure.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#pragma once
-
-template<typename T>
-struct Summa_Variable {
-    std::vector<T> dat; // needs to be general as each array can have its own type
-    int var_type;  // maps to varType() in Fortran-Side
-    int var_fortran_index; // maps to the index of the var portion of the summa_variable
-};
-
-extern "C" {
-    void getSummaVariableInfo(int* var_type, int* var_fortran_index, void* data_struct);
-}
-
-
-
-
-template <typename T>
-std::vector<Summa_Variable<T>> init_summa_variable_vector(int num_variables) {
-    std::vector<Summa_Variable<T>> summa_variables(num_variables);
-
-    int variable_index = 1; // value to index into the fortran structure of the array
-    for (Summa_Variable var : summa_variables) {
-        var.var_fortran_index = variable_index;
-        getSummaVariableInfo(var.var_type, var.var_fortran_index);
-        variable_index++;
-    }
-
-    return summa_variables;
-}
-
-
-
diff --git a/build/includes/job_actor/GRU.hpp b/build/includes/job_actor/GRU.hpp
index 8123f21d9627e4f52a6fd6947e72940f8541b96d..3c33f51d0afd520b43a230c2fd370f3f7a846959 100644
--- a/build/includes/job_actor/GRU.hpp
+++ b/build/includes/job_actor/GRU.hpp
@@ -13,9 +13,7 @@ enum class gru_state {
     succeeded
 };
 
-auto success = [](const gru_state& state) -> int {
-    return(state == gru_state::succeeded) ? 1 : 0;
-};
+int is_success(const gru_state& state);
 
 /**
  * Class that holds information about the running GRUs. This class is held by the job actor
@@ -29,6 +27,8 @@ class GRU {
 
     // Modifyable Parameters
     int dt_init_factor; // The initial dt for the GRU
+    double rel_tol; // The relative tolerance for the GRU
+    double abs_tol; // The absolute tolerance for the GRU
 
     // Status Information
     int attempts_left; // The number of attempts left for the GRU to succeed
@@ -44,7 +44,8 @@ class GRU {
     
   public:
     // Constructor
-    GRU(int global_gru_index, int local_gru_index, caf::actor gru_actor, int dt_init_factor, int max_attempts);
+    GRU(int global_gru_index, int local_gru_index, caf::actor gru_actor, int dt_init_factor, 
+        double rel_tol, double abs_tol, int max_attempts);
 
     // Deconstructor
     ~GRU();
@@ -60,12 +61,16 @@ class GRU {
     double getRunPhysicsDuration();
     double getWriteOutputDuration();
 
+    double getRelTol();
+    double getAbsTol();
+
     double getAttemptsLeft();
     gru_state getStatus();
 
     bool isFailed();
 
 
+
     // Setters
     void setRunTime(double run_time);
     void setInitDuration(double init_duration);
@@ -73,6 +78,9 @@ class GRU {
     void setRunPhysicsDuration(double run_physics_duration);
     void setWriteOutputDuration(double write_output_duration);
 
+    void setRelTol(double rel_tol);
+    void setAbsTol(double abs_tol);
+
     void setSuccess();
     void setFailed();
     void setRunning();
diff --git a/build/includes/job_actor/job_actor.hpp b/build/includes/job_actor/job_actor.hpp
index e92a7a1f15ab3601090057a106436b2654255177..c6926a06239f64aa82df2df433eae2fc4a86da93 100644
--- a/build/includes/job_actor/job_actor.hpp
+++ b/build/includes/job_actor/job_actor.hpp
@@ -4,13 +4,32 @@
 #include "GRU.hpp"
 #include "timing_info.hpp"
 #include "settings_functions.hpp"
+#include "global.hpp"
+#include "json.hpp"
+#include "hru_actor.hpp"
+#include "message_atoms.hpp"
+#include "file_access_actor.hpp"
 #include <unistd.h>
 #include <limits.h>
-#include "global.hpp"
 
+
+/*********************************************
+ * Job Actor Fortran Functions
+ *********************************************/
+extern "C" {
+    void job_init_fortran(char const* file_manager, int* start_gru_index, int* num_gru, int* num_hru, int* err);
+
+    void deallocateJobActor(int* err);
+}
+
+
+/*********************************************
+ * Job Actor state variables
+ *********************************************/
 namespace caf {
 using chrono_time = std::chrono::time_point<std::chrono::system_clock>;
 
+// Holds information about the GRUs
 struct GRU_Container {
     std::vector<GRU*> gru_list;
     chrono_time gru_start_time; // Vector of start times for each GRU
@@ -26,21 +45,17 @@ struct job_state {
     caf::actor parent;            // actor reference to the top-level SummaActor
 
     // Job Parameters
-    int start_gru;                 // Starting GRU for this job
-    int num_gru;                   // Number of GRUs for this job
+    int start_gru;                // Starting GRU for this job
+    int num_gru;                  // Number of GRUs for this job
     int num_hru;
-    int max_run_attempts = 1;         // Max number of attemtps to solve a GRU
-
-
+    int max_run_attempts = 1;     // Max number of attempts to solve a GRU
 
     GRU_Container gru_container;
 
-
-
     // Variables for GRU monitoring
-    int dt_init_start_factor = 1;   // Initial Factor for dt_init (coupled_em)
-    int num_gru_done = 0;             // The number of GRUs that have completed
-    int num_gru_failed = 0;           // Number of GRUs that have failed
+    int dt_init_start_factor = 1; // Initial Factor for dt_init (coupled_em)
+    int num_gru_done = 0;         // The number of GRUs that have completed
+    int num_gru_failed = 0;       // Number of GRUs that have failed
 
     // Timing Variables
     TimingInfo job_timing;
@@ -55,21 +70,22 @@ struct job_state {
 };
 
 
+/** The Job Actor */
+behavior job_actor(stateful_actor<job_state>* self, 
+                   int start_gru, int num_gru, 
+                   File_Access_Actor_Settings file_access_actor_settings, 
+                   Job_Actor_Settings job_actor_settings, 
+                   HRU_Actor_Settings hru_actor_settings, 
+                   actor parent);
 
-behavior job_actor(stateful_actor<job_state>* self, int start_gru, int num_gru, 
-    File_Access_Actor_Settings file_access_actor_settings, Job_Actor_Settings job_actor_settings, 
-    HRU_Actor_Settings hru_actor_settings, actor parent);
-
-/*
- * Start all of the GRU actors and set up their container class
-*/
-void initGRUs(stateful_actor<job_state>* self);
 
-/**
- * Get the information for the GRUs that will be written to the netcdf file
-*/
-std::vector<serializable_netcdf_gru_actor_info> getGruNetcdfInfo(int max_run_attempts, std::vector<GRU*> &gru_list);
+/*********************************************
+ * Functions for the Job Actor
+ *********************************************/
 
-void handleGRUError(stateful_actor<job_state>* self, const error& err, caf::actor src);
+/** Get the information for the GRUs that will be written to the netcdf file */
+std::vector<serializable_netcdf_gru_actor_info> getGruNetcdfInfo(int max_run_attempts, 
+                                                                 std::vector<GRU*> &gru_list);
 
+void handleGRUError(stateful_actor<job_state>* self, caf::actor src);
 } // end namespace
\ No newline at end of file
diff --git a/build/includes/job_actor/job_actor_subroutine_wrappers.hpp b/build/includes/job_actor/job_actor_subroutine_wrappers.hpp
deleted file mode 100644
index 07622122f95a06bd0d06a57628f922ef82c5d1e6..0000000000000000000000000000000000000000
--- a/build/includes/job_actor/job_actor_subroutine_wrappers.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-extern "C" {
-    void setTimesDirsAndFiles(char const* file_manager, int* err);
-
-    void defineGlobalData(int* start_gru_index, int* err);
-
-    void readDimension(int* num_gru, int* num_hru, int* start_gru_index, int* err);
-
-    void readIcondNLayers(int* num_gru, int* err);
-
-    void allocateTimeStructure(int* err);
-
-    void deallocateJobActor(int* err);
-    
-}
\ No newline at end of file
diff --git a/build/includes/summa_actor/batch/batch.hpp b/build/includes/summa_actor/batch.hpp
similarity index 100%
rename from build/includes/summa_actor/batch/batch.hpp
rename to build/includes/summa_actor/batch.hpp
diff --git a/build/includes/summa_actor/batch/batch_container.hpp b/build/includes/summa_actor/batch_container.hpp
similarity index 98%
rename from build/includes/summa_actor/batch/batch_container.hpp
rename to build/includes/summa_actor/batch_container.hpp
index ed787cd195c342769113e8b17dcce78fc0f75a41..8a61429f08f957bd33e639063e4f9d26861b9575 100644
--- a/build/includes/summa_actor/batch/batch_container.hpp
+++ b/build/includes/summa_actor/batch_container.hpp
@@ -1,6 +1,6 @@
 #include "caf/all.hpp"
 #pragma once
-#include "client/client.hpp"
+#include "client.hpp"
 
 
 class Batch_Container {
diff --git a/build/includes/summa_actor/client/client.hpp b/build/includes/summa_actor/client.hpp
similarity index 98%
rename from build/includes/summa_actor/client/client.hpp
rename to build/includes/summa_actor/client.hpp
index d5fc7aad7f5013f84516f83462784a9ec7746de6..406acbb016310f8ce6ab714611bb0d7a2525062a 100644
--- a/build/includes/summa_actor/client/client.hpp
+++ b/build/includes/summa_actor/client.hpp
@@ -1,7 +1,7 @@
 #pragma once
 #include "caf/all.hpp"
 #include <optional>
-#include "batch/batch.hpp"
+#include "batch.hpp"
 
 class Client {
     private:
diff --git a/build/includes/summa_actor/client/client_container.hpp b/build/includes/summa_actor/client_container.hpp
similarity index 97%
rename from build/includes/summa_actor/client/client_container.hpp
rename to build/includes/summa_actor/client_container.hpp
index 18436f7017d27f435529a9fa24b782b5dd8854b9..8e2384bac1d5503176b2c64c4e07846fafce7405 100644
--- a/build/includes/summa_actor/client/client_container.hpp
+++ b/build/includes/summa_actor/client_container.hpp
@@ -1,8 +1,8 @@
 #pragma once
 #include "caf/all.hpp"
 #include <vector>
-#include "batch/batch.hpp"
-#include "client/client.hpp"
+#include "batch.hpp"
+#include "client.hpp"
 #include <optional>
 
 
diff --git a/build/includes/summa_actor/summa_client.hpp b/build/includes/summa_actor/summa_client.hpp
index 23ec9c7e33de8e55446b0e2cbdeb845a62a0a537..a33361f46991a20c3a381f0ea0426d1368d55a99 100644
--- a/build/includes/summa_actor/summa_client.hpp
+++ b/build/includes/summa_actor/summa_client.hpp
@@ -3,7 +3,7 @@
 #include "caf/all.hpp"
 #include "caf/io/all.hpp"
 #include "settings_functions.hpp"
-#include "batch/batch.hpp"
+#include "batch.hpp"
 #include "summa_actor.hpp"
 #include "message_atoms.hpp"
 #include <string>
diff --git a/build/includes/summa_actor/summa_server.hpp b/build/includes/summa_actor/summa_server.hpp
index 22d223043b2ee0a1ed0f2f4452d4cb1222b6bfca..b15d631d07dac60e6259ecd7f1d37469fbe2d49c 100644
--- a/build/includes/summa_actor/summa_server.hpp
+++ b/build/includes/summa_actor/summa_server.hpp
@@ -2,10 +2,10 @@
 
 #include "caf/all.hpp"
 #include "caf/io/all.hpp"
-#include "batch/batch.hpp"
-#include "batch/batch_container.hpp"
-#include "client/client.hpp"
-#include "client/client_container.hpp"
+#include "batch.hpp"
+#include "batch_container.hpp"
+#include "client.hpp"
+#include "client_container.hpp"
 #include "settings_functions.hpp"
 #include "global.hpp"
 #include "message_atoms.hpp"
diff --git a/build/makefiles/Makefile_Summa b/build/makefiles/Makefile_Summa
deleted file mode 100755
index dbd339fcd4907e297e3a440a24a375d69aaf5851..0000000000000000000000000000000000000000
--- a/build/makefiles/Makefile_Summa
+++ /dev/null
@@ -1,385 +0,0 @@
-#========================================================================
-# Makefile to compile SUMMA
-#========================================================================
-#
-# Recommended use: Copy this file to Makefile.local, edit it to your
-# heart's content, and then run `make -f build/Makefile.local` from
-# your top level SUMMA directory. Don't include the Makefile.local in
-# any pull requests you make.
-#
-# Note that Makefile configurations that we commonly use can be found on
-# the SUMMA wiki at:
-# https://github.com/NCAR/summa/wiki/SUMMA-Makefile-Part-0-configuration
-# feel free to add yours to that page.
-#
-# To troubleshoot your paths and setup, type 'make check'
-#
-# At a minimum you will need to set the following:
-#  * F_MASTER         - top level summa directory
-#  * FC               - compiler suite
-#  * FC_EXE           - compiler executable
-#  * INCLUDES         - path to include files
-#  * LIBRARIES        - path to and libraries to include
-#
-# Some further options can be specified for OpenMP, etc. See in Part 0 of
-# the Makefile. You don't need to make any changes in PART 1 and
-# following unless you are doing SUMMA development and changed what
-# needs to be compiled
-
-#========================================================================
-# PART 0: User-configurable part
-#========================================================================
-
-# The variables can be specified in one of two ways:
-# * delete the '##' in front of the variable, fill out the entry,
-#   save the file and run make
-# * make no changes to this file, but specify the variables in your
-#   environment before you run make
-
-# Define core directory below which everything resides. This is the
-# parent directory of the 'build' directory
-F_MASTER = /globalhome/kck540/HPC/Summa-Projects/Summa-Actors/build/summa
-
-# Define the Fortran Compiler. If you are using gfortran, then this needs
-# to be version 6 or higher. This variable is simply used to select the right
-# compiler flags in the ifeq statements in this Makefile. The compiler
-# executable is set separately as FC_EXE
-# Currently this is either gfortran or ifort
-FC = gfortran
-
-# Define the path for the compiler executable. This is the actual executable
-# that is invoked. For example, FC=gfortran and FC_EXE=/usr/bin-gfortran-mp-6
-# FC and FC_EXE have to be consistent
-FC_EXE = gfortran
-
-# Define the NetCDF and LAPACK libraries and path to include files.
-# INCLUDES needs to be of the form (no quotes around the string):
-# INCLUDES = -I<include path 1> -I<include path 2> -I<...> -I<include path n>
-# LIBRARIES needs to be of the form ( no quotes around the string):
-# LIBRARIES = '-L<netcdf library path> -lnetcdff -L<blas library path> -lblas -L<etc> -l<etc>'
-# If none of this makes sense, please talk to your system
-# administrator.
-INCLUDES = -I$(EBROOTNETCDFMINFORTRAN)/include
-LIBRARIES = -L$(EBROOTNETCDFMINFORTRAN)/lib64 -L$(EBROOTOPENBLAS)/lib -lnetcdff -lopenblas
-
-# Eventually we plan move to a real configure script, but for now we like
-# to keep track of successful compilations of SUMMA on different platforms
-# and with different compilers. If you are successful compiling SUMMA,
-# please add your configuration (operating system and compiler plus
-# part 0 of the Makefile) to the SUMMA wiki on github.
-
-# Define compiler flags. If you use a different compiler,
-# you will need to figure out what the equivalent flags are
-# and may need to update this section
-
-# ------------ define compiler flags ----------------------------------------
-
-# define open MP flags
-isOpenMP =
-FLAGS_OMP =
-LIBOPENMP =
-
-# Define compiler flags. If you use a different compiler,
-# you will need to figure out what the equivalent flags are
-# and may need to update this section
-
-# gfortran compiler flags
-ifeq "$(FC)" "gfortran"
-
-	ifeq "$(isOpenMP)" "yes"
- 		FLAGS_OMP = -fopenmp
-	endif
-
-# Production runs
-FLAGS_NOAH = -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
-FLAGS_COMM = -O3 -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
-FLAGS_SUMMA = -O3 -ffree-line-length-none -fmax-errors=0 $(FLAGS_OMP)
-
-# Debug runs
-#FLAGS_NOAH = -p -g -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument
-#FLAGS_COMM = -p -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds
-#FLAGS_SUMMA = -p -g -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds
-
-endif
-
-# ifort compiler flags
-ifeq "$(FC)" "ifort"
-
-	ifeq "$(isOpenMP)" "yes"
- 		FLAGS_OMP = -qopenmp
-	endif
-
-# Production runs
-FLAGS_NOAH = -O3 -noerror_limit -FR -auto -fltconsistency $(FLAGS_OMP)
-FLAGS_COMM = -O3 -FR -auto -fltconsistency -fpe0 $(FLAGS_OMP)
-FLAGS_SUMMA = -O3 -FR -auto -fltconsistency -fpe0 $(FLAGS_OMP)
-
-# Debug runs
-#FLAGS_NOAH = -O0 -p -g -warn nounused -noerror_limit -FR -auto -WB -traceback -fltconsistency
-#FLAGS_COMM = -O0 -p -g -debug -warn all -check all -FR -auto -WB -traceback -fltconsistency -fpe0
-#FLAGS_SUMMA = -O0 -p -g -debug -warn all -check all -FR -auto -WB -traceback -fltconsistency -fpe0
-endif
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(F_MASTER)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(F_MASTER)/build
-
-# Define the directory for the executables
-EXE_PATH = $(F_MASTER)/bin
-
-#========================================================================
-# PART 2: Assemble all of the SUMMA sub-routines
-#========================================================================
-
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-#
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaFileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		multiconst.f90 \
-		var_lookup.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90 \
-		get_ixname.f90 \
-		popMetadat.f90 \
-		outpt_stat.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		updatState.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-# Solver
-SUMMA_SOLVER= \
-		vegPhenlgy.f90 \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		varSubstep.f90 \
-		opSplittin.f90 \
-		coupled_em.f90 \
-		run_oneHRU.f90 \
-		run_oneGRU.f90
-SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_SOLVER))
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspace.f90 \
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_attrb.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		read_param.f90 \
-		paramCheck.f90 \
-		check_icond.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		updateVars.f90 \
-		var_derive.f90 \
-		read_force.f90 \
-		derivforce.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define routines for the solver
-SUMMA_MSOLVE = \
-
-# Define NetCDF routines
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		modelwrite.f90 \
-		read_icond.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(HOOKUP) $(DATAMS) $(UTILMS)
-
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(MODRUN) $(SOLVER)
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summa_type.f90 \
-		summa_util.f90 \
-		summa_alarms.f90 \
-		summa_globalData.f90 \
-		summa_defineOutput.f90 \
-		summa_init.f90 \
-		summa_setup.f90 \
-		summa_restart.f90 \
-		summa_forcing.f90 \
-		summa_modelRun.f90 \
-		summa_writeOutput.f90 \
-		summa_driver.f90
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-# Define the executable
-DRIVER__EX = summa.exe
-
-# Define version number
-VERSIONFILE = $(DRIVER_DIR)/summaversion.inc
-VERSION = $(shell git tag | tail -n 1)
-BULTTIM = $(shell date)
-GITBRCH = $(shell git describe --long --all --always | sed -e's/heads\///')
-GITHASH = $(shell git rev-parse HEAD)
-
-#========================================================================
-# PART 3: Checks
-#======================================================================
-# make sure that the paths are defined. These are just some high level checks
-ifndef F_MASTER
- $(error F_MASTER is undefined)
-endif
-ifndef FC
- $(error FC is undefined: Specify your compiler)
-endif
-ifndef FC_EXE
- $(error FC_EXE is undefined: Specify your compiler executable)
-endif
-ifndef FLAGS_SUMMA
- $(error Specify flags for your compiler: $(FC))
-endif
-ifndef INCLUDES
- $(error INCLUDES is undefined)
-endif
-ifndef LIBRARIES
- $(error LIBRARIES is undefined)
-endif
-
-#========================================================================
-# PART 4: compilation
-#======================================================================
-
-# Compile
-all: compile_noah compile_comm compile_summa link clean install
-
-check:
-	$(info)
-	$(info Displaying make variables:)
-	$(info   F_MASTER   : $(F_MASTER))
-	$(info   EXE_PATH   : $(EXE_PATH))
-	$(info   FC         : $(FC))
-	$(info   INCLUDES   : $(INCLUDES))
-	$(info   LIBRARIES  : $(LIBRARIES))
-	$(info   FLAGS_NOAH : $(FLAGS_NOAH))
-	$(info   FLAGS_COMM : $(FLAGS_COMM))
-	$(info   FLAGS_SUMMA: $(FLAGS_SUMMA))
-	$(info)
-
-# update version information
-update_version:
-	echo "character(len=64), parameter     :: summaVersion = '${VERSION}'" > $(VERSIONFILE)
-	echo "character(len=64), parameter     :: buildTime = '${BULTTIM}'" >> $(VERSIONFILE)
-	echo "character(len=64), parameter     :: gitBranch = '${GITBRCH}'" >> $(VERSIONFILE)
-	echo "character(len=64), parameter     :: gitHash = '${GITHASH}'" >> $(VERSIONFILE)
-
-# compile Noah-MP routines
-compile_noah:
-	$(FC_EXE) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC_EXE) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: update_version
-	$(FC_EXE) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) \
-	$(INCLUDES)
-
-# link routines
-link:
-	$(FC_EXE) -g *.o $(LIBRARIES) -o $(DRIVER__EX)
-
-# Remove object files
-clean:
-	rm -f *.o
-	rm -f *.mod
-	rm -f soil_veg_gen_parm__genmod.f90
-
-# Copy the executable to the bin directory
-install:
-	@mkdir -p $(EXE_PATH)
-	@mv $(DRIVER__EX) $(EXE_PATH)
-	$(info $(DRIVER__EX) successfully installed in $(EXE_PATH))
diff --git a/build/makefiles/compile_copernicus.sh b/build/makefiles/compile_copernicus.sh
deleted file mode 100644
index defa4b69d3bacfeede63c94e26cd2b673c3d5cc2..0000000000000000000000000000000000000000
--- a/build/makefiles/compile_copernicus.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/bash
-
-#### load modules if using Compute Canada or Copernicus ####
-module load gcc/9.3.0
-module load netcdf-fortran
-module load openblas
-module load caf
-
-
-#### parent directory of the 'build' directory ####
-export ROOT_DIR=/globalhome/kck540/HPC/Summa-Projects/Summa-Actors
-
-export INCLUDES="-I$EBROOTNETCDFMINFORTRAN/include"
-export LIBRARIES="-L$EBROOTNETCDFMINFORTRAN/lib64\
-    -L$EBROOTOPENBLAS/lib\
-    -lnetcdff -lopenblas"
-
-# INCLUDES FOR Actors Component
-export ACTORS_INCLUDES="-I$EBROOTCAF/include\
-    -I$EBROOTNETCDFMINFORTRAN/include"
-
-export ACTORS_LIBRARIES="-L$EBROOTCAF/lib\
-    -L$EBROOTCAF/lib64\
-    -L$EBROOTNETCDFMINFORTRAN/lib64\
-    -L$EBROOTOPENBLAS/lib\
-    -L$ROOT_DIR/bin\
-    -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff"
-
-make -f ${ROOT_DIR}/build/makefiles/makefile_cluster
-export LD_LIBRARY_PATH=${ROOT_DIR}/bin
\ No newline at end of file
diff --git a/build/makefiles/compile_graham.sh b/build/makefiles/compile_graham.sh
deleted file mode 100644
index 13c2881fc3f3ab4ad72d80c3af1fc56d9e9140a8..0000000000000000000000000000000000000000
--- a/build/makefiles/compile_graham.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/bash
-
-#### load modules if using Compute Canada or Copernicus ####
-module load gcc/9.3.0
-module load netcdf-fortran
-module load openblas
-module load caf
-
-
-#### parent directory of the 'build' directory ####
-# export ROOT_DIR=/home/kklenk/Summa-Projects/Summa-Actors
-
-# export INCLUDES="-I$EBROOTNETCDFMINFORTRAN/include"
-# export LIBRARIES="-L$EBROOTNETCDFMINFORTRAN/lib64\
-#     -L$EBROOTOPENBLAS/lib\
-#     -lnetcdff -lopenblas"
-
-# # INCLUDES FOR Actors Component
-# export ACTORS_INCLUDES="-I$EBROOTCAF/include\
-#     -I$EBROOTNETCDFMINFORTRAN/include"
-
-# export ACTORS_LIBRARIES="-L$EBROOTCAF/lib\
-#     -L$EBROOTCAF/lib64\
-#     -L$EBROOTNETCDFMINFORTRAN/lib64\
-#     -L$EBROOTOPENBLAS/lib\
-#     -L$ROOT_DIR/bin\
-#     -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff"
-
-# make -f ${ROOT_DIR}/build/makefiles/makefile_cluster cpp
-# export LD_LIBRARY_PATH=${ROOT_DIR}/bin
\ No newline at end of file
diff --git a/build/makefiles/makefile b/build/makefiles/makefile
deleted file mode 100644
index 299cfbe490be807df7b121f79c66fe74fcb11f6f..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile
+++ /dev/null
@@ -1,392 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /Summa-Actors
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include
-LIBRARIES = -L/usr/lib -L/usr/local/lib -lnetcdff -lopenblas
-
-ACTORS_INCLUDES = -I/usr/include -I/usr/local/include
-ACTORS_LIBRARIES = -L/usr/lib -L/usr/local/lib -L/Summa-Actors/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff
-
-
-# Production runs
-FLAGS_NOAH = -g -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -g -O3 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		multiconst.f90 \
-		var_lookup.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90 \
-		get_ixname.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		popMetadat.f90 \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		updatState.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-# Solver
-SUMMA_SOLVER= \
-		vegPhenlgy.f90 \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		varSubstep.f90 \
-		opSplittin.f90 \
-		coupled_em.f90
-		
-SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_SOLVER))
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		initOutputStruc.f90 \
-		deallocateOutputStruc.f90 \
-		cppwrap_fileAccess.f90 \
-		read_attribute_all_hru.f90 \
-		read_param_all_hru.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		alloc_file_access.f90\
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_attribute.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		read_paramActors.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90 \
-		# allocspace.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		updateVars.f90 \
-		var_derive.f90 \
-		read_forcingActors.f90 \
-		access_forcing.f90\
-		access_write.f90 \
-		derivforce.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		outputStrucWrite.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS) $(INTERFACE) $(HOOKUP) $(DEPEND_ON_FILEMANAGER) $(UTILMS)
-
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(MODRUN) $(SOLVER) 
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		init_hru_actor.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		summaActors_forcing.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90 \
-		summaActors_wOutputStruc.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = /Summa-Actors/build/includes
-SOURCE_DIR = /Summa-Actors/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-BATCH_MANGER = $(SOURCE_DIR)/summa_actor/batch_manager.cpp
-CLIENT_MANAGER = $(SOURCE_DIR)/summa_actor/client.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/forcing_file_info.cpp
-OUTPUT_MANAGER = $(SOURCE_DIR)/file_access_actor/output_manager.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(SETTINGS_FILES) $(GLOBAL_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES)
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES)
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(BATCH_MANGER) $(CLIENT_MANAGER) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
-
-
-
-
diff --git a/build/makefiles/makefile_apptainer b/build/makefiles/makefile_apptainer
deleted file mode 100644
index ee3b1ba70e4ebdeb5ffbfac8440f717387d7ee56..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile_apptainer
+++ /dev/null
@@ -1,420 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /Summa-Actors
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-DIR_SUNDIALS=/usr/local/sundials
-INC_SUNDIALS=-I$(DIR_SUNDIALS)/include -I$(DIR_SUNDIALS)/fortran
-LIB_SUNDIALS=-L$(DIR_SUNDIALS)/lib -lsundials_fnvecmanyvector_mod -lsundials_fida_mod -lsundials_fnvecserial_mod -lsundials_fsunlinsoldense_mod -lsundials_fsunmatrixdense_mod 
- 
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include $(INC_SUNDIALS)
-LIBRARIES = -L/usr/lib -L/usr/local/lib -lnetcdff -lopenblas $(LIB_SUNDIALS)
-
-ACTORS_INCLUDES = -I/usr/include -I/usr/local/include $(INC_SUNDIALS)
-ACTORS_LIBRARIES = -L/usr/lib -L/usr/local/lib -L/Summa-Actors/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff $(LIB_SUNDIALS)
-
-
-# Production runs
-FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -g -O0 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -g -O0 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -g -O0 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor/fortran_code
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor/fortran_code
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90 \
-
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		multiconst.f90 \
-		var_lookup.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90 \
-		get_ixname.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		popMetadat.f90 \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		sundials/soil_utilsAddSundials.f90 \
-		updatState.f90 \
-		sundials/updatStateSundials.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-# Solver
-SUMMA_SOLVER= \
-		vegPhenlgy.f90 \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		sundials/type4IDA.f90 \
-		sundials/tol4IDA.f90 \
-		sundials/computEnthalpy.f90 \
-		sundials/computHeatCap.f90 \
-		sundials/computThermConduct.f90 \
-		sundials/computResidSundials.f90 \
-		sundials/eval8summaSundials.f90 \
-		sundials/computJacobSundials.f90 \
-		sundials/computSnowDepth.f90 \
-		sundials/summaSolveSundialsIDA.f90 \
-		sundials/systemSolvSundials.f90 \
-		varSubstep.f90 \
-		sundials/varSubstepSundials.f90 \
-		opSplittin.f90 \
-		coupled_em.f90
-		
-SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_SOLVER))
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		cppwrap_fileAccess.f90 \
-		read_attribute.f90 \
-		read_forcing.f90 \
-		read_param.f90 \
-		write_to_netcdf.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90 \
-		hru_actor.f90 \
-		init_hru_actor.f90 \
-
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_dimension.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90 \
-		# allocspace.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-# sundials - t2enthalpy.f90
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		sundials/t2enthalpy.f90 \
-		updateVars.f90 \
-		sundials/updateVarsSundials.f90 \
-		var_derive.f90 \
-		derivforce.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS) $(INTERFACE) $(HOOKUP) $(DEPEND_ON_FILEMANAGER) $(UTILMS)
-
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(MODRUN) $(SOLVER) 
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = /Summa-Actors/build/includes
-SOURCE_DIR = /Summa-Actors/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-AUXILARY = $(SOURCE_DIR)/global/auxiliary.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-SUMMA_BACKUP_SERVER = $(SOURCE_DIR)/summa_actor/summa_backup_server.cpp
-
-BATCH = $(SOURCE_DIR)/summa_actor/batch/batch.cpp
-BATCH_CONTAINER = $(SOURCE_DIR)/summa_actor/batch/batch_container.cpp
-
-CLIENT = $(SOURCE_DIR)/summa_actor/client/client.cpp
-CLIENT_CONTAINER = $(SOURCE_DIR)/summa_actor/client/client_container.cpp
-
-CLIENT_BATCH = $(SOURCE_DIR)/summa_actor/batch_client.cpp
-CLIENT_BATCH_CONTAINERS = $(SOURCE_DIR)/summa_actor/batch_client_containers.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp
-OUTPUT_MANAGER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_manager.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(SUMMA_BACKUP_SERVER) $(BATCH) $(CLIENT) $(BATCH_CONTAINER) $(CLIENT_CONTAINER) \
-	$(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -Wl,-rpath='/Summa-Actors/bin:/usr/local/lib:/code/sundials/instdir/lib' -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
-
-
-
-
diff --git a/build/makefiles/makefile_cluster b/build/makefiles/makefile_cluster
deleted file mode 100644
index 18e025f3ec668bf5d2eaba7fc172fe45f9095746..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile_cluster
+++ /dev/null
@@ -1,419 +0,0 @@
-#### parent directory of the 'build' directory ####
-# ROOT_DIR =
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-#### Includes AND Libraries ####
-# INCLUDES =
-# LIBRARIES =
-
-# ACTORS_INCLUDES =
-# ACTORS_LIBRARIES =
-
-
-# Production runs
-FLAGS_NOAH = -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -O3 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-
-SUMMA_DSHARE_DIR = $(MOD_PATH)/summa/build/source/dshare
-SUMMA_ENGINE_DIR = $(MOD_PATH)/summa/build/source/engine
-
-
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor/fortran_code
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor/fortran_code
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90 \
-
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		var_lookup.f90 \
-		multiconst.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-IXNAME_METADAT = \
-		get_ixname.f90 \
-		popMetadat.f90
-IXNAME_METADAT_DATAMS = $(patsubst %, $(SUMMA_DSHARE_DIR)/%, $(IXNAME_METADAT))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		updatState.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-
-
-# Solver - Split up to compiling with old summa files vs new summa files
-VEG_PHENLGY= \
-		vegPhenlgy.f90
-VEG_PHENLGY_SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(VEG_PHENLGY))
-SNOW_DEPTH= \
-		sundials/computSnowDepth.f90
-SNOW_DEPTH_SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SNOW_DEPTH))
-SUMMA_SOLVER= \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		varSubstep.f90 \
-		opSplittin.f90
-SOLVER = $(patsubst %, $(SUMMA_ENGINE_DIR)/%, $(SUMMA_SOLVER))
-SUMMA_ACTORS_SOLVER = \
-		coupled_em.f90
-COUPLED_EM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_ACTORS_SOLVER))
-
-
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		output_structure.f90 \
-		cppwrap_fileAccess.f90 \
-		read_attribute.f90 \
-		read_forcing.f90 \
-		read_param.f90 \
-		read_initcond.f90 \
-		writeOutputFromOutputStructure.f90 \
-		write_to_netcdf.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90 \
-		hru_actor.f90 \
-		init_hru_actor.f90 \
-		outputStrucWrite.f90 \
-		hru_writeOutput.f90
-
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		alloc_fileAccess.f90 \
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_dimension.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-DERIV_FORCE = \
-		derivforce.f90 \
-		sundials/t2enthalpy.f90
-DERIV_FORCE_MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(DERIV_FORCE))
-
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		updateVars.f90 \
-		var_derive.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(SUMMA_ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS)  \
-	$(INTERFACE) $(HOOKUP) $(IXNAME_METADAT_DATAMS) $(DEPEND_ON_FILEMANAGER) \
-	$(TIME_UTILS_UTILMS) $(M_DECISIONS_UTILMS) $(UTILMS)
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(DERIV_FORCE_MODRUN) $(MODRUN) \
- 	$(VEG_PHENLGY_SOLVER) $(SOLVER) $(SNOW_DEPTH_SOLVER) $(COUPLED_EM)
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = $(ROOT_DIR)/build/includes
-SOURCE_DIR = $(ROOT_DIR)/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-AUXILARY = $(SOURCE_DIR)/global/auxiliary.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-SUMMA_BACKUP_SERVER = $(SOURCE_DIR)/summa_actor/summa_backup_server.cpp
-
-BATCH = $(SOURCE_DIR)/summa_actor/batch/batch.cpp
-BATCH_CONTAINER = $(SOURCE_DIR)/summa_actor/batch/batch_container.cpp
-
-CLIENT = $(SOURCE_DIR)/summa_actor/client/client.cpp
-CLIENT_CONTAINER = $(SOURCE_DIR)/summa_actor/client/client_container.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp
-OUTPUT_CONTAINER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_container.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(OUTPUT_CONTAINER) $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(SUMMA_BACKUP_SERVER) $(BATCH) $(CLIENT) $(BATCH_CONTAINER) $(CLIENT_CONTAINER) \
-	$(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -Wl,-rpath='$(ROOT_DIR)/bin:/usr/local/lib' -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
\ No newline at end of file
diff --git a/build/makefiles/makefile_herschel b/build/makefiles/makefile_herschel
deleted file mode 100644
index 88ed907a12bb9ba9ce4a6b9f64cf2293de57e2ff..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile_herschel
+++ /dev/null
@@ -1,412 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /home/kklenk/Summa-Distributed/Summa-Actors
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-DIR_SUNDIALS=/usr/local/sundials
-INC_SUNDIALS=-I$(DIR_SUNDIALS)/include -I$(DIR_SUNDIALS)/fortran
-LIB_SUNDIALS=-L$(DIR_SUNDIALS)/lib -lsundials_fnvecmanyvector_mod -lsundials_fida_mod -lsundials_fnvecserial_mod -lsundials_fsunlinsoldense_mod -lsundials_fsunmatrixdense_mod 
- 
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include $(INC_SUNDIALS)
-LIBRARIES = -L/usr/lib -L/usr/local/lib -lnetcdff -lopenblas $(LIB_SUNDIALS)
-
-ACTORS_INCLUDES = -I/usr/include -I/usr/local/include $(INC_SUNDIALS)
-ACTORS_LIBRARIES = -L/usr/lib -L/usr/local/lib -L$(ROOT_DIR)/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff $(LIB_SUNDIALS)
-
-
-# Production runs
-FLAGS_NOAH = -g -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -g -O3 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor/fortran_code
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor/fortran_code
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90 \
-
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		multiconst.f90 \
-		var_lookup.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90 \
-		get_ixname.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		popMetadat.f90 \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		sundials/soil_utilsAddSundials.f90 \
-		updatState.f90 \
-		sundials/updatStateSundials.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-# Solver
-SUMMA_SOLVER= \
-		vegPhenlgy.f90 \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		sundials/type4IDA.f90 \
-		sundials/tol4IDA.f90 \
-		sundials/computEnthalpy.f90 \
-		sundials/computHeatCap.f90 \
-		sundials/computThermConduct.f90 \
-		sundials/computResidSundials.f90 \
-		sundials/eval8summaSundials.f90 \
-		sundials/computJacobSundials.f90 \
-		sundials/computSnowDepth.f90 \
-		sundials/summaSolveSundialsIDA.f90 \
-		sundials/systemSolvSundials.f90 \
-		varSubstep.f90 \
-		sundials/varSubstepSundials.f90 \
-		opSplittin.f90 \
-		coupled_em.f90
-		
-SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_SOLVER))
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		cppwrap_fileAccess.f90 \
-		read_attribute.f90 \
-		read_forcing.f90 \
-		read_param.f90 \
-		write_to_netcdf.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90 \
-		hru_actor.f90 \
-		init_hru_actor.f90 \
-
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_dimension.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90 \
-		# allocspace.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-# sundials - t2enthalpy.f90
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		sundials/t2enthalpy.f90 \
-		updateVars.f90 \
-		sundials/updateVarsSundials.f90 \
-		var_derive.f90 \
-		derivforce.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS) $(INTERFACE) $(HOOKUP) $(DEPEND_ON_FILEMANAGER) $(UTILMS)
-
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(MODRUN) $(SOLVER) 
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = $(ROOT_DIR)/build/includes
-SOURCE_DIR = $(ROOT_DIR)/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-AUXILARY = $(SOURCE_DIR)/global/auxiliary.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-BATCH_MANGER = $(SOURCE_DIR)/summa_actor/batch_manager.cpp
-CLIENT_MANAGER = $(SOURCE_DIR)/summa_actor/client.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp
-OUTPUT_MANAGER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_manager.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES)
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES)
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(BATCH_MANGER) $(CLIENT_MANAGER) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -Wl,-rpath='/home/kklenk/Summa-Distributed/Summa-Actors:/usr/local/lib:/usr/local/sundials/lib' -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
-
-
-
-
diff --git a/build/makefiles/makefile_old_summa b/build/makefiles/makefile_old_summa
deleted file mode 100644
index 74aafdddf436dc9c222f998e87bb2c594f2d4840..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile_old_summa
+++ /dev/null
@@ -1,421 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /Summa-Actors
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include
-LIBRARIES = -L/usr/lib -L/usr/local/lib -lnetcdff -lopenblas
-
-ACTORS_INCLUDES = -I/usr/include -I/usr/local/include
-ACTORS_LIBRARIES = -L/usr/lib -L/usr/local/lib -L/Summa-Actors/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff
-
-# Production runs
-FLAGS_NOAH = -g -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -g -O3 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-
-SUMMA_DSHARE_DIR = $(MOD_PATH)/summa/build/source/dshare
-SUMMA_ENGINE_DIR = $(MOD_PATH)/summa/build/source/engine
-
-
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor/fortran_code
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor/fortran_code
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90 \
-
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		var_lookup.f90 \
-		multiconst.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-IXNAME_METADAT = \
-		get_ixname.f90 \
-		popMetadat.f90
-IXNAME_METADAT_DATAMS = $(patsubst %, $(SUMMA_DSHARE_DIR)/%, $(IXNAME_METADAT))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		updatState.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-
-
-# Solver - Split up to compiling with old summa files vs new summa files
-VEG_PHENLGY= \
-		vegPhenlgy.f90
-VEG_PHENLGY_SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(VEG_PHENLGY))
-SNOW_DEPTH= \
-		sundials/computSnowDepth.f90
-SNOW_DEPTH_SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SNOW_DEPTH))
-SUMMA_SOLVER= \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		varSubstep.f90 \
-		opSplittin.f90
-SOLVER = $(patsubst %, $(SUMMA_ENGINE_DIR)/%, $(SUMMA_SOLVER))
-SUMMA_ACTORS_SOLVER = \
-		coupled_em.f90
-COUPLED_EM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_ACTORS_SOLVER))
-
-
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		output_structure.f90 \
-		cppwrap_fileAccess.f90 \
-		read_attribute.f90 \
-		read_forcing.f90 \
-		read_param.f90 \
-		read_initcond.f90 \
-		writeOutputFromOutputStructure.f90 \
-		write_to_netcdf.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90 \
-		hru_actor.f90 \
-		init_hru_actor.f90 \
-		outputStrucWrite.f90 \
-		hru_writeOutput.f90
-
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		alloc_fileAccess.f90 \
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_dimension.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-DERIV_FORCE = \
-		derivforce.f90 \
-		sundials/t2enthalpy.f90
-DERIV_FORCE_MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(DERIV_FORCE))
-
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		updateVars.f90 \
-		var_derive.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(SUMMA_ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS)  \
-	$(INTERFACE) $(HOOKUP) $(IXNAME_METADAT_DATAMS) $(DEPEND_ON_FILEMANAGER) \
-	$(TIME_UTILS_UTILMS) $(M_DECISIONS_UTILMS) $(UTILMS)
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(DERIV_FORCE_MODRUN) $(MODRUN) \
- 	$(VEG_PHENLGY_SOLVER) $(SOLVER) $(SNOW_DEPTH_SOLVER) $(COUPLED_EM)
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = $(ROOT_DIR)/build/includes
-SOURCE_DIR = $(ROOT_DIR)/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-AUXILARY = $(SOURCE_DIR)/global/auxiliary.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-SUMMA_BACKUP_SERVER = $(SOURCE_DIR)/summa_actor/summa_backup_server.cpp
-
-BATCH = $(SOURCE_DIR)/summa_actor/batch/batch.cpp
-BATCH_CONTAINER = $(SOURCE_DIR)/summa_actor/batch/batch_container.cpp
-
-CLIENT = $(SOURCE_DIR)/summa_actor/client/client.cpp
-CLIENT_CONTAINER = $(SOURCE_DIR)/summa_actor/client/client_container.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp
-OUTPUT_CONTAINER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_container.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(OUTPUT_CONTAINER) $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(SUMMA_BACKUP_SERVER) $(BATCH) $(CLIENT) $(BATCH_CONTAINER) $(CLIENT_CONTAINER) \
-	$(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -Wl,-rpath='$(ROOT_DIR)/bin:/usr/local/lib' -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
-
diff --git a/build/makefiles/makefile_richardson b/build/makefiles/makefile_richardson
deleted file mode 100644
index 92853c168b55666403a38af528e2f67c8edaf3f5..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile_richardson
+++ /dev/null
@@ -1,425 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /u1/kck540/Summa-Projects/Summa-Actors-Main
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include
-LIBRARIES = -L/usr/lib -L/usr/local/lib -lnetcdff -lopenblas
-
-ACTORS_INCLUDES = -I/usr/include -I/usr/local/include
-ACTORS_LIBRARIES = -L/usr/lib -L/usr/local/lib -L$(ROOT_DIR)/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff
-
-
-# Production runs
-FLAGS_NOAH = -g -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -g -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -g -O3 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-
-SUMMA_DSHARE_DIR = $(MOD_PATH)/summa/build/source/dshare
-SUMMA_ENGINE_DIR = $(MOD_PATH)/summa/build/source/engine
-
-
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor/fortran_code
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor/fortran_code
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90 \
-
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		var_lookup.f90 \
-		multiconst.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-IXNAME_METADAT = \
-		get_ixname.f90 \
-		popMetadat.f90
-IXNAME_METADAT_DATAMS = $(patsubst %, $(SUMMA_DSHARE_DIR)/%, $(IXNAME_METADAT))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		updatState.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-
-
-# Solver - Split up to compiling with old summa files vs new summa files
-VEG_PHENLGY= \
-		vegPhenlgy.f90
-VEG_PHENLGY_SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(VEG_PHENLGY))
-SNOW_DEPTH= \
-		sundials/computSnowDepth.f90
-SNOW_DEPTH_SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SNOW_DEPTH))
-SUMMA_SOLVER= \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		varSubstep.f90 \
-		opSplittin.f90
-SOLVER = $(patsubst %, $(SUMMA_ENGINE_DIR)/%, $(SUMMA_SOLVER))
-SUMMA_ACTORS_SOLVER = \
-		coupled_em.f90
-COUPLED_EM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_ACTORS_SOLVER))
-
-
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		output_structure.f90 \
-		cppwrap_fileAccess.f90 \
-		read_attribute.f90 \
-		read_forcing.f90 \
-		read_param.f90 \
-		read_initcond.f90 \
-		writeOutputFromOutputStructure.f90 \
-		write_to_netcdf.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90 \
-		hru_actor.f90 \
-		init_hru_actor.f90 \
-		outputStrucWrite.f90 \
-		hru_writeOutput.f90
-
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		alloc_fileAccess.f90 \
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_dimension.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-DERIV_FORCE = \
-		derivforce.f90 \
-		sundials/t2enthalpy.f90
-DERIV_FORCE_MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(DERIV_FORCE))
-
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		updateVars.f90 \
-		var_derive.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(SUMMA_ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS)  \
-	$(INTERFACE) $(HOOKUP) $(IXNAME_METADAT_DATAMS) $(DEPEND_ON_FILEMANAGER) \
-	$(TIME_UTILS_UTILMS) $(M_DECISIONS_UTILMS) $(UTILMS)
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(DERIV_FORCE_MODRUN) $(MODRUN) \
- 	$(VEG_PHENLGY_SOLVER) $(SOLVER) $(SNOW_DEPTH_SOLVER) $(COUPLED_EM)
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = $(ROOT_DIR)/build/includes
-SOURCE_DIR = $(ROOT_DIR)/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-AUXILARY = $(SOURCE_DIR)/global/auxiliary.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-SUMMA_BACKUP_SERVER = $(SOURCE_DIR)/summa_actor/summa_backup_server.cpp
-
-BATCH = $(SOURCE_DIR)/summa_actor/batch/batch.cpp
-BATCH_CONTAINER = $(SOURCE_DIR)/summa_actor/batch/batch_container.cpp
-
-CLIENT = $(SOURCE_DIR)/summa_actor/client/client.cpp
-CLIENT_CONTAINER = $(SOURCE_DIR)/summa_actor/client/client_container.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp
-OUTPUT_CONTAINER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_container.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(OUTPUT_CONTAINER) $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(SUMMA_BACKUP_SERVER) $(BATCH) $(CLIENT) $(BATCH_CONTAINER) $(CLIENT_CONTAINER) \
-	$(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -Wl,-rpath='$(ROOT_DIR)/bin:/usr/local/lib' -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
-
-
-
-
diff --git a/build/makefiles/makefile_sundials b/build/makefiles/makefile_sundials
deleted file mode 100644
index c21fc15896a12153c763414667cf05ffc10cb7e6..0000000000000000000000000000000000000000
--- a/build/makefiles/makefile_sundials
+++ /dev/null
@@ -1,420 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /Summa-Actors
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-DIR_SUNDIALS=/code/sundials/instdir
-INC_SUNDIALS=-I$(DIR_SUNDIALS)/include -I$(DIR_SUNDIALS)/fortran
-LIB_SUNDIALS=-L$(DIR_SUNDIALS)/lib -lsundials_fnvecmanyvector_mod -lsundials_fida_mod -lsundials_fnvecserial_mod -lsundials_fsunlinsoldense_mod -lsundials_fsunmatrixdense_mod 
- 
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include $(INC_SUNDIALS)
-LIBRARIES = -L/usr/lib -L/usr/local/lib -lnetcdff -lopenblas $(LIB_SUNDIALS)
-
-ACTORS_INCLUDES = -I/usr/include -I/usr/local/include $(INC_SUNDIALS)
-ACTORS_LIBRARIES = -L/usr/lib -L/usr/local/lib -L/Summa-Actors/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff $(LIB_SUNDIALS)
-
-
-# Production runs
-FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -g -O0 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -g -O0 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -g -O0 -Wfatal-errors -std=c++17
-
-# Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor/fortran_code
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor/fortran_code
-GRU_ACTOR_DIR = $(ACTORS_DIR)/gru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90 \
-
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		multiconst.f90 \
-		var_lookup_sundials.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90 \
-		get_ixname.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-SUMMA_DEPEND_ON_FILEMANAGER= \
-		popMetadat.f90 \
-		outpt_stat.f90
-DEPEND_ON_FILEMANAGER = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DEPEND_ON_FILEMANAGER))
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		sundials/mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		sundials/soil_utilsAddSundials.f90 \
-		updatState.f90 \
-		sundials/updatStateSundials.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-# Solver
-SUMMA_SOLVER= \
-		vegPhenlgy.f90 \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		sundials/type4IDA.f90 \
-		sundials/tol4IDA.f90 \
-		sundials/computEnthalpy.f90 \
-		sundials/computHeatCap.f90 \
-		sundials/computThermConduct.f90 \
-		sundials/computResidSundials.f90 \
-		sundials/eval8summaSundials.f90 \
-		sundials/computJacobSundials.f90 \
-		sundials/computSnowDepth.f90 \
-		sundials/summaSolveSundialsIDA.f90 \
-		sundials/systemSolvSundials.f90 \
-		varSubstep.f90 \
-		sundials/varSubstepSundials.f90 \
-		opSplittin.f90 \
-		sundials/coupled_em.f90
-		
-SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_SOLVER))
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-
-SUMMA_FILEACCESS_INTERFACE = \
-		cppwrap_fileAccess.f90 \
-		read_attribute.f90 \
-		read_forcing.f90 \
-		read_param.f90 \
-		write_to_netcdf.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		job_actor.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90 \
-		hru_actor.f90 \
-		init_hru_actor.f90 \
-
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-
-SUMMA_GRU_INTERFACE = \
-		gru_actor.f90 \
-
-GRU_INTERFACE = $(patsubst %, $(GRU_ACTOR_DIR)/%, $(SUMMA_GRU_INTERFACE))
-
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		sundials/checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_dimension.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90 \
-		# allocspace.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-# sundials - t2enthalpy.f90
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		sundials/t2enthalpy.f90 \
-		updateVars.f90 \
-		sundials/updateVarsSundials.f90 \
-		var_derive.f90 \
-		derivforce.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(DATAMS) $(INTERFACE) $(HOOKUP) $(DEPEND_ON_FILEMANAGER) $(UTILMS)
-
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(MODRUN) $(SOLVER) 
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = /Summa-Actors/build/includes
-SOURCE_DIR = /Summa-Actors/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-SETTINGS_FILES = $(SOURCE_DIR)/global/settings_functions.cpp
-AUXILARY = $(SOURCE_DIR)/global/auxiliary.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-SUMMA_BACKUP_SERVER = $(SOURCE_DIR)/summa_actor/summa_backup_server.cpp
-
-BATCH = $(SOURCE_DIR)/summa_actor/batch/batch.cpp
-BATCH_CONTAINER = $(SOURCE_DIR)/summa_actor/batch/batch_container.cpp
-
-CLIENT = $(SOURCE_DIR)/summa_actor/client/client.cpp
-CLIENT_CONTAINER = $(SOURCE_DIR)/summa_actor/client/client_container.cpp
-
-CLIENT_BATCH = $(SOURCE_DIR)/summa_actor/batch_client.cpp
-CLIENT_BATCH_CONTAINERS = $(SOURCE_DIR)/summa_actor/batch_client_containers.cpp
-
-GRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/gru_actor
-GRU_ACTOR = $(SOURCE_DIR)/gru_actor/gru_actor.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/cpp_code/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/cpp_code/forcing_file_info.cpp
-OUTPUT_MANAGER = $(SOURCE_DIR)/file_access_actor/cpp_code/output_manager.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/cpp_code/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_gru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(GRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(AUXILARY) $(SETTINGS_FILES) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_gru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(GRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES) $(GRU_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES) $(SUMMA_ACTOR_INCLUDES) 
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(SUMMA_BACKUP_SERVER) $(BATCH) $(CLIENT) $(BATCH_CONTAINER) $(CLIENT_CONTAINER) \
-	$(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -Wl,-rpath='/Summa-Actors/bin:/usr/local/lib:/code/sundials/instdir/lib' -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
-
-
-
-
diff --git a/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp b/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp
deleted file mode 100644
index c9c5deecc52df644f8f76b55932aa641c17de09d..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/cpp_code/file_access_actor.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-#include "file_access_actor.hpp"
-#include "forcing_file_info.hpp"
-#include "file_access_actor_subroutine_wrappers.hpp"
-#include "fortran_data_types.hpp"
-#include "message_atoms.hpp"
-#include "json.hpp"
-#include "auxilary.hpp"
-
-using json = nlohmann::json;
-
-
-namespace caf {
-
-behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gru, int num_gru, 
-    File_Access_Actor_Settings file_access_actor_settings, actor parent) {
-    aout(self) << "\n----------File_Access_Actor Started----------\n";
-    
-    // Set Up timing Info we wish to track
-    self->state.file_access_timing = TimingInfo();
-    self->state.file_access_timing.addTimePoint("read_duration");
-    self->state.file_access_timing.addTimePoint("write_duration");
-    self->state.file_access_actor_settings = file_access_actor_settings;
-
-    self->state.parent = parent;
-    self->state.num_gru = num_gru;
-    self->state.start_gru = start_gru;
-    self->state.handle_forcing_file_info = new_handle_file_info();
-    self->state.handle_ncid = new_handle_var_i();
-    self->state.err = 0;
-
-    self->state.num_output_steps = self->state.file_access_actor_settings.num_timesteps_in_output_buffer;
-
-        
-    initalizeFileAccessActor(self);
-
-    // Set up the output container
-    self->state.output_container = new Output_Container(
-        self->state.file_access_actor_settings.num_partitions_in_output_buffer,
-        self->state.num_gru,
-        self->state.file_access_actor_settings.num_timesteps_in_output_buffer,
-        self->state.num_steps); 
-
-    return {
-        [=](write_param, int index_gru, int index_hru, std::vector<double> attr_struct, 
-            std::vector<int> type_struct, std::vector<std::vector<double>> mpar_struct,
-            std::vector<double> bpar_struct) {
-            int err = 0;
-
-            std::shared_ptr<hru_output_handles> params = std::make_shared<hru_output_handles>();
-
-            self->state.file_access_timing.updateStartPoint("write_duration");
-
-            // populate the newly created Fortran structures
-            set_var_d(attr_struct, params->handle_attr_struct);
-            set_var_i(type_struct, params->handle_type_struct);
-            set_var_dlength(mpar_struct, params->handle_mpar_struct);
-            set_var_d(bpar_struct, params->handle_bpar_struct);
-            // write the populated data to netCDF
-            writeParamToNetCDF(self->state.handle_ncid, &index_gru, &index_hru, 
-                params->handle_attr_struct, 
-                params->handle_type_struct, 
-                params->handle_mpar_struct, 
-                params->handle_bpar_struct, &err);
-        
-
-            self->state.file_access_timing.updateEndPoint("write_duration");
-            
-        },
-
-        [=](access_forcing, int currentFile, caf::actor refToRespondTo) {
-            if (currentFile <= self->state.numFiles) {
-                if(self->state.forcing_file_list[currentFile - 1].isFileLoaded()) { // C++ starts at 0 Fortran starts at 1
-                    // Send the HRU actor the new forcing file
-                    // then tell it to get back to running
-                    self->send(refToRespondTo, new_forcing_file_v, 
-                        self->state.forcing_file_list[currentFile - 1].getNumSteps(),
-                        currentFile);
-
-                } else {
-                    self->state.file_access_timing.updateStartPoint("read_duration");
-                    
-                    // Load the file
-                    read_forcingFile(self->state.handle_forcing_file_info, &currentFile,
-                        &self->state.stepsInCurrentFile, &self->state.start_gru, 
-                        &self->state.num_gru, &self->state.err);
-                    if (self->state.err != 0) {
-                        aout(self) << "ERROR: Reading Forcing" << std::endl;
-                    }
-                    self->state.filesLoaded += 1;
-                    self->state.forcing_file_list[currentFile - 1].updateNumSteps(self->state.stepsInCurrentFile);
-
-                    self->state.file_access_timing.updateEndPoint("read_duration");
-                    // Check if we have loaded all forcing files
-                    if(self->state.filesLoaded <= self->state.numFiles) {
-                        self->send(self, access_forcing_internal_v, currentFile + 1);
-                    }
-
-                    // Send the HRU actor the new forcing file
-                    // then tell it to get back to running
-                    self->send(refToRespondTo, new_forcing_file_v, 
-                        self->state.forcing_file_list[currentFile - 1].getNumSteps(),
-                        currentFile);
-                }
-            } else {
-                aout(self) << currentFile << " is larger than expected for a forcing file request from an HRU" << std::endl;
-            }
-            
-        },
-
-        [=](access_forcing_internal, int currentFile) {
-            if (self->state.filesLoaded <= self->state.numFiles &&
-                currentFile <= self->state.numFiles) {
-                if (self->state.forcing_file_list[currentFile - 1].isFileLoaded()) {
-                    aout(self) << "File Loaded when shouldn't be \n";
-                }
-                self->state.file_access_timing.updateStartPoint("read_duration");
-
-                read_forcingFile(self->state.handle_forcing_file_info, &currentFile,
-                    &self->state.stepsInCurrentFile, &self->state.start_gru, 
-                    &self->state.num_gru, &self->state.err);
-                if (self->state.err != 0) {
-                    aout(self) << "ERROR: Reading Forcing" << std::endl;
-                }
-                self->state.filesLoaded += 1;
-                self->state.forcing_file_list[currentFile - 1].updateNumSteps(self->state.stepsInCurrentFile);
-                
-                self->state.file_access_timing.updateEndPoint("read_duration");
-
-                self->send(self, access_forcing_internal_v, currentFile + 1);
-            } else {
-                aout(self) << "All Forcing Files Loaded \n";
-            }
-        },
-
-        [=] (get_attributes_params, int index_gru, caf::actor actor_to_respond) {
-            // From Attributes File
-            std::vector<double> attr_struct_to_send = self->state.attr_structs_for_hrus[index_gru-1];
-            std::vector<int> type_struct_to_send = self->state.type_structs_for_hrus[index_gru-1];
-            std::vector<long int> id_struct_to_send = self->state.id_structs_for_hrus[index_gru-1];
-
-            // From Parameters File
-            std::vector<double> bpar_struct_to_send = self->state.bpar_structs_for_hrus[index_gru-1];
-            std::vector<double> dpar_struct_to_send = self->state.dpar_structs_for_hrus[index_gru-1];
-            std::vector<std::vector<double>> mpar_struct_to_send = self->state.mpar_structs_for_hrus[index_gru-1];
-
-            self->send(actor_to_respond, get_attributes_params_v, attr_struct_to_send,
-                type_struct_to_send, id_struct_to_send, bpar_struct_to_send, 
-                dpar_struct_to_send, mpar_struct_to_send);
-            
-        },
-
-        [=] (get_num_output_steps, caf::actor hru) {
-            self->send(hru, num_steps_before_write_v, self->state.num_output_steps);
-        },
-
-        [=](write_output, int index_gru, int index_hru, caf::actor hru_actor) {
-            self->state.file_access_timing.updateStartPoint("write_duration");
-
-            Output_Partition *output_partition = self->state.output_container->getOutputPartition(index_gru);
-
-            output_partition->setGRUReadyToWrite(hru_actor);
-        
-    
-            if (output_partition->isReadyToWrite()) {
-                int num_timesteps_to_write = output_partition->getNumStoredTimesteps();
-                int start_gru = output_partition->getStartGRUIndex();
-                int max_gru = output_partition->getMaxGRUIndex();
-                
-                writeOutput(self->state.handle_ncid, &num_timesteps_to_write,
-                    &start_gru, &max_gru, &self->state.err);
-                
-                output_partition->updateTimeSteps();
-
-                int num_steps_before_next_write = output_partition->getNumStoredTimesteps();
-
-                std::vector<caf::actor> hrus_to_update = output_partition->getReadyToWriteList();
-                
-                for (int i = 0; i < hrus_to_update.size(); i++) {
-                    self->send(hrus_to_update[i], num_steps_before_write_v, num_steps_before_next_write);
-                    self->send(hrus_to_update[i], run_hru_v);
-                }
-            
-                output_partition->resetReadyToWriteList();
-            }
-
-            self->state.file_access_timing.updateEndPoint("write_duration");
-        },
-
-        [=](restart_failures) {
-            self->state.output_container->reconstruct();
-        },
-
-        [=](run_failure, int local_gru_index) {
-            Output_Partition *output_partition = self->state.output_container->getOutputPartition(local_gru_index);
-            
-            output_partition->addFailedGRUIndex(local_gru_index);
-
-            int active_grus = output_partition->getNumActiveGRUs();
-
-            if (output_partition->isReadyToWrite() && active_grus > 0) {
-                int num_timesteps_to_write = output_partition->getNumStoredTimesteps();
-                int start_gru = output_partition->getMaxGRUIndex();
-                int max_gru = output_partition->getStartGRUIndex();
-                
-                writeOutput(self->state.handle_ncid, &num_timesteps_to_write,
-                    &start_gru, &max_gru, &self->state.err);
-                
-                output_partition->updateTimeSteps();
-
-                int num_steps_before_next_write = output_partition->getNumStoredTimesteps();
-
-                std::vector<caf::actor> hrus_to_update = output_partition->getReadyToWriteList();
-                
-                for (int i = 0; i < hrus_to_update.size(); i++) {
-                    self->send(hrus_to_update[i], num_steps_before_write_v, num_steps_before_next_write);
-                    self->send(hrus_to_update[i], run_hru_v);
-                }
-            
-                output_partition->resetReadyToWriteList();
-            
-            }
-          
-        },
-
-
-        [=](deallocate_structures, std::vector<serializable_netcdf_gru_actor_info> &netcdf_gru_info) {
-            int num_gru = netcdf_gru_info.size();
-            WriteGRUStatistics(self->state.handle_ncid, &self->state.gru_actor_stats, 
-                    netcdf_gru_info.data(), &num_gru, &self->state.err);
-
-            
-            // call output_container deconstructor
-            self->state.output_container->~Output_Container();
-
-
-            aout(self) << "Deallocating Structure" << std::endl;
-            FileAccessActor_DeallocateStructures(self->state.handle_forcing_file_info, self->state.handle_ncid);
-            // deallocateOutputStructure(&self->state.err);
-            aout(self) << "\n________________FILE_ACCESS_ACTOR TIMING INFO RESULTS________________\n";
-            aout(self) << "Total Read Duration = " << self->state.file_access_timing.getDuration("read_duration").value_or(-1.0) << " Seconds\n";
-            aout(self) << "Total Write Duration = " << self->state.file_access_timing.getDuration("write_duration").value_or(-1.0) << " Seconds\n";
-            
-            self->send(self->state.parent, 
-                file_access_actor_done_v, 
-                self->state.file_access_timing.getDuration("read_duration").value_or(-1.0), 
-                self->state.file_access_timing.getDuration("write_duration").value_or(-1.0));
-            self->quit();
-        },
-
-    };
-}
-
-
-void initalizeFileAccessActor(stateful_actor<file_access_state>* self) {
-    int indx = 1;
-    int err = 0;
-    
-    // read information on model forcing files
-    ffile_info(&indx, 
-        self->state.handle_forcing_file_info, &self->state.numFiles, &err);
-    if (err != 0) {
-        aout(self) << "Error: ffile_info_C - File_Access_Actor \n";
-        std::string function = "ffile_info_C";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-
-    // save model decisions as named integers
-    mDecisions(&self->state.num_steps, &err); 
-    if (err != 0) {
-        aout(self) << "Error: mDecisions - FileAccess Actor \n";
-        std::string function = "mDecisions_C";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-    aout(self) << "Simluations Steps: " << self->state.num_steps << "\n";
-    // Check that the number of timesteps in the output buffer is not greater than the number of timesteps in the simulation
-    if (self->state.num_steps < self->state.file_access_actor_settings.num_timesteps_in_output_buffer) {
-        self->state.num_output_steps = self->state.num_steps;
-        self->state.file_access_actor_settings.num_timesteps_in_output_buffer = self->state.num_steps;
-    }
-
-    read_pinit_C(&err);
-    if (err != 0) {
-        aout(self) << "ERROR: read_pinit_C\n";
-        std::string function = "read_pinit_C";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-    
-    read_vegitationTables(&err);
-    if (err != 0) {
-        aout(self) << "ERROR: read_vegitationTables\n";
-        std::string function = "read_vegitationTables";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-
-    initFailedHRUTracker(&self->state.num_gru);
-
-    def_output(self->state.handle_ncid, &self->state.start_gru, &self->state.num_gru, 
-               &self->state.num_gru, &self->state.gru_actor_stats, &err);
-    if (err != 0) {
-        aout(self) << "ERROR: Create_OutputFile\n";
-        std::string function = "def_output";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-
-    // Initalize the output Structure
-    aout(self) << "Initalizing Output Structure" << std::endl;
-    initOutputStructure(self->state.handle_forcing_file_info, 
-        &self->state.file_access_actor_settings.num_timesteps_in_output_buffer, 
-        &self->state.num_gru, &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "ERROR: Init_OutputStruct\n";
-        std::string function = "Init_OutputStruct";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-
-    initOutputTimeStep(&self->state.num_gru, &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "ERROR: Init_OutputTimeStep\n";
-        std::string function = "Init_OutputTimeStep";
-        self->send(self->state.parent, file_access_actor_err_v, function);
-        self->quit();
-        return;
-    }
-
-    // Read in the attribute and parameter information for the HRUs to request
-    readAttributes(self);
-    readParameters(self);
-
-    // read in the inital conditions for the grus/hrus
-    readInitConditions(self);
-    
-    // Inital Files Have Been Loaded - Send Message to Job_Actor to Start Simulation
-    self->send(self->state.parent, init_gru_v);
-    // initalize the forcingFile array
-    self->state.filesLoaded = 0;
-    for (int i = 1; i <= self->state.numFiles; i++) {
-        self->state.forcing_file_list.push_back(Forcing_File_Info(i));
-    }
-}
-
-void readAttributes(stateful_actor<file_access_state>* self) {
-
-    int err = 0;
-    openAttributeFile(&self->state.attribute_ncid, &err);
-    
-    getNumVarAttr(&self->state.attribute_ncid, &self->state.num_var_in_attributes_file, &err);
-    
-    for (int index_gru = 1; index_gru < self->state.num_gru + 1; index_gru++) {
-
-        void* handle_attr_struct = new_handle_var_d();
-        void* handle_type_struct = new_handle_var_i();
-        void* handle_id_struct   = new_handle_var_i8();
-        int index_hru = 1;
-
-        allocateAttributeStructures(&index_gru, &index_hru, handle_attr_struct, handle_type_struct,
-            handle_id_struct, &err);
-
-        readAttributeFromNetCDF(&self->state.attribute_ncid, &index_gru, &index_hru,
-            &self->state.num_var_in_attributes_file, handle_attr_struct, handle_type_struct,
-            handle_id_struct, &err);
-        
-        // attr struct
-        std::vector<double> attr_struct_to_push = get_var_d(handle_attr_struct);
-        self->state.attr_structs_for_hrus.push_back(attr_struct_to_push);
-        delete_handle_var_d(handle_attr_struct);
-        // type struct
-        std::vector<int> type_struct_to_push = get_var_i(handle_type_struct);
-        self->state.type_structs_for_hrus.push_back(type_struct_to_push);
-        delete_handle_var_i(handle_type_struct);
-        // id struct
-        std::vector<long int> id_struct_to_push = get_var_i8(handle_id_struct);
-        self->state.id_structs_for_hrus.push_back(id_struct_to_push);
-        delete_handle_var_i8(handle_id_struct);
-    }
-
-    closeAttributeFile(&self->state.attribute_ncid, &err);
-}
-
-void readParameters(stateful_actor<file_access_state>* self) {
-
-    int err = 0;
-    int index_hru = 1;
-
-    openParamFile(&self->state.param_ncid, &self->state.param_file_exists, 
-        &err);
-
-    getParamSizes(&self->state.dpar_array_size, &self->state.bpar_array_size,
-        &self->state.type_array_size);
-    
-
-    if (self->state.param_file_exists) {
-        getNumVarParam(&self->state.param_ncid, &self->state.num_var_in_param_file,
-            &err);
-    } else {
-        self->state.num_var_in_param_file = self->state.type_array_size;
-    }
-
-    for (int index_gru = 1; index_gru < self->state.num_gru + 1; index_gru++) {
-
-        std::vector<double> dpar_array(self->state.dpar_array_size);
-        void* handle_type_struct = new_handle_var_i();
-        void* handle_dpar_struct = new_handle_var_d();
-        void* handle_mpar_struct = new_handle_var_dlength();      
-        void* handle_bpar_struct = new_handle_var_d();  
-        std::vector<double> bpar_array(self->state.dpar_array_size);        
-
-        allocateParamStructures(&index_gru, &index_hru, handle_dpar_struct, 
-            handle_mpar_struct, handle_bpar_struct, &err);
-
-        // need to convert attr_struct to FORTRAN format   
-        set_var_i(self->state.type_structs_for_hrus[index_gru-1], handle_type_struct); 
-    
-        overwriteParam(&index_gru, &index_hru, 
-            handle_type_struct,
-            handle_dpar_struct, 
-            handle_mpar_struct, 
-            handle_bpar_struct, 
-            &err);
-
-        if (self->state.param_file_exists) {
-            readParamFromNetCDF(&self->state.param_ncid, &index_gru, &index_hru,
-                &self->state.start_gru, 
-                &self->state.num_var_in_param_file, 
-                handle_mpar_struct, 
-                handle_bpar_struct,
-                &err);
-        }
-
-        // type_struct
-        delete_handle_var_i(handle_type_struct);
-        
-        // dpar_struct
-        std::vector<double> dpar_struct_to_push = get_var_d(handle_dpar_struct);
-        self->state.dpar_structs_for_hrus.push_back(dpar_struct_to_push);
-        delete_handle_var_d(handle_dpar_struct);
-        // mpar_struct
-        std::vector<std::vector<double>> mpar_struct_to_push = get_var_dlength(handle_mpar_struct);
-        self->state.mpar_structs_for_hrus.push_back(mpar_struct_to_push);
-        delete_handle_var_dlength(handle_mpar_struct);
-        // bpar_struct
-        std::vector<double> bpar_struct_to_push = get_var_d(handle_bpar_struct);
-        self->state.bpar_structs_for_hrus.push_back(bpar_struct_to_push);
-        delete_handle_var_d(handle_bpar_struct);
-    }
-    closeParamFile(&self->state.param_ncid, &err);
-}
-
-
-void readInitConditions(stateful_actor<file_access_state>* self) {
-    int err;
-    openInitCondFile(&self->state.init_cond_ncid, &err);
-    readInitCond_prog(&self->state.init_cond_ncid, &self->state.start_gru, &self->state.num_gru, &err);
-    readInitCond_bvar(&self->state.init_cond_ncid, &self->state.start_gru, &self->state.num_gru, &err);
-    closeInitCondFile(&self->state.init_cond_ncid, &err); 
-}
-
-} // end namespace
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/cpp_code/partition_actor.cpp b/build/source/actors/file_access_actor/cpp_code/partition_actor.cpp
deleted file mode 100644
index 4a226c7aef77ea1859b37d9930b58bbcafbccfe8..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/cpp_code/partition_actor.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "partition_actor.hpp"
-
-
-namespace caf {
-
-behavior partition_actor(stateful_actor<partition_actor_state>* self, int start_local_gru_index, 
-    int num_local_grus, int num_timesteps_simulation, int num_timesteps_buffer) {
-    
-    self->state.start_local_gru_index = start_local_gru_index;
-    self->state.num_local_grus = num_local_grus;
-    self->state.num_timesteps_simulation = num_timesteps_simulation;
-    self->state.num_timesteps_buffer = num_timesteps_buffer;
-    
-    
-    return {
-    };
-}
-}
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/cppwrap_fileAccess.f90 b/build/source/actors/file_access_actor/cppwrap_fileAccess.f90
new file mode 100644
index 0000000000000000000000000000000000000000..d27c767cd25a7c72ff7a2a7507af9da983d7514d
--- /dev/null
+++ b/build/source/actors/file_access_actor/cppwrap_fileAccess.f90
@@ -0,0 +1,678 @@
+module cppwrap_fileAccess
+
+
+  !======= Inclusions ===========
+  USE, intrinsic :: iso_c_binding
+  USE nrtype
+  USE data_types
+  USE actor_data_types
+  USE globalData
+  USE globalData,only:integerMissing      ! missing integer value
+  USE globalData,only:realMissing         ! missing double precision value
+
+  USE var_lookup,only:maxvarFreq                ! maximum number of output files
+
+
+  implicit none
+  public::fileAccessActor_init_fortran
+  public::FileAccessActor_DeallocateStructures
+  public::SOIL_VEG_GEN_PARM
+
+  character(len=64), parameter     :: summaVersion = ''
+  character(len=64), parameter     :: buildTime = ''
+  character(len=64), parameter     :: gitBranch = ''
+  character(len=64), parameter     :: gitHash = ''
+  
+  contains
+
+! Call the fortran routines that read data in and are associtated with the forcing structure
+subroutine fileAccessActor_init_fortran(& ! Variables for forcing
+                                        handle_forcFileInfo,&
+                                        num_forcing_files,&
+                                        num_timesteps,&
+                                        num_timesteps_output_buffer,&
+                                        ! Variables for output
+                                        handle_output_ncid,&
+                                        start_gru,&  
+                                        num_gru,&
+                                        num_hru,&
+                                        err) bind(C, name="fileAccessActor_init_fortran")
+  USE ffile_info_actors_module,only:ffile_info
+  USE mDecisions_module,only:mDecisions                       ! module to read model decisions
+  USE read_pinit_module,only:read_pinit                       ! module to read initial model parameter values
+  USE module_sf_noahmplsm,only:read_mp_veg_parameters         ! module to read NOAH vegetation tables
+  USE output_structure_module,only:initOutputStructure        ! module to initialize output structure
+  USE output_structure_module,only:initOutputTimeStep         ! module to initialize output timestep structure (tracks GRUs timestep for output)
+  USE read_attrb_module,only:read_attrb                       ! module to read local attributes
+  USE read_param_module,only:read_param                       ! module to read model parameter sets
+  USE pOverwrite_module,only:pOverwrite                       ! module to overwrite default parameter values with info from the Noah tables
+  USE var_derive_module,only:fracFuture                       ! module to calculate the fraction of runoff in future time steps (time delay histogram)
+  USE paramCheck_module,only:paramCheck                       ! module to check consistency of model parameters
+  USE read_icond_module,only:read_icond                       ! module to read initial conditions
+  USE check_icond_module,only:check_icond                     ! module to check initial conditions
+  USE def_output_module,only:def_output                       ! module to define model output
+  USE globalData,only:localParFallback                        ! local column default parameters
+  USE globalData,only:basinParFallback                        ! basin-average default parameters
+  USE globalData,only:mpar_meta,bpar_meta                     ! parameter metadata structures
+  USE summaFileManager,only:LOCALPARAM_INFO,BASINPARAM_INFO   ! files defining the default values and constraints for model parameters
+  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
+  USE summaFileManager,only:LOCAL_ATTRIBUTES                  ! name of model initial attributes file
+  USE summaFileManager,only:GENPARM,VEGPARM,SOILPARM,MPTABLE  ! files defining the noah tables
+  USE summaFileManager,only:MODEL_INITCOND                    ! name of model initial conditions file
+  USE summaFileManager,only:STATE_PATH                        ! optional path to state/init. condition files (defaults to SETTINGS_PATH)
+  USE summaFileManager,only:OUTPUT_PATH,OUTPUT_PREFIX ! define output file
+  USE globalData,only:model_decisions                         ! model decision structure
+  USE var_lookup,only:iLookDECISIONS                          ! look-up values for model decisions
+  USE var_lookup,only:iLookTYPE                               ! look-up values for model types
+  USE var_lookup,only:iLookID                                 ! look-up values for model IDs
+  USE var_lookup,only:iLookPARAM
+  USE var_lookup,only:iLookATTR                               ! look-up values for model attributes
+  USE var_lookup,only:iLookBVAR                               ! look-up values for basin-average variables
+  USE output_structure_module,only:outputStructure            ! output structure
+
+  USE globalData,only:iRunModeFull,iRunModeGRU,iRunModeHRU
+  USE globalData,only:iRunMode                                ! define the current running mode
+  USE globalData,only:checkHRU                                ! index of the HRU for a single HRU run
+  
+  ! look-up values for the choice of heat capacity computation
+#ifdef V4_ACTIVE
+  USE mDecisions_module,only:enthalpyFD                       ! heat capacity using enthalpy
+  USE t2enthalpy_module,only:T2E_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
+#endif
+  USE mDecisions_module,only:&
+                        monthlyTable,&        ! LAI/SAI taken directly from a monthly table for different vegetation classes
+                        specified,&           ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
+                        sameRulesAllLayers, & ! SNTHERM option: same combination/sub-dividion rules applied to all layers
+                        rulesDependLayerIndex ! CLM option: combination/sub-dividion rules depend on layer index
+
+  USE ConvE2Temp_module,only:E2T_lookup       ! module to calculate a look-up table for the temperature-enthalpy conversion
+
+
+  USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM    ! 2-d tables for stem area index and leaf area index (vegType,month)
+  USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB      ! height at the top and bottom of vegetation (vegType)
+  USE globalData,only:numtim                  ! number of time steps in the simulation
+  USE globalData,only:fileout                 ! name of the output file
+  USE globalData,only:ncid                    ! id of the output file
+  implicit none
+
+  type(c_ptr), intent(in), value         :: handle_forcFileInfo
+  integer(c_int),intent(out)             :: num_forcing_files
+  integer(c_int),intent(out)             :: num_timesteps
+  integer(c_int),intent(in)              :: num_timesteps_output_buffer
+  type(c_ptr),intent(in), value          :: handle_output_ncid
+  integer(c_int),intent(out)             :: start_gru
+  integer(c_int),intent(out)             :: num_gru
+  integer(c_int),intent(out)             :: num_hru
+  integer(c_int),intent(out)             :: err
+
+  ! local Variables
+  type(file_info_array),pointer          :: forcFileInfo
+  type(var_i),pointer                    :: output_ncid        ! id of output file
+  integer(i4b)                           :: iGRU               ! counter for GRUs
+  integer(i4b)                           :: iHRU               ! counter for HRUs
+  integer(i4b)                           :: jHRU,kHRU          ! HRU indices
+  integer(i4b)                           :: ivar               ! counter for variables
+  character(len=256)                     :: attrFile           ! attributes file name
+  character(LEN=256)                     :: restartFile        ! restart file name
+  
+  integer(i4b)                           :: indxGRU=1
+  character(len=256)                     :: message            ! error message for downwind routine
+
+
+  err=0; message="fileAccessActor_init_fortran/"
+
+  call c_f_pointer(handle_forcFileInfo, forcFileInfo)
+  call c_f_pointer(handle_output_ncid, output_ncid)
+
+  ! Get the initial forcing file information
+  call ffile_info(indxGRU, forcFileInfo, num_forcing_files, err, message)
+  if(err/=0)then; print*, trim(message); return; endif
+
+  ! Get and save the model decisions as integers
+  call mDecisions(err,message)
+  if(err/=0)then; print*,trim(message); return; endif
+  num_timesteps = numtim
+
+    ! get the maximum number of snow layers
+  select case(model_decisions(iLookDECISIONS%snowLayers)%iDecision)
+    case(sameRulesAllLayers);    err=100; message=trim(message)//'sameRulesAllLayers not implemented';print*,message;return
+    case(rulesDependLayerIndex); maxSnowLayers = 5
+    case default; err=20; message=trim(message)//'unable to identify option to combine/sub-divide snow layers';print*,message;return
+  end select ! (option to combine/sub-divide snow layers)
+
+
+  maxLayers = gru_struc(1)%hruInfo(1)%nSoil + maxSnowLayers
+
+  ! *****************************************************************************
+  ! *** read default model parameters
+  ! *****************************************************************************
+  ! read default values and constraints for model parameters (local column)
+  call read_pinit(LOCALPARAM_INFO,.TRUE., mpar_meta,localParFallback,err,message)
+  if(err/=0)then; print*,trim(message); return; endif
+
+  ! read default values and constraints for model parameters (basin-average)
+  call read_pinit(BASINPARAM_INFO,.FALSE.,bpar_meta,basinParFallback,err,message)
+  if(err/=0)then; print*,trim(message); return; endif
+  
+  
+  ! *****************************************************************************
+  ! *** read Noah vegetation and soil tables
+  ! *****************************************************************************
+
+  greenVegFrac_monthly = (/0.01_dp, 0.02_dp, 0.03_dp, 0.07_dp, 0.50_dp, 0.90_dp, 0.95_dp, 0.96_dp, 0.65_dp, 0.24_dp, 0.11_dp, 0.02_dp/)
+
+
+  ! read Noah soil and vegetation tables
+  call soil_veg_gen_parm(trim(SETTINGS_PATH)//trim(VEGPARM),      & ! filename for vegetation table
+                         trim(SETTINGS_PATH)//trim(SOILPARM),                        & ! filename for soils table
+                         trim(SETTINGS_PATH)//trim(GENPARM),                         & ! filename for general table
+                         trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision), & ! classification system used for vegetation
+                         trim(model_decisions(iLookDECISIONS%soilCatTbl)%cDecision))   ! classification system used for soils
+  if(err/=0)then; print*,trim(message); return; endif
+
+  ! read Noah-MP vegetation tables
+  call read_mp_veg_parameters(trim(SETTINGS_PATH)//trim(MPTABLE),                       & ! filename for Noah-MP table
+                              trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision)) ! classification system used for vegetation
+  if(err/=0)then; print*,trim(message); return; endif
+
+    ! define urban vegetation category
+  select case(trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision))
+    case('USGS');                     urbanVegCategory =    1
+    case('MODIFIED_IGBP_MODIS_NOAH'); urbanVegCategory =   13
+    case('plumberCABLE');             urbanVegCategory = -999
+    case('plumberCHTESSEL');          urbanVegCategory = -999
+    case('plumberSUMMA');             urbanVegCategory = -999
+    case default; message=trim(message)//'unable to identify vegetation category';print*,message;return
+  end select
+
+
+  ! *****************************************************************************
+  ! *** Define Output Files
+  ! *****************************************************************************
+  nGRUrun = num_gru
+  nHRUrun = num_gru ! the same as nGRUrun for now
+  fileout = trim(OUTPUT_PATH)//trim(OUTPUT_PREFIX)//trim(output_fileSuffix)
+  ncid(:) = integerMissing
+  call def_output(summaVersion,buildTime,gitBranch,gitHash,num_gru,num_hru,gru_struc(1)%hruInfo(1)%nSoil,fileout,err,message)
+  if(err/=0)then; print*,trim(message); return; endif
+  ! allocate space for the output file ID array
+  if (.not.allocated(output_ncid%var))then
+    allocate(output_ncid%var(maxVarFreq))
+    output_ncid%var(:) = integerMissing
+  endif
+  ! copy ncid
+  output_ncid%var(:) = ncid(:)
+
+  ! *****************************************************************************
+  ! *** Initialize output structure
+  ! *****************************************************************************
+  call initOutputStructure(forcFileInfo, num_timesteps_output_buffer, num_gru, err)
+  if(err/=0)then; print*,trim(message); return; endif
+
+  ! *****************************************************************************
+  ! *** Initialize output time step
+  ! *****************************************************************************
+  call initOutputTimeStep(num_gru, err)
+  if(err/=0)then; print*,trim(message); return; endif
+
+
+  ! *****************************************************************************
+  ! *** Read Attributes
+  ! *****************************************************************************
+
+  attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES)
+  call read_attrb(trim(attrFile),num_gru,outputStructure(1)%attrStruct,&
+                  outputStructure(1)%typeStruct,outputStructure(1)%idStruct,err,message)
+  if(err/=0)then; print*,trim(message); return; endif
+
+
+  ! set default model parameters
+  do iGRU=1, num_gru
+    do iHRU=1, gru_struc(iGRU)%hruCount
+      ! set parmameters to their default value
+      outputStructure(1)%dparStruct%gru(iGRU)%hru(iHRU)%var(:) = localParFallback(:)%default_val         ! x%hru(:)%var(:)
+
+      ! overwrite default model parameters with information from the Noah-MP tables
+      call pOverwrite(outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%vegTypeIndex),  &  ! vegetation category
+                      outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%soilTypeIndex), &  ! soil category
+                      outputStructure(1)%dparStruct%gru(iGRU)%hru(iHRU)%var,                          &  ! default model parameters
+                      err,message)                                                   ! error control
+      if(err/=0)then; print*, trim(message); return; endif
+
+
+   ! copy over to the parameter structure
+   ! NOTE: constant for the dat(:) dimension (normally depth)
+      do ivar=1,size(localParFallback)
+        outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU)%var(ivar)%dat(:) = outputStructure(1)%dparStruct%gru(iGRU)%hru(iHRU)%var(ivar)
+      end do  ! looping through variables
+    
+    end do  ! looping through HRUs
+    
+    ! set default for basin-average parameters
+    outputStructure(1)%bparStruct%gru(iGRU)%var(:) = basinParFallback(:)%default_val
+    
+  end do  ! looping through GRUs
+
+
+  ! *****************************************************************************
+  ! *** Read Parameters
+  ! *****************************************************************************
+  checkHRU = integerMissing
+  call read_param(iRunMode,checkHRU,start_gru,num_hru,num_gru,outputStructure(1)%idStruct,&
+                  outputStructure(1)%mparStruct,outputStructure(1)%bparStruct,err,message)
+  if(err/=0)then; print*,trim(message); return; endif
+
+  ! *****************************************************************************
+  ! *** compute derived model variables that are pretty much constant for the basin as a whole
+  ! *****************************************************************************
+  ! ! loop through GRUs
+  do iGRU=1,num_gru
+    ! calculate the fraction of runoff in future time steps
+    call fracFuture(outputStructure(1)%bparStruct%gru(iGRU)%var,    &  ! vector of basin-average model parameters
+                    outputStructure(1)%bvarStruct_init%gru(iGRU),    &  ! data structure of basin-average variables
+                    err,message)                   ! error control
+    if(err/=0)then; print*, trim(message); return; endif
+
+    ! loop through local HRUs
+    do iHRU=1,gru_struc(iGRU)%hruCount
+
+    
+      kHRU=0
+      ! check the network topology (only expect there to be one downslope HRU)
+      do jHRU=1,gru_struc(iGRU)%hruCount
+      if(outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%downHRUindex) == outputStructure(1)%idStruct%gru(iGRU)%hru(jHRU)%var(iLookID%hruId))then
+        if(kHRU==0)then  ! check there is a unique match
+        kHRU=jHRU
+        else
+        message=trim(message)//'only expect there to be one downslope HRU'; print*, message; return
+        end if  ! (check there is a unique match)
+      end if  ! (if identified a downslope HRU)
+      end do
+
+
+      ! check that the parameters are consistent
+      call paramCheck(outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU),err,message)
+      if(err/=0)then; print*, message; return; endif
+
+
+      ! calculate a look-up table for the temperature-enthalpy conversion: snow
+      ! NOTE1: this should eventually be replaced by the more general routine below
+      ! NOTE2: this does not actually need to be called for each HRU and GRU
+      call E2T_lookup(outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU),err,message)
+      if(err/=0)then; print*,message; return; endif
+
+      ! calculate a lookup table to compute enthalpy from temperature, only for enthalpyFD
+#ifdef V4_ACTIVE      
+      if(model_decisions(iLookDECISIONS%howHeatCap)%iDecision == enthalpyFD)then
+        call T2E_lookup(gru_struc(iGRU)%hruInfo(iHRU)%nSoil,   &   ! intent(in):    number of soil layers
+                        outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU),        &   ! intent(in):    parameter data structure
+                        outputStructure(1)%lookupStruct%gru(iGRU)%hru(iHRU),      &   ! intent(inout): lookup table data structure
+                        err,message)                              ! intent(out):   error control
+        if(err/=0)then; print*, message; return; endif
+      endif
+#endif
+      ! overwrite the vegetation height
+      HVT(outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%vegTypeIndex)) = outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU)%var(iLookPARAM%heightCanopyTop)%dat(1)
+      HVB(outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%vegTypeIndex)) = outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU)%var(iLookPARAM%heightCanopyBottom)%dat(1)
+         
+      ! overwrite the tables for LAI and SAI
+      if(model_decisions(iLookDECISIONS%LAI_method)%iDecision == specified)then
+        SAIM(outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%vegTypeIndex),:) = outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU)%var(iLookPARAM%winterSAI)%dat(1)
+        LAIM(outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookTYPE%vegTypeIndex),:) = outputStructure(1)%mparStruct%gru(iGRU)%hru(iHRU)%var(iLookPARAM%summerLAI)%dat(1)*greenVegFrac_monthly
+      endif
+
+    end do ! HRU
+    
+    ! compute total area of the upstream HRUS that flow into each HRU
+    do iHRU=1,gru_struc(iGRU)%hruCount
+      outputStructure(1)%upArea%gru(iGRU)%hru(iHRU) = 0._rkind
+      do jHRU=1,gru_struc(iGRU)%hruCount
+       ! check if jHRU flows into iHRU; assume no exchange between GRUs
+       if(outputStructure(1)%typeStruct%gru(iGRU)%hru(jHRU)%var(iLookTYPE%downHRUindex)==outputStructure(1)%typeStruct%gru(iGRU)%hru(iHRU)%var(iLookID%hruId))then
+        outputStructure(1)%upArea%gru(iGRU)%hru(iHRU) = outputStructure(1)%upArea%gru(iGRU)%hru(iHRU) + outputStructure(1)%attrStruct%gru(iGRU)%hru(jHRU)%var(iLookATTR%HRUarea)
+       endif   ! (if jHRU is an upstream HRU)
+      end do  ! jHRU
+    end do  ! iHRU
+  
+    ! identify the total basin area for a GRU (m2)  
+    outputStructure(1)%bvarStruct_init%gru(iGRU)%var(iLookBVAR%basin__totalArea)%dat(1) = 0._rkind
+    do iHRU=1,gru_struc(iGRU)%hruCount
+      outputStructure(1)%bvarStruct_init%gru(iGRU)%var(iLookBVAR%basin__totalArea)%dat(1) = &
+      outputStructure(1)%bvarStruct_init%gru(iGRU)%var(iLookBVAR%basin__totalArea)%dat(1) + outputStructure(1)%attrStruct%gru(iGRU)%hru(iHRU)%var(iLookATTR%HRUarea)
+    end do
+  
+  end do ! GRU
+
+
+
+
+
+
+  ! *****************************************************************************
+  ! Restart File
+  ! *****************************************************************************
+  ! define restart file path/name
+  if(STATE_PATH == '') then
+    restartFile = trim(SETTINGS_PATH)//trim(MODEL_INITCOND)
+  else
+    restartFile = trim(STATE_PATH)//trim(MODEL_INITCOND)
+  endif
+
+ ! read initial conditions
+  call read_icond(restartFile,                        & ! intent(in):    name of initial conditions file
+                  num_gru,                            & ! intent(in):    number of response units
+                  outputStructure(1)%mparStruct,      & ! intent(in):    model parameters
+                  outputStructure(1)%progStruct_init, & ! intent(inout): model prognostic variables
+                  outputStructure(1)%bvarStruct_init, & ! intent(inout): model basin (GRU) variables
+                  outputStructure(1)%indxStruct_init, & ! intent(inout): model indices
+                  err,message)                          ! intent(out):   error control
+  if(err/=0)then; print*, message; return; endif
+
+  call check_icond(num_gru,                            &
+                   outputStructure(1)%progStruct_init, &  ! intent(inout): model prognostic variables
+                   outputStructure(1)%mparStruct,      & ! intent(in):    model parameters
+                   outputStructure(1)%indxStruct_init, & ! intent(inout): model indices
+                   err,message)                          ! intent(out):   error control
+  if(err/=0)then; print*, message; return; endif  
+end subroutine fileAccessActor_init_fortran
+
+
+subroutine FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid) bind(C,name="FileAccessActor_DeallocateStructures")
+  USE netcdf_util_module,only:nc_file_close 
+  USE globalData,only:structInfo                              ! information on the data structures
+  USE access_forcing_module,only:forcingDataStruct
+  USE access_forcing_module,only:vectime
+  USE output_structure_module,only:outputTimeStep
+  implicit none
+  type(c_ptr),intent(in), value        :: handle_forcFileInfo
+  type(c_ptr),intent(in), value        :: handle_ncid
+  type(var_i),pointer                  :: ncid
+
+  type(file_info_array), pointer       :: forcFileInfo
+  integer(i4b)                         :: iFreq
+  character(LEN=256)                   :: cmessage
+  character(LEN=256)                   :: message
+  integer(i4b)                         :: err
+
+  call c_f_pointer(handle_ncid, ncid)
+  call c_f_pointer(handle_forcFileInfo, forcFileInfo)
+
+
+  ! close the open output FIle
+  do iFreq=1,maxvarFreq
+    if (ncid%var(iFreq)/=integerMissing) then
+        call nc_file_close(ncid%var(iFreq),err,cmessage)
+        if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
+    endif   
+  end do
+  
+  deallocate(forcFileInfo)
+  deallocate(ncid)
+  deallocate(outputTimeStep)
+end subroutine FileAccessActor_DeallocateStructures
+
+! **************************************************************************************************
+! private subroutine SOIL_VEG_GEN_PARM: Read soil, vegetation and other model parameters (from NOAH)
+! **************************************************************************************************
+SUBROUTINE SOIL_VEG_GEN_PARM(FILENAME_VEGTABLE, FILENAME_SOILTABLE, FILENAME_GENERAL, MMINLU, MMINSL)
+  !-----------------------------------------------------------------
+  use module_sf_noahlsm, only : shdtbl, nrotbl, rstbl, rgltbl, &
+  &                        hstbl, snuptbl, maxalb, laimintbl, &
+  &                        bb, drysmc, f11, maxsmc, laimaxtbl, &
+  &                        emissmintbl, emissmaxtbl, albedomintbl, &
+  &                        albedomaxtbl, wltsmc, qtz, refsmc, &
+  &                        z0mintbl, z0maxtbl, &
+  &                        satpsi, satdk, satdw, &
+  &                        theta_res, theta_sat, vGn_alpha, vGn_n, k_soil, &  ! MPC add van Genutchen parameters
+  &                        fxexp_data, lvcoef_data, &
+  &                        lutype, maxalb, &
+  &                        slope_data, frzk_data, bare, cmcmax_data, &
+  &                        cfactr_data, csoil_data, czil_data, &
+  &                        refkdt_data, natural, refdk_data, &
+  &                        rsmax_data, salp_data, sbeta_data, &
+  &                        zbot_data, smhigh_data, smlow_data, &
+  &                        lucats, topt_data, slcats, slpcats, sltype
+
+  IMPLICIT NONE
+
+  CHARACTER(LEN=*), INTENT(IN) :: FILENAME_VEGTABLE, FILENAME_SOILTABLE, FILENAME_GENERAL
+  CHARACTER(LEN=*), INTENT(IN) :: MMINLU, MMINSL
+  integer :: LUMATCH, IINDEX, LC, NUM_SLOPE
+  integer :: ierr
+  INTEGER , PARAMETER :: OPEN_OK = 0
+
+  character*128 :: mess , message
+
+  !-----SPECIFY VEGETATION RELATED CHARACTERISTICS :
+  !             ALBBCK: SFC albedo (in percentage)
+  !                 Z0: Roughness length (m)
+  !             SHDFAC: Green vegetation fraction (in percentage)
+  !  Note: The ALBEDO, Z0, and SHDFAC values read from the following table
+  !          ALBEDO, amd Z0 are specified in LAND-USE TABLE; and SHDFAC is
+  !          the monthly green vegetation data
+  !             CMXTBL: MAX CNPY Capacity (m)
+  !             NROTBL: Rooting depth (layer)
+  !              RSMIN: Mimimum stomatal resistance (s m-1)
+  !              RSMAX: Max. stomatal resistance (s m-1)
+  !                RGL: Parameters used in radiation stress function
+  !                 HS: Parameter used in vapor pressure deficit functio
+  !               TOPT: Optimum transpiration air temperature. (K)
+  !             CMCMAX: Maximum canopy water capacity
+  !             CFACTR: Parameter used in the canopy inteception calculati
+  !               SNUP: Threshold snow depth (in water equivalent m) that
+  !                     implies 100% snow cover
+  !                LAI: Leaf area index (dimensionless)
+  !             MAXALB: Upper bound on maximum albedo over deep snow
+  !
+  !-----READ IN VEGETAION PROPERTIES FROM VEGPARM.TBL
+  !
+
+  OPEN(19, FILE=trim(FILENAME_VEGTABLE),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
+  IF(ierr .NE. OPEN_OK ) THEN
+  WRITE(message,FMT='(A)') &
+  'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening VEGPARM.TBL'
+  CALL wrf_error_fatal ( message )
+  END IF
+
+  LUMATCH=0
+
+  FIND_LUTYPE : DO WHILE (LUMATCH == 0)
+  READ (19,*,END=2002)
+  READ (19,*,END=2002)LUTYPE
+  READ (19,*)LUCATS,IINDEX
+
+  IF(LUTYPE.EQ.MMINLU)THEN
+  WRITE( mess , * ) 'LANDUSE TYPE = ' // TRIM ( LUTYPE ) // ' FOUND', LUCATS,' CATEGORIES'
+  ! CALL wrf_message( mess )
+  LUMATCH=1
+  ELSE
+  ! call wrf_message ( "Skipping over LUTYPE = " // TRIM ( LUTYPE ) )
+  DO LC = 1, LUCATS+12
+  read(19,*)
+  ENDDO
+  ENDIF
+  ENDDO FIND_LUTYPE
+  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
+  IF ( SIZE(SHDTBL)       < LUCATS .OR. &
+  SIZE(NROTBL)       < LUCATS .OR. &
+  SIZE(RSTBL)        < LUCATS .OR. &
+  SIZE(RGLTBL)       < LUCATS .OR. &
+  SIZE(HSTBL)        < LUCATS .OR. &
+  SIZE(SNUPTBL)      < LUCATS .OR. &
+  SIZE(MAXALB)       < LUCATS .OR. &
+  SIZE(LAIMINTBL)    < LUCATS .OR. &
+  SIZE(LAIMAXTBL)    < LUCATS .OR. &
+  SIZE(Z0MINTBL)     < LUCATS .OR. &
+  SIZE(Z0MAXTBL)     < LUCATS .OR. &
+  SIZE(ALBEDOMINTBL) < LUCATS .OR. &
+  SIZE(ALBEDOMAXTBL) < LUCATS .OR. &
+  SIZE(EMISSMINTBL ) < LUCATS .OR. &
+  SIZE(EMISSMAXTBL ) < LUCATS ) THEN
+  CALL wrf_error_fatal('Table sizes too small for value of LUCATS in module_sf_noahdrv.F')
+  ENDIF
+
+  IF(LUTYPE.EQ.MMINLU)THEN
+  DO LC=1,LUCATS
+  READ (19,*)IINDEX,SHDTBL(LC),                        &
+  NROTBL(LC),RSTBL(LC),RGLTBL(LC),HSTBL(LC), &
+  SNUPTBL(LC),MAXALB(LC), LAIMINTBL(LC),     &
+  LAIMAXTBL(LC),EMISSMINTBL(LC),             &
+  EMISSMAXTBL(LC), ALBEDOMINTBL(LC),         &
+  ALBEDOMAXTBL(LC), Z0MINTBL(LC), Z0MAXTBL(LC)
+  ENDDO
+
+  READ (19,*)
+  READ (19,*)TOPT_DATA
+  READ (19,*)
+  READ (19,*)CMCMAX_DATA
+  READ (19,*)
+  READ (19,*)CFACTR_DATA
+  READ (19,*)
+  READ (19,*)RSMAX_DATA
+  READ (19,*)
+  READ (19,*)BARE
+  READ (19,*)
+  READ (19,*)NATURAL
+  ENDIF
+
+  2002 CONTINUE
+
+  CLOSE (19)
+  IF (LUMATCH == 0) then
+  CALL wrf_error_fatal ("Land Use Dataset '"//MMINLU//"' not found in VEGPARM.TBL.")
+  ENDIF
+
+  !
+  !-----READ IN SOIL PROPERTIES FROM SOILPARM.TBL
+  !
+  OPEN(19, FILE=trim(FILENAME_SOILTABLE),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
+  IF(ierr .NE. OPEN_OK ) THEN
+  WRITE(message,FMT='(A)') &
+  'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening SOILPARM.TBL'
+  CALL wrf_error_fatal ( message )
+  END IF
+
+  WRITE(mess,*) 'INPUT SOIL TEXTURE CLASSIFICATION = ', TRIM ( MMINSL )
+  ! CALL wrf_message( mess )
+
+  LUMATCH=0
+
+  ! MPC add a new soil table
+  FIND_soilTYPE : DO WHILE (LUMATCH == 0)
+  READ (19,*)
+  READ (19,*,END=2003)SLTYPE
+  READ (19,*)SLCATS,IINDEX
+  IF(SLTYPE.EQ.MMINSL)THEN
+  WRITE( mess , * ) 'SOIL TEXTURE CLASSIFICATION = ', TRIM ( SLTYPE ) , ' FOUND', &
+  SLCATS,' CATEGORIES'
+  ! CALL wrf_message ( mess )
+  LUMATCH=1
+  ELSE
+  ! call wrf_message ( "Skipping over SLTYPE = " // TRIM ( SLTYPE ) )
+  DO LC = 1, SLCATS
+  read(19,*)
+  ENDDO
+  ENDIF
+  ENDDO FIND_soilTYPE
+  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
+  IF ( SIZE(BB    ) < SLCATS .OR. &
+  SIZE(DRYSMC) < SLCATS .OR. &
+  SIZE(F11   ) < SLCATS .OR. &
+  SIZE(MAXSMC) < SLCATS .OR. &
+  SIZE(REFSMC) < SLCATS .OR. &
+  SIZE(SATPSI) < SLCATS .OR. &
+  SIZE(SATDK ) < SLCATS .OR. &
+  SIZE(SATDW ) < SLCATS .OR. &
+  SIZE(WLTSMC) < SLCATS .OR. &
+  SIZE(QTZ   ) < SLCATS  ) THEN
+  CALL wrf_error_fatal('Table sizes too small for value of SLCATS in module_sf_noahdrv.F')
+  ENDIF
+
+  ! MPC add new soil table
+  select case(trim(SLTYPE))
+  case('STAS','STAS-RUC')  ! original soil tables
+  DO LC=1,SLCATS
+  READ (19,*) IINDEX,BB(LC),DRYSMC(LC),F11(LC),MAXSMC(LC),&
+  REFSMC(LC),SATPSI(LC),SATDK(LC), SATDW(LC),   &
+  WLTSMC(LC), QTZ(LC)
+  ENDDO
+  case('ROSETTA')          ! new soil table
+  DO LC=1,SLCATS
+  READ (19,*) IINDEX,&
+  ! new soil parameters (from Rosetta)
+  theta_res(LC), theta_sat(LC),        &
+  vGn_alpha(LC), vGn_n(LC), k_soil(LC), &
+  ! original soil parameters
+  BB(LC),DRYSMC(LC),F11(LC),MAXSMC(LC),&
+  REFSMC(LC),SATPSI(LC),SATDK(LC), SATDW(LC),   &
+  WLTSMC(LC), QTZ(LC)
+  ENDDO
+  case default
+  CALL wrf_message( 'SOIL TEXTURE IN INPUT FILE DOES NOT ' )
+  CALL wrf_message( 'MATCH SOILPARM TABLE'                 )
+  CALL wrf_error_fatal ( 'INCONSISTENT OR MISSING SOILPARM FILE' )
+  end select
+
+  2003 CONTINUE
+
+  CLOSE (19)
+
+  IF(LUMATCH.EQ.0)THEN
+  CALL wrf_message( 'SOIL TEXTURE IN INPUT FILE DOES NOT ' )
+  CALL wrf_message( 'MATCH SOILPARM TABLE'                 )
+  CALL wrf_error_fatal ( 'INCONSISTENT OR MISSING SOILPARM FILE' )
+  ENDIF
+
+  !
+  !-----READ IN GENERAL PARAMETERS FROM GENPARM.TBL
+  !
+  OPEN(19, FILE=trim(FILENAME_GENERAL),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
+  IF(ierr .NE. OPEN_OK ) THEN
+  WRITE(message,FMT='(A)') &
+  'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening GENPARM.TBL'
+  CALL wrf_error_fatal ( message )
+  END IF
+
+  READ (19,*)
+  READ (19,*)
+  READ (19,*) NUM_SLOPE
+
+  SLPCATS=NUM_SLOPE
+  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
+  IF ( SIZE(slope_data) < NUM_SLOPE ) THEN
+  CALL wrf_error_fatal('NUM_SLOPE too large for slope_data array in module_sf_noahdrv')
+  ENDIF
+
+  DO LC=1,SLPCATS
+  READ (19,*)SLOPE_DATA(LC)
+  ENDDO
+
+  READ (19,*)
+  READ (19,*)SBETA_DATA
+  READ (19,*)
+  READ (19,*)FXEXP_DATA
+  READ (19,*)
+  READ (19,*)CSOIL_DATA
+  READ (19,*)
+  READ (19,*)SALP_DATA
+  READ (19,*)
+  READ (19,*)REFDK_DATA
+  READ (19,*)
+  READ (19,*)REFKDT_DATA
+  READ (19,*)
+  READ (19,*)FRZK_DATA
+  READ (19,*)
+  READ (19,*)ZBOT_DATA
+  READ (19,*)
+  READ (19,*)CZIL_DATA
+  READ (19,*)
+  READ (19,*)SMLOW_DATA
+  READ (19,*)
+  READ (19,*)SMHIGH_DATA
+  READ (19,*)
+  READ (19,*)LVCOEF_DATA
+  CLOSE (19)
+
+END SUBROUTINE SOIL_VEG_GEN_PARM
+
+end module cppwrap_fileAccess
diff --git a/build/source/netcdf/def_output.f90 b/build/source/actors/file_access_actor/def_output.f90
similarity index 95%
rename from build/source/netcdf/def_output.f90
rename to build/source/actors/file_access_actor/def_output.f90
index 97f9328a9d542c816827ac8c416f1714601ea4af..4b63790355d5d546c9e4cea4bcf1f8c493d25216 100755
--- a/build/source/netcdf/def_output.f90
+++ b/build/source/actors/file_access_actor/def_output.f90
@@ -18,10 +18,10 @@
 ! You should have received a copy of the GNU General Public License
 ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-module def_output_module
+module def_output_actors_module
 
-USE, intrinsic :: iso_c_binding
-USE data_types,only:var_i,netcdf_gru_actor_info
+USE data_types,only:var_i
+USE actor_data_types,only:netcdf_gru_actor_info
 USE netcdf
 USE netcdf_util_module,only:netcdf_err        ! netcdf error handling function
 USE netcdf_util_module,only:nc_file_close     ! close NetCDF files
@@ -72,7 +72,7 @@ contains
  ! **********************************************************************************************************
  ! public subroutine def_output: define model output file
  ! **********************************************************************************************************
-subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,actor_info,err) bind(C, name='def_output')
+subroutine def_output(ncid,startGRU,nGRU,nHRU,actor_info,err,message)
   USE globalData,only:structInfo                               ! information on the data structures
   USE globalData,only:forc_meta,attr_meta,type_meta            ! metaData structures
   USE globalData,only:prog_meta,diag_meta,flux_meta,deriv_meta ! metaData structures
@@ -80,7 +80,6 @@ subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,actor_info,err) bind(C, nam
   USE globalData,only:bpar_meta,bvar_meta,time_meta            ! metaData structures
   USE globalData,only:model_decisions                          ! model decisions
   USE globalData,only:outFreq                                  ! output frequencies
-  USE globalData,only:fname
   ! Some global variabels required in the writing process
   USE globalData,only:nHRUrun
   USE globalData,only:nGRUrun
@@ -93,22 +92,19 @@ subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,actor_info,err) bind(C, nam
   USE globalData,only:outputTimeStep              ! output time step
 
   ! ---------------------------------------------------------------------------------------
-  ! * variables from C++
+  ! * Dummy Variables
   ! ---------------------------------------------------------------------------------------
-  type(c_ptr),intent(in), value          :: handle_ncid       ! ncid of the output file
-  integer(c_int),intent(in)              :: startGRU          ! startGRU for the entire job (for file creation)
-  integer(c_int),intent(in)              :: nGRU              ! number of GRUs
-  integer(c_int),intent(in)              :: nHRU              ! number of HRUs
+  type(var_i),pointer                    :: ncid              ! id of output file
+  integer(i4b),intent(in)                :: startGRU          ! startGRU for the entire job (for file creation)
+  integer(i4b),intent(in)                :: nGRU              ! number of GRUs
+  integer(i4b),intent(in)                :: nHRU              ! number of HRUs
   type(netcdf_gru_actor_info),intent(out):: actor_info        ! netcdf actor information 
-  integer(c_int),intent(out)             :: err               ! error code
-  ! ---------------------------------------------------------------------------------------
-  ! * Fortran Variables For Conversion
-  ! ---------------------------------------------------------------------------------------
-  type(var_i),pointer                  :: ncid                        ! id of output file
+  character(*),intent(out)               :: message           ! error message
+  integer(i4b),intent(out)               :: err               ! error code
+
   ! ---------------------------------------------------------------------------------------
   ! * Local Subroutine Variables
   ! ---------------------------------------------------------------------------------------
-  character(len=256)                   :: message                       ! error message
   integer(i4b)                         :: ivar                          ! loop through model decisions
   integer(i4b)                         :: iFreq                         ! loop through output frequencies
   integer(i4b)                         :: iStruct                       ! loop through structure types
@@ -117,10 +113,7 @@ subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,actor_info,err) bind(C, nam
   integer(i4b)                         :: iGRU
   character(LEN=256)                   :: startGRUString    ! String Variable to convert startGRU
   character(LEN=256)                   :: numGRUString      ! String Varaible to convert numGRU
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_ncid, ncid)
+  character(len=1024)                  :: fname                         ! temporary filename
 
 
   ! initialize errors
@@ -171,11 +164,7 @@ subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,actor_info,err) bind(C, nam
     fstring = get_freqName(iFreq)
     fname   = trim(fileout)//'_'//trim(fstring)//'.nc'
     call ini_create(nGRU,nHRU,gru_struc(1)%hruInfo(1)%nSoil,trim(fname),ncid%var(iFreq),err,cmessage)
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
+    if(err/=0)then; message=trim(message)//trim(cmessage); print*, message; return; end if
 
     ! define model decisions
     do iVar = 1,size(model_decisions)
@@ -233,11 +222,9 @@ subroutine def_output(handle_ncid,startGRU,nGRU,nHRU,actor_info,err) bind(C, nam
     err = nf90_def_var(ncid%var(iFreq),"write_output_duration",outputPrecision,(/gru_DimID/),actor_info%write_output_duration_var_id)
     err = nf90_def_var(ncid%var(iFreq),"successful",nf90_int,(/gru_DimID/),actor_info%state_var_id)
     err = nf90_def_var(ncid%var(iFreq),"num_attempts",nf90_int,(/gru_DimID/),actor_info%num_attempts_var_id)
-    if(err/=0) then 
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
+    err = nf90_def_var(ncid%var(iFreq),"rel_tol",outputPrecision,(/gru_DimID/),actor_info%rel_tol_var_id)
+    err = nf90_def_var(ncid%var(iFreq),"abs_tol",outputPrecision,(/gru_DimID/),actor_info%abs_tol_var_id)
+    if(err/=0) then; message=trim(message)//trim(cmessage); print*, message; return; end if
 
   end do
 end subroutine def_output
@@ -549,4 +536,4 @@ subroutine ini_create(nGRU,nHRU,nSoil,infile,ncid,err,message)
 
  end subroutine
 
-end module def_output_module
+end module def_output_actors_module
diff --git a/build/source/engine/ffile_info.f90 b/build/source/actors/file_access_actor/ffile_info.f90
similarity index 85%
rename from build/source/engine/ffile_info.f90
rename to build/source/actors/file_access_actor/ffile_info.f90
index 02f598c1feb85c0f92b7bb1089dbe62be78a4545..02f1dfdfc36607f66309ac5c0cfaf0b6c52d57e4 100755
--- a/build/source/engine/ffile_info.f90
+++ b/build/source/actors/file_access_actor/ffile_info.f90
@@ -18,11 +18,11 @@
 ! You should have received a copy of the GNU General Public License
 ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-module ffile_info_module
-USE, intrinsic :: iso_c_binding
+module ffile_info_actors_module
 USE nrtype
 USE netcdf
 USE data_types
+USE actor_data_types,only:file_info_array
 USE globalData,only:integerMissing
 implicit none
 private
@@ -38,7 +38,7 @@ contains
  ! ************************************************************************************************
  ! public subroutine ffile_info: read information on model forcing files
  ! ************************************************************************************************
-subroutine ffile_info(indxGRU,handle_forcFileInfo,num_forcing_files,err) bind(C, name='ffile_info')
+subroutine ffile_info(indxGRU,forcFileInfo,num_forcing_files,err,message)
   ! used to read metadata on the forcing data file
   USE ascii_util_module,only:file_open
   USE ascii_util_module,only:linewidth
@@ -61,42 +61,41 @@ subroutine ffile_info(indxGRU,handle_forcFileInfo,num_forcing_files,err) bind(C,
 
   implicit none
   ! define input & output
-  integer(c_int),intent(in)            :: indxGRU          
-  type(c_ptr), intent(in), value       :: handle_forcFileInfo
-  integer(c_int),intent(out)           :: num_forcing_files
-  integer(c_int),intent(out)           :: err              ! error code
+  integer(i4b),intent(in)                  :: indxGRU          
+  type(file_info_array),pointer,intent(in) :: forcFileInfo
+  integer(i4b),intent(out)                 :: num_forcing_files
+  integer(i4b),intent(out)                 :: err              ! error code
+  character(*),intent(inout)               :: message          ! error message
   ! define local variables
-  type(file_info_array),pointer        :: forcFileInfo
+
   ! netcdf file i/o related
-  integer(i4b)                         :: ncid             ! netcdf file id
-  integer(i4b)                         :: mode             ! netCDF file open mode
-  integer(i4b)                         :: dimId            ! netcdf dimension id
-  character(LEN=nf90_max_name)         :: varName          ! character array of netcdf variable name
-  integer(i4b)                         :: iNC              ! index of a variable in netcdf file
-  integer(i4b)                         :: nvar             ! number of variables in netcdf local attribute file
+  integer(i4b)                             :: ncid             ! netcdf file id
+  integer(i4b)                             :: mode             ! netCDF file open mode
+  integer(i4b)                             :: dimId            ! netcdf dimension id
+  character(LEN=nf90_max_name)             :: varName          ! character array of netcdf variable name
+  integer(i4b)                             :: iNC              ! index of a variable in netcdf file
+  integer(i4b)                             :: nvar             ! number of variables in netcdf local attribute file
   ! the rest
-  character(LEN=linewidth),allocatable :: dataLines(:)     ! vector of lines of information (non-comment lines)
-  character(len=256)                   :: message         ! error message for downwind routine
-  character(len=256)                   :: cmessage         ! error message for downwind routine
-  character(LEN=256)                   :: infile           ! input filename
-  integer(i4b)                         :: unt              ! file unit (free unit output from file_open)
-  integer(i4b)                         :: ivar             ! index of model variable
-  integer(i4b)                         :: iFile            ! counter for forcing files
-  integer(i4b)                         :: nFile            ! number of forcing files in forcing file list
-  integer(i4b)                         :: totalFiles       ! total number of forcing files defiend in the forcing file list
-  integer(i4b)                         :: startIndx        ! total number of forcing files defiend in the forcing file list
-  integer(i4b)                         :: file_nHRU        ! number of HRUs in current forcing file
-  integer(i4b)                         :: nForcing         ! number of forcing variables
-  real(dp)                             :: dataStep_iFile   ! data step for a given forcing data file
-  logical(lgt)                         :: xist             ! .TRUE. if the file exists
+  character(LEN=linewidth),allocatable     :: dataLines(:)     ! vector of lines of information (non-comment lines)
+  character(len=256)                       :: cmessage         ! error message for downwind routine
+  character(LEN=256)                       :: infile           ! input filename
+  integer(i4b)                             :: unt              ! file unit (free unit output from file_open)
+  integer(i4b)                             :: ivar             ! index of model variable
+  integer(i4b)                             :: iFile            ! counter for forcing files
+  integer(i4b)                             :: nFile            ! number of forcing files in forcing file list
+  integer(i4b)                             :: totalFiles       ! total number of forcing files defiend in the forcing file list
+  integer(i4b)                             :: startIndx        ! total number of forcing files defiend in the forcing file list
+  integer(i4b)                             :: file_nHRU        ! number of HRUs in current forcing file
+  integer(i4b)                             :: nForcing         ! number of forcing variables
+  real(dp)                                 :: dataStep_iFile   ! data step for a given forcing data file
+  logical(lgt)                             :: xist             ! .TRUE. if the file exists
   ! Time Variables
-  type(var_i)                          :: startTime
-  type(var_i)                          :: forcingStart
-  type(var_i)                          :: finishTime
-  real(rkind)                          :: dsec,dsec_tz
-  integer(i4b)                         :: ffinfo_index
+  type(var_i)                              :: startTime
+  type(var_i)                              :: forcingStart
+  type(var_i)                              :: finishTime
+  real(rkind)                              :: dsec,dsec_tz
+  integer(i4b)                             :: ffinfo_index
   
-  call c_f_pointer(handle_forcFileInfo, forcFileInfo)
   ! Start procedure here
   err=0; message="ffile_info/"
   ! ------------------------------------------------------------------------------------------------------------------
@@ -369,7 +368,7 @@ subroutine setHRUID(ncid,indxGRU,varName,inFile,err,message)
   USE netCDF
   implicit none
   integer(i4b),intent(in)                           :: ncid
-  integer(c_int),intent(in)                         :: indxGRU
+  integer(i4b),intent(in)                           :: indxGRU
   character(*),intent(in)                           :: varName
   character(*),intent(in)                           :: inFile       ! file that populated dataLines
   integer(i4b),intent(out)                          :: err
@@ -399,4 +398,4 @@ subroutine setHRUID(ncid,indxGRU,varName,inFile,err,message)
 
 end subroutine
 
-end module ffile_info_module
+end module ffile_info_actors_module
diff --git a/build/source/actors/file_access_actor/fortran_code/writeOutputFromOutputStructure.f90 b/build/source/actors/file_access_actor/fileAccess_writeOutput.f90
similarity index 87%
rename from build/source/actors/file_access_actor/fortran_code/writeOutputFromOutputStructure.f90
rename to build/source/actors/file_access_actor/fileAccess_writeOutput.f90
index 484e90eca739ea682d29a57b9939b9b7e0c1ca56..b1cf9eb84936598d690c7bc925de43a7b0d32d10 100644
--- a/build/source/actors/file_access_actor/fortran_code/writeOutputFromOutputStructure.f90
+++ b/build/source/actors/file_access_actor/fileAccess_writeOutput.f90
@@ -18,7 +18,7 @@
 ! You should have received a copy of the GNU General Public License
 ! along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-module writeOutputFromOutputStructure_module
+module fileAccess_writeOutput
   USE, intrinsic :: iso_c_binding
 
 ! NetCDF types
@@ -35,15 +35,14 @@ USE globalData,only: integerMissing, realMissing
 USE globalData,only:gru_struc                             ! gru->hru mapping structure
 
 USE output_structure_module,only:outputStructure
+USE output_structure_module,only:outputTimeStep
 
-USE data_types,only:var_i
 
 ! provide access to the derived types to define the data structures
 USE data_types,only:&
                     ! final data vectors
                     dlength,             & ! var%dat
                     ilength,             & ! var%dat
-                    time_dlength,        & ! var(:)%tim(:)%dat (dp)
                     ! no spatial dimension
                     var_i,               & ! x%var(:)            (i4b)
                     var_i8,              & ! x%var(:)            integer(8)
@@ -53,7 +52,6 @@ USE data_types,only:&
                     ! no variable dimension
                     hru_i,               & ! x%hru(:)            (i4b)
                     hru_d,               & ! x%hru(:)            (dp)
-                    time_i,              &
                     ! gru dimension
                     gru_int,             & ! x%gru(:)%var(:)     (i4b)
                     gru_double,          & ! x%gru(:)%var(:)     (dp)
@@ -64,8 +62,12 @@ USE data_types,only:&
                     gru_hru_int8,        & ! x%gru(:)%hru(:)%var(:)     integer(8)
                     gru_hru_double,      & ! x%gru(:)%hru(:)%var(:)     (dp)
                     gru_hru_intVec,      & ! x%gru(:)%hru(:)%var(:)%dat (i4b)
-                    gru_hru_doubleVec,   & ! x%gru(:)%hru(:)%var(:)%dat (dp)
-                    gru_hru_time_double, &
+                    gru_hru_doubleVec      ! x%gru(:)%hru(:)%var(:)%dat (dp)
+    
+USE actor_data_types,only:&
+                    time_dlength,          & ! var(:)%tim(:)%dat (dp)
+                    time_i,                &
+                    gru_hru_time_double,   &
                     gru_hru_time_doubleVec,&
                     gru_hru_time_intVec
 
@@ -75,7 +77,7 @@ USE var_lookup, only: maxvarStat ! number of statistics
 
 implicit none
 private
-public::writeOutput
+public::writeOutput_fortran
 public::writeParm
 public::writeData
 public::writeBasin
@@ -89,19 +91,19 @@ contains
 ! **********************************************************************************************************
 ! public subroutine writeParm: write model parameters
 ! **********************************************************************************************************
-subroutine writeOutput(handle_ncid, num_steps, start_gru, max_gru, err) bind(C, name="writeOutput")
+subroutine writeOutput_fortran(handle_ncid, num_steps, start_gru, max_gru, write_parm_flag, err) bind(C, name="writeOutput_fortran")
   USE var_lookup,only:maxVarFreq                               ! # of available output frequencies
   USE globalData,only:structInfo
   USE globalData,only:bvarChild_map,forcChild_map,progChild_map,diagChild_map,fluxChild_map,indxChild_map             ! index of the child data structure: stats bvar
-  USE globalData,only:outputTimeStep
-  USE globalData,only:bvar_meta,time_meta,forc_meta,prog_meta,diag_meta,flux_meta,indx_meta
+  USE globalData,only:attr_meta,bvar_meta,type_meta,time_meta,forc_meta,prog_meta,diag_meta,flux_meta,indx_meta,bpar_meta,mpar_meta
   USE globalData,only:maxLayers
   implicit none
   ! dummy variables
   type(c_ptr),intent(in), value        :: handle_ncid       ! ncid of the output file
-  integer(c_int),intent(in)            :: num_steps            ! number of steps to write
-  integer(c_int),intent(in)            :: start_gru            ! index of GRU we are currently writing for
-  integer(c_int),intent(in)            :: max_gru            ! index of HRU we are currently writing for
+  integer(c_int),intent(in)            :: num_steps         ! number of steps to write
+  integer(c_int),intent(in)            :: start_gru         ! index of GRU we are currently writing for
+  integer(c_int),intent(in)            :: max_gru           ! index of HRU we are currently writing for
+  logical(c_bool),intent(in)           :: write_parm_flag   ! flag to write parameters
   integer(c_int),intent(out)           :: err               ! Error code
   ! local variables
   type(var_i),pointer                  :: ncid
@@ -116,9 +118,31 @@ subroutine writeOutput(handle_ncid, num_steps, start_gru, max_gru, err) bind(C,
   integer(i4b)                         :: iStruct
   integer(i4b)                         :: numGRU
   
-
   ! Change the C pointer to a fortran pointer
   call c_f_pointer(handle_ncid, ncid)
+  
+  ! Write the Parameters if first write
+  if (write_parm_flag)then
+    do iStruct=1,size(structInfo)
+      do iGRU=start_gru, max_gru
+        select case(trim(structInfo(iStruct)%structName))
+        case('attr'); call writeParm(ncid,gru_struc(iGRU)%hruInfo(indxHRU)%hru_ix, &
+          outputStructure(1)%attrStruct%gru(iGRU)%hru(indxHRU),attr_meta,err,cmessage)
+        case('type'); call writeParm(ncid,gru_struc(iGRU)%hruInfo(indxHRU)%hru_ix, &
+          outputStructure(1)%typeStruct%gru(iGRU)%hru(indxHRU),type_meta,err,cmessage)
+        case('mpar'); call writeParm(ncid,gru_struc(iGRU)%hruInfo(indxHRU)%hru_ix, &
+          outputStructure(1)%mparStruct%gru(iGRU)%hru(indxHRU),mpar_meta,err,cmessage)
+        end select
+        if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
+        call writeParm(ncid,iGRU,outputStructure(1)%bparStruct%gru(iGRU),bpar_meta,err,cmessage)
+        if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
+      end do ! GRU
+    end do ! structInfo
+  end if
+  
+
+
+
   ! ****************************************************************************
   ! *** write basin data
   ! ****************************************************************************
@@ -126,7 +150,7 @@ subroutine writeOutput(handle_ncid, num_steps, start_gru, max_gru, err) bind(C,
     stepCounter(:) = outputTimeStep(iGRU)%dat(:) ! We want to avoid updating outputTimeStep
     do iStep=1, num_steps
       call writeTime(ncid,outputTimeStep(iGRU)%dat(:),iStep,time_meta, &
-              outputStructure(1)%timeStruct(1)%gru(iGRU)%hru(indxHRU)%var,err,cmessage)
+              outputStructure(1)%timeStruct%gru(iGRU)%hru(indxHRU)%var,err,cmessage)
     end do ! istep
   end do ! iGRU
 
@@ -137,7 +161,7 @@ subroutine writeOutput(handle_ncid, num_steps, start_gru, max_gru, err) bind(C,
   ! ****************************************************************************
   call writeBasin(ncid,outputTimeStep(start_gru)%dat(:),outputTimeStepUpdate,num_steps,&
                   start_gru, max_gru, numGRU, &
-                  bvar_meta,outputStructure(1)%bvarStat(1),outputStructure(1)%bvarStruct(1), &
+                  bvar_meta,outputStructure(1)%bvarStat,outputStructure(1)%bvarStruct, &
                   bvarChild_map,err,cmessage)
 
   ! ****************************************************************************
@@ -148,28 +172,28 @@ subroutine writeOutput(handle_ncid, num_steps, start_gru, max_gru, err) bind(C,
       case('forc')
         call writeData(ncid,outputTimeStep(start_gru)%dat(:),outputTimestepUpdate,maxLayers,num_steps,&
                         start_gru, max_gru, numGRU, & 
-                        forc_meta,outputStructure(1)%forcStat(1),outputStructure(1)%forcStruct(1),'forc', &
-                        forcChild_map,outputStructure(1)%indxStruct(1),err,cmessage)
+                        forc_meta,outputStructure(1)%forcStat,outputStructure(1)%forcStruct,'forc', &
+                        forcChild_map,outputStructure(1)%indxStruct,err,cmessage)
       case('prog')
         call writeData(ncid,outputTimeStep(start_gru)%dat(:),outputTimestepUpdate,maxLayers,num_steps,&
                         start_gru, max_gru, numGRU, &
-                        prog_meta,outputStructure(1)%progStat(1),outputStructure(1)%progStruct(1),'prog', &
-                        progChild_map,outputStructure(1)%indxStruct(1),err,cmessage)
+                        prog_meta,outputStructure(1)%progStat,outputStructure(1)%progStruct,'prog', &
+                        progChild_map,outputStructure(1)%indxStruct,err,cmessage)
       case('diag')
         call writeData(ncid,outputTimeStep(start_gru)%dat(:),outputTimestepUpdate,maxLayers,num_steps,&
                         start_gru, max_gru, numGRU, &
-                        diag_meta,outputStructure(1)%diagStat(1),outputStructure(1)%diagStruct(1),'diag', &
-                        diagChild_map,outputStructure(1)%indxStruct(1),err,cmessage)
+                        diag_meta,outputStructure(1)%diagStat,outputStructure(1)%diagStruct,'diag', &
+                        diagChild_map,outputStructure(1)%indxStruct,err,cmessage)
       case('flux')
         call writeData(ncid,outputTimeStep(start_gru)%dat(:),outputTimestepUpdate,maxLayers,num_steps,&
                         start_gru, max_gru, numGRU, &
-                        flux_meta,outputStructure(1)%fluxStat(1),outputStructure(1)%fluxStruct(1),'flux', &
-                        fluxChild_map,outputStructure(1)%indxStruct(1),err,cmessage)
+                        flux_meta,outputStructure(1)%fluxStat,outputStructure(1)%fluxStruct,'flux', &
+                        fluxChild_map,outputStructure(1)%indxStruct,err,cmessage)
       case('indx')
         call writeData(ncid,outputTimeStep(start_gru)%dat(:),outputTimestepUpdate,maxLayers,num_steps,&
                         start_gru, max_gru, numGRU, &
-                        indx_meta,outputStructure(1)%indxStat(1),outputStructure(1)%indxStruct(1),'indx', &
-                        indxChild_map,outputStructure(1)%indxStruct(1),err,cmessage)
+                        indx_meta,outputStructure(1)%indxStat,outputStructure(1)%indxStruct,'indx', &
+                        indxChild_map,outputStructure(1)%indxStruct,err,cmessage)
     end select
     if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
   end do  ! (looping through structures)
@@ -179,7 +203,7 @@ subroutine writeOutput(handle_ncid, num_steps, start_gru, max_gru, err) bind(C,
     outputTimeStep(start_gru)%dat(iFreq) = outputTimeStep(start_gru)%dat(iFreq) + outputTimeStepUpdate(iFreq) 
   end do ! ifreq
 
-end subroutine writeOutput
+end subroutine writeOutput_fortran
 
 
 ! **********************************************************************************************************
@@ -223,7 +247,6 @@ subroutine writeParm(ncid,ispatial,struct,meta,err,message)
         class is (var_d)
           err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)/),start=(/iSpatial/),count=(/1/))
         class is (var_dlength)
-          print*, "Param size", size(struct%var(iVar)%dat)
           err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)%dat/),start=(/iSpatial,1/),count=(/1,size(struct%var(iVar)%dat)/))
         class default; err=20; message=trim(message)//'unknown variable type (with HRU)'; return
       end select
@@ -259,7 +282,6 @@ subroutine writeData(ncid,outputTimestep,outputTimestepUpdate,maxLayers,nSteps,
   USE var_lookup,only:iLookIndex                     ! index into index structure
   USE var_lookup,only:iLookStat                      ! index into stat structure
   USE globalData,only:outFreq                        ! output file information
-  USE globalData,only:failedHRUs
   USE get_ixName_module,only:get_varTypeName         ! to access type strings for error messages
   USE get_ixName_module,only:get_statName            ! to access type strings for error messages
 
@@ -293,7 +315,6 @@ subroutine writeData(ncid,outputTimestep,outputTimestepUpdate,maxLayers,nSteps,
   integer(i4b)                     :: stepCounter       ! counter to know how much data we have to write, needed because we do not always write nSteps
   integer(i4b)                     :: iStep
   integer(i4b)                     :: iGRU
-  integer(i4b)                     :: verifiedGRUIndex    ! index of HRU verified to not have failed
   ! initialize error control
   err=0;message="writeData/"
   ! loop through output frequencies
@@ -305,29 +326,16 @@ subroutine writeData(ncid,outputTimestep,outputTimestepUpdate,maxLayers,nSteps,
     do iVar = 1,size(meta)
       stepCounter = 0
 
-      ! Todo: wrap this in a function
       if (meta(iVar)%varName=='time' .and. structName == 'forc')then
         ! get variable index
         err = nf90_inq_varid(ncid%var(iFreq),trim(meta(iVar)%varName),ncVarID)
         call netcdf_err(err,message); if (err/=0) return
         
-        ! make sure the HRU we are using has not failed
-        if (minGRU == maxGRU)then
-          verifiedGRUIndex = minGRU
-        else 
-          do iGRU = minGRU, maxGRU
-            if(.not.failedHRUs(iGRU))then
-              verifiedGRUIndex = iGRU
-              exit
-            endif
-          end do  
-        endif
-
         do iStep = 1, nSteps
           ! check if we want this timestep
-          if(.not.outputStructure(1)%finalizeStats(1)%gru(verifiedGRUIndex)%hru(1)%tim(iStep)%dat(iFreq)) cycle
+          if(.not.outputStructure(1)%finalizeStats%gru(minGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
           stepCounter = stepCounter+1
-          timeVec(stepCounter) = outputStructure(1)%forcStruct(1)%gru(verifiedGRUIndex)%hru(1)%var(iVar)%tim(iStep)
+          timeVec(stepCounter) = outputStructure(1)%forcStruct%gru(minGRU)%hru(1)%var(iVar)%tim(iStep)
         end do ! iStep
         err = nf90_put_var(ncid%var(iFreq),ncVarID,timeVec(1:stepCounter),start=(/outputTimestep(iFreq)/),count=(/stepCounter/))
         call netcdf_err(err,message); if (err/=0)then; print*, "err"; return; endif
@@ -380,9 +388,9 @@ subroutine writeScalar(ncid, outputTimestep, outputTimestepUpdate, nSteps, minGR
   character(*)  ,intent(inout)      :: message
 
   ! local variables
-  integer(i4b)                      :: gruCounter             ! counter for the realVecs
-  integer(i4b)                      :: iStep                  ! counter for looping over nSteps
-  integer(i4b)                      :: stepCounter            ! counter for the realVec
+  integer(i4b)                      :: gruCounter=0             ! counter for the realVecs
+  integer(i4b)                      :: iStep=1                  ! counter for looping over nSteps
+  integer(i4b)                      :: stepCounter=0            ! counter for the realVec
   integer(i4b)                      :: iGRU
   ! output array
   real(rkind)                       :: realVec(numGRU, nSteps)! real vector for all HRUs in the run domain
@@ -396,22 +404,24 @@ subroutine writeScalar(ncid, outputTimestep, outputTimestepUpdate, nSteps, minGR
         stepCounter = 0
         gruCounter = gruCounter + 1
         do iStep = 1, nSteps
-          if(.not.outputStructure(1)%finalizeStats(1)%gru(iGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
+          if(.not.outputStructure(1)%finalizeStats%gru(iGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
           stepCounter = stepCounter + 1
           realVec(gruCounter, stepCounter) = stat%gru(iGRU)%hru(1)%var(map(iVar))%tim(iStep)%dat(iFreq)
           outputTimeStepUpdate(iFreq) = stepCounter
         end do ! iStep
-      end do ! iGRU  
-    
-      err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),realVec(1:gruCounter, 1:stepCounter),start=(/minGRU,outputTimestep(iFreq)/),count=(/numGRU,stepCounter/))
+      end do ! iGRU 
+
       if (outputTimeStepUpdate(iFreq) /= stepCounter ) then
         print*, "ERROR Missmatch in Steps - stat doubleVec"
         print*, "   outputTimeStepUpdate(iFreq) = ", outputTimeStepUpdate(iFreq)
         print*, "   stepCounter = ", stepCounter
         print*, "   iFreq = ", iFreq
-
+        print*, "   minGRU = ", minGRU
+        print*, "   maxGRU = ", maxGRU
+        err = 20
         return
       endif
+      err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),realVec(1:gruCounter, 1:stepCounter),start=(/minGRU,outputTimestep(iFreq)/),count=(/numGRU,stepCounter/))
     class default; err=20; message=trim(message)//'stats must be scalarv and of type gru_hru_doubleVec'; return
   end select  ! stat
 
@@ -489,12 +499,12 @@ subroutine writeVector(ncid, outputTimestep, maxLayers, nSteps, minGRU, maxGRU,
       ! get the data vectors
       select type (dat)
           class is (gru_hru_time_doubleVec)
-              if(.not.outputStructure(1)%finalizeStats(1)%gru(iGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
-              realArray(gruCounter,1:datLength) = dat%gru(iGRU)%hru(1)%var(iVar)%tim(iStep)%dat(:)
+              if(.not.outputStructure(1)%finalizeStats%gru(iGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
+              realArray(gruCounter,1:datLength) = dat%gru(iGRU)%hru(1)%var(iVar)%tim(iStep)%dat(1:datLength)
 
           class is (gru_hru_time_intVec)
-              if(.not.outputStructure(1)%finalizeStats(1)%gru(iGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
-              intArray(gruCounter,1:datLength) = dat%gru(iGRU)%hru(1)%var(iVar)%tim(iStep)%dat(:)
+              if(.not.outputStructure(1)%finalizeStats%gru(iGRU)%hru(1)%tim(iStep)%dat(iFreq)) cycle
+              intArray(gruCounter,1:datLength) = dat%gru(iGRU)%hru(1)%var(iVar)%tim(iStep)%dat(1:datLength)
           class default; err=20; message=trim(message)//'data must not be scalarv and either of type gru_hru_doubleVec or gru_hru_intVec'; return
       end select
 
@@ -518,11 +528,11 @@ subroutine writeVector(ncid, outputTimestep, maxLayers, nSteps, minGRU, maxGRU,
       case(ixReal)
         err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),realArray(1:numGRU,1:maxLength),start=(/minGRU,1,stepCounter/),count=(/numGRU,maxLength,1/))
         if(err/=0)then; print*, "ERROR: with nf90_put_var in data vector (ixReal)"; return; endif
-
+        realArray(:,:) = realMissing ! reset the realArray
       case(ixInteger)
         err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),intArray(1:numGRU,1:maxLength),start=(/minGRU,1,stepCounter/),count=(/numGRU,maxLength,1/))
         if(err/=0)then; print*, "ERROR: with nf90_put_var in data vector (ixInteger)"; return; endif
-
+        intArray(:,:) = integerMissing ! reset the intArray
       case default; err=20; message=trim(message)//'data must be of type integer or real'; return
     end select ! data type
     stepCounter = stepCounter + 1
@@ -564,6 +574,7 @@ subroutine writeBasin(ncid,outputTimestep,outputTimestepUpdate,nSteps,&
   ! initialize error control
   err=0;message="f-writeBasin/"
 
+
   ! loop through output frequencies
   do iFreq=1,maxvarFreq
 
@@ -629,15 +640,14 @@ subroutine writeTime(ncid,outputTimestep,iStep,meta,dat,err,message)
   do iFreq=1,maxvarFreq
 
     ! check that we have finalized statistics for a given frequency
-    if(.not.outputStructure(1)%finalizeStats(1)%gru(1)%hru(1)%tim(iStep)%dat(iFreq)) cycle
+    if(.not.outputStructure(1)%finalizeStats%gru(1)%hru(1)%tim(iStep)%dat(iFreq)) cycle
 
     ! loop through model variables
     do iVar = 1,size(meta)
 
       ! check instantaneous
     if (meta(iVar)%statIndex(iFreq)/=iLookStat%inst) cycle
-      print*, "Time Data", dat(iVar)%tim(iStep)
-        ! get variable id in file
+      ! get variable id in file
       err = nf90_inq_varid(ncid%var(iFreq),trim(meta(iVar)%varName),ncVarID)
       if (err/=0) message=trim(message)//trim(meta(iVar)%varName); call netcdf_err(err,message)
       if (err/=0) then; err=20; return; end if
@@ -651,7 +661,5 @@ subroutine writeTime(ncid,outputTimestep,iStep,meta,dat,err,message)
   end do ! iFreq
 
 
-end subroutine writeTime
-
-   
-end module writeOutputFromOutputStructure_module
\ No newline at end of file
+end subroutine writeTime   
+end module fileAccess_writeOutput
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/file_access_actor.cpp b/build/source/actors/file_access_actor/file_access_actor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5c29fc5362ff01cc0746f3af704bebf4b788c2da
--- /dev/null
+++ b/build/source/actors/file_access_actor/file_access_actor.cpp
@@ -0,0 +1,219 @@
+#include "file_access_actor.hpp"
+#include "forcing_file_info.hpp"
+#include "fortran_data_types.hpp"
+#include "message_atoms.hpp"
+#include "json.hpp"
+#include "auxilary.hpp"
+
+using json = nlohmann::json;
+
+namespace caf {
+
+behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gru, int num_gru, 
+    File_Access_Actor_Settings file_access_actor_settings, actor parent) {
+    aout(self) << "\n----------File_Access_Actor Started----------\n";
+    
+    // Set Up timing Info we wish to track
+    self->state.file_access_timing = TimingInfo();
+    self->state.file_access_timing.addTimePoint("read_duration");
+    self->state.file_access_timing.addTimePoint("write_duration");
+    // Save the parameters passed from job_actor
+    self->state.file_access_actor_settings = file_access_actor_settings;
+    self->state.parent = parent;
+    self->state.num_gru = num_gru;
+    self->state.start_gru = start_gru;
+    self->state.err = 0;
+
+    self->state.num_output_steps = self->state.file_access_actor_settings.num_timesteps_in_output_buffer;
+
+
+    fileAccessActor_init_fortran(self->state.handle_forcing_file_info, 
+                                 &self->state.numFiles,
+                                 &self->state.num_steps,
+                                 &self->state.file_access_actor_settings.num_timesteps_in_output_buffer, 
+                                 self->state.handle_ncid,
+                                 &self->state.start_gru, 
+                                 &self->state.num_gru, 
+                                 &self->state.num_gru, // Filler for num_hrus
+                                 &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "ERROR: File Access Actor - File_Access_init_Fortran\n";
+        if (self->state.err == 100) {
+            self->send(self->state.parent, file_access_error::mDecisions_error, self);
+        } else {
+            self->send(self->state.parent, file_access_error::unhandleable_error, self);
+        }
+        return {};
+        
+    }
+
+    aout(self) << "Simluations Steps: " << self->state.num_steps << "\n";
+
+    
+    // Inital Files Have Been Loaded - Send Message to Job_Actor to Start Simulation
+    self->send(self->state.parent, init_gru_v);
+    // initalize the forcingFile array
+    self->state.filesLoaded = 0;
+    for (int i = 1; i <= self->state.numFiles; i++) {
+        self->state.forcing_file_list.push_back(Forcing_File_Info(i));
+    }
+
+    // Check that the number of timesteps in the output buffer is not greater than the number of timesteps in the simulation
+    if (self->state.num_steps < self->state.file_access_actor_settings.num_timesteps_in_output_buffer) {
+        self->state.num_output_steps = self->state.num_steps;
+        self->state.file_access_actor_settings.num_timesteps_in_output_buffer = self->state.num_steps;
+    }
+
+    // Set up the output container
+    self->state.output_container = new Output_Container(self->state.file_access_actor_settings.num_partitions_in_output_buffer,
+                                                        self->state.num_gru,
+                                                        self->state.file_access_actor_settings.num_timesteps_in_output_buffer,
+                                                        self->state.num_steps); 
+
+    return {
+
+        // Message from the HRU actor to get the forcing file that is loaded
+        [=](access_forcing, int currentFile, caf::actor refToRespondTo) {
+            if (currentFile <= self->state.numFiles) {
+                if(self->state.forcing_file_list[currentFile - 1].isFileLoaded()) { // C++ starts at 0 Fortran starts at 1
+                    // Send the HRU actor the new forcing file
+                    // then tell it to get back to running
+                    self->send(refToRespondTo, new_forcing_file_v, 
+                        self->state.forcing_file_list[currentFile - 1].getNumSteps(),
+                        currentFile);
+
+                } else {
+                    self->state.file_access_timing.updateStartPoint("read_duration");
+                    
+                    // Load the file
+                    read_forcingFile(self->state.handle_forcing_file_info, &currentFile,
+                        &self->state.stepsInCurrentFile, &self->state.start_gru, 
+                        &self->state.num_gru, &self->state.err);
+                    if (self->state.err != 0) {
+                        aout(self) << "ERROR: Reading Forcing" << std::endl;
+                    }
+                    self->state.filesLoaded += 1;
+                    self->state.forcing_file_list[currentFile - 1].updateNumSteps(self->state.stepsInCurrentFile);
+
+                    self->state.file_access_timing.updateEndPoint("read_duration");
+                    // Check if we have loaded all forcing files
+                    if(self->state.filesLoaded <= self->state.numFiles) {
+                        self->send(self, access_forcing_internal_v, currentFile + 1);
+                    }
+
+                    // Send the HRU actor the new forcing file
+                    // then tell it to get back to running
+                    self->send(refToRespondTo, new_forcing_file_v, 
+                        self->state.forcing_file_list[currentFile - 1].getNumSteps(),
+                        currentFile);
+                }
+            } else {
+                aout(self) << currentFile << " is larger than expected for a forcing file request from an HRU" << std::endl;
+            }
+        },
+        
+        // Internal Message to load all forcing files, calling this message allows other messages to be processed
+        [=](access_forcing_internal, int currentFile) {
+            if (self->state.filesLoaded <= self->state.numFiles &&
+                currentFile <= self->state.numFiles) {
+                if (self->state.forcing_file_list[currentFile - 1].isFileLoaded()) {
+                    aout(self) << "File Loaded when shouldn't be \n";
+                }
+                self->state.file_access_timing.updateStartPoint("read_duration");
+
+                read_forcingFile(self->state.handle_forcing_file_info, &currentFile,
+                    &self->state.stepsInCurrentFile, &self->state.start_gru, 
+                    &self->state.num_gru, &self->state.err);
+                if (self->state.err != 0) {
+                    aout(self) << "ERROR: Reading Forcing" << std::endl;
+                }
+                self->state.filesLoaded += 1;
+                self->state.forcing_file_list[currentFile - 1].updateNumSteps(self->state.stepsInCurrentFile);
+                
+                self->state.file_access_timing.updateEndPoint("read_duration");
+
+                self->send(self, access_forcing_internal_v, currentFile + 1);
+            } else {
+                aout(self) << "All Forcing Files Loaded \n";
+            }
+        },
+        
+        // Message from HRU Actor so it knows how many timesteps it can write before waiting
+        [=] (get_num_output_steps) { return self->state.num_output_steps; },
+
+        [=](write_output, int index_gru, int index_hru, caf::actor hru_actor) {
+            self->state.file_access_timing.updateStartPoint("write_duration");
+
+            Output_Partition *output_partition = self->state.output_container->getOutputPartition(index_gru);
+
+            output_partition->setGRUReadyToWrite(hru_actor);
+        
+            if (output_partition->isReadyToWrite()) {
+                writeOutput(self, output_partition);
+            }
+
+            self->state.file_access_timing.updateEndPoint("write_duration");
+        },
+
+        [=](restart_failures) {
+            self->state.output_container->reconstruct();
+        },
+
+        [=](run_failure, int local_gru_index) {
+            self->state.file_access_timing.updateStartPoint("write_duration");
+
+            Output_Partition *output_partition = self->state.output_container->getOutputPartition(local_gru_index);
+            
+            output_partition->addFailedGRUIndex(local_gru_index);
+
+            if (output_partition->isReadyToWrite()) {
+                writeOutput(self, output_partition);
+            }
+            self->state.file_access_timing.updateEndPoint("write_duration");
+        },
+
+
+        [=](finalize) {
+            
+            aout(self) << "File Access Actor: Deallocating Structure" << std::endl;
+            self->state.output_container->~Output_Container(); // Delete Output Container
+            FileAccessActor_DeallocateStructures(self->state.handle_forcing_file_info, self->state.handle_ncid);
+
+            aout(self) << "\n________________FILE_ACCESS_ACTOR TIMING INFO RESULTS________________\n";
+            aout(self) << "Total Read Duration = " << self->state.file_access_timing.getDuration("read_duration").value_or(-1.0) << " Seconds\n";
+            aout(self) << "Total Write Duration = " << self->state.file_access_timing.getDuration("write_duration").value_or(-1.0) << " Seconds\n";
+            
+            self->quit();
+            return std::make_tuple(self->state.file_access_timing.getDuration("read_duration").value_or(-1.0), 
+                                   self->state.file_access_timing.getDuration("write_duration").value_or(-1.0));
+        },
+
+    };
+}
+
+
+void writeOutput(stateful_actor<file_access_state>* self, Output_Partition* partition) {
+                
+    int num_timesteps_to_write = partition->getNumStoredTimesteps();
+    int start_gru = partition->getStartGRUIndex();
+    int max_gru = partition->getMaxGRUIndex();
+    bool write_param_flag = partition->isWriteParams();
+    
+    writeOutput_fortran(self->state.handle_ncid, &num_timesteps_to_write,
+        &start_gru, &max_gru, &write_param_flag, &self->state.err);
+    
+    partition->updateTimeSteps();
+
+    int num_steps_before_next_write = partition->getNumStoredTimesteps();
+
+    std::vector<caf::actor> hrus_to_update = partition->getReadyToWriteList();
+    
+    for (int i = 0; i < hrus_to_update.size(); i++) {
+        self->send(hrus_to_update[i], num_steps_before_write_v, num_steps_before_next_write);
+        self->send(hrus_to_update[i], run_hru_v);
+    }
+
+    partition->resetReadyToWriteList();
+}
+
+} // end namespace
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/cpp_code/forcing_file_info.cpp b/build/source/actors/file_access_actor/forcing_file_info.cpp
similarity index 100%
rename from build/source/actors/file_access_actor/cpp_code/forcing_file_info.cpp
rename to build/source/actors/file_access_actor/forcing_file_info.cpp
diff --git a/build/source/actors/file_access_actor/fortran_code/cppwrap_fileAccess.f90 b/build/source/actors/file_access_actor/fortran_code/cppwrap_fileAccess.f90
deleted file mode 100644
index e3ccb081f2c30d831aab9c997fb393e9db40ccd7..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/fortran_code/cppwrap_fileAccess.f90
+++ /dev/null
@@ -1,151 +0,0 @@
-module cppwrap_fileAccess
-
-
-  !======= Inclusions ===========
-  USE, intrinsic :: iso_c_binding
-  USE nrtype
-  USE data_types
-  USE globalData
-  USE var_lookup,only:maxvarFreq                ! maximum number of output files
-
-
-  implicit none
-  public::read_pinit_C
-  public::read_vegitationTables
-  public::FileAccessActor_DeallocateStructures
-  public::initFailedHRUTracker
-  
-  contains
-
-
-! Read in the inital parameters, from the txt files that are give to summa as input LocalParamInfo.txt BasinParamInfo.txt
-subroutine read_pinit_C(err) bind(C, name='read_pinit_C')
-  USE globalData,only:localParFallback                        ! local column default parameters
-  USE globalData,only:basinParFallback                        ! basin-average default parameters
-  USE summaFileManager,only:LOCALPARAM_INFO,BASINPARAM_INFO   ! files defining the default values and constraints for model parameters
-  USE globalData,only:mpar_meta,bpar_meta                     ! parameter metadata structures
-  USE read_pinit_module,only:read_pinit                       ! module to read initial model parameter values
-
-  
-  implicit none
-  integer(c_int),intent(inout)        :: err                ! Error Code
-
-  character(LEN=256)                  :: message           ! error message of downwind routine
-  character(LEN=256)                  :: cmessage           ! error message of downwind routine
-
-
- ! *****************************************************************************
- ! *** read default model parameters
- ! *****************************************************************************
-
- ! read default values and constraints for model parameters (local column)
- call read_pinit(LOCALPARAM_INFO,.TRUE., mpar_meta,localParFallback,err,cmessage)
- if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
- ! read default values and constraints for model parameters (basin-average)
- call read_pinit(BASINPARAM_INFO,.FALSE.,bpar_meta,basinParFallback,err,cmessage)
- if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-end subroutine read_pinit_C
-
-subroutine read_vegitationTables(err) bind(C, name="read_vegitationTables")
-  USE SummaActors_setup,only:SOIL_VEG_GEN_PARM
-  USE module_sf_noahmplsm,only:read_mp_veg_parameters         ! module to read NOAH vegetation tables
-  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
-  USE summaFileManager,only:GENPARM,VEGPARM,SOILPARM,MPTABLE  ! files defining the noah tables
-  USE globalData,only:model_decisions                         ! model decision structure
-  USE var_lookup,only:iLookDECISIONS                          ! look-up values for model decisions
-
-  implicit none
-  
-  integer(c_int),intent(inout)              :: err                        ! Error Code
-  err = 0
-
- ! read Noah soil and vegetation tables
-  call soil_veg_gen_parm(trim(SETTINGS_PATH)//trim(VEGPARM),      & ! filename for vegetation table
-      trim(SETTINGS_PATH)//trim(SOILPARM),                        & ! filename for soils table
-      trim(SETTINGS_PATH)//trim(GENPARM),                         & ! filename for general table
-      trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision), & ! classification system used for vegetation
-      trim(model_decisions(iLookDECISIONS%soilCatTbl)%cDecision))   ! classification system used for soils
-
-  ! read Noah-MP vegetation tables
-  call read_mp_veg_parameters(trim(SETTINGS_PATH)//trim(MPTABLE),                       & ! filename for Noah-MP table
-       trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision)) ! classification system used for vegetation
-  
-end subroutine
-
-! allocate the failedHRU logical array and intialize it with all false values
-subroutine initFailedHRUTracker(numGRU) bind(C, name="initFailedHRUTracker")
-  USE globalData,only:failedHRUs
-  implicit none
-  integer(c_int), intent(in)        :: numGRU
-
-  if (allocated(failedHRUs))then; deallocate(failedHRUs); endif;
-  allocate(failedHRUs(numGRU))
-
-  failedHRUs(:) = .false.
-
-
-end subroutine
-
-subroutine updateFailed(indxHRU) bind(C, name="updateFailed")
-  USE globalData,only:failedHRUs
-  implicit none
-  integer(c_int), intent(in)        :: indxHRU
-
-  failedHRUs(indxHRU) = .true.
-end subroutine
-
-subroutine resetFailedArray() bind(C, name="resetFailedArray")
-  USE globalData,only:failedHRUs
-  implicit none
-
-  failedHRUs(:) = .false.
-
-end subroutine
-
-
-subroutine FileAccessActor_DeallocateStructures(handle_forcFileInfo, handle_ncid) bind(C,name="FileAccessActor_DeallocateStructures")
-  USE netcdf_util_module,only:nc_file_close 
-  USE globalData,only:structInfo                              ! information on the data structures
-  USE globalData,only:failedHRUs
-  USE globalData,only:forcingDataStruct
-  USE globalData,only:vectime
-  USE globalData,only:outputTimeStep
-  USE globalData,only:init_cond_prog
-  USE globalData,only:init_cond_bvar
-  implicit none
-  type(c_ptr),intent(in), value        :: handle_forcFileInfo
-  type(c_ptr),intent(in), value        :: handle_ncid
-  type(var_i),pointer                  :: ncid
-
-  type(file_info_array), pointer       :: forcFileInfo
-  integer(i4b)                         :: iFreq
-  character(LEN=256)                   :: cmessage
-  character(LEN=256)                   :: message
-  integer(i4b)                         :: err
-
-  call c_f_pointer(handle_ncid, ncid)
-  call c_f_pointer(handle_forcFileInfo, forcFileInfo)
-
-
-  ! close the open output FIle
-  do iFreq=1,maxvarFreq
-    if (ncid%var(iFreq)/=integerMissing) then
-        call nc_file_close(ncid%var(iFreq),err,cmessage)
-        if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-    endif   
-  end do
-  
-  deallocate(forcFileInfo)
-  deallocate(ncid)
-  deallocate(failedHRUs)
-  deallocate(outputTimeStep)
-  deallocate(init_cond_prog)
-  if (allocated(init_cond_bvar))then; deallocate(init_cond_bvar); endif;
-end subroutine FileAccessActor_DeallocateStructures
-
-
-end module cppwrap_fileAccess
-
-
-
diff --git a/build/source/actors/file_access_actor/fortran_code/output_structure.f90 b/build/source/actors/file_access_actor/fortran_code/output_structure.f90
deleted file mode 100644
index 8f0da6c06f27c25cadca4f8c771c559ccd5aa113..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/fortran_code/output_structure.f90
+++ /dev/null
@@ -1,437 +0,0 @@
-module output_structure_module
-  USE nrtype
-  USE data_types,only:summa_output_type
-  USE, intrinsic :: iso_c_binding
-  implicit none
-  public::initOutputTimeStep
-  public::initOutputStructure
-  public::deallocateOutputStructure
-  public::deallocateData_output
-  
-  
-  type(summa_output_type),allocatable,save,public :: outputStructure(:) ! summa_OutputStructure(iFile)%struc%var(:)%dat(nTimeSteps) 
-  
-  contains
-
-subroutine initOutputTimeStep(num_gru, err) bind(C, name="initOutputTimeStep") 
-  USE globalData,only:outputTimeStep
-  USE var_lookup,only:maxvarFreq                ! maximum number of output files
-  implicit none
-  integer(c_int), intent(in)  :: num_gru
-  integer(c_int), intent(out) :: err
-  ! local variables
-  integer(i4b)                :: iGRU
-
-  ! initalize outputTimeStep - keeps track of the step the GRU is writing for
-  if (.not.allocated(outputTimeStep))then
-    allocate(outputTimeStep(num_gru))
-    do iGRU = 1, num_gru
-      allocate(outputTimeStep(iGRU)%dat(maxVarFreq))
-      outputTimeStep(iGRU)%dat(:) = 1
-    end do
-  end if
-
-end subroutine initOutputTimeStep
-
-subroutine initOutputStructure(handle_forcFileInfo, maxSteps, num_gru, err) bind(C, name="initOutputStructure")
-  USE globalData,only:time_meta,forc_meta,attr_meta,type_meta ! metadata structures
-  USE globalData,only:prog_meta,diag_meta,flux_meta,id_meta   ! metadata structures
-  USE globalData,only:mpar_meta,indx_meta                     ! metadata structures
-  USE globalData,only:bpar_meta,bvar_meta                     ! metadata structures
-  USE globalData,only:statForc_meta                           ! child metadata for stats
-  USE globalData,only:statProg_meta                           ! child metadata for stats
-  USE globalData,only:statDiag_meta                           ! child metadata for stats
-  USE globalData,only:statFlux_meta                           ! child metadata for stats
-  USE globalData,only:statIndx_meta                           ! child metadata for stats
-  USE globalData,only:statBvar_meta                           ! child metadata for stats
-  USE globalData,only:gru_struc
-  USE globalData,only:structInfo                              ! information on the data structures
-  USE alloc_outputStructure,only:alloc_outputStruc
-  USE multiconst,only:secprday               ! number of seconds in a day
-  USE data_types,only:file_info_array
-  USE var_lookup,only:maxvarFreq                ! maximum number of output files
-  
-  implicit none
-  type(c_ptr), intent(in), value        :: handle_forcFileInfo
-  integer(c_int), intent(in)            :: maxSteps
-  integer(c_int), intent(in)            :: num_gru
-  integer(c_int), intent(out)           :: err 
-
-  ! local variables
-  type(file_info_array), pointer        :: forcFileInfo
-
-  integer(i4b)                          :: nVars
-  integer(i4b)                          :: iGRU
-  integer(i4b)                          :: iHRU
-  integer(i4b)                          :: iStep
-  integer(i4b)                          :: nSnow
-  integer(i4b)                          :: nSoil
-  integer(i4b)                          :: iStruct
-  character(len=256)                    :: message
-  integer(i4b)                          :: num_hru
-
-  call c_f_pointer(handle_forcFileInfo, forcFileInfo)
-
-  ! Allocate structure to hold output files
-  if (.not.allocated(outputStructure))then
-    allocate(outputStructure(1))
-  else
-    print*, "Already Allocated"
-    return;
-  end if
-
-  ! Statistics Structures
-  allocate(outputStructure(1)%forcStat(1))
-  allocate(outputStructure(1)%progStat(1))
-  allocate(outputStructure(1)%diagStat(1))
-  allocate(outputStructure(1)%fluxStat(1))
-  allocate(outputStructure(1)%indxStat(1))
-  allocate(outputStructure(1)%bvarStat(1))
-  allocate(outputStructure(1)%forcStat(1)%gru(num_gru))
-  allocate(outputStructure(1)%progStat(1)%gru(num_gru))
-  allocate(outputStructure(1)%diagStat(1)%gru(num_gru))
-  allocate(outputStructure(1)%fluxStat(1)%gru(num_gru))
-  allocate(outputStructure(1)%indxStat(1)%gru(num_gru))
-  allocate(outputStructure(1)%bvarStat(1)%gru(num_gru))
-
-  ! Primary Data Structures (scalars)
-  allocate(outputStructure(1)%timeStruct(1))
-  allocate(outputStructure(1)%forcStruct(1))
-  allocate(outputStructure(1)%attrStruct(1))
-  allocate(outputStructure(1)%typeStruct(1))
-  allocate(outputStructure(1)%idStruct(1))
-  allocate(outputStructure(1)%timeStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%forcStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%attrStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%typeStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%idStruct(1)%gru(num_gru))
-  
-  ! Primary Data Structures (variable length vectors)
-  allocate(outputStructure(1)%indxStruct(1))
-  allocate(outputStructure(1)%mparStruct(1))
-  allocate(outputStructure(1)%progStruct(1))
-  allocate(outputStructure(1)%diagStruct(1))
-  allocate(outputStructure(1)%fluxStruct(1))
-  allocate(outputStructure(1)%indxStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%mparStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%progStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%diagStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%fluxStruct(1)%gru(num_gru))
-
-  ! Basin-Average structures
-  allocate(outputStructure(1)%bparStruct(1))
-  allocate(outputStructure(1)%bvarStruct(1))
-  allocate(outputStructure(1)%bparStruct(1)%gru(num_gru))
-  allocate(outputStructure(1)%bvarStruct(1)%gru(num_gru))
-
-  ! define the ancillary data structures
-  allocate(outputStructure(1)%dparStruct(1))
-  allocate(outputStructure(1)%dparStruct(1)%gru(num_gru))
-
-  ! Finalize Stats for writing
-  allocate(outputStructure(1)%finalizeStats(1))
-  allocate(outputStructure(1)%finalizeStats(1)%gru(num_gru))
-  
-  
-  do iGRU = 1, num_gru
-    num_hru = gru_struc(iGRU)%hruCount
-    ! Statistics Structures
-    allocate(outputStructure(1)%forcStat(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%progStat(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%diagStat(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%fluxStat(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%indxStat(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%bvarStat(1)%gru(iGRU)%hru(num_hru))
-
-    ! Primary Data Structures (scalars)
-    allocate(outputStructure(1)%timeStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%forcStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%attrStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%typeStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%idStruct(1)%gru(iGRU)%hru(num_hru))
-  
-    ! Primary Data Structures (variable length vectors)
-    allocate(outputStructure(1)%indxStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%mparStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%progStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%diagStruct(1)%gru(iGRU)%hru(num_hru))
-    allocate(outputStructure(1)%fluxStruct(1)%gru(iGRU)%hru(num_hru))
-  
-    ! Basin-Average structures
-    allocate(outputStructure(1)%bvarStruct(1)%gru(iGRU)%hru(num_hru))
-
-   ! define the ancillary data structures
-    allocate(outputStructure(1)%dparStruct(1)%gru(iGRU)%hru(num_hru))
-
-    ! Finalize Stats for writing
-    allocate(outputStructure(1)%finalizeStats(1)%gru(iGRU)%hru(num_hru))
-
-  end do
-
-  do iGRU=1,num_gru
-    do iHRU=1,gru_struc(iGRU)%hruCount
-
-      ! Get the maximum number of steps needed to initalize the output structure
-      nVars = maxval(forcFileInfo%ffile_list(:)%nVars)
-      nSnow = gru_struc(iGRU)%hruInfo(iHRU)%nSnow
-      nSoil = gru_struc(iGRU)%hruInfo(iHRU)%nSoil
-
-      do iStruct=1,size(structInfo)
-        ! allocate space structures
-          select case(trim(structInfo(iStruct)%structName))    
-            case('time')
-              call alloc_outputStruc(time_meta,outputStructure(1)%timeStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,err=err,message=message)     ! model forcing data
-            case('forc')
-              ! Structure
-              call alloc_outputStruc(forc_meta,outputStructure(1)%forcStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model forcing data
-              ! Statistics
-              call alloc_outputStruc(statForc_meta(:)%var_info,outputStructure(1)%forcStat(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model forcing data
-            case('attr')
-              call alloc_outputStruc(attr_meta,outputStructure(1)%attrStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! local attributes for each HRU
-            case('type')
-              call alloc_outputStruc(type_meta,outputStructure(1)%typeStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! classification of soil veg etc.
-            case('id'  )
-              call alloc_outputStruc(id_meta,outputStructure(1)%idStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);        ! local values of hru gru IDs
-            case('mpar') ! model parameters
-              call alloc_outputStruc(mpar_meta,outputStructure(1)%mparStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message); 
-
-              call alloc_outputStruc(mpar_meta, outputStructure(1)%dparStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,err=err,message=message)
-            case('indx')
-              ! Structure
-              call alloc_outputStruc(indx_meta,outputStructure(1)%indxStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,str_name='indx',message=message);    ! model variables
-              ! Statistics
-              call alloc_outputStruc(statIndx_meta(:)%var_info,outputStructure(1)%indxStat(1)%gru(iGRU)%hru(1), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! index vars
-            case('prog')
-              ! Structure
-              call alloc_outputStruc(prog_meta,outputStructure(1)%progStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model prognostic (state) variables
-              ! Statistics
-              call alloc_outputStruc(statProg_meta(:)%var_info,outputStructure(1)%progStat(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model prognostic 
-            case('diag')
-              ! Structure
-              call alloc_outputStruc(diag_meta,outputStructure(1)%diagStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model diagnostic variables
-              ! Statistics
-              call alloc_outputStruc(statDiag_meta(:)%var_info,outputStructure(1)%diagStat(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model diagnostic
-            case('flux')
-              ! Structure
-              call alloc_outputStruc(flux_meta,outputStructure(1)%fluxStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model fluxes
-              ! Statistics
-              call alloc_outputStruc(statFlux_meta(:)%var_info,outputStructure(1)%fluxStat(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=nSnow,nSoil=nSoil,err=err,message=message);    ! model fluxes
-            case('bpar')
-              call alloc_outputStruc(bpar_meta,outputStructure(1)%bparStruct(1)%gru(iGRU), &
-                                      nSteps=maxSteps,nSnow=0,nSoil=0,err=err,message=message);  ! basin-average params 
-            case('bvar')
-              ! Structure
-              call alloc_outputStruc(bvar_meta,outputStructure(1)%bvarStruct(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=0,nSoil=0,err=err,message=message);  ! basin-average variables
-              ! Statistics
-              call alloc_outputStruc(statBvar_meta(:)%var_info,outputStructure(1)%bvarStat(1)%gru(iGRU)%hru(iHRU), &
-                                      nSteps=maxSteps,nSnow=0,nSoil=0,err=err,message=message);  ! basin-average variables
-            case('deriv');  cycle
-            case('lookup'); cycle
-            case default; err=20; message='unable to find structure name: '//trim(structInfo(iStruct)%structName)
-        end select
-
-        ! check errors
-        if(err/=0)then
-          message=trim(message)//'initOutputStruc.f90 - [structure =  '//trim(structInfo(iStruct)%structName)//']'
-          print*, "Problem with structure: ", trim(structInfo(iStruct)%structName)
-          return
-        endif
-      end do  ! looping through data structures
-    
-      ! Finalize stats structure for writing to output file
-      allocate(outputStructure(1)%finalizeStats(1)%gru(iGRU)%hru(iHRU)%tim(maxSteps))
-      do iStep = 1, maxSteps
-        allocate(outputStructure(1)%finalizeStats(1)%gru(iGRU)%hru(iHRU)%tim(iStep)%dat(1:maxVarFreq))
-      end do ! timeSteps
-    end do ! Looping through GRUs
-  end do
-
-
-end subroutine initOutputStructure
-
-subroutine deallocateOutputStructure(err) bind(C, name="deallocateOutputStructure")
-  implicit none
-  integer(i4b), intent(inout)   :: err
-
-  err = 0
-  ! Time
-  deallocate(outputStructure)
-  ! call deallocateData_output(outputStructure(1)%timeStruct(1));    deallocate(outputStructure(1)%timeStruct)
-  ! ! Forc
-  ! call deallocateData_output(outputStructure(1)%forcStat(1));       deallocate(outputStructure(1)%forcStat)
-  ! call deallocateData_output(outputStructure(1)%forcStruct(1));     deallocate(outputStructure(1)%forcStruct)
-  ! ! prog
-  ! call deallocateData_output(outputStructure(1)%progStat(1));       deallocate(outputStructure(1)%progStat)
-  ! call deallocateData_output(outputStructure(1)%progStruct(1));     deallocate(outputStructure(1)%progStruct)
-  ! ! diag
-  ! call deallocateData_output(outputStructure(1)%diagStat(1));       deallocate(outputStructure(1)%diagStat)
-  ! call deallocateData_output(outputStructure(1)%diagStruct(1));     deallocate(outputStructure(1)%diagStruct)
-  ! ! flux
-  ! call deallocateData_output(outputStructure(1)%fluxStat(1));       deallocate(outputStructure(1)%fluxStat)
-  ! call deallocateData_output(outputStructure(1)%fluxStruct(1));     deallocate(outputStructure(1)%fluxStruct)
-  ! ! indx
-  ! call deallocateData_output(outputStructure(1)%indxStat(1));       deallocate(outputStructure(1)%indxStat)
-  ! call deallocateData_output(outputStructure(1)%indxStruct(1));     deallocate(outputStructure(1)%indxStruct)
-  ! ! bvar
-  ! call deallocateData_output(outputStructure(1)%bvarStat(1));       deallocate(outputStructure(1)%bvarStat)
-  ! call deallocateData_output(outputStructure(1)%bvarStruct(1));     deallocate(outputStructure(1)%bvarStruct)
-  ! ! id
-  ! call deallocateData_output(outputStructure(1)%idStruct(1));       deallocate(outputStructure(1)%idStruct)
-  ! ! attr
-  ! call deallocateData_output(outputStructure(1)%attrStruct(1));     deallocate(outputStructure(1)%attrStruct)
-  ! ! type
-  ! call deallocateData_output(outputStructure(1)%typeStruct(1));     deallocate(outputStructure(1)%typeStruct)
-  ! ! mpar
-  ! call deallocateData_output(outputStructure(1)%mparStruct(1));     deallocate(outputStructure(1)%mparStruct)
-  ! ! bpar
-  ! call deallocateData_output(outputStructure(1)%bparStruct(1));     deallocate(outputStructure(1)%bparStruct)
-  ! ! finalize stats
-  ! call deallocateData_output(outputStructure(1)%finalizeStats(1));  deallocate(outputStructure(1)%finalizeStats)
-
-end subroutine deallocateOutputStructure
-
-subroutine deallocateData_output(dataStruct)
-  USE data_types,only:gru_hru_time_doubleVec, &
-                      gru_hru_time_intVec, &
-                      gru_hru_time_flagVec, &
-                      gru_hru_time_int, &
-                      gru_hru_int, &
-                      gru_hru_time_int8, &
-                      gru_hru_time_double, &
-                      gru_hru_double, &
-                      gru_double
-  implicit none
-  class(*),intent(inout)      :: dataStruct
-  ! local variables
-  integer(i4b)                :: iGRU
-  integer(i4b)                :: iHRU
-  integer(i4b)                :: iVar
-  integer(i4b)                :: iTim
-
-  select type(dataStruct)
-    class is (gru_hru_time_doubleVec)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
-            do iTim = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(:))
-              deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(iTim)%dat)
-            end do ! Time
-            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
-          end do ! var
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_hru_time_intVec)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
-            do iTim = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(:))
-              deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(iTim)%dat)
-            end do ! Time
-            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
-          end do ! var
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_hru_time_flagVec)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          do iTim = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%tim(:))
-            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%tim(iTim)%dat)
-          end do ! Time
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%tim)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-  
-    class is (gru_hru_time_int)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
-            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
-          end do ! var
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_hru_int)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_hru_time_int8)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
-            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
-          end do ! var
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_hru_time_double)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
-            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
-          end do ! var
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_hru_double)
-      do iGRU = 1, size(dataStruct%gru(:))
-        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
-          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
-        end do ! hru
-        deallocate(dataStruct%gru(iGRU)%hru)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-    class is (gru_double)
-      do iGRU = 1, size(dataStruct%gru(:))
-          deallocate(dataStruct%gru(iGRU)%var)
-      end do ! gru
-      deallocate(dataStruct%gru)
-
-
-  end select
-
-end subroutine
-
-
-end module output_structure_module
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/fortran_code/read_attribute.f90 b/build/source/actors/file_access_actor/fortran_code/read_attribute.f90
deleted file mode 100644
index 2351c3a8e6ba982d99af39e842235ee1616df157..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/fortran_code/read_attribute.f90
+++ /dev/null
@@ -1,356 +0,0 @@
-module read_attribute_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-
-implicit none
-private
-public::allocateAttributeStructures
-public::openAttributeFile
-public::getNumVarAttr
-public::closeAttributeFile
-public::readAttributeFromNetCDF
-
-contains
-
-subroutine allocateAttributeStructures(index_gru, index_hru, & ! indexes into gru_struc
-    handle_attr_struct, handle_type_struct, handle_id_struct, err) bind(C, name="allocateAttributeStructures")
-  USE data_types,only:var_d, var_i, var_i8
-  USE globalData,only:gru_struc
-  USE globalData,only:attr_meta,type_meta,id_meta
-  USE allocspace_module,only:allocLocal
-  implicit none
-  integer(c_int),intent(in)           :: index_gru
-  integer(c_int),intent(in)           :: index_hru
-  type(c_ptr), intent(in), value      :: handle_attr_struct
-  type(c_ptr), intent(in), value      :: handle_type_struct
-  type(c_ptr), intent(in), value      :: handle_id_struct
-  integer(c_int), intent(out)         :: err
-  type(var_d), pointer                :: attr_struct
-  type(var_i), pointer                :: type_struct
-  type(var_i8), pointer               :: id_struct
-  integer(i4b)                        :: nSoil
-  integer(i4b)                        :: nSnow
-  character(len=256)                  :: message
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_attr_struct, attr_struct)
-  call c_f_pointer(handle_type_struct, type_struct)
-  call c_f_pointer(handle_id_struct,   id_struct)
-  ! Start subroutine
-  err=0; message="read_attribute.f90 - allocateAttributeStructures"
-
-  nSnow = gru_struc(index_gru)%hruInfo(index_hru)%nSnow
-  nSoil = gru_struc(index_gru)%hruInfo(index_hru)%nSoil
-
-  call allocLocal(attr_meta,attr_struct,nSnow,nSoil,err,message);
-  call allocLocal(type_meta,type_struct,nSnow,nSoil,err,message);
-  call allocLocal(id_meta,id_struct,nSnow,nSoil,err,message);
-  if(err/=0)then; message=trim(message); print*, message; return; endif;
-  
-end subroutine allocateAttributeStructures
-
-
-subroutine openAttributeFile(attr_ncid, err) bind(C, name="openAttributeFile")
-  USE netcdf
-  USE netcdf_util_module,only:nc_file_open                   ! open netcdf file
-  ! Attribute File
-  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
-  USE summaFileManager,only:LOCAL_ATTRIBUTES                  ! name of model initial attributes file
-  implicit none
-  integer(c_int),intent(out)                :: attr_ncid
-  integer(c_int),intent(out)                :: err
-
-  ! local variables
-  character(len=256)                        :: message       ! error message
-  character(len=256)                        :: attrFile           ! attributes file name
-
-  err=0; message="read_attribute.f90 - openAttributesFile"
-  attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES)
-
-  call nc_file_open(trim(attrFile),nf90_noWrite,attr_ncid,err,message)
-  if(err/=0)then
-      message=trim(message)
-      print*, message
-      return
-  endif
-
-end subroutine
-
-subroutine getNumVarAttr(attr_ncid, num_var, err) bind(C, name="getNumVarAttr")
-  USE netcdf
-  USE netcdf_util_module,only:netcdf_err                     ! netcdf error handling function
-  implicit none
-  integer(c_int),intent(in)                 :: attr_ncid
-  integer(c_int),intent(out)                :: num_var
-  integer(c_int),intent(out)                :: err
-
-  ! local variables
-  character(len=256)                        :: message       ! error message
-  err=0; message="read_attribute.f90 - getNumVar"
-  ! get number of variables total in netcdf file
-  err = nf90_inquire(attr_ncid,nvariables=num_var)
-  call netcdf_err(err,message)
-  if (err/=0) then
-      message=trim(message)//'problem with nf90_inquire'
-      return
-  endif
-
-end subroutine getNumVarAttr
-
-subroutine closeAttributeFile(attr_ncid, err) bind(C, name="closeAttributeFile")
-  USE netcdf_util_module,only:nc_file_close
-  implicit none
-  integer(c_int),intent(in)         :: attr_ncid
-  integer(c_int),intent(out)        :: err
-  ! local variables
-  character(len=256)                :: message
-  err=0; message="read_attribute.f90 - closeAttributeFile"
-
-  call nc_file_close(attr_ncid,err,message)
-  if (err/=0)then
-    message=trim(message)
-    return
-  end if
-
-end subroutine closeAttributeFile
-
-
-
-! Read in the local attributes for an HRU
-subroutine readAttributeFromNetCDF(ncid, index_gru, index_hru, num_var, &
-  handle_attr_struct, handle_type_struct, handle_id_struct, err) bind(C, name="readAttributeFromNetCDF")
-  ! netcdf utilities
-  USE netcdf
-  USE netcdf_util_module,only:nc_file_open                   ! open netcdf file
-  USE netcdf_util_module,only:nc_file_close                  ! close netcdf file
-  USE nr_utility_module ,only:arth
-  ! needed global data structures and metadata
-  USE globalData,only:gru_struc                              ! gru-hru mapping structure
-  USE globalData,only:attr_meta,type_meta,id_meta            ! metadata structures
-  USE get_ixname_module,only:get_ixAttr,get_ixType,get_ixId  ! access function to find index of elements in structure
-  ! Information to make up the attributes file
-  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
-  USE summaFileManager,only:LOCAL_ATTRIBUTES                  ! name of model initial attributes file
-  ! Fortran Data Type Structures
-  USE data_types,only:var_d, var_i, var_i8
-  implicit none
-  ! indexes into gru_struc
-  integer(c_int), intent(in)            :: ncid
-  integer(c_int), intent(in)            :: index_gru
-  integer(c_int), intent(in)            :: index_hru
-  ! number of variables from the netCDF file
-  integer(c_int), intent(in)            :: num_var
-  ! data structures to populate
-  type(c_ptr), intent(in), value        :: handle_attr_struct
-  type(c_ptr), intent(in), value        :: handle_type_struct
-  type(c_ptr), intent(in), value        :: handle_id_struct
-  ! error control
-  integer(c_int), intent(out)           :: err
-  ! local variables
-  integer(i4b)                          :: iVar               ! loop through varibles in the netcdf file
-  integer(i4b)                          :: varType            ! type of variable (categorica, numerical, idrelated)
-  integer(i4b)                          :: varIndx            ! index of variable within its data structure
-  ! Fortran structures
-  type(var_d), pointer                  :: attr_struct
-  type(var_i), pointer                  :: type_struct
-  type(var_i8), pointer                 :: id_struct
-  ! check structures - to verify input
-  integer(i4b)                          :: iCheck             ! index of an attribute name
-  logical(lgt),allocatable              :: checkType(:)       ! vector to check if we have all desired categorical values
-  logical(lgt),allocatable              :: checkId(:)         ! vector to check if we have all desired IDs
-  logical(lgt),allocatable              :: checkAttr(:)       ! vector to check if we have all desired local attributes
-  ! netcdf variables
-  character(LEN=nf90_max_name)          :: varName            ! character array of netcdf variable name
-  integer(i4b),parameter                :: categorical=101    ! named variable to denote categorical data
-  integer(i4b),parameter                :: numerical=102      ! named variable to denote numerical data
-  integer(i4b),parameter                :: idrelated=103      ! named variable to denote ID related data
-  integer(i4b)                          :: categorical_var(1) ! temporary categorical variable from local attributes netcdf file
-  real(rkind)                           :: numeric_var(1)     ! temporary numeric variable from local attributes netcdf file
-  integer(8)                            :: idrelated_var(1)   ! temporary ID related variable from local attributes netcdf file
-  character(len=256)                    :: attr_file          ! attributes file name
-  character(len=256)                    :: message           
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_attr_struct, attr_struct)
-  call c_f_pointer(handle_type_struct, type_struct)
-  call c_f_pointer(handle_id_struct,   id_struct)
-
-  err=0; message="read_attribute_file_access_actor - read_attribute.f90"
-
-  attr_file= trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES)
-
-  ! **********************************************************************************************
-  ! (1) prepare check vectors
-  ! **********************************************************************************************
-  allocate(checkType(size(type_meta)),checkAttr(size(attr_meta)),checkId(size(id_meta)),stat=err)
-  if(err/=0)then
-      err=20
-      message=trim(message)//'problem allocating space for variable check vectors'
-      print*, message
-      return
-  endif
-  checkType(:) = .false.
-  checkAttr(:) = .false.
-  checkId(:)   = .false.
-
-  iCheck = 1
-  do iVar = 1,num_var
-    ! inqure about current variable name, type, number of dimensions
-    err = nf90_inquire_variable(ncID,iVar,name=varName)
-    if(err/=nf90_noerr)then; 
-        message=trim(message)//'problem inquiring variable: '//trim(varName)//'/'//trim(nf90_strerror(err)); 
-        print*, message
-        return 
-    endif
-    
-    ! find attribute name
-    select case(trim(varName))
-   
-      ! ** categorical data
-      case('vegTypeIndex','soilTypeIndex','slopeTypeIndex','downHRUindex')
-
-          ! get the index of the variable
-          varType = categorical
-          varIndx = get_ixType(varName)
-          checkType(varIndx) = .true.
-
-          ! check that the variable could be identified in the data structure
-          if(varIndx < 1)then
-              err=20; 
-              message=trim(message)//'unable to find variable ['//trim(varName)//'] in data structure'; 
-              print*, message
-              return; 
-          endif
-  
-
-          err = nf90_get_var(ncID,iVar,categorical_var,start=(/gru_struc(index_gru)%hruInfo(index_hru)%hru_nc/),count=(/1/))
-          if(err/=nf90_noerr)then
-              message=trim(message)//'problem reading: '//trim(varName)
-              print*, message
-              return
-          end if
-          type_struct%var(varIndx) = categorical_var(1)
-
-          ! ** ID related data
-      case('hruId')
-          ! get the index of the variable
-          varType = idrelated
-          varIndx = get_ixId(varName)
-          checkId(varIndx) = .true.
-  
-          ! check that the variable could be identified in the data structure
-          if(varIndx < 1)then
-              err=20
-              message=trim(message)//'unable to find variable ['//trim(varName)//'] in data structure'
-              print*, message
-              return
-          endif
-  
-          ! get data from netcdf file and store in vector
-
-          err = nf90_get_var(ncID,iVar,idrelated_var,start=(/gru_struc(index_gru)%hruInfo(index_hru)%hru_nc/),count=(/1/))
-          if(err/=nf90_noerr)then
-              message=trim(message)//'problem reading: '//trim(varName)
-              print*, message
-              return
-          end if
-          id_struct%var(varIndx) = idrelated_var(1)
-
-
-      ! ** numerical data
-      case('latitude','longitude','elevation','tan_slope','contourLength','HRUarea','mHeight')
-
-          ! get the index of the variable
-          varType = numerical
-          varIndx = get_ixAttr(varName)
-          checkAttr(varIndx) = .true.
-  
-          ! check that the variable could be identified in the data structure
-          if(varIndx < 1)then
-              err=20; message=trim(message)//'unable to find variable ['//trim(varName)//'] in data structure'
-              print*, message
-              return 
-          endif
-          ! get data from netcdf file and store in vector
-                 
-          err = nf90_get_var(ncID,iVar,numeric_var,start=(/gru_struc(index_gru)%hruInfo(index_hru)%hru_nc/),count=(/1/))
-          if(err/=nf90_noerr)then
-              message=trim(message)//'problem reading: '//trim(varName)
-              print*, message
-              return
-          end if
-          attr_struct%var(varIndx) = numeric_var(1)
-    
-      
-      ! for mapping varibles, do nothing (information read above)
-      case('hru2gruId','gruId'); cycle
-  
-      ! check that variables are what we expect
-      case default
-          message=trim(message)//'unknown variable ['//trim(varName)//'] in local attributes file'
-          print*,message
-          err=20
-          return
-
-    end select ! select variable
-
-  end do ! (looping through netcdf local attribute file)
-
-  ! ** now handle the optional aspect variable if it's missing
-  varIndx = get_ixAttr('aspect')
-  ! check that the variable was not found in the attribute file
-  if(.not. checkAttr(varIndx)) then
-      if (index_gru == 1) then
-        write(*,*) NEW_LINE('A')//'INFO: aspect not found in the input attribute file, continuing ...'//NEW_LINE('A')
-      endif
-      attr_struct%var(varIndx) = nr_realMissing      ! populate variable with out-of-range value, used later
-      checkAttr(varIndx) = .true.
-  endif
-
-  ! **********************************************************************************************
-  ! (4) check that we have all the desired varaibles
-  ! **********************************************************************************************
-  ! check that we have all desired categorical variables
-  if(any(.not.checkType))then
-    do iCheck = 1,size(type_meta)
-        if(.not.checkType(iCheck))then 
-            err=20
-            message=trim(message)//'missing variable ['//trim(type_meta(iCheck)%varname)//'] in local attributes file'
-            print*, message
-            return
-        endif
-    end do
-  endif
-
-  ! check that we have all desired ID variables
-  if(any(.not.checkId))then
-    do iCheck = 1,size(id_meta)
-        if(.not.checkId(iCheck))then
-            err=20
-            message=trim(message)//'missing variable ['//trim(id_meta(iCheck)%varname)//'] in local attributes file'
-            print*, message
-            return 
-        endif
-    end do
-  endif
-
-  ! check that we have all desired local attributes
-  if(any(.not.checkAttr))then
-    do iCheck = 1,size(attr_meta)
-        if(.not.checkAttr(iCheck))then; 
-            err=20
-            message=trim(message)//'missing variable ['//trim(attr_meta(iCheck)%varname)//'] in local attributes file'
-            print*, message
-            return 
-        endif
-    end do
-  endif
-
-  ! free memory
-  deallocate(checkType)
-  deallocate(checkId)
-  deallocate(checkAttr)
-end subroutine readAttributeFromNetCDF
-end module read_attribute_module
diff --git a/build/source/actors/file_access_actor/fortran_code/read_initcond.f90 b/build/source/actors/file_access_actor/fortran_code/read_initcond.f90
deleted file mode 100644
index fefff723bfef3e2c0fcb559ff8fc791e8738ddf0..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/fortran_code/read_initcond.f90
+++ /dev/null
@@ -1,280 +0,0 @@
-module read_initcond_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-
-
-implicit none
-private
-public :: openInitCondFile
-public :: closeInitCondFile
-public :: readInitCond_prog
-public :: readInitCond_bvar
-
-! define single HRU restart file
-integer(i4b), parameter :: singleHRU=1001
-integer(i4b), parameter :: multiHRU=1002
-integer(i4b), parameter :: restartFileType=multiHRU
-contains
-
-subroutine openInitCondFile(init_cond_ncid, err) bind(C, name="openInitCondFile")
-  USE netcdf_util_module,only:nc_file_open               ! open netcdf file
-  USE netcdf
-  ! file paths
-  USE summaFileManager,only:SETTINGS_PATH           ! path to settings files (e.g., Noah vegetation tables)
-  USE summaFileManager,only:STATE_PATH              ! optional path to state/init. condition files (defaults to SETTINGS_PATH)
-  USE summaFileManager,only:MODEL_INITCOND          ! name of model initial conditions file
-  implicit none
-
-  integer(c_int),intent(out)          :: init_cond_ncid
-  integer(c_int),intent(out)          :: err
-
-  character(len=256)                  :: init_cond_fileName
-  character(len=256)                  :: message          ! error message
-  character(len=1024)                 :: cmessage         ! error message for downwind routine
-  ! --------------------------------------------------------------------------------------------------------
-
-  ! define restart file path/name
-  if(STATE_PATH == '') then
-    init_cond_fileName = trim(SETTINGS_PATH)//trim(MODEL_INITCOND)
-  else
-    init_cond_fileName = trim(STATE_PATH)//trim(MODEL_INITCOND)
-  endif
-
-  call nc_file_open(init_cond_fileName,nf90_nowrite,init_cond_ncid,err,cmessage)
-  if (err/=0) then
-    message=trim(message)//trim(cmessage)
-    print(message)
-    return
-  end if
-
-end subroutine openInitCondFile
-
-subroutine closeInitCondFile(init_cond_ncid,err) bind(C, name="closeInitCondFile")
-  USE netcdf_util_module,only:nc_file_close
-  implicit none
-  
-  integer(c_int),intent(out)          :: init_cond_ncid
-  integer(c_int),intent(out)          :: err
-  
-  ! local variables
-  character(len=256)                  :: message
-  ! --------------------------------------------------------------------------------------------------------
-  err=0; message="read_initcond.f90 - closeInitCondFile/"
-
-  call nc_file_close(init_cond_ncid,err,message)
-  if (err/=0) then
-    message=trim(message)
-    print(message)
-    return
-  end if
-
-end subroutine closeInitCondFile
-
-subroutine readInitCond_prog(init_cond_ncid, start_gru, num_gru, err) bind(C, name="readInitCond_prog")
-  ! Structures to populate
-  USE globalData,only:init_cond_prog
-  ! Netcdf
-  USE netcdf
-  USE netcdf_util_module,only:nc_file_close              ! close netcdf file
-  USE netcdf_util_module,only:netcdf_err                 ! netcdf error handling
-
-  ! metadata
-  USE globalData,only:prog_meta                     ! metadata for prognostic variables
-  USE globalData,only:bvar_meta                     ! metadata for basin (GRU) variables
-  ! var_lookup
-  USE var_lookup,only:iLookVarType                  ! variable lookup structure
-  USE var_lookup,only:iLookPROG                     ! variable lookup structure
-  USE var_lookup,only:iLookPARAM                    ! variable lookup structure
-  USE var_lookup,only:iLookINDEX                    ! variable lookup structure
-  ! access type string
-  USE get_ixName_module,only:get_varTypeName        ! to access type strings for error messages
-  implicit none
-
-  integer(c_int), intent(in)             :: init_cond_ncid
-  integer(c_int), intent(in)             :: start_gru
-  integer(c_int), intent(in)             :: num_gru
-  integer(c_int), intent(out)            :: err
- 
-  ! local variables
-  integer(i4b)                           :: iVar
-  integer(i4b)                           :: dimID        ! varible dimension ids
-  integer(i4b)                           :: ncVarID      ! variable ID in netcdf file
-  integer(i4b)                           :: dimLen       ! data dimensions
-  character(256)                         :: dimName      ! not used except as a placeholder in call to inq_dim function
-  integer(i4b)                           :: fileHRU      ! number of HRUs in file
-
-  character(LEN=256)                     :: icond_file  ! restart/icond_file file name
-  character(len=256)                     :: message
-  character(len=256)                     :: cmessage
-
-  character(len=32),parameter            :: scalDimName   ='scalarv'  ! dimension name for scalar data
-  character(len=32),parameter            :: midSoilDimName='midSoil'  ! dimension name for soil-only layers
-  character(len=32),parameter            :: midTotoDimName='midToto'  ! dimension name for layered varaiables
-  character(len=32),parameter            :: ifcTotoDimName='ifcToto'  ! dimension name for layered varaiables
-  ! --------------------------------------------------------------------------------------------------------
-
-  err=0; message="read_initcond.f90 - readInitCond_prog"
-  
-  ! get number of HRUs in file
-  err = nf90_inq_dimid(init_cond_ncid,"hru",dimID);
-  if(err/=nf90_noerr)then; message=trim(message)//'problem finding hru dimension/'//trim(nf90_strerror(err)); return; end if
-  err = nf90_inquire_dimension(init_cond_ncid,dimID,len=fileHRU);
-  if(err/=nf90_noerr)then; message=trim(message)//'problem reading hru dimension/'//trim(nf90_strerror(err)); return; end if
-
-  allocate(init_cond_prog(size(prog_meta)))
-
-  ! loop through prognostic variables
-  do iVar = 1,size(prog_meta)
-    ! skip variables that are computed later
-    if(prog_meta(iVar)%varName=='scalarCanopyWat'           .or. &
-       prog_meta(iVar)%varName=='spectralSnowAlbedoDiffuse' .or. &
-       prog_meta(iVar)%varName=='scalarSurfaceTemp'         .or. &
-       prog_meta(iVar)%varName=='mLayerVolFracWat'          .or. &
-       prog_meta(iVar)%varName=='mLayerHeight'                   )then 
-       cycle
-    endif
-
-    ! get variable id
-    err = nf90_inq_varid(init_cond_ncid,trim(prog_meta(iVar)%varName),ncVarID); call netcdf_err(err,message)
-    if(err/=0)then
-      message=trim(message)//': problem with getting variable id, var='//trim(prog_meta(iVar)%varName)
-      print*,message
-      return
-    endif
-
-    ! get variable dimension IDs
-    select case (prog_meta(iVar)%varType)
-      case (iLookVarType%scalarv); err = nf90_inq_dimid(init_cond_ncid,trim(scalDimName)   ,dimID)
-        call netcdf_err(err,message)
-      case (iLookVarType%midSoil); err = nf90_inq_dimid(init_cond_ncid,trim(midSoilDimName),dimID)
-        call netcdf_err(err,message)
-      case (iLookVarType%midToto); err = nf90_inq_dimid(init_cond_ncid,trim(midTotoDimName),dimID)
-        call netcdf_err(err,message)
-      case (iLookVarType%ifcToto); err = nf90_inq_dimid(init_cond_ncid,trim(ifcTotoDimName),dimID)
-        call netcdf_err(err,message)
-    case default
-      message=trim(message)//"unexpectedVariableType[name='"//trim(prog_meta(iVar)%varName)//"';type='"//trim(get_varTypeName(prog_meta(iVar)%varType))//"']"
-      print*, message
-      err=20; return
-    end select
-
-    ! check errors
-    if(err/=0)then
-      message=trim(message)//': problem with dimension ids, var='//trim(prog_meta(iVar)%varName)
-      print*, message
-      return
-    endif
-
-    ! get the dimension length
-    err = nf90_inquire_dimension(init_cond_ncid,dimID,dimName,dimLen); call netcdf_err(err,message)
-    if(err/=0)then;message=trim(message)//': problem getting the dimension length';print*, message;return;endif
-
-    ! initialize the variable data
-    allocate(init_cond_prog(iVar)%var_data(num_gru,dimLen),stat=err)
-    if(err/=0)then;message=trim(message)//'problem allocating HRU variable data';print*, message;return;endif
-
-     ! get data
-    err = nf90_get_var(init_cond_ncid,ncVarID,init_cond_prog(iVar)%var_data, start=(/start_gru,1/),count=(/num_gru,dimLen/)) 
-    call netcdf_err(err,message)
-    if(err/=0)then; message=trim(message)//': problem getting the data for variable '//trim(prog_meta(iVar)%varName); return; endif
-
-  end do
-
-end subroutine readInitCond_prog
-
-subroutine readInitCond_bvar(init_cond_ncid, start_gru, num_gru, err) bind(C, name="readInitCond_bvar")
-  USE globalData,only:init_cond_bvar
-  USE globalData,only: nTimeDelay   ! number of hours in the time delay histogram
-  ! var_lookup
-  USE var_lookup,only:iLookBVAR                     ! variable lookup structure
-  ! metadata structures
-  USE globalData,only:bvar_meta                     ! metadata for basin (GRU) variables
-  ! netcdf
-  USE netcdf
-  USE netcdf_util_module,only:netcdf_err                 ! netcdf error handling
-  implicit none
-  
-  integer(c_int), intent(in)             :: init_cond_ncid
-  integer(c_int), intent(in)             :: start_gru
-  integer(c_int), intent(in)             :: num_gru
-  integer(c_int), intent(out)            :: err
-
-  ! local variables
-  integer(i4b)                           :: nTDH          ! number of points in time-delay histogram
-  integer(i4b)                           :: dimID        ! varible dimension ids
-  integer(i4b)                           :: fileGRU      ! number of GRUs in file
-  integer(i4b)                           :: i          
-  integer(i4b)                           :: iVar     
-  integer(i4b)                           :: dimLen       ! data dimensions
-  character(256)                         :: dimName      ! not used except as a placeholder in call to inq_dim function
-  integer(i4b)                           :: ncVarID      ! variable ID in netcdf file
-  integer(i4b),dimension(1)              :: ndx          ! intermediate array of loop indices
-   
-
-  character(len=256)                     :: message
-  
-  character(len=32),parameter            :: tdhDimName    ='tdh'      ! dimension name for time-delay basin variables
-
-  ! --------------------------------------------------------------------------------------------------------
-  err = 0; message="read_initcond.f90 - readInitCond_bvar/"
-  if(restartFileType/=singleHRU)then
-    ! get dimension of time delay histogram (TDH) from initial conditions file
-    err = nf90_inq_dimid(init_cond_ncid,"tdh",dimID);
-    
-    if(err/=nf90_noerr)then
-      write(*,*) 'WARNING: routingRunoffFuture is not in the initial conditions file ... using zeros'  ! previously created in var_derive.f90
-      err=nf90_noerr    ! reset this err
-    
-    else 
-      ! the state file *does* have the basin variable(s), so process them
-      err = nf90_inquire_dimension(init_cond_ncid,dimID,len=nTDH);
-      if(err/=nf90_noerr)then
-        message=trim(message)//'problem reading tdh dimension from initial condition file/'//trim(nf90_strerror(err))
-        print*, message
-        return
-      end if
-      
-      ! get number of GRUs in file
-      err = nf90_inq_dimid(init_cond_ncid,"gru",dimID);               if(err/=nf90_noerr)then; message=trim(message)//'problem finding gru dimension/'//trim(nf90_strerror(err)); return; end if
-      err = nf90_inquire_dimension(init_cond_ncid,dimID,len=fileGRU); if(err/=nf90_noerr)then; message=trim(message)//'problem reading gru dimension/'//trim(nf90_strerror(err)); return; end if
-
-      ! check vs hardwired value set in globalData.f90
-      if(nTDH /= nTimeDelay)then
-        write(*,*) 'tdh=',nTDH,' nTimeDelay=',nTimeDelay
-        message=trim(message)//': state file time delay dimension tdh does not match summa expectation of nTimeDelay set in globalData()'
-        return
-      endif
-
-      ndx = (/iLookBVAR%routingRunoffFuture/)   ! array of desired variable indices
-      allocate(init_cond_bvar(size(ndx)))
-      do i = 1, size(ndx)
-        iVar = ndx(i)
-        ! get tdh dimension Id in file (should be 'tdh')
-        err = nf90_inq_dimid(init_cond_ncid,trim(tdhDimName), dimID);
-        if(err/=0)then;message=trim(message)//': problem with dimension ids for tdh vars';print*,message;return;endif
-
-        ! get the tdh dimension length (dimName and dimLen are outputs of this call)
-        err = nf90_inquire_dimension(init_cond_ncid,dimID,dimName,dimLen); call netcdf_err(err,message)
-        if(err/=0)then;message=trim(message)//': problem getting the dimension length for tdh vars';print*,message;return;endif
-
-        ! get tdh-based variable id
-        err = nf90_inq_varid(init_cond_ncid,trim(bvar_meta(iVar)%varName),ncVarID); call netcdf_err(err,message)
-        if(err/=0)then; message=trim(message)//': problem with getting basin variable id, var='//trim(bvar_meta(iVar)%varName); return; endif
-
-        allocate(init_cond_bvar(i)%var_data(num_gru,dimLen),stat=err)
-        if(err/=0)then; print*, 'err= ',err; message=trim(message)//'problem allocating GRU variable data'; return; endif
-
-        ! get data
-        err = nf90_get_var(init_cond_ncid,ncVarID,init_cond_bvar(i)%var_data, start=(/start_gru,1/),count=(/num_gru,dimLen/)); call netcdf_err(err,message)
-        if(err/=0)then; message=trim(message)//': problem getting the data'; return; endif
-      end do
-    endif
-  endif
-
-
-end subroutine readInitCond_bvar
-
-
-
-
-end module read_initcond_module
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/fortran_code/read_param.f90 b/build/source/actors/file_access_actor/fortran_code/read_param.f90
deleted file mode 100644
index 3c7c38eb7ed4314a698a35be74823f1972704dd7..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/fortran_code/read_param.f90
+++ /dev/null
@@ -1,401 +0,0 @@
-module read_param_module
-  USE, intrinsic :: iso_c_binding
-  USE nrtype
-  implicit none
-  private
-  public::allocateParamStructures
-  public::openParamFile
-  public::getNumVarParam
-  public::closeParamFile
-  public::getParamSizes
-  public::overwriteParam
-  public::readParamFromNetCDF
-  contains
-subroutine allocateParamStructures(index_gru, index_hru, handle_dpar_struct, &
-    handle_mpar_struct, handle_bpar_struct, err) bind(C, name="allocateParamStructures")
-  
-  USE globalData,only:mpar_meta,bpar_meta
-  USE globalData,only:gru_struc
-  USE data_types,only:var_dlength,var_d
-  USE allocspace_module,only:allocLocal
-
-  implicit none
-  integer(c_int),intent(in)       :: index_gru
-  integer(c_int),intent(in)       :: index_hru
-  type(c_ptr),intent(in),value    :: handle_dpar_struct
-  type(c_ptr),intent(in),value    :: handle_mpar_struct
-  type(c_ptr),intent(in),value    :: handle_bpar_struct
-  integer(c_int),intent(out)      :: err
-
-  type(var_d), pointer            :: dpar_struct
-  type(var_dlength), pointer      :: mpar_struct
-  type(var_d), pointer            :: bpar_struct
-
-  integer(i4b)                    :: nSnow  
-  integer(i4b)                    :: nSoil
-
-  character(len=256)              :: message
-
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_dpar_struct, dpar_struct)
-  call c_f_pointer(handle_mpar_struct, mpar_struct)
-  call c_f_pointer(handle_bpar_struct, bpar_struct)
-  ! start of subroutine
-  err=0; message="read_attribute.f90 - allocateAttributeStructures"
-
-  nSnow = gru_struc(index_gru)%hruInfo(index_hru)%nSnow
-  nSoil = gru_struc(index_gru)%hruInfo(index_hru)%nSoil
-
-  ! initalize the structure with allocatable components
-  call allocLocal(mpar_meta,dpar_struct,nSnow,nSoil,err,message); 
-  call allocLocal(mpar_meta,mpar_struct,nSnow,nSoil,err,message); 
-  call allocLocal(bpar_meta,bpar_struct,nSnow=0,nSoil=0,err=err,message=message); 
-  if(err/=0)then; message=trim(message); print*, message; return; endif;
-end subroutine
-
-subroutine openParamFile(param_ncid, param_file_exists, err) bind(C, name="openParamFile")
-  USE netcdf
-  USE netcdf_util_module,only:nc_file_open
-  ! Parameters File
-  USE summaFileManager,only:SETTINGS_PATH             ! path for metadata files
-  USE summaFileManager,only:PARAMETER_TRIAL           ! file with parameter trial values
-  
-  implicit none
-  integer(c_int),intent(out)          :: param_ncid
-  logical(c_bool),intent(out)         :: param_file_exists
-  integer(c_int),intent(out)          :: err
-  
-  ! local variables
-  character(LEN=1024)                 :: infile           ! input filename
-  character(len=256)                  :: message          ! error message
-  character(len=1024)                 :: cmessage         ! error message for downwind routine
-  err=0; message="read_param.f90 - openParamFile"    
-  ! **********************************************************************************************
-  ! * open files, etc.
-  ! **********************************************************************************************
-  
-  infile = trim(SETTINGS_PATH)//trim(PARAMETER_TRIAL) ! build filename
-
-  ! check whether the user-specified file exists and warn if it does not
-  inquire(file=trim(infile),exist=param_file_exists)
-  if (.not.param_file_exists) then
-      write(*,'(A)') NEW_LINE('A')//'!! WARNING:  trial parameter file not found; proceeding instead with other default parameters; check path in file manager input if this was not the desired behavior'//NEW_LINE('A')
-      return
-  endif
-
-  ! open trial parameters file if it exists
-  call nc_file_open(trim(infile),nf90_nowrite,param_ncid,err,cmessage)
-  if(err/=0)then
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-end subroutine openParamFile
-
-subroutine getNumVarParam(param_ncid, num_var, err) bind(C, name="getNumVarParam")
-  USE netcdf
-  USE netcdf_util_module,only:netcdf_err                     ! netcdf error handling function
-  implicit none
-  integer(c_int),intent(in)            :: param_ncid
-  integer(c_int),intent(out)           :: num_var
-  integer(c_int),intent(out)           :: err
-
-  ! local variables
-  character(len=256)                   :: message       ! error message
-  
-  err=0; message="read_param.f90 - getNumVarAndDims/"
-  ! get the number of variables in the parameter file
-  err=nf90_inquire(param_ncid, nVariables=num_var)
-  call netcdf_err(err,message)
-  if (err/=0) then
-    err=20
-    print*, message
-    return
-  end if
-
-end subroutine getNumVarParam
-
-subroutine closeParamFile(param_ncid, err) bind(C, name="closeParamFile")
-  USE netcdf_util_module,only:nc_file_close
-  implicit none
-  integer(c_int),intent(in)            :: param_ncid
-  integer(c_int),intent(out)           :: err
-  ! local variables
-  character(len=256)                   :: message
-  ! --------------------------------------------------------------------------------------------------------
- 
-  err=0; message="read_param.f90 - closeParamFile/"
-
-  call nc_file_close(param_ncid,err,message)
-  if(err/=0)then
-    message=trim(message)
-    print*, message
-    return
-  end if
-
-end subroutine closeParamFile
-
-! get the sizes of the arrays for dpar_array bpar_array
-subroutine getParamSizes(dpar_array_size, bpar_array_size, type_array_size) bind(C, name="getParamSizes")
-  USE var_lookup,only:maxvarMpar      ! model parameters: maximum number variables
-  USE var_lookup,only:maxvarBpar      ! model parameters: maximum number variables
-  USE var_lookup,only:maxvarType
-
-  implicit none
-  integer(c_int),intent(out)    :: dpar_array_size
-  integer(c_int),intent(out)    :: bpar_array_size
-  integer(c_int),intent(out)    :: type_array_size
-
-
-  dpar_array_size = maxvarMpar
-  bpar_array_size = maxvarBpar
-  type_array_size = maxvarType
-
-
-end subroutine getParamSizes
-
-subroutine overwriteParam(index_gru, index_hru, handle_type_struct, &
-  handle_dpar_struct, handle_mpar_struct, handle_bpar_struct, err) bind(C, name="overwriteParam")
-  USE var_lookup,only:maxvarMpar      ! model parameters: maximum number variables
-  USE var_lookup,only:maxvarBpar      ! model parameters: maximum number variables
-  USE var_lookup,only:iLookTYPE      ! named variables to index elements of the data vectors
-  ! global data
-  USE globalData,only:gru_struc
-  USE globalData,only:localParFallback                        ! local column default parameters
-  USE globalData,only:basinParFallback                        ! basin-average default parameter
-  USE data_types,only:var_dlength,var_i,var_d
-
-  USE pOverwrite_module,only:pOverwrite                       ! module to overwrite default parameter values with info from the Noah tables
-  USE allocspace_module,only:allocLocal
-  implicit none
-  integer(c_int),intent(in)     :: index_gru
-  integer(c_int),intent(in)     :: index_hru
-  ! structures
-  type(c_ptr),intent(in),value  :: handle_type_struct
-  type(c_ptr),intent(in),value  :: handle_dpar_struct
-  type(c_ptr),intent(in),value  :: handle_mpar_struct
-  type(c_ptr),intent(in),value  :: handle_bpar_struct
-
-  ! error control
-  integer(c_int), intent(out)   :: err
-
-  ! local variables
-  type(var_i),pointer           :: type_struct                 !  model parameters
-  type(var_d),pointer           :: dpar_struct                 !  model parameters
-  type(var_dlength),pointer     :: mpar_struct                 !  model parameters
-  type(var_d),pointer           :: bpar_struct                 !  model parameters
-
-  integer(i4b)                  :: iVar
-  integer(i4b)                  :: iDat
-
-  character(len=256)            :: message
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_type_struct, type_struct)
-  call c_f_pointer(handle_dpar_struct, dpar_struct)
-  call c_f_pointer(handle_mpar_struct, mpar_struct)
-  call c_f_pointer(handle_bpar_struct, bpar_struct)
-  ! Start subroutine
-  err=0; message="read_param.f90 - overwriteParam"
-
-  ! Set the basin parameters with the default values
-  do ivar=1, size(localParFallback)
-    dpar_struct%var(iVar) = localParFallback(iVar)%default_val
-  end do
-
-  call pOverwrite(type_struct%var(iLookTYPE%vegTypeIndex), &  ! vegetation category
-                  type_struct%var(iLookTYPE%soilTypeIndex),&  ! soil category
-                  dpar_struct%var(:),err,message)             ! default model parameters
-  
-  do ivar=1, size(localParFallback)
-    do iDat=1, size(mpar_struct%var(iVar)%dat)
-      mpar_struct%var(iVar)%dat(iDat) = dpar_struct%var(iVar)
-    end do
-  end do
-
-  do iVar=1, size(basinParFallback)
-    bpar_struct%var(iVar) = basinParFallback(iVar)%default_val
-  end do
-
-end subroutine overwriteParam
-
-
-subroutine readParamFromNetCDF(param_ncid, index_gru, index_hru, start_index_gru, &
-    num_vars, handle_mpar_struct, handle_bpar_struct, err) bind(C, name="readParamFromNetCDF")
-  USE netcdf
-  USE netcdf_util_module,only:netcdf_err     ! netcdf error handling function
-
-  USE data_types,only:var_dlength,var_d
-  USE get_ixname_module,only:get_ixparam,get_ixbpar   ! access function to find index of elements in structure
-  
-  USE globalData,only:index_map,gru_struc             ! mapping from global HRUs to the elements in the data structures
-  USE globalData,only:integerMissing  ! missing integer
-  
-  implicit none
-  ! dummy variables
-  integer(c_int),intent(in)     :: param_ncid
-  integer(c_int),intent(in)     :: index_gru
-  integer(c_int),intent(in)     :: index_hru
-  integer(c_int),intent(in)     :: start_index_gru
-  integer(c_int),intent(in)     :: num_vars
-  type(c_ptr),intent(in),value  :: handle_mpar_struct
-  type(c_ptr),intent(in),value  :: handle_bpar_struct
-  integer(c_int), intent(out)   :: err
-  ! define local variables
-  type(var_dlength),pointer     :: mpar_struct                 !  model parameters
-  type(var_d),pointer           :: bpar_struct                 !  model parameters
-
-  character(len=256)            :: message          ! error message
-  character(len=1024)           :: cmessage         ! error message for downwind routine
-  integer(i4b)                  :: localHRU_ix      ! index of HRU within data structure
-  integer(i4b)                  :: ixParam          ! index of the model parameter in the data structure
-  
-  ! indices/metadata in the NetCDF file
-  integer(i4b)                  :: num_dims            ! number of dimensions
-
-  integer(i4b)                  :: ivarid           ! variable index
-  character(LEN=64)             :: dimName          ! dimension name
-
-  character(LEN=64)             :: parName          ! parameter name
-  integer(i4b)                  :: nSoil_file       ! number of soil layers in the file
-  integer(i4b)                  :: idim_list(2)     ! list of dimension ids
-  ! data in the netcdf file
-  integer(i4b)                  :: parLength        ! length of the parameter data
-  real(dp),allocatable          :: parVector(:)     ! model parameter vector
-  integer(i4b)                  :: fHRU             ! index of HRU in input file
-  integer(i4b)                  :: netcdf_index
-
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_mpar_struct, mpar_struct)
-  call c_f_pointer(handle_bpar_struct, bpar_struct)
-  err=0; message="read_param.f90 - readParamFromNetCDF/"
-
-
-  ! **********************************************************************************************
-  ! * read the local parameters and the basin parameters
-  ! ********************************************************************************************** 
-  do ivarid=1,num_vars
-    ! get the parameter name
-    err=nf90_inquire_variable(param_ncid, ivarid, name=parName)
-    call netcdf_err(err,message)
-    if (err/=0) then
-      err=20
-      print*,message
-      return
-    end if
-
-    ! get the local parameters
-    ixParam = get_ixparam( trim(parName) )
-    if(ixParam/=integerMissing)then
-      ! **********************************************************************************************
-      ! * read the local parameters
-      ! **********************************************************************************************
-      ! get the variable shape
-      err=nf90_inquire_variable(param_ncid, ivarid, nDims=num_dims, dimids=idim_list)
-      if(err/=0)then
-          message=trim(message)//trim(cmessage)
-          print*, message
-          return
-      end if
-        
-        ! get the length of the depth dimension (if it exists)
-        if(num_dims==2)then
-            ! get the information on the 2nd dimension for 2-d variables
-            err=nf90_inquire_dimension(param_ncid, idim_list(2), dimName, nSoil_file)
-            if(err/=0)then
-                message=trim(message)//trim(cmessage)
-                print*, message
-                return
-            end if
-            
-            ! check that it is the depth dimension
-            if(trim(dimName)/='depth')then
-                message=trim(message)//'expect 2nd dimension of 2-d variable to be depth (dimension name = '//trim(dimName)//')'
-                err=20; return
-            endif
-
-            ! ! check that the dimension length is correct
-            if(size(mpar_struct%var(ixParam)%dat) /= nSoil_file)then
-                message=trim(message)//'unexpected number of soil layers in parameter file'
-                err=20; return
-            endif
-
-            ! define parameter length
-            parLength = nSoil_file
-        else
-            parLength = 1
-        endif ! if two dimensions
-
-        ! allocate space for model parameters
-        allocate(parVector(parLength),stat=err)
-        if(err/=0)then
-            message=trim(message)//'problem allocating space for parameter vector'
-            err=20; return
-        endif
-        
-
-        localHRU_ix=index_map(index_hru)%localHRU_ix
-        fHRU = gru_struc(index_gru)%hruInfo(localHRU_ix)%hru_nc
-        ! read parameter data
-        select case(num_dims)
-            case(1); err=nf90_get_var(param_ncid, ivarid, parVector, start=(/fHRU/), count=(/1/) )
-            case(2); err=nf90_get_var(param_ncid, ivarid, parVector, start=(/fHRU,1/), count=(/1,nSoil_file/) )
-            case default; err=20; message=trim(message)//'unexpected number of dimensions for parameter '//trim(parName)
-        end select
-          
-        ! error check for the parameter read
-        if(err/=0)then
-            message=trim(message)//trim(cmessage)
-            print*, message
-            return
-        end if
-          
-          ! populate parameter structures
-        select case(num_dims)
-            case(1); mpar_struct%var(ixParam)%dat(:) = parVector(1)  ! also distributes scalar across depth dimension
-            case(2); mpar_struct%var(ixParam)%dat(:) = parVector(:)
-            case default; err=20; message=trim(message)//'unexpected number of dimensions for parameter '//trim(parName)
-        end select
-
-        ! deallocate space for model parameters
-        deallocate(parVector,stat=err)
-        if(err/=0)then
-            message=trim(message)//'problem deallocating space for parameter vector'
-            print*, message
-            err=20; return
-        endif
-    
-    ! **********************************************************************************************
-    ! * read the basin parameters
-    ! **********************************************************************************************
-    
-    ! get the basin parameters
-    else
-        ! get the parameter index
-        ixParam = get_ixbpar( trim(parName) )
-
-        ! allow extra variables in the file that are not used
-        if(ixParam==integerMissing) cycle
-
-        ! read parameter data
-        netcdf_index = start_index_gru + index_gru - 1
-        err=nf90_get_var(param_ncid, ivarid, bpar_struct%var(ixParam), start=(/netcdf_index/))
-        if(err/=0)then
-          message=trim(message)//trim(cmessage)
-          print*, message
-          return
-        end if
-    endif
-
-  end do ! (looping through the parameters in the NetCDF file)
-
-end subroutine readParamFromNetCDF
-
-
-end module read_param_module
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/fortran_code/write_to_netcdf.f90 b/build/source/actors/file_access_actor/fortran_code/write_to_netcdf.f90
deleted file mode 100644
index 6b3ce362234bd46055e191f58d5756f956ee3f48..0000000000000000000000000000000000000000
--- a/build/source/actors/file_access_actor/fortran_code/write_to_netcdf.f90
+++ /dev/null
@@ -1,343 +0,0 @@
-module write_to_netcdf_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-USE data_types
-
-!TODO: This module is only used for writeParamToNetCDF the others are not.
-
-
-implicit none
-public::writeParamToNetCDF
-public::writeDataToNetCDF
-public::writeBasinToNetCDF
-public::writeTimeToNetCDF
-public::writeGRUStatistics
-
-contains
-
-! Subroutine that writes data from the HRU actor to be written to netcdf
-subroutine writeParamToNetCDF(handle_ncid,    &
-                          index_gru,          &
-                          index_hru,          &
-                          handle_attr_struct, &
-                          handle_type_struct, &
-                          handle_mpar_struct, &
-                          handle_bpar_struct, &
-                          err) bind(C, name="writeParamToNetCDF")
-  USE globalData,only:attr_meta,type_meta,mpar_meta,bpar_meta ! meta structures
-  USE globalData,only:gru_struc
-  USE writeOutput_module,only:writeParm 
-  USE globalData,only:structInfo                              ! information on the data structures
-  implicit none
-  ! dummy variables
-  type(c_ptr),   intent(in), value  :: handle_ncid        ! ncid of the output file
-  integer(c_int),intent(in)         :: index_gru          ! index of GRU in gru_struc
-  integer(c_int),intent(in)         :: index_hru          ! index of HRU in gru_struc
-  type(c_ptr),   intent(in), value  :: handle_attr_struct
-  type(c_ptr),   intent(in), value  :: handle_type_struct
-  type(c_ptr),   intent(in), value  :: handle_mpar_struct
-  type(c_ptr),   intent(in), value  :: handle_bpar_struct 
-  integer(c_int),intent(out)        :: err 
-  ! local variables pointers
-  type(var_i), pointer              :: ncid
-  type(var_d), pointer              :: attr_struct
-  type(var_i), pointer              :: type_struct
-  type(var_dlength), pointer        :: mpar_struct
-  type(var_d),pointer               :: bpar_struct
-  ! local variables
-  integer(i4b)                      :: iStruct
-  character(LEN=256)                :: cmessage
-  character(LEN=256)                :: message
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  message="file_access_actor.f90 - writeParamToNetCDF"
-  call c_f_pointer(handle_ncid, ncid)
-  call c_f_pointer(handle_attr_struct, attr_struct)
-  call c_f_pointer(handle_type_struct, type_struct)
-  call c_f_pointer(handle_mpar_struct, mpar_struct)
-  call c_f_pointer(handle_bpar_struct, bpar_struct)
-
-  do iStruct=1,size(structInfo)
-    select case(trim(structInfo(iStruct)%structName))
-      case('attr'); call writeParm(ncid,gru_struc(index_gru)%hruInfo(index_hru)%hru_ix, &
-        attr_struct,attr_meta,err,cmessage)
-      case('type'); call writeParm(ncid,gru_struc(index_gru)%hruInfo(index_hru)%hru_ix, &
-        type_struct,type_meta,err,cmessage)
-      case('mpar'); call writeParm(ncid,gru_struc(index_gru)%hruInfo(index_hru)%hru_ix, &
-        mpar_struct,mpar_meta,err,cmessage)
-    end select
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'
-      print*, message
-      return
-    endif
-  end do
-
-  ! write GRU parameters
-  call writeParm(ncid,index_gru,bpar_struct,bpar_meta,err,cmessage)
-  if(err/=0)then
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-end subroutine writeParamToNetCDF
-
-subroutine writeDataToNetCDF(handle_ncid,          &
-                             index_gru,             &
-                             index_hru,             &
-                             handle_finalize_stats, & 
-                             handle_forc_stat,      &
-                             handle_forc_struct,    &
-                             handle_prog_stat,      &
-                             handle_prog_struct,    &
-                             handle_diag_stat,      &
-                             handle_diag_struct,    &
-                             handle_flux_stat,      &
-                             handle_flux_struct,    &
-                             handle_indx_stat,      &
-                             handle_indx_struct,    &
-                             handle_output_timestep,&
-                             err) bind(C, name="writeDataToNetCDF")
-  USE globalData, only:forc_meta, prog_meta, diag_meta, flux_meta, indx_meta
-  USE globalData, only:forcChild_map, progChild_map, diagChild_map, fluxChild_map, indxChild_map
-  USE globalData,only:maxLayers                               ! maximum number of layers
-  USE globalData,only:structInfo
-  USE writeOutput_module,only:writeParm 
-  USE writeOutput_module,only:writeData
-
-  implicit none
-  ! dummy variables
-  type(c_ptr),    intent(in), value  :: handle_ncid
-  integer(c_int), intent(in)         :: index_gru
-  integer(c_int), intent(in)         :: index_hru
-  type(c_ptr),    intent(in), value  :: handle_finalize_stats
-  type(c_ptr),    intent(in), value  :: handle_forc_stat
-  type(c_ptr),    intent(in), value  :: handle_forc_struct
-  type(c_ptr),    intent(in), value  :: handle_prog_stat
-  type(c_ptr),    intent(in), value  :: handle_prog_struct
-  type(c_ptr),    intent(in), value  :: handle_diag_stat
-  type(c_ptr),    intent(in), value  :: handle_diag_struct
-  type(c_ptr),    intent(in), value  :: handle_flux_stat
-  type(c_ptr),    intent(in), value  :: handle_flux_struct
-  type(c_ptr),    intent(in), value  :: handle_indx_stat
-  type(c_ptr),    intent(in), value  :: handle_indx_struct
-  type(c_ptr),    intent(in), value  :: handle_output_timestep
-  integer(c_int), intent(out)        :: err
-  ! local pointers
-  type(var_i), pointer               :: ncid
-  type(flagVec), pointer             :: finalize_stats
-  type(var_dlength),pointer          :: forc_stat 
-  type(var_d),pointer                :: forc_struct 
-  type(var_dlength),pointer          :: prog_stat
-  type(var_dlength),pointer          :: prog_struct 
-  type(var_dlength),pointer          :: diag_stat
-  type(var_dlength),pointer          :: diag_struct 
-  type(var_dlength),pointer          :: flux_stat 
-  type(var_dlength),pointer          :: flux_struct 
-  type(var_dlength),pointer          :: indx_stat 
-  type(var_ilength),pointer          :: indx_struct 
-  type(var_i),pointer                :: output_timestep
-  ! local_variables
-  integer(i4b)                       :: numGRU=1
-  integer(i4b)                       :: nSteps=1
-  integer(i4b)                       :: iStruct
-  character(LEN=256)                 :: cmessage
-  character(LEN=256)                 :: message
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_ncid, ncid)
-  call c_f_pointer(handle_finalize_stats, finalize_stats)
-  call c_f_pointer(handle_forc_stat, forc_stat)
-  call c_f_pointer(handle_forc_struct, forc_struct)
-  call c_f_pointer(handle_prog_stat, prog_stat)
-  call c_f_pointer(handle_prog_struct, prog_struct)
-  call c_f_pointer(handle_diag_stat, diag_stat)
-  call c_f_pointer(handle_diag_struct, diag_struct)
-  call c_f_pointer(handle_flux_stat, flux_stat)
-  call c_f_pointer(handle_flux_struct, flux_struct)
-  call c_f_pointer(handle_indx_stat, indx_stat)
-  call c_f_pointer(handle_indx_struct, indx_struct)
-  call c_f_pointer(handle_output_timestep, output_timestep)
-
-  message="file_access_actor.f90 - writeDataToNetCDF"
-  do iStruct=1,size(structInfo)
-    select case(trim(structInfo(iStruct)%structName))
-      case('forc')
-        call writeData(ncid, finalize_stats%dat(:), output_timestep%var(:),maxLayers,&
-                      index_gru, numGRU, & 
-                      forc_meta,forc_stat,forc_struct,'forc', &
-                      forcChild_map,indx_struct,err,cmessage)
-      case('prog')
-        call writeData(ncid, finalize_stats%dat(:), output_timestep%var(:),maxLayers,&
-                      index_gru, numGRU, &
-                      prog_meta,prog_stat,prog_struct,'prog', &
-                      progChild_map,indx_struct,err,cmessage)
-      case('diag')
-        call writeData(ncid, finalize_stats%dat(:), output_timestep%var(:),maxLayers,&
-                      index_gru, numGRU, &
-                      diag_meta, diag_stat, diag_struct,'diag', &
-                      diagChild_map,indx_struct,err,cmessage)
-      case('flux')
-        call writeData(ncid, finalize_stats%dat(:), output_timestep%var(:),maxLayers,&
-                      index_gru, numGRU, &
-                      flux_meta,flux_stat,flux_struct,'flux', &
-                      fluxChild_map,indx_struct,err,cmessage)
-      case('indx')
-        call writeData(ncid, finalize_stats%dat(:), output_timestep%var(:),maxLayers,&
-                      index_gru, numGRU, &
-                      indx_meta,indx_stat, indx_struct, 'indx', &
-                      indxChild_map,indx_struct,err,cmessage)
-    end select
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'
-      print*, message
-      return
-    endif
-  end do  ! (looping through structures)
-end subroutine writeDataToNetCDF
-
-! subroutine setOutputStructure(index_gru, index_timestep, 
-!   handle_finalize_stats, handle_output_timestep, handle_output_timestep, )
-
-! end subroutine setOutputStructure
-
-subroutine writeBasinToNetCDF(handle_ncid, index_gru, handle_finalize_stats, &
-  handle_output_timestep, handle_bvar_stat, handle_bvar_struct, err) bind(C, name="writeBasinToNetCDF")
-  USE writeOutput_module,only:writeBasin
-  USE globalData,only:bvar_meta                 ! metadata on basin-average variables
-  USE globalData,only:bvarChild_map             ! index of the child data structure: stats bvar
- 
-  implicit none
-  ! dummy variables
-  type(c_ptr),    intent(in), value  :: handle_ncid
-  integer(c_int), intent(in)         :: index_gru
-  type(c_ptr),    intent(in), value  :: handle_finalize_stats
-  type(c_ptr),    intent(in), value  :: handle_output_timestep
-  type(c_ptr),    intent(in), value  :: handle_bvar_stat
-  type(c_ptr),    intent(in), value  :: handle_bvar_struct
-  integer(c_int), intent(out)        :: err
-  ! local pointers for dummy variables
-  type(var_i), pointer               :: ncid
-  type(flagVec), pointer             :: finalize_stats
-  type(var_i),pointer                :: output_timestep
-  type(var_dlength),pointer          :: bvar_stat
-  type(var_dlength),pointer          :: bvar_struct
-  ! local Variables
-  character(len=256)                 :: message
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_ncid, ncid)
-  call c_f_pointer(handle_finalize_stats, finalize_stats)
-  call c_f_pointer(handle_output_timestep, output_timestep)
-  call c_f_pointer(handle_bvar_stat, bvar_stat)
-  call c_f_pointer(handle_bvar_struct, bvar_struct)
-  message="file_access_actor.f90 - writeBasinToNetCDF"
-
-
-  call writeBasin(ncid,index_gru,finalize_stats%dat(:),output_timestep%var(:),&
-      bvar_meta, bvar_stat%var, bvar_struct%var, bvarChild_map, err, message)
-  if(err/=0)then 
-    message=trim(message)//'[bvar]'
-    print*, message
-    return
-  endif 
-
-end subroutine writeBasinToNetCDF
-
-subroutine writeTimeToNetCDF(handle_ncid, handle_finalize_stats, handle_output_timestep, &
-    handle_time_struct, err) bind(C, name="writeTimeToNetCDF")
-  USE writeOutput_module,only:writeTime
-  USE globalData,only:time_meta
-
-  implicit none
-  type(c_ptr), intent(in), value :: handle_ncid
-  type(c_ptr), intent(in), value :: handle_finalize_stats
-  type(c_ptr), intent(in), value :: handle_output_timestep
-  type(c_ptr), intent(in), value :: handle_time_struct
-  integer(c_int), intent(out)    :: err
-
-  type(var_i), pointer           :: ncid
-  type(flagVec), pointer         :: finalize_stats
-  type(var_i),pointer            :: output_timestep
-  type(var_i),pointer            :: time_struct
-  character(len=256)             :: message
-
-  call c_f_pointer(handle_ncid, ncid)
-  call c_f_pointer(handle_finalize_stats, finalize_stats)
-  call c_f_pointer(handle_output_timestep, output_timestep)
-  call c_f_pointer(handle_time_struct, time_struct)
-  message="file_access_actor.f90 - writeTimeToNetCDF"
-
-  call writeTime(ncid, finalize_stats%dat(:),output_timestep%var(:),&
-      time_meta, time_struct%var,err,message)
-  if(err/=0)then 
-    message=trim(message)//'writeTime'
-    print*, message
-    return
-  endif 
-
-end subroutine writeTimeToNetCDF
-
-subroutine writeGRUStatistics(handle_ncid,      &
-                              gru_var_ids,      &
-                              gru_stats_vector, &
-                              num_gru,          &
-                              err) bind(C, name="WriteGRUStatistics")
-  USE data_types,only:var_i,netcdf_gru_actor_info,serializable_netcdf_gru_actor_info
-  USE var_lookup, only: maxvarFreq ! number of output frequencies
-  USE netcdf
-  implicit none
-  ! Dummy Variables
-  type(c_ptr), intent(in), value                      :: handle_ncid
-  type(netcdf_gru_actor_info),intent(in)              :: gru_var_ids
-  type(serializable_netcdf_gru_actor_info),intent(in) :: gru_stats_vector(num_gru)
-  integer(c_int), intent(in)                          :: num_gru
-  integer(c_int), intent(out)                         :: err
-  
-  ! Local Variables
-  type(var_i), pointer                                :: ncid
-  real(c_double), dimension(num_gru)                  :: run_time_array
-  real(c_double), dimension(num_gru)                  :: init_time_array
-  real(c_double), dimension(num_gru)                  :: forcing_time_array
-  real(c_double), dimension(num_gru)                  :: run_physics_time_array
-  real(c_double), dimension(num_gru)                  :: write_output_time_array
-
-  integer(c_int), dimension(num_gru)                  :: successful_array
-  integer(c_int), dimension(num_gru)                  :: num_attempts_array
-
-  integer(c_int)                                      :: i
-  integer(c_int)                                      :: iFreq         
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  call c_f_pointer(handle_ncid, ncid)
-
-  ! Assemble fortran arrays
-  do i=1,num_gru
-    run_time_array(i) = gru_stats_vector(i)%run_time
-    init_time_array(i) = gru_stats_vector(i)%init_duration
-    forcing_time_array(i) = gru_stats_vector(i)%forcing_duration
-    run_physics_time_array(i) = gru_stats_vector(i)%run_physics_duration
-    write_output_time_array(i) = gru_stats_vector(i)%write_output_duration
-    successful_array(i) = gru_stats_vector(i)%successful
-    num_attempts_array(i) = gru_stats_vector(i)%num_attempts
-  end do
-
-  ! Write to NetCDF
-  do iFreq=1, maxvarFreq
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%run_time_var_id, run_time_array)
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%init_duration_var_id, init_time_array)
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%forcing_duration_var_id, forcing_time_array)
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%run_physics_duration_var_id, run_physics_time_array)
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%write_output_duration_var_id, write_output_time_array)
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%state_var_id, successful_array)
-    err = nf90_put_var(ncid%var(iFreq), gru_var_ids%num_attempts_var_id, num_attempts_array)
-  end do
-
-end subroutine writeGRUStatistics
-
-
-end module write_to_netcdf_module
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/cpp_code/output_container.cpp b/build/source/actors/file_access_actor/output_container.cpp
similarity index 93%
rename from build/source/actors/file_access_actor/cpp_code/output_container.cpp
rename to build/source/actors/file_access_actor/output_container.cpp
index d02e45f2537583eee094b7eb15bbfbc5a0c00c1a..65a900410c1c866c604407cc405893fb63b07e60 100644
--- a/build/source/actors/file_access_actor/cpp_code/output_container.cpp
+++ b/build/source/actors/file_access_actor/output_container.cpp
@@ -89,6 +89,14 @@ std::vector<int> Output_Partition::getFailedGRUIndexList() {
     return this->failed_gru_index_list;
 }
 
+bool Output_Partition::isWriteParams() {
+    if (this->write_params) {
+        this->write_params = false;
+        return true;
+    }
+    return this->write_params;
+}
+
 
 //###################################################################
 // Output_Container
@@ -108,13 +116,13 @@ Output_Container::Output_Container(int num_partitions, int num_grus, int num_sto
 
     // Initialize the output partitions
     int start_gru_counter = 1;
-    this->num_grus_per_partition = std::round(num_grus / num_partitions);
+    this->num_grus_per_partition = std::round(this->num_grus / this->num_partitions);
     for (int i = 0; i < num_partitions - 1; i++) {
-        this->output_partitions.push_back(new Output_Partition(start_gru_counter, this->num_grus_per_partition, num_timesteps_simulation, num_stored_timesteps));
+        this->output_partitions.push_back(new Output_Partition(start_gru_counter, this->num_grus_per_partition, this->num_timesteps_simulation, this->num_stored_timesteps));
         start_gru_counter += this->num_grus_per_partition;
     }
     // The last partition will have the remainder of the GRUs
-    this->output_partitions.push_back(new Output_Partition(start_gru_counter, num_grus - start_gru_counter + 1, num_timesteps_simulation, num_stored_timesteps));
+    this->output_partitions.push_back(new Output_Partition(start_gru_counter, this->num_grus - start_gru_counter + 1, this->num_timesteps_simulation, this->num_stored_timesteps));
 }
 
 Output_Container::~Output_Container() {
diff --git a/build/source/actors/file_access_actor/output_structure.f90 b/build/source/actors/file_access_actor/output_structure.f90
new file mode 100644
index 0000000000000000000000000000000000000000..7bef7cc4df5acf1d33d3cdd69385b2ed8e40f8fa
--- /dev/null
+++ b/build/source/actors/file_access_actor/output_structure.f90
@@ -0,0 +1,790 @@
+module output_structure_module
+  USE nrtype
+  ! USE data_types,only:summa_output_type
+  USE data_types,only:&
+                      ! final data vectors
+                      dlength,             & ! var%dat
+                      ilength,             & ! var%dat
+                      ! no spatial dimension
+                      var_i,               & ! x%var(:)            (i4b)
+                      var_i8,              & ! x%var(:)            integer(8)
+                      var_d,               & ! x%var(:)            (rkind)
+                      var_flagVec,         & ! x%var(:)%dat        (logical)
+                      var_ilength,         & ! x%var(:)%dat        (i4b)
+                      var_dlength,         & ! x%var(:)%dat        (rkind)
+                      ! gru dimension
+                      gru_d,               & ! x%gru(:)%var(:)     (rkind)  
+                      gru_int,             & ! x%gru(:)%var(:)     (i4b)
+                      gru_int8,            & ! x%gru(:)%var(:)     integer(8)
+                      gru_double,          & ! x%gru(:)%var(:)     (rkind)
+                      gru_intVec,          & ! x%gru(:)%var(:)%dat (i4b)
+                      gru_doubleVec,       & ! x%gru(:)%var(:)%dat (rkind)
+                      ! gru+hru dimension
+                      gru_hru_int,         & ! x%gru(:)%hru(:)%var(:)     (i4b)
+                      gru_hru_int8,        & ! x%gru(:)%hru(:)%var(:)     integer(8)
+                      gru_hru_double,      & ! x%gru(:)%hru(:)%var(:)     (rkind)
+                      gru_hru_intVec,      & ! x%gru(:)%hru(:)%var(:)%dat (i4b)
+                      gru_hru_doubleVec      ! x%gru(:)%hru(:)%var(:)%dat (rkind)
+                      ! gru+hru+z dimension
+#ifdef V4_ACTIVE
+  USE data_types,only:gru_hru_z_vLookup ! x%gru(:)%hru(:)%z(:)%var(:)%lookup (rkind)
+#endif
+
+  USE actor_data_types,only:&
+                      var_time_i8,         & ! x%var(:)%tim(:)     integer(8)
+                      var_time_i,          & ! x%var(:)%tim(:)     (i4b)
+                      var_time_d,          & ! x%var(:)%tim(:)     (rkind)
+                      var_time_ilength,    & ! x%var(:)%tim(:)     (i4b)
+                      var_time_dlength,    & ! x%var(:)%tim(:)     (rkind)
+                      gru_hru_time_doublevec, & ! x%gru(:)%hru(:)%var(:)%tim(:)%dat (rkind)
+                      gru_hru_time_int,    &  ! x%gru(:)%hru(:)%var(:)%tim(:)     (i4b)
+                      gru_hru_time_double, &  ! x%gru(:)%hru(:)%var(:)%tim(:)     (rkind)
+                      gru_hru_time_intvec, &  ! x%gru(:)%hru(:)%var(:)%tim(:)%dat (i4b)
+                      gru_hru_time_flagvec
+
+
+  USE data_types,only:var_info
+  USE globalData,only:integerMissing
+  USE globalData,only:nBand                 ! number of spectral bands
+  USE globalData,only:nTimeDelay            ! number of timesteps in the time delay histogram
+  USE var_lookup,only:maxvarFreq             ! allocation dimension (output frequency)
+  USE var_lookup,only:iLookVarType           ! look up structure for variable typed
+  USE var_lookup,only:iLookINDEX
+  USE, intrinsic :: iso_c_binding
+  implicit none
+  public::initOutputTimeStep
+  public::initOutputStructure
+  public::deallocateOutputStructure
+  public::deallocateData_output
+  public::alloc_outputStruc
+  public::allocateDat_rkind
+  public::allocateDat_int
+  private::is_var_desired
+
+  type, public :: summa_output_type
+#ifdef V4_ACTIVE  
+    type(gru_hru_z_vLookup)                          :: lookupStruct                   ! x%gru(:)%hru(:)%z(:)%var(:)%lookup(:) -- lookup tables
+#endif
+    ! define the statistics structures
+    type(gru_hru_time_doubleVec)                      :: forcStat                      ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model forcing data
+    type(gru_hru_time_doubleVec)                      :: progStat                      ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model prognostic (state) variables
+    type(gru_hru_time_doubleVec)                      :: diagStat                      ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model diagnostic variables
+    type(gru_hru_time_doubleVec)                      :: fluxStat                      ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model fluxes
+    type(gru_hru_time_doubleVec)                      :: indxStat                      ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model indices
+    type(gru_hru_time_doubleVec)                      :: bvarStat                      ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- basin-average variabl
+
+    ! define the primary data structures (scalars)
+    type(gru_hru_time_int)                            :: timeStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)     -- model time data
+    type(gru_hru_time_double)                         :: forcStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)     -- model forcing data
+    type(gru_hru_double)                              :: attrStruct                    ! x%gru(:)%hru(:)%var(:)            -- local attributes for each HRU, DOES NOT CHANGE OVER TIMESTEPS
+    type(gru_hru_int)                                 :: typeStruct                    ! x%gru(:)%hru(:)%var(:)            -- local classification of soil veg etc. for each HRU, DOES NOT CHANGE OVER TIMESTEPS
+    type(gru_hru_int8)                                :: idStruct                      ! x%gru(:)%hru(:)%var(:)
+
+    ! define the primary data structures (variable length vectors)
+    type(gru_hru_time_intVec)                         :: indxStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model indices
+    type(gru_hru_intVec)                              :: indxStruct_init               ! x%gru(:)%hru(:)%var(:)%dat        -- model indices
+    type(gru_hru_doubleVec)                           :: mparStruct                    ! x%gru(:)%hru(:)%var(:)%dat        -- model parameters, DOES NOT CHANGE OVER TIMESTEPS TODO: MAYBE
+    type(gru_hru_time_doubleVec)                      :: progStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model prognostic (state) variables
+    type(gru_hru_doubleVec)                           :: progStruct_init               ! x%gru(:)%hru(:)%var(:)%dat        -- model prognostic (state) variables
+    type(gru_hru_time_doubleVec)                      :: diagStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model diagnostic variables
+    type(gru_hru_time_doubleVec)                      :: fluxStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model fluxes
+
+    ! define the basin-average structures
+    type(gru_double)                                  :: bparStruct                    ! x%gru(:)%var(:)                   -- basin-average parameters, DOES NOT CHANGE OVER TIMESTEPS
+    type(gru_hru_time_doubleVec)                      :: bvarStruct                    ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- basin-average variables
+    type(gru_doubleVec)                               :: bvarStruct_init               ! x%gru(:)%hru(:)%var(:)%dat        -- basin-average variables
+    ! define the ancillary data structures
+    type(gru_hru_double)                              :: dparStruct                    ! x%gru(:)%hru(:)%var(:)
+
+    ! finalize stats structure
+    type(gru_hru_time_flagVec)                        :: finalizeStats                 ! x%gru(:)%hru(:)%tim(:)%dat -- flags on when to write to file
+
+    type(gru_d)                                       :: upArea
+
+    integer(i4b)                                      :: nTimeSteps
+  end type summa_output_type  
+  
+
+  type(summa_output_type),allocatable,save,public     :: outputStructure(:)            ! summa_OutputStructure(1)%struc%var(:)%dat(nTimeSteps) 
+  type(ilength),allocatable,save,public               :: outputTimeStep(:)             ! timestep in output files
+  
+  contains
+
+subroutine initOutputTimeStep(num_gru, err)
+  USE var_lookup,only:maxvarFreq                ! maximum number of output files
+  implicit none
+  integer(i4b), intent(in)  :: num_gru
+  integer(i4b), intent(out) :: err
+  ! local variables
+  integer(i4b)                :: iGRU
+
+  ! initalize outputTimeStep - keeps track of the step the GRU is writing for
+  if (.not.allocated(outputTimeStep))then
+    allocate(outputTimeStep(num_gru))
+    do iGRU = 1, num_gru
+      allocate(outputTimeStep(iGRU)%dat(maxVarFreq))
+      outputTimeStep(iGRU)%dat(:) = 1
+    end do
+  end if
+
+end subroutine initOutputTimeStep
+
+subroutine initOutputStructure(forcFileInfo, maxSteps, num_gru, err)
+  USE globalData,only:time_meta,forc_meta,attr_meta,type_meta ! metadata structures
+  USE globalData,only:prog_meta,diag_meta,flux_meta,id_meta   ! metadata structures
+  USE globalData,only:mpar_meta,indx_meta                     ! metadata structures
+  USE globalData,only:bpar_meta,bvar_meta                     ! metadata structures
+#ifdef V4_ACTIVE
+  USE globalData,only:lookup_meta
+#endif
+  USE globalData,only:statForc_meta                           ! child metadata for stats
+  USE globalData,only:statProg_meta                           ! child metadata for stats
+  USE globalData,only:statDiag_meta                           ! child metadata for stats
+  USE globalData,only:statFlux_meta                           ! child metadata for stats
+  USE globalData,only:statIndx_meta                           ! child metadata for stats
+  USE globalData,only:statBvar_meta                           ! child metadata for stats
+  USE globalData,only:gru_struc
+  USE globalData,only:structInfo                              ! information on the data structures
+  USE multiconst,only:secprday                                ! number of seconds in a day
+  USE actor_data_types,only:file_info_array
+  USE var_lookup,only:maxvarFreq                              ! maximum number of output files
+
+  USE allocspace_module,only:allocGlobal                      ! module to allocate space for global data structures
+  USE globalData,only:maxSnowLayers
+  
+  implicit none
+  type(file_info_array),intent(in)      :: forcFileInfo
+  integer(i4b), intent(in)              :: maxSteps
+  integer(i4b), intent(in)              :: num_gru
+  integer(i4b), intent(out)             :: err 
+
+  ! local variables
+
+  integer(i4b)                          :: nVars
+  integer(i4b)                          :: iGRU
+  integer(i4b)                          :: iHRU
+  integer(i4b)                          :: iStep
+  integer(i4b)                          :: nSnow
+  integer(i4b)                          :: nSoil
+  integer(i4b)                          :: iStruct
+  character(len=256)                    :: message
+  integer(i4b)                          :: num_hru
+
+
+  ! Allocate structure to hold output files
+  if (.not.allocated(outputStructure))then
+    allocate(outputStructure(1))
+  else
+    print*, "Already Allocated"; return;
+  end if
+
+  ! LookupStructure
+
+  ! Statistics Structures
+  allocate(outputStructure(1)%forcStat%gru(num_gru))
+  allocate(outputStructure(1)%progStat%gru(num_gru))
+  allocate(outputStructure(1)%diagStat%gru(num_gru))
+  allocate(outputStructure(1)%fluxStat%gru(num_gru))
+  allocate(outputStructure(1)%indxStat%gru(num_gru))
+  allocate(outputStructure(1)%bvarStat%gru(num_gru))
+  ! Primary Data Structures (scalars)
+  allocate(outputStructure(1)%timeStruct%gru(num_gru))
+  allocate(outputStructure(1)%forcStruct%gru(num_gru))
+  ! Primary Data Structures (variable length vectors)
+  allocate(outputStructure(1)%indxStruct%gru(num_gru))
+  allocate(outputStructure(1)%progStruct%gru(num_gru))
+  allocate(outputStructure(1)%diagStruct%gru(num_gru))
+  allocate(outputStructure(1)%fluxStruct%gru(num_gru))
+  ! Basin-Average structures
+  allocate(outputStructure(1)%bvarStruct%gru(num_gru))
+  ! Finalize Stats for writing
+  allocate(outputStructure(1)%finalizeStats%gru(num_gru))
+  ! Extras
+  allocate(outputStructure(1)%upArea%gru(num_gru))
+  
+  
+  do iGRU = 1, num_gru
+    num_hru = gru_struc(iGRU)%hruCount
+    ! Statistics Structures
+    allocate(outputStructure(1)%forcStat%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%progStat%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%diagStat%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%fluxStat%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%indxStat%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%bvarStat%gru(iGRU)%hru(num_hru))
+
+    ! Primary Data Structures (scalars)
+    allocate(outputStructure(1)%timeStruct%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%forcStruct%gru(iGRU)%hru(num_hru))
+
+    ! Primary Data Structures (variable length vectors)
+    allocate(outputStructure(1)%indxStruct%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%progStruct%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%diagStruct%gru(iGRU)%hru(num_hru))
+    allocate(outputStructure(1)%fluxStruct%gru(iGRU)%hru(num_hru))
+  
+    ! Basin-Average structures
+    allocate(outputStructure(1)%bvarStruct%gru(iGRU)%hru(num_hru))
+
+
+   ! define the ancillary data structures
+
+    ! Finalize Stats for writing
+    allocate(outputStructure(1)%finalizeStats%gru(iGRU)%hru(num_hru))
+
+    allocate(outputStructure(1)%upArea%gru(iGRU)%hru(num_hru))
+
+  end do
+
+
+  ! Allocate variables that do not require time
+  do iStruct=1,size(structInfo)
+    select case(trim(structInfo(iStruct)%structName))
+    case('time'); cycle;
+    case('forc'); cycle;
+    case('attr'); call allocGlobal(attr_meta,  outputStructure(1)%attrStruct,  err, message)
+    case('type'); call allocGlobal(type_meta,  outputStructure(1)%typeStruct,  err, message)
+    case('id'  ); call allocGlobal(id_meta,    outputStructure(1)%idStruct,    err, message)
+    case('mpar'); call allocGlobal(mpar_meta,  outputStructure(1)%mparStruct,  err, message); 
+    case('indx'); call allocGlobal(indx_meta,  outputStructure(1)%indxStruct_init, err, message);
+    case('prog'); call allocGlobal(prog_meta,  outputStructure(1)%progStruct_init, err, message);
+    case('diag'); cycle;
+    case('flux'); cycle;
+    case('bpar'); call allocGlobal(bpar_meta,outputStructure(1)%bparStruct    ,err, message);  ! basin-average params 
+    case('bvar'); call allocGlobal(bvar_meta,outputStructure(1)%bvarStruct_init,err,message);  ! basin-average variables
+    case('deriv'); cycle;
+#ifdef V4_ACTIVE     
+    case('lookup'); call allocGlobal(lookup_meta,outputStructure(1)%lookupStruct,err, message);
+#endif
+    end select
+  end do
+  
+
+  call allocGlobal(mpar_meta,outputStructure(1)%dparStruct,err,message);
+
+
+
+  do iGRU=1,num_gru
+    do iHRU=1,gru_struc(iGRU)%hruCount
+
+      ! Get the maximum number of steps needed to initalize the output structure
+      nVars = maxval(forcFileInfo%ffile_list(:)%nVars)
+      nSnow = gru_struc(iGRU)%hruInfo(iHRU)%nSnow
+      nSoil = gru_struc(iGRU)%hruInfo(iHRU)%nSoil
+
+      do iStruct=1,size(structInfo)
+        ! allocate space structures
+          select case(trim(structInfo(iStruct)%structName))    
+            case('time')
+              call alloc_outputStruc(time_meta,outputStructure(1)%timeStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,err=err,message=message)     ! model forcing data
+            case('forc')
+              ! Structure
+              call alloc_outputStruc(forc_meta,outputStructure(1)%forcStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model forcing data
+              ! Statistics
+              call alloc_outputStruc(statForc_meta(:)%var_info,outputStructure(1)%forcStat%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model forcing data
+            case('attr'); cycle;
+              ! call alloc_outputStruc(attr_meta, outputStructure(1)%attrStruct(1)%gru(iGRU)%hru(iHRU),&
+              !                         nSteps=1,err=err,message=message)
+            case('type'); cycle;
+            case('id'  ); cycle;
+            case('mpar'); cycle;
+            case('indx')
+              ! Structure
+              call alloc_outputStruc(indx_meta,outputStructure(1)%indxStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,str_name='indx',message=message);    ! model variables
+              ! Statistics
+              call alloc_outputStruc(statIndx_meta(:)%var_info,outputStructure(1)%indxStat%gru(iGRU)%hru(1), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! index vars
+            case('prog')
+              ! Structure
+              call alloc_outputStruc(prog_meta,outputStructure(1)%progStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model prognostic (state) variables
+              ! Statistics
+              call alloc_outputStruc(statProg_meta(:)%var_info,outputStructure(1)%progStat%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model prognostic 
+            case('diag')
+              ! Structure
+              call alloc_outputStruc(diag_meta,outputStructure(1)%diagStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model diagnostic variables
+              ! Statistics
+              call alloc_outputStruc(statDiag_meta(:)%var_info,outputStructure(1)%diagStat%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model diagnostic
+            case('flux')
+              ! Structure
+              call alloc_outputStruc(flux_meta,outputStructure(1)%fluxStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model fluxes
+              ! Statistics
+              call alloc_outputStruc(statFlux_meta(:)%var_info,outputStructure(1)%fluxStat%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=maxSnowLayers,nSoil=nSoil,err=err,message=message);    ! model fluxes
+            case('bpar'); cycle;
+            case('bvar')
+              ! Structure
+              call alloc_outputStruc(bvar_meta,outputStructure(1)%bvarStruct%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=0,nSoil=0,err=err,message=message);  ! basin-average variables
+              ! Statistics
+              call alloc_outputStruc(statBvar_meta(:)%var_info,outputStructure(1)%bvarStat%gru(iGRU)%hru(iHRU), &
+                                      nSteps=maxSteps,nSnow=0,nSoil=0,err=err,message=message);  ! basin-average variables
+            case('deriv');  cycle
+            case('lookup'); cycle  ! lookup tables
+            case default; err=20; message='unable to find structure name: '//trim(structInfo(iStruct)%structName)
+        end select
+
+        ! check errors
+        if(err/=0)then
+          message=trim(message)//'initOutputStruc.f90 - [structure =  '//trim(structInfo(iStruct)%structName)//']'
+          print*, "Problem with structure: ", trim(structInfo(iStruct)%structName)
+          return
+        endif
+      end do  ! looping through data structures
+    
+      ! Finalize stats structure for writing to output file
+      allocate(outputStructure(1)%finalizeStats%gru(iGRU)%hru(iHRU)%tim(maxSteps))
+      do iStep = 1, maxSteps
+        allocate(outputStructure(1)%finalizeStats%gru(iGRU)%hru(iHRU)%tim(iStep)%dat(1:maxVarFreq))
+      end do ! timeSteps
+    end do ! Looping through GRUs
+  end do
+
+
+
+end subroutine initOutputStructure
+
+subroutine deallocateOutputStructure(err) bind(C, name="deallocateOutputStructure")
+  implicit none
+  integer(i4b), intent(inout)   :: err
+
+  err = 0
+  deallocate(outputStructure)
+
+end subroutine deallocateOutputStructure
+
+subroutine deallocateData_output(dataStruct)
+  USE actor_data_types,only:gru_hru_time_doubleVec, &
+                            gru_hru_time_intVec,    &
+                            gru_hru_time_flagVec,   &
+                            gru_hru_time_int,       &
+                            gru_hru_time_int8,      &
+                            gru_hru_time_double
+
+  USE data_types,only:gru_hru_int,    &
+                      gru_hru_double, &
+                      gru_double
+  implicit none
+  class(*),intent(inout)      :: dataStruct
+  ! local variables
+  integer(i4b)                :: iGRU
+  integer(i4b)                :: iHRU
+  integer(i4b)                :: iVar
+  integer(i4b)                :: iTim
+
+  select type(dataStruct)
+    class is (gru_hru_time_doubleVec)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
+            do iTim = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(:))
+              deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(iTim)%dat)
+            end do ! Time
+            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
+          end do ! var
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_hru_time_intVec)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
+            do iTim = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(:))
+              deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim(iTim)%dat)
+            end do ! Time
+            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
+          end do ! var
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_hru_time_flagVec)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          do iTim = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%tim(:))
+            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%tim(iTim)%dat)
+          end do ! Time
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%tim)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+  
+    class is (gru_hru_time_int)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
+            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
+          end do ! var
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_hru_int)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_hru_time_int8)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
+            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
+          end do ! var
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_hru_time_double)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          do iVar = 1, size(dataStruct%gru(iGRU)%hru(iHRU)%var(:))
+            deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var(iVar)%tim)
+          end do ! var
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_hru_double)
+      do iGRU = 1, size(dataStruct%gru(:))
+        do iHRU = 1, size(dataStruct%gru(iGRU)%hru(:))
+          deallocate(dataStruct%gru(iGRU)%hru(iHRU)%var)
+        end do ! hru
+        deallocate(dataStruct%gru(iGRU)%hru)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+    class is (gru_double)
+      do iGRU = 1, size(dataStruct%gru(:))
+          deallocate(dataStruct%gru(iGRU)%var)
+      end do ! gru
+      deallocate(dataStruct%gru)
+
+
+  end select
+
+end subroutine
+
+logical function is_var_desired(metaStruct, iVar)
+  implicit none
+  type(var_info),intent(in) :: metaStruct(:)
+  integer(i4b),intent(in)   :: iVar
+  ! local
+  integer(i4b)              :: iFreq
+  ! initalize error control
+  is_var_desired=.false.
+  do iFreq=1,maxvarFreq
+    if(metaStruct(iVar)%statIndex(iFreq) /= integerMissing)then
+      is_var_desired=.true.
+      exit
+    end if
+  end do
+
+end function is_var_desired
+
+subroutine alloc_outputStruc(metaStruct,dataStruct,nSteps,nSnow,nSoil,str_name,err,message)
+  implicit none
+  type(var_info),intent(in)            :: metaStruct(:)
+  class(*),intent(inout)               :: dataStruct
+  ! optional input
+  integer(i4b),intent(in),optional     :: nSteps
+  integer(i4b),intent(in),optional     :: nSnow          ! number of snow layers
+  integer(i4b),intent(in),optional     :: nSoil          ! number of soil layers
+  character(len=*),intent(in),optional :: str_name    ! name of the structure to allocate
+  ! output
+  integer(i4b),intent(inout)           :: err            ! error code
+  character(*),intent(out)             :: message        ! error message
+  ! local
+  logical(lgt)                         :: check          ! .true. if the variables are allocated
+  integer(i4b)                         :: nVars          ! number of variables in the metadata structure
+  integer(i4b)                         :: nLayers        ! total number of layers
+  integer(i4b)                         :: iVar
+  integer(i4b)                         :: iStat          ! checks if we want this variable
+  character(len=256)                   :: cmessage       ! error message of the downwind routine
+  ! initalize error control
+  message='alloc_outputStruc'
+
+  nVars = size(metaStruct)
+  if(present(nSnow) .or. present(nSoil))then
+    ! check both are present
+    if(.not.present(nSoil))then; err=20; message=trim(message)//'expect nSoil to be present when nSnow is present'; print*,message; return; end if
+    if(.not.present(nSnow))then; err=20; message=trim(message)//'expect nSnow to be present when nSoil is present'; print*,message; return; end if
+    nLayers = nSnow+nSoil
+    ! It is possible that nSnow and nSoil are actually needed here, so we return an error if the optional arguments are missing when needed
+  else
+    select type(dataStruct)
+      class is (var_time_ilength); err=20
+      class is (var_time_dlength); err=20
+    end select
+    if(err/=0)then; message=trim(message)//'expect nSnow and nSoil to be present for variable-length data structures'; print*,message; return; end if
+  end if
+
+  check=.false.
+  ! allocate the space for the variables and thier time steps in the output structure
+  select type(dataStruct)
+    ! ****************************************************
+    class is (var_time_i)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else 
+        allocate(dataStruct%var(nVars),stat=err)
+      end if
+      do iVar=1, nVars
+        ! Check if this variable is desired within any timeframe
+        if(is_var_desired(metaStruct,iVar))then
+          allocate(dataStruct%var(iVar)%tim(nSteps))
+        end if
+      end do
+      return
+    ! ****************************************************
+    class is (var_time_i8)
+      if(allocated(dataStruct%var))then 
+        check=.true.
+      else 
+        allocate(dataStruct%var(nVars),stat=err) 
+      end if 
+      do iVar=1, nVars
+        ! Check if this variable is desired within any timeframe
+        if(is_var_desired(metaStruct,iVar))then
+          allocate(dataStruct%var(iVar)%tim(nSteps))
+        end if
+      end do
+      return
+    ! ****************************************************
+    class is (var_time_d)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else
+        allocate(dataStruct%var(nVars),stat=err)
+      end if
+      do iVar=1, nVars
+        ! Check if this variable is desired within any timeframe
+        if(is_var_desired(metaStruct,iVar))then
+          allocate(dataStruct%var(iVar)%tim(nSteps))
+        end if
+      end do
+      return
+    ! ****************************************************   
+    class is (var_d)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else
+        allocate(dataStruct%var(nVars),stat=err)
+      end if
+      return
+    ! ****************************************************
+    class is (var_i)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else
+        allocate(dataStruct%var(nVars),stat=err)
+      end if
+      return
+    ! ****************************************************    
+    class is (var_i8)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else
+        allocate(dataStruct%var(nVars), stat=err)
+      end if
+      return
+    ! ****************************************************    
+    class is (var_dlength)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else
+        allocate(dataStruct%var(nVars),stat=err)
+        call allocateDat_rkind(metaStruct,dataStruct,nSnow,nSoil,err,cmessage)
+      end if
+    ! ****************************************************
+    class is (var_time_ilength)
+      if(allocated(dataStruct%var))then
+        check=.true. 
+      else 
+        allocate(dataStruct%var(nVars),stat=err) 
+      end if
+      do iVar=1, nVars
+        ! Check if this variable is desired within any timeframe
+        if(is_var_desired(metaStruct,iVar) .or. (present(str_name) .and. &
+         ((iVar == iLookINDEX%nLayers) .or. (iVar == iLookINDEX%nSnow) .or. (iVar == iLookINDEX%nSoil)) ))then
+        allocate(dataStruct%var(iVar)%tim(nSteps))
+          call allocateDat_int(metaStruct,dataStruct,nSnow,nSoil,nSteps,iVar,err,cmessage)
+        end if
+      end do
+    ! ****************************************************
+    class is (var_time_dlength)
+      if(allocated(dataStruct%var))then
+        check=.true.
+      else 
+        allocate(dataStruct%var(nVars),stat=err)
+      end if
+      do iVar=1, nVars
+        ! Check if this variable is desired within any timeframe
+        if(is_var_desired(metaStruct,iVar))then
+          allocate(dataStruct%var(iVar)%tim(nSteps))
+          call allocateDat_rkind_nSteps(metaStruct,dataStruct,nSnow,nSoil,nSteps,iVar,err,cmessage)
+        end if
+      end do
+    ! ****************************************************
+    class default; err=20; message=trim(message)//'unable to identify derived data type for the variable dimension'; print*,message;return
+  end select
+  ! check errors
+  if(check) then; err=20; message=trim(message)//'structure was unexpectedly allocated already'; print*,message; return; end if
+  if(err/=0)then; err=20; message=trim(message)//'problem allocating'; print*,message; return; end if
+
+  ! check errors
+  if(err/=0)then; message=trim(message)//trim(cmessage); print*, message; return; end if
+end subroutine
+
+subroutine allocateDat_rkind_nSteps(metadata,varData,nSnow, nSoil, &
+  nSteps,iVar,err,message)
+
+  USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
+
+  implicit none
+  type(var_info),intent(in)            :: metadata(:)
+  ! output variables
+  type(var_time_dlength),intent(inout) :: varData     ! model variables for a local HRU
+  integer(i4b),intent(in)              :: nSnow
+  integer(i4b),intent(in)              :: nSoil
+  integer(i4b),intent(in)              :: nSteps
+  integer(i4b),intent(in)              :: iVar
+  integer(i4b),intent(inout)           :: err         ! error code
+  character(*),intent(inout)           :: message     ! error message
+
+  ! local variables
+  integer(i4b)                         :: iStep 
+  integer(i4b)                         :: nLayers
+  message='allocateDat_rkindAccessActor'
+
+  nLayers = nSnow+nSoil
+  do iStep=1, nSteps
+    select case(metadata(iVar)%vartype)
+      case(iLookVarType%scalarv); allocate(varData%var(iVar)%tim(iStep)%dat(1),stat=err)
+      case(iLookVarType%wLength); allocate(varData%var(iVar)%tim(iStep)%dat(nBand),stat=err)
+      case(iLookVarType%midSnow); allocate(varData%var(iVar)%tim(iStep)%dat(nSnow),stat=err)
+      case(iLookVarType%midSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
+      case(iLookVarType%midToto); allocate(varData%var(iVar)%tim(iStep)%dat(nLayers),stat=err)
+      case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%tim(iStep)%dat((nLayers-nSoil)+1),stat=err)
+      case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil+1),stat=err)
+      case(iLookVarType%ifcToto); allocate(varData%var(iVar)%tim(iStep)%dat(nLayers+1),stat=err)
+      case(iLookVarType%parSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
+      case(iLookVarType%routing); allocate(varData%var(iVar)%tim(iStep)%dat(nTimeDelay),stat=err)
+      case(iLookVarType%outstat); allocate(varData%var(iVar)%tim(iStep)%dat(maxvarfreq*2),stat=err)
+      case(iLookVarType%unknown); allocate(varData%var(iVar)%tim(iStep)%dat(0),stat=err)
+      case default
+      err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
+      return
+    end select
+  end do ! (iStep)
+
+end subroutine allocateDat_rkind_nSteps
+
+subroutine allocateDat_rkind(metadata,varData,nSnow,nSoil,err,message)
+  USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
+  implicit none
+  type(var_info),intent(in)         :: metadata(:)
+  ! output variables
+  type(var_dlength),intent(inout)   :: varData     ! model variables for a local HRU
+  integer(i4b),intent(in)           :: nSnow
+  integer(i4b),intent(in)           :: nSoil
+  
+  integer(i4b),intent(inout)        :: err         ! error code
+  character(*),intent(inout)        :: message     ! error message
+  
+  ! local variables
+  integer(i4b)                      :: nVars
+  integer(i4b)                      :: iVar
+  integer(i4b)                      :: nLayers
+  message='allocateDat_rkindAccessActor'
+
+  nVars = size(metaData)
+  nLayers = nSnow+nSoil
+  do iVar=1, nVars
+    select case(metadata(iVar)%vartype)
+    case(iLookVarType%scalarv); allocate(varData%var(iVar)%dat(1),stat=err)
+    case(iLookVarType%wLength); allocate(varData%var(iVar)%dat(nBand),stat=err)
+    case(iLookVarType%midSnow); allocate(varData%var(iVar)%dat(nSnow),stat=err)
+    case(iLookVarType%midSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
+    case(iLookVarType%midToto); allocate(varData%var(iVar)%dat(nLayers),stat=err)
+    case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%dat((nLayers-nSoil)+1),stat=err)
+    case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%dat(nSoil+1),stat=err)
+    case(iLookVarType%ifcToto); allocate(varData%var(iVar)%dat(nLayers+1),stat=err)
+    case(iLookVarType%parSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
+    case(iLookVarType%routing); allocate(varData%var(iVar)%dat(nTimeDelay),stat=err)
+    case(iLookVarType%outstat); allocate(varData%var(iVar)%dat(maxvarfreq*2),stat=err)
+    case(iLookVarType%unknown); allocate(varData%var(iVar)%dat(0),stat=err)
+    case default
+        err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
+        return
+    end select
+  end do
+
+end subroutine allocateDat_rkind
+
+subroutine allocateDat_int(metadata,varData,nSnow, nSoil, &
+                           nSteps,iVar,err,message)
+  USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
+
+  implicit none
+  type(var_info),intent(in)            :: metadata(:)
+  ! output variables
+  type(var_time_ilength),intent(inout) :: varData     ! model variables for a local HRU
+  integer(i4b),intent(in)              :: nSnow
+  integer(i4b),intent(in)              :: nSoil
+  integer(i4b),intent(in)              :: nSteps
+  integer(i4b),intent(in)              :: iVar  
+  integer(i4b),intent(inout)           :: err         ! error code
+  character(*),intent(inout)           :: message     ! error message
+  ! local variables
+  integer(i4b)                         :: iStep 
+  integer(i4b)                         :: nLayers
+  message='allocateDat_rkindAccessActor'
+
+  nLayers = nSnow+nSoil
+  do iStep=1, nSteps
+    select case(metadata(iVar)%vartype)
+      case(iLookVarType%scalarv); allocate(varData%var(iVar)%tim(iStep)%dat(1),stat=err)
+      case(iLookVarType%wLength); allocate(varData%var(iVar)%tim(iStep)%dat(nBand),stat=err)
+      case(iLookVarType%midSnow); allocate(varData%var(iVar)%tim(iStep)%dat(nSnow),stat=err)
+      case(iLookVarType%midSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
+      case(iLookVarType%midToto); allocate(varData%var(iVar)%tim(iStep)%dat(nLayers),stat=err)
+      case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%tim(iStep)%dat((nLayers-nSoil)+1),stat=err)
+      case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil+1),stat=err)
+      case(iLookVarType%ifcToto); allocate(varData%var(iVar)%tim(iStep)%dat(nLayers+1),stat=err)
+      case(iLookVarType%parSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
+      case(iLookVarType%routing); allocate(varData%var(iVar)%tim(iStep)%dat(nTimeDelay),stat=err)
+      case(iLookVarType%outstat); allocate(varData%var(iVar)%tim(iStep)%dat(maxvarfreq*2),stat=err)
+      case(iLookVarType%unknown); allocate(varData%var(iVar)%tim(iStep)%dat(0),stat=err)
+      case default
+      err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
+      return
+    end select
+  end do ! loop through time steps
+end subroutine
+
+
+end module output_structure_module
\ No newline at end of file
diff --git a/build/source/actors/file_access_actor/fortran_code/read_forcing.f90 b/build/source/actors/file_access_actor/read_force.f90
similarity index 94%
rename from build/source/actors/file_access_actor/fortran_code/read_forcing.f90
rename to build/source/actors/file_access_actor/read_force.f90
index 18d639e471db9435698d491bae53b8a6df32f0ee..5eecbeafc5de3ddfdf74e19f9d56d993dbb1ad6b 100644
--- a/build/source/actors/file_access_actor/fortran_code/read_forcing.f90
+++ b/build/source/actors/file_access_actor/read_force.f90
@@ -8,26 +8,27 @@ USE, intrinsic :: iso_c_binding
 USE nrtype
 
 USE data_types,only:file_info
-USE data_types,only:file_info_array
+USE data_types,only:dlength         ! global data structure for forcing data
+USE data_types,only:ilength         ! global data structure for forcing data
+USE actor_data_types,only:file_info_array
+USE actor_data_types,only:var_forc        ! global data structure for forcing data
 
 USE globalData,only:gru_struc
-USE globalData,only:forcingDataStruct
-USE globalData,only:vecTime
 USE globalData,only:time_meta,forc_meta       ! metadata structures
 USE globalData,only:integerMissing            ! integer missing value
-
-
 USE var_lookup,only:iLookTIME,iLookFORCE      ! named variables to define structure elements
-
-
 USE summaFileManager,only:FORCING_PATH        ! path of the forcing data file
 USE netcdf_util_module,only:nc_file_close  ! close netcdf file
 
 
+
 implicit none
 private
 public::read_forcingFile
 
+type(var_forc),allocatable,save,public         :: forcingDataStruct(:)              ! forcingDataStruct(:)%var(:)%dataFromFile(:,:)
+type(dlength),allocatable,save,public          :: vecTime(:)
+
 contains
 subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, numGRU, err) bind(C,name="read_forcingFile")
     USE netcdf                                              ! netcdf capability
@@ -60,7 +61,7 @@ subroutine read_forcingFile(handle_forcFileInfo, iFile, stepsInFile, startGRU, n
     call c_f_pointer(handle_forcFileInfo, forcFileInfo)
 
     ! Start Procedure here
-    err=0; message="read_forcing.f90 - read_forcingFile/"
+    err=0; message="read_force.f90 - read_forcingFile/"
    
     nFiles=size(forcFileInfo%ffile_list(:))
     
@@ -155,12 +156,12 @@ subroutine openForcingFile(forcFileInfo,iFile,infile,ncId,err,message)
     USE netcdf_util_module,only:nc_file_open                ! open netcdf file
     USE time_utils_module,only:fracDay                      ! compute fractional day
     USE time_utils_module,only:extractTime                  ! extract time info from units string
-    USE time_utils_module,only:compJulday                   ! convert calendar date to julian day
+    USE time_utils_module,only:compJulDay                   ! convert calendar date to julian day
     !USE globalData,only:tmZoneOffsetFracDay                ! time zone offset in fractional days
     USE globalData,only:ncTime                              ! time zone information from NetCDF file (timeOffset = longitude/15. - ncTimeOffset)
     USE globalData,only:utcTime                             ! all times in UTC (timeOffset = longitude/15. hours)
     USE globalData,only:localTime                           ! all times local (timeOffset = 0)
-    USE globalData,only:refJulday_data
+    USE globalData,only:refJulDay_data
     USE summafilemanager,only:NC_TIME_ZONE
     ! dummy variables
     type(file_info),intent(inout)     :: forcFileInfo(:)
@@ -209,7 +210,7 @@ subroutine openForcingFile(forcFileInfo,iFile,infile,ncId,err,message)
     end select ! (option time zone option)
    
     call compjulday(iyyy,im,id,ih,imin,dsec,                & ! output = year, month, day, hour, minute, second
-                    refJulday_data,err,cmessage)              ! output = julian day (fraction of day) + error control
+                    refJulDay_data,err,cmessage)              ! output = julian day (fraction of day) + error control
     if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
    
     ! get the time multiplier needed to convert time to units of days
diff --git a/build/source/actors/file_access_actor/summaversion.inc b/build/source/actors/file_access_actor/summaversion.inc
new file mode 100644
index 0000000000000000000000000000000000000000..ed93ce0d0b583cf6ea9d765ec9189290b694e4c0
--- /dev/null
+++ b/build/source/actors/file_access_actor/summaversion.inc
@@ -0,0 +1,4 @@
+character(len=64), parameter     :: summaVersion = ''
+character(len=64), parameter     :: buildTime = ''
+character(len=64), parameter     :: gitBranch = ''
+character(len=64), parameter     :: gitHash = ''
\ No newline at end of file
diff --git a/build/source/actors/global/actor_data_types.f90 b/build/source/actors/global/actor_data_types.f90
new file mode 100644
index 0000000000000000000000000000000000000000..1367876cfc6feb4fe3d52c5e52e1203a9981cd54
--- /dev/null
+++ b/build/source/actors/global/actor_data_types.f90
@@ -0,0 +1,181 @@
+module actor_data_types
+  USE, intrinsic :: iso_c_binding
+  USE nrtype, integerMissing=>nr_integerMissing
+  USE data_types
+  implicit none
+  private
+
+  ! ***********************************************************************************************************
+  ! Wrapping of file_info (prevents a segmentation fault)
+  ! ***********************************************************************************************************
+  type,public :: file_info_array
+    type(file_info), allocatable         :: ffile_list(:)
+  end type file_info_array
+
+  type,public :: forcingFileData
+    real(rkind), dimension (:,:), allocatable   :: dataFromFile
+  end type forcingFileData
+
+  type,public :: var_forc
+    type(forcingFileData), allocatable   :: var(:)       ! var(:)%dataFromFile(:,:)
+    character(len=256)                   :: refTimeString
+    real(rkind)                          :: convTime2Days
+    integer(i4b)                         :: nVars
+    integer(i4b),allocatable             :: var_ix(:)
+    real(rkind)                          :: tmZoneOffsetFracDay
+    real(rkind)                          :: refJulDay_data 
+    integer(i4b)                         :: nTimeSteps    ! Number of Timesteps in the file
+  end type var_forc
+
+  ! ** double precision type of for time series
+  type, public :: time_dlength
+    type(dlength),allocatable          :: tim(:)    ! tim(:)%dat
+  endtype time_dlength
+  ! ** integer type of for time series
+  type, public :: time_ilength
+    type(ilength),allocatable          :: tim(:)    ! tim(:)%dat
+  endtype time_ilength
+  ! ** double prcision type for time series of fixed length
+  type, public :: time_d
+    real(rkind),allocatable            :: tim(:)    ! tim(:)
+  endtype time_d
+  ! ** integer type for time series of fixed length
+  type, public :: time_i
+    integer(i4b),allocatable           :: tim(:)    ! tim(:)
+  endtype time_i
+  ! ** logical type for time series
+  type, public :: time_flagVec
+    type(flagVec),allocatable         :: tim(:)    ! tim(:)%dat
+  end type time_flagVec
+
+  ! ** double precision type of variable length with storage
+  ! for each time_step
+  type, public :: var_time_dlength
+    type(time_dlength),allocatable     :: var(:)   ! var(:)%tim(:)%dat
+  endtype var_time_dlength
+
+  ! ** integer type of variable length with storage
+  ! for each time_step
+  type, public :: var_time_ilength
+    type(time_ilength),allocatable     :: var(:)   ! var(:)%tim(:)%dat
+  endtype var_time_ilength
+
+  type, public :: time_i8
+    type(var_i8),allocatable           :: tim(:)    ! tim(:)
+  endtype time_i8
+
+  type, public :: var_time_d
+    type(time_d),allocatable           :: var(:)     ! var(:)%tim
+  endtype var_time_d
+
+  type, public :: var_time_i
+    type(time_i),allocatable            :: var(:)     ! var(:)%tim
+  endtype var_time_i
+
+  type, public :: var_time_i8
+    type(time_i8),allocatable           :: var(:)     ! var(:)%tim
+  endtype var_time_i8
+
+  ! ***********************************************************************************************************
+  ! Type for handling lateral-flows
+  ! ***********************************************************************************************************
+  type,public :: var_dlength_array
+    type(var_dlength), allocatable      :: struc(:) ! struc(:)var(:)%dat
+  end type var_dlength_array   
+
+    ! ** double precision type of variable length with timestep storage
+  type, public :: hru_time_double
+    type(var_time_d),allocatable      :: hru(:)     ! hru(:)%tim(:)%var
+  endtype hru_time_double
+  ! ** integer type of variable length with timestep storage
+  type, public :: hru_time_int
+    type(var_time_i),allocatable      :: hru(:)     ! hru(:)%tim(:)%var
+  endtype hru_time_int
+  ! ** integer type of variable length with timestep storage
+  type, public :: hru_time_int8
+    type(var_time_i8),allocatable     :: hru(:)     ! hru(:)%tim(:)%var
+  endtype hru_time_int8
+
+  ! ** double precission type of timestep variable length
+  type, public :: hru_time_doubleVec
+    type(var_time_dlength), allocatable :: hru(:)
+  endtype hru_time_doubleVec
+
+  type, public :: hru_time_intVec
+    type(var_time_ilength), allocatable :: hru(:)
+  endtype hru_time_intVec
+
+  type, public :: hru_time_flagVec
+    type(time_flagVec),allocatable       :: hru(:)  ! hru(:)%tim(:)%dat          
+  endtype hru_time_flagVec
+
+  type,public :: gru_hru_time_flagVec
+    type(hru_time_flagVec),allocatable :: gru(:)  ! gru(:)%hru(:)%tim(:)%dat(:)
+  endtype gru_hru_time_flagVec           
+
+  type, public :: gru_hru_time_double
+    type(hru_time_double),allocatable :: gru(:)
+  endtype gru_hru_time_double
+
+  type, public :: gru_hru_time_int
+    type(hru_time_int), allocatable   :: gru(:)
+  endtype gru_hru_time_int
+
+  type, public :: gru_hru_time_int8
+    type(hru_time_int8), allocatable  :: gru(:)  
+  endtype gru_hru_time_int8 
+
+  type, public :: gru_hru_time_doubleVec
+    type(hru_time_doubleVec),allocatable :: gru(:)
+  endtype gru_hru_time_doubleVec
+
+  type, public :: gru_hru_time_intVec
+    type(hru_time_intVec),allocatable    :: gru(:)
+  endtype gru_hru_time_intVec
+
+  type, public :: hru_type
+#ifdef V4_ACTIVE
+    type(zLookup),pointer                      :: lookupStruct               ! z(:)%var(:)%lookup(:) -- lookup tables
+#endif
+    type(var_dlength),pointer                  :: forcStat                   ! model forcing data
+    type(var_dlength),pointer                  :: progStat                   ! model prognostic (state) variables
+    type(var_dlength),pointer                  :: diagStat                   ! model diagnostic variables
+    type(var_dlength),pointer                  :: fluxStat                   ! model fluxes
+    type(var_dlength),pointer                  :: indxStat                   ! model indices
+    type(var_dlength),pointer                  :: bvarStat                   ! basin-average variabl
+    ! primary data structures (scalars)
+    type(var_i),pointer                        :: timeStruct                 ! model time data
+    type(var_d),pointer                        :: forcStruct                 ! model forcing data
+    type(var_d),pointer                        :: attrStruct                 ! model attribute data
+    type(var_i),pointer                        :: typeStruct                 ! model type data
+    type(var_i8),pointer                       :: idStruct                   ! model id data
+    ! primary data structures (variable length vectors)
+    type(var_ilength),pointer                  :: indxStruct                 ! model indices
+    type(var_dlength),pointer                  :: mparStruct                 ! model parameters
+    type(var_dlength),pointer                  :: progStruct                 ! model prognostic (state) variables
+    type(var_dlength),pointer                  :: diagStruct                 ! model diagnostic variables
+    type(var_dlength),pointer                  :: fluxStruct                 ! model fluxes
+    ! basin-average structures
+    type(var_d),pointer                        :: bparStruct                 ! basin-average variables
+    type(var_dlength),pointer                  :: bvarStruct                 ! basin-average variables
+    type(var_d),pointer                        :: dparStruct                 ! default model parameters
+    ! local HRU data structures
+    type(var_i),pointer                        :: startTime_hru              ! start time for the model simulation
+    type(var_i),pointer                        :: finishTime_hru             ! end time for the model simulation
+    type(var_i),pointer                        :: refTime_hru                ! reference time for the model simulation
+    type(var_i),pointer                        :: oldTime_hru                ! time from previous step
+
+    ! Statistic flags 
+    type(var_i), pointer                       :: statCounter                ! time counter for stats
+    type(var_i), pointer                       :: outputTimeStep             ! timestep in output files
+    type(flagVec), pointer                     :: resetStats                 ! flags to finalize statistics
+    type(flagVec), pointer                     :: finalizeStats              ! flags to finalize statistics
+
+    ! Julian Day Variables
+    real(c_double)                             :: fracJulDay                 ! fractional julian days since the start of year
+    real(c_double)                             :: tmZoneOffsetFracDay        ! time zone offset in fractional days
+    integer(c_int)                             :: yearLength                 ! number of days in the current year
+    ! Misc Variables
+    integer(c_int)                             :: computeVegFlux             ! flag to indicate if we are computing fluxes over vegetation
+  end type hru_type
+end module
diff --git a/build/source/actors/global/auxiliary.cpp b/build/source/actors/global/auxiliary.cpp
index b606966ffc359d332bc75f9bdd81e9b57ee86c4a..0075f054735c453bc883ffb30563e124f210f9ae 100644
--- a/build/source/actors/global/auxiliary.cpp
+++ b/build/source/actors/global/auxiliary.cpp
@@ -132,6 +132,16 @@ std::vector<int> get_var_i(void* handle) {
     return array;
 }
 
+std::vector<int> get_type_struct(void* handle) {
+    int size;
+    get_size_data_typeStruct(handle, &size);
+    if (size == 0) return std::vector<int>();
+
+    std::vector<int> array(size);
+    get_data_typeStruct(handle, &array[0]);
+    return array;
+}
+
 
 std::vector<double> get_var_d(void* handle) {
     int size;
@@ -143,6 +153,26 @@ std::vector<double> get_var_d(void* handle) {
     return array;
 }
 
+std::vector<double> get_attr_struct(void* handle) {
+    int size;
+    get_size_data_attrStruct(handle, &size);
+    if (size == 0) return std::vector<double>();
+
+    std::vector<double> array(size);
+    get_data_attrStruct(handle, &array[0]);
+    return array;
+}
+
+std::vector<double> get_bpar_struct(void* handle) {
+    int size;
+    get_size_data_bparStruct(handle, &size);
+    if (size == 0) return std::vector<double>();
+
+    std::vector<double> array(size);
+    get_data_bparStruct(handle, &array[0]);
+    return array;
+}
+
 std::vector<long int> get_var_i8(void* handle) {
     int size;
     get_size_data_var_i8(handle, &size);
@@ -183,6 +213,8 @@ std::vector<double> get_dlength(void* handle) {
     return array;
 }
 
+
+
 std::vector<std::vector<int> > get_var_flagVec(void* handle) {
     int num_row;
     get_size_var_flagVec(handle, &num_row);
@@ -300,4 +332,34 @@ std::vector<std::vector<double> > get_var_dlength(void* handle) {
     }
         
     return mat;
-}
\ No newline at end of file
+}
+
+std::vector<std::vector<double>> get_mpar_struct_array(void* handle) {
+    int num_row;
+    get_size_var_mparStruct(handle, &num_row);
+    if (num_row == 0) return std::vector<std::vector<double> >();
+
+    std::vector<int> num_col(num_row);
+    get_size_data_mparStruct(handle, &num_row, &num_col[0]);
+
+    int num_elem = 0;
+    for(int i=0; i<num_row; i++)
+        num_elem += num_col[i];   	
+
+    std::vector<double> array(num_elem);
+
+    get_data_mparStruct(handle, &array[0]);
+
+    std::vector<std::vector<double> > mat(num_row);
+    for(size_t i=0; i<num_row; i++)
+        mat[i] = std::vector<double>(num_col[i]);
+
+    num_elem = 0;
+    for(size_t i=0; i<num_row; i++){
+        for(size_t j=0; j<num_col[i]; j++)
+            mat[i][j] = array[num_elem + j];
+        num_elem += num_col[i];    		
+    }
+        
+    return mat;
+}
diff --git a/build/source/actors/global/cppwrap_datatypes.f90 b/build/source/actors/global/cppwrap_datatypes.f90
index decf8edfb9f0e5e0f275d54c90891e00bbc5b757..eac2466a2afd6efb86e6284957594e1178f92a88 100644
--- a/build/source/actors/global/cppwrap_datatypes.f90
+++ b/build/source/actors/global/cppwrap_datatypes.f90
@@ -3,6 +3,7 @@ module cppwrap_datatypes
 
 use, intrinsic :: iso_c_binding
 use data_types
+use actor_data_types
 
 implicit none
   
@@ -166,6 +167,36 @@ subroutine get_data_var_i(handle, array) bind(C, name='get_data_var_i')
   
 end subroutine get_data_var_i
 
+!-----------------------------------
+subroutine get_size_data_typeStruct(handle, arr_size) bind(C, name='get_size_data_typeStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  integer(c_int), intent(out) :: arr_size
+  type(hru_type), pointer :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%typeStruct%var)) then
+    arr_size = size(hru_data%typeStruct%var, kind=c_int)
+  else
+    arr_size = 0_c_int
+  end if
+  
+end subroutine get_size_data_typeStruct
+
+!-----------------------------------
+subroutine get_data_typeStruct(handle, array) bind(C, name='get_data_typeStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  integer(c_int), intent(out) :: array(*)
+  type(hru_type), pointer :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%typeStruct%var)) then
+    array(:size(hru_data%typeStruct%var)) = hru_data%typeStruct%var
+  end if
+  
+end subroutine get_data_typeStruct
+
 ! **************************** var_i8 ****************************
 
 function new_handle_var_i8() result(handle) bind(C, name='new_handle_var_i8')
@@ -447,6 +478,7 @@ subroutine get_size_data_var_d(handle, arr_size) bind(C, name='get_size_data_var
   
 end subroutine get_size_data_var_d
 
+
 !-----------------------------------
 subroutine get_data_var_d(handle, array) bind(C, name='get_data_var_d')
   
@@ -461,6 +493,66 @@ subroutine get_data_var_d(handle, array) bind(C, name='get_data_var_d')
   
 end subroutine get_data_var_d
 
+
+
+subroutine get_size_data_attrStruct(handle, arr_size) bind(C, name='get_size_data_attrStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  integer(c_int), intent(out) :: arr_size
+  type(hru_type), pointer :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%attrStruct%var)) then
+    arr_size = size(hru_data%attrStruct%var, kind=c_int)
+  else
+    arr_size = 0_c_int
+  end if
+  
+end subroutine get_size_data_attrStruct
+
+!-----------------------------------
+subroutine get_data_attrStruct(handle, array) bind(C, name='get_data_attrStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  real(c_double), intent(out) :: array(*)
+  type(hru_type), pointer :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%attrStruct%var)) then
+    array(:size(hru_data%attrStruct%var)) = hru_data%attrStruct%var
+  end if
+  
+end subroutine get_data_attrStruct
+
+subroutine get_size_data_bparStruct(handle, arr_size) bind(C, name='get_size_data_bparStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  integer(c_int), intent(out) :: arr_size
+  type(hru_type), pointer :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%bparStruct%var)) then
+    arr_size = size(hru_data%bparStruct%var, kind=c_int)
+  else
+    arr_size = 0_c_int
+  end if
+  
+end subroutine get_size_data_bparStruct
+
+!-----------------------------------
+subroutine get_data_bparStruct(handle, array) bind(C, name='get_data_bparStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  real(c_double), intent(out) :: array(*)
+  type(hru_type), pointer :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%bparStruct%var)) then
+    array(:size(hru_data%bparStruct%var)) = hru_data%bparStruct%var
+  end if
+  
+end subroutine get_data_bparStruct
+
 ! **************************** dlength **************************
 
 function new_handle_dlength() result(handle) bind(C, name='new_handle_dlength')
@@ -991,6 +1083,22 @@ subroutine get_size_var_dlength(handle, var_size) bind(C, name='get_size_var_dle
   
 end subroutine get_size_var_dlength
 
+subroutine get_size_var_mparStruct(handle, var_size) bind(C, name='get_size_var_mparStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  integer(c_int), intent(out)    :: var_size
+  type(hru_type), pointer     :: hru_data
+  
+  call c_f_pointer(handle, hru_data)
+  if (allocated(hru_data%mparStruct%var)) then
+    var_size = size(hru_data%mparStruct%var, kind=c_int)
+  else
+    var_size = 0_c_int
+  end if
+  
+end subroutine get_size_var_mparStruct
+
+
 !-----------------------------------
 subroutine get_size_data_var_dlength(handle, var_size, dat_size) bind(C, name='get_size_data_var_dlength')
   
@@ -1008,6 +1116,24 @@ subroutine get_size_data_var_dlength(handle, var_size, dat_size) bind(C, name='g
   
 end subroutine get_size_data_var_dlength
 
+!-----------------------------------
+subroutine get_size_data_mparStruct(handle, var_size, dat_size) bind(C, name='get_size_data_mparStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  integer(c_int), intent(in) :: var_size
+  integer(c_int), intent(out) :: dat_size(*)
+  type(hru_type), pointer :: hru_data
+  integer(c_int)  :: i
+  
+  call c_f_pointer(handle, hru_data)
+  
+  do i=1,var_size
+      dat_size(i) = size(hru_data%mparStruct%var(i)%dat, kind=c_int)
+  end do
+  
+end subroutine get_size_data_mparStruct
+
+
 !-----------------------------------
 subroutine get_data_var_dlength(handle, array) bind(C, name='get_data_var_dlength')
   
@@ -1044,6 +1170,42 @@ subroutine get_data_var_dlength(handle, array) bind(C, name='get_data_var_dlengt
   
 end subroutine get_data_var_dlength
 
+subroutine get_data_mparStruct(handle, array) bind(C, name='get_data_mparStruct')
+  
+  type(c_ptr), intent(in), value :: handle
+  real(c_double), intent(out)    :: array(*)
+  type(hru_type), pointer        :: hru_data
+  integer(c_int)                 :: i,j,size_var,size_dat,size_array,j2,loop_val
+  integer(c_int)                 :: start_index(1)
+  
+  call c_f_pointer(handle, hru_data)
+  
+  size_array = 0
+  if (allocated(hru_data%mparStruct%var)) then
+    size_var = size(hru_data%mparStruct%var)
+    do i=1,size_var
+      size_dat = size(hru_data%mparStruct%var(i)%dat)
+      start_index = lbound(hru_data%mparStruct%var(i)%dat)
+
+      if (start_index(1) == 0) then
+        loop_val = size_dat - 1
+      else
+        loop_val = size_dat
+      endif
+
+      j2=1
+      do j=start_index(1),loop_val
+        array(size_array+j2) = hru_data%mparStruct%var(i)%dat(j)
+        j2=j2+1
+      end do
+      size_array = size_array + size_dat
+    end do
+    
+  end if
+  
+end subroutine get_data_mparStruct
+
+
 ! **************************** var_dlength **************************
 ! ************************ var_dlength_array ************************
 function new_handle_dlength_array() result(handle) bind(C, name='new_handle_dlength_array')
@@ -1089,8 +1251,9 @@ end subroutine delete_handle_file_info
     
 
 ! ****************************** z_lookup ****************************
+#ifdef V4_ACTIVE
 function new_handle_z_lookup() result(handle) bind(C, name="new_handle_z_lookup")
-  type(c_ptr)           :: handle
+  type(c_ptr)            :: handle
   type(zLookup), pointer :: p
 
   allocate(p)
@@ -1103,7 +1266,86 @@ subroutine delete_handle_z_lookup(handle) bind(C, name="delete_handle_z_lookup")
 
   call c_f_pointer(handle, p)
   deallocate(p)
-end subroutine 
+end subroutine
+#endif
+
+! ****************************** hru type ****************************
+function new_handle_hru_type() result(handle) bind(C, name="new_handle_hru_type")
+  type(c_ptr)            :: handle
+  type(hru_type), pointer :: p
+
+  allocate(p)
+#ifdef V4_ACTIVE
+  allocate(p%lookupStruct)
+#endif
+  allocate(p%forcStat)
+  allocate(p%progStat)
+  allocate(p%diagStat)
+  allocate(p%fluxStat)
+  allocate(p%indxStat)
+  allocate(p%bvarStat)
+  allocate(p%timeStruct)
+  allocate(p%forcStruct)
+  allocate(p%attrStruct)
+  allocate(p%typeStruct)
+  allocate(p%idStruct)
+  allocate(p%indxStruct)
+  allocate(p%mparStruct)
+  allocate(p%progStruct)
+  allocate(p%diagStruct)
+  allocate(p%fluxStruct)
+  allocate(p%bparStruct)
+  allocate(p%bvarStruct)
+  allocate(p%dparStruct)
+  allocate(p%startTime_hru)
+  allocate(p%finishTime_hru)
+  allocate(p%refTime_hru)
+  allocate(p%oldTime_hru)
+  allocate(p%statCounter)
+  allocate(p%outputTimeStep)
+  allocate(p%resetStats)
+  allocate(p%finalizeStats)
+  handle = c_loc(p)
+end function
+
+subroutine delete_handle_hru_type(handle) bind(C, name="delete_handle_hru_type")
+  type(c_ptr), intent(in), value :: handle
+  type(hru_type), pointer :: p
+
+  call c_f_pointer(handle, p)
+#ifdef V4_ACTIVE
+  deallocate(p%lookupStruct)
+#endif
+  deallocate(p%forcStat)
+  deallocate(p%progStat)
+  deallocate(p%diagStat)
+  deallocate(p%fluxStat)
+  deallocate(p%indxStat)
+  deallocate(p%bvarStat)
+  deallocate(p%timeStruct)
+  deallocate(p%forcStruct)
+  deallocate(p%attrStruct)
+  deallocate(p%typeStruct)
+  deallocate(p%idStruct)
+  deallocate(p%indxStruct)
+  deallocate(p%mparStruct)
+  deallocate(p%progStruct)
+  deallocate(p%diagStruct)
+  deallocate(p%fluxStruct)
+  deallocate(p%bparStruct)
+  deallocate(p%bvarStruct)
+  deallocate(p%dparStruct)
+  deallocate(p%startTime_hru)
+  deallocate(p%finishTime_hru)
+  deallocate(p%refTime_hru)
+  deallocate(p%oldTime_hru)
+  deallocate(p%statCounter)
+  deallocate(p%outputTimeStep)
+  deallocate(p%resetStats)
+  deallocate(p%finalizeStats)
+  deallocate(p)
+
+end subroutine
 
 end module cppwrap_datatypes
 
diff --git a/build/source/actors/global/settings_functions.cpp b/build/source/actors/global/settings_functions.cpp
index ad69d90eda8ce8b36dd7b9fb03398177abbc1502..85511246aad68faf8fe38b1e512523c4f8cd2f85 100644
--- a/build/source/actors/global/settings_functions.cpp
+++ b/build/source/actors/global/settings_functions.cpp
@@ -1,9 +1,19 @@
 #include "settings_functions.hpp"
 
-std::optional<std::vector<std::string>> getSettingsArray(std::string json_settings_file, 
-    std::string key_1, std::string key_2) {
+// Default Values
+int default_partition_count = std::thread::hardware_concurrency() / 2;
+int missing_value = -9999;
+int default_gru_per_job = 250;
+int default_output_frequency = 1000;
+int default_timesteps_output_buffer = 500;
+int default_dt_init_factor = 1;
+
+
+
+std::optional<std::vector<std::string>> getSettingsArray(std::string json_settings_file, std::string key_1, std::string key_2) {
     json settings;
     std::ifstream settings_file(json_settings_file);
+    if (!settings_file.good()) return {}; // return none in the optional
     settings_file >> settings;
     settings_file.close();
     std::vector<std::string> return_vector;
@@ -31,18 +41,6 @@ std::optional<std::vector<std::string>> getSettingsArray(std::string json_settin
         std::cout << key_2 << "\n";
         return {};
     }
-   
-}
-
-int checkFileExists(std::string file_path) {
-    std::ifstream file(file_path);
-    if (file.good()) {
-        file.close();
-        return 0;
-    } else {
-        file.close();
-        return -1;
-    }
 }
 
 Distributed_Settings readDistributedSettings(std::string json_settings_file) {
@@ -56,13 +54,13 @@ Distributed_Settings readDistributedSettings(std::string json_settings_file) {
         "servers_list").value_or(std::vector<std::string>());
 
     distributed_settings.port = getSettings(json_settings_file, parent_key,
-        "port", distributed_settings.port).value_or(-1);
+        "port", distributed_settings.port).value_or(missing_value);
 
     distributed_settings.total_hru_count = getSettings(json_settings_file, parent_key,
-        "total_hru_count", distributed_settings.total_hru_count).value_or(-1);
+        "total_hru_count", distributed_settings.total_hru_count).value_or(missing_value);
 
     distributed_settings.num_hru_per_batch = getSettings(json_settings_file, parent_key,
-        "num_hru_per_batch", distributed_settings.num_hru_per_batch).value_or(-1);
+        "num_hru_per_batch", distributed_settings.num_hru_per_batch).value_or(missing_value);
     
     return distributed_settings;
 }
@@ -82,9 +80,9 @@ File_Access_Actor_Settings readFileAccessActorSettings(std::string json_settings
     File_Access_Actor_Settings file_access_actor_settings;
     std::string parent_key = "File_Access_Actor";
     file_access_actor_settings.num_partitions_in_output_buffer = getSettings(json_settings_file, parent_key,
-        "num_partitions_in_output_buffer", file_access_actor_settings.num_partitions_in_output_buffer).value_or(1);
+        "num_partitions_in_output_buffer", file_access_actor_settings.num_partitions_in_output_buffer).value_or(default_partition_count);
     file_access_actor_settings.num_timesteps_in_output_buffer = getSettings(json_settings_file, parent_key,
-        "num_timesteps_in_output_buffer", file_access_actor_settings.num_timesteps_in_output_buffer).value_or(1);
+        "num_timesteps_in_output_buffer", file_access_actor_settings.num_timesteps_in_output_buffer).value_or(default_timesteps_output_buffer);
 
     return file_access_actor_settings;
 }
@@ -111,11 +109,82 @@ HRU_Actor_Settings readHRUActorSettings(std::string json_settings_file) {
         "print_output", hru_actor_settings.print_output).value_or(true);
 
     hru_actor_settings.output_frequency = getSettings(json_settings_file, parent_key,
-        "output_frequency", hru_actor_settings.output_frequency).value_or(250);
+        "output_frequency", hru_actor_settings.output_frequency).value_or(default_output_frequency);
 
     hru_actor_settings.dt_init_factor = getSettings(json_settings_file, parent_key,
         "dt_init_factor", hru_actor_settings.dt_init_factor).value_or(1);
 
+
+    /*
+    Set Tolerances
+    ---------------
+    We can use rel_tol and abs_tol to set the tolerances for all the state variables.
+    If we set rel_tol and abs_tol in the config.json file then we just don't include 
+    the other tolerance values and they will be set to the value of rtol and atol.
+    */
+    hru_actor_settings.rel_tol = getSettings(json_settings_file, parent_key,
+        "rel_tol", hru_actor_settings.rel_tol).value_or(missing_value);
+
+    hru_actor_settings.abs_tol = getSettings(json_settings_file, parent_key,
+        "abs_tol", hru_actor_settings.abs_tol).value_or(missing_value);
+
+    double local_rtol;
+    double local_atol;
+
+    if (hru_actor_settings.rel_tol > 0) {
+        local_rtol = hru_actor_settings.rel_tol;
+    } else {
+        local_rtol = 1e-6;
+    }
+
+    if (hru_actor_settings.abs_tol > 0) {
+        local_atol = hru_actor_settings.abs_tol;
+    } else {
+        local_atol = 1e-6;
+    }
+
+    hru_actor_settings.relTolTempCas = getSettings(json_settings_file, parent_key,
+        "relTolTempCas", hru_actor_settings.relTolTempCas).value_or(local_rtol);
+
+    hru_actor_settings.absTolTempCas = getSettings(json_settings_file, parent_key,
+        "absTolTempCas", hru_actor_settings.absTolTempCas).value_or(local_atol);
+
+    hru_actor_settings.relTolTempVeg = getSettings(json_settings_file, parent_key,
+        "relTolTempVeg", hru_actor_settings.relTolTempVeg).value_or(local_rtol);
+
+    hru_actor_settings.absTolTempVeg = getSettings(json_settings_file, parent_key,
+        "absTolTempVeg", hru_actor_settings.absTolTempVeg).value_or(local_atol);
+
+    hru_actor_settings.relTolWatVeg = getSettings(json_settings_file, parent_key,
+        "relTolWatVeg", hru_actor_settings.relTolWatVeg).value_or(local_rtol);
+
+    hru_actor_settings.absTolWatVeg = getSettings(json_settings_file, parent_key,
+        "absTolWatVeg", hru_actor_settings.absTolWatVeg).value_or(local_atol);
+
+    hru_actor_settings.relTolTempSoilSnow = getSettings(json_settings_file, parent_key,
+        "relTolTempSoilSnow", hru_actor_settings.relTolTempSoilSnow).value_or(local_rtol);
+
+    hru_actor_settings.absTolTempSoilSnow = getSettings(json_settings_file, parent_key,
+        "absTolTempSoilSnow", hru_actor_settings.absTolTempSoilSnow).value_or(local_atol);
+
+    hru_actor_settings.relTolWatSnow = getSettings(json_settings_file, parent_key,
+        "relTolWatSnow", hru_actor_settings.relTolWatSnow).value_or(local_rtol);
+
+    hru_actor_settings.absTolWatSnow = getSettings(json_settings_file, parent_key,
+        "absTolWatSnow", hru_actor_settings.absTolWatSnow).value_or(local_atol);
+
+    hru_actor_settings.relTolMatric = getSettings(json_settings_file, parent_key,
+        "relTolMatric", hru_actor_settings.relTolMatric).value_or(local_rtol);
+
+    hru_actor_settings.absTolMatric = getSettings(json_settings_file, parent_key,
+        "absTolMatric", hru_actor_settings.absTolMatric).value_or(local_atol);
+
+    hru_actor_settings.relTolAquifr = getSettings(json_settings_file, parent_key,
+        "relTolAquifr", hru_actor_settings.relTolAquifr).value_or(local_rtol);
+
+    hru_actor_settings.absTolAquifr = getSettings(json_settings_file, parent_key,
+        "absTolAquifr", hru_actor_settings.absTolAquifr).value_or(local_atol);
+
     return hru_actor_settings;
 }
 
@@ -125,27 +194,78 @@ void check_settings_from_json(Distributed_Settings &distributed_settings,
     Summa_Actor_Settings &summa_actor_settings, File_Access_Actor_Settings &file_access_actor_settings, 
     Job_Actor_Settings &job_actor_settings, HRU_Actor_Settings &hru_actor_settings) {
 
-    std::cout << "************ DISTRIBUTED_SETTINGS ************\n";
-    std::cout << distributed_settings.distributed_mode << "\n";
+    std::cout << "************ DISTRIBUTED_SETTINGS ************\n"
+              << distributed_settings.distributed_mode << "\n";
     for (auto& host : distributed_settings.servers_list) {
         std::cout << host << "\n";
     }
-    std::cout << distributed_settings.port << "\n";
-    std::cout << distributed_settings.total_hru_count << "\n";
-    std::cout << distributed_settings.num_hru_per_batch << "\n";
+    std::cout << distributed_settings.port << "\n"
+              << distributed_settings.total_hru_count << "\n"
+              << distributed_settings.num_hru_per_batch << "\n"
+              << "************ SUMMA_ACTOR_SETTINGS ************\n"
+              << summa_actor_settings.max_gru_per_job << "\n\n\n"
+              << "************ FILE_ACCESS_ACTOR_SETTINGS ************\n"
+              << file_access_actor_settings.num_partitions_in_output_buffer << "\n"
+              << file_access_actor_settings.num_timesteps_in_output_buffer << "\n\n\n"
+              << "************ JOB_ACTOR_SETTINGS ************\n"
+              << job_actor_settings.file_manager_path << "\n"
+              << "************ HRU_ACTOR_SETTINGS ************\n"
+              << hru_actor_settings.print_output << "\n"
+              << hru_actor_settings.output_frequency << "\n"
+              << "rel_tol: "            << hru_actor_settings.rel_tol << "\n"
+              << "abs_tol: "            << hru_actor_settings.abs_tol << "\n"
+              << "relTolTempCas: "      << hru_actor_settings.relTolTempCas << "\n"
+              << "absTolTempCas: "      << hru_actor_settings.absTolTempCas << "\n"
+              << "relTolTempVeg: "      << hru_actor_settings.relTolTempVeg << "\n"
+              << "absTolTempVeg: "      << hru_actor_settings.absTolTempVeg << "\n"
+              << "relTolWatVeg: "       << hru_actor_settings.relTolWatVeg << "\n"
+              << "absTolWatVeg: "       << hru_actor_settings.absTolWatVeg << "\n"
+              << "relTolTempSoilSnow: " << hru_actor_settings.relTolTempSoilSnow << "\n"
+              << "absTolTempSoilSnow: " << hru_actor_settings.absTolTempSoilSnow << "\n"
+              << "relTolWatSnow: "      << hru_actor_settings.relTolWatSnow << "\n"
+              << "absTolWatSnow: "      << hru_actor_settings.absTolWatSnow << "\n"
+              << "relTolMatric: "       << hru_actor_settings.relTolMatric << "\n"
+              << "absTolMatric: "       << hru_actor_settings.absTolMatric << "\n"
+              << "relTolAquifr: "       << hru_actor_settings.relTolAquifr << "\n"
+              << "absTolAquifr: "       << hru_actor_settings.absTolAquifr << "\n\n\n";
 
-    std::cout << "************ SUMMA_ACTOR_SETTINGS ************\n";
-    std::cout << summa_actor_settings.max_gru_per_job << "\n\n\n";
+}
 
-    std::cout << "************ FILE_ACCESS_ACTOR_SETTINGS ************\n";
-    std::cout << file_access_actor_settings.num_partitions_in_output_buffer << "\n";
-    std::cout << file_access_actor_settings.num_timesteps_in_output_buffer << "\n\n\n";
 
-    std::cout << "************ JOB_ACTOR_SETTINGS ************\n";
-    std::cout << job_actor_settings.file_manager_path << "\n";
+void generate_config_file() {
+    json config_file; 
+    config_file["Distributed_Settings"] = {
+        {"distributed_mode", false},
+        {"port", missing_value},
+        {"total_hru_count", missing_value},
+        {"num_hru_per_batch", missing_value},
+        {"servers_list", {
+            {{"hostname", "host_1"}},
+            {{"hostname", "host_2"}},
+            {{"hostname", "host_3"}}
+        }}
+    };
 
-    std::cout << "************ HRU_ACTOR_SETTINGS ************\n";
-    std::cout << hru_actor_settings.print_output << "\n";
-    std::cout << hru_actor_settings.output_frequency << "\n\n\n"; 
+    config_file["Summa_Actor"] = {
+        {"max_gru_per_job", default_gru_per_job}
+    };
+    config_file["File_Access_Actor"] = {
+        {"num_partitions_in_output_buffer", default_partition_count},
+        {"num_timesteps_in_output_buffer", default_timesteps_output_buffer}
+    };
+    config_file["Job_Actor"] = {
+        {"file_manager_path", "/home/username/summa_file_manager"},
+        {"max_run_attempts", 1}
+    };
+    config_file["HRU_Actor"] = {
+        {"print_output", true},
+        {"output_frequency", default_output_frequency},
+        {"dt_init_factor", 1},
+        {"rel_tol", missing_value},
+        {"abs_tol", missing_value}
+    };
 
+    std::ofstream config_file_stream("config.json");
+    config_file_stream << std::setw(4) << config_file.dump(4) << std::endl;
+    config_file_stream.close();
 }
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/cpp_code/hru_actor.cpp b/build/source/actors/hru_actor/cpp_code/hru_actor.cpp
deleted file mode 100644
index 89108d4ac7c0526589d0cc0725b0757d0d5e77c5..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/cpp_code/hru_actor.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-#include "caf/all.hpp"
-#include "hru_actor.hpp"
-#include "global.hpp"
-#include "message_atoms.hpp"
-#include "hru_actor_subroutine_wrappers.hpp"
-#include "serialize_data_structure.hpp"
-#include <thread>
-
-
-namespace caf {
-
-behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
-    HRU_Actor_Settings hru_actor_settings, caf::actor file_access_actor, caf::actor parent) {
-    
-    // Actor References
-    self->state.file_access_actor = file_access_actor;
-    self->state.parent            = parent;
-    // Indexes into global structures
-    self->state.indxHRU           = 1;
-    self->state.indxGRU           = indxGRU;
-    self->state.refGRU            = refGRU;
-    // initialize counters 
-    self->state.timestep          = 1;  
-    self->state.forcingStep       = 1;  
-    self->state.output_structure_step_index = 1;
-    self->state.iFile             = 1;
-    // Get the settings for the HRU
-    self->state.hru_actor_settings = hru_actor_settings;
-    self->state.dt_init_factor = hru_actor_settings.dt_init_factor;
-
-
-    initHRU(&self->state.indxGRU, &self->state.num_steps, self->state.handle_lookupStruct, self->state.handle_forcStat,
-        self->state.handle_progStat, self->state.handle_diagStat, self->state.handle_fluxStat, self->state.handle_indxStat, 
-        self->state.handle_bvarStat, self->state.handle_timeStruct, self->state.handle_forcStruct, self->state.handle_indxStruct,
-        self->state.handle_progStruct, self->state.handle_diagStruct, self->state.handle_fluxStruct,
-        self->state.handle_bvarStruct, self->state.handle_startTime, self->state.handle_finshTime, 
-        self->state.handle_refTime,self->state.handle_oldTime, &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "Error: HRU_Actor - Initialize - HRU = " << self->state.indxHRU << 
-            " - indxGRU = " << self->state.indxGRU << " - refGRU = "<< self->state.refGRU << std::endl;
-        aout(self) << "Error = " << self->state.err << "\n";
-        self->quit();
-    }
-
-    // Initialize flags taht are used for the output 
-    initStatisticsFlags(self->state.handle_statCounter, self->state.handle_outputTimeStep, 
-        self->state.handle_resetStats, self->state.handle_finalizeStats, &self->state.err);
-
-
-    self->send(self->state.file_access_actor, get_num_output_steps_v, self);
-
-    // Get attributes
-    self->send(self->state.file_access_actor, get_attributes_params_v, self->state.indxGRU, self);
-
-
-    return {
-
-        // First method called after initialization, starts the HRU and the HRU asks
-        // for parameters and forcing data from the file_access_actor
-        [=](start_hru) {
-            int err = 0;
-            std::vector<double> attr_struct_array = get_var_d(self->state.handle_attrStruct); 
-            std::vector<int> type_struct_array    = get_var_i(self->state.handle_typeStruct);
-            std::vector<std::vector<double>> mpar_struct_array = get_var_dlength(self->state.handle_mparStruct);
-            std::vector<double> bpar_struct_array = get_var_d(self->state.handle_bparStruct);
-
-            // ask file_access_actor to write parameters
-            self->send(self->state.file_access_actor, write_param_v, 
-                self->state.indxGRU, self->state.indxHRU, attr_struct_array,
-                type_struct_array, mpar_struct_array, bpar_struct_array);
-            
-            // ask file_access_actor for forcing data
-            self->send(self->state.file_access_actor, access_forcing_v, self->state.iFile, self);
-            
-        },
-
-        // Starts the HRU and tells it to ask for data from the file_access_actor
-        [=](get_attributes_params, std::vector<double> attr_struct, std::vector<int> type_struct, 
-            std::vector<long int> id_struct, std::vector<double> bpar_struct, 
-            std::vector<double> dpar_struct, std::vector<std::vector<double>> mpar_struct) {
-            
-            int err = 0;
-            set_var_d(attr_struct, self->state.handle_attrStruct);
-            set_var_i(type_struct, self->state.handle_typeStruct);
-            set_var_i8(id_struct, self->state.handle_idStruct);
-            set_var_d(bpar_struct, self->state.handle_bparStruct);
-            set_var_d(dpar_struct, self->state.handle_dparStruct);
-            set_var_dlength(mpar_struct, self->state.handle_mparStruct);
-
-            Initialize_HRU(self);
-
-            self->send(self, start_hru_v);
-        },
-
-        [=](num_steps_before_write, int num_steps) {
-            self->state.num_steps_until_write = num_steps;
-            self->state.output_structure_step_index = 1;
-        },
-
-        // Run HRU for a number of timesteps
-        [=](run_hru) {
-            int err = 0;
-
-            if (self->state.timestep == 1) {
-                getFirstTimestep(&self->state.iFile, &self->state.forcingStep, &err);
-                if (self->state.forcingStep == -1) { aout(self) << "HRU - Wrong starting forcing file\n";} 
-            }
-
-            while(self->state.num_steps_until_write > 0) {
-                if (self->state.forcingStep > self->state.stepsInCurrentFFile) {
-                    self->send(self->state.file_access_actor, access_forcing_v, self->state.iFile+1, self);
-                    break;
-                }
-
-                self->state.num_steps_until_write--;
-
-                err = Run_HRU(self); // Simulate a Timestep
-
-                if (err != 0) {
-                    aout(self) << "Error: HRU_Actor - Run_HRU - HRU = " << self->state.indxHRU << 
-                        " - indxGRU = " << self->state.indxGRU << " - refGRU = "<< self->state.refGRU << std::endl;
-                    aout(self) << "Error = " << err << "\n";
-
-                    self->send(self->state.parent, hru_error::run_physics_unhandleable, self);
-                    self->quit();
-                    return;
-                }
-
-                writeHRUToOutputStructure(&self->state.indxHRU, &self->state.indxGRU, 
-                    &self->state.output_structure_step_index,
-                    self->state.handle_forcStat,
-                    self->state.handle_progStat,
-                    self->state.handle_diagStat,
-                    self->state.handle_fluxStat,
-                    self->state.handle_indxStat,
-                    self->state.handle_bvarStat,
-                    self->state.handle_timeStruct,
-                    self->state.handle_forcStruct,
-                    self->state.handle_indxStruct,
-                    self->state.handle_mparStruct,
-                    self->state.handle_progStruct,
-                    self->state.handle_diagStruct,
-                    self->state.handle_fluxStruct,
-                    self->state.handle_bparStruct,
-                    self->state.handle_bvarStruct,
-                    self->state.handle_statCounter,
-                    self->state.handle_outputTimeStep,
-                    self->state.handle_resetStats,
-                    self->state.handle_finalizeStats,
-                    self->state.handle_finshTime,
-                    self->state.handle_oldTime,
-                    &err);
-                if (err != 0) {
-                    aout(self) << "Error: HRU_Actor - writeHRUToOutputStructure - HRU = " << self->state.indxHRU << 
-                        " - indxGRU = " << self->state.indxGRU << " - refGRU = "<< self->state.refGRU << std::endl;
-                    aout(self) << "Error = " << err << "\n";
-                    self->send(self->state.parent, hru_error::run_physics_unhandleable, self);
-                    self->quit();
-                    return;
-                }
-
-                self->state.timestep++;
-                self->state.forcingStep++;
-                self->state.output_structure_step_index++;
- 
-                if (self->state.timestep > self->state.num_steps) {
-                    self->send(self, done_hru_v);
-                    break;
-                }
-
-            }
-            // Our output structure is full
-            if (self->state.num_steps_until_write <= 0) {
-                self->send(self->state.file_access_actor, write_output_v, self->state.indxGRU, self->state.indxHRU, self);
-            }
-        },
-
-
-        [=](new_forcing_file, int num_forcing_steps_in_iFile, int iFile) {
-            int err;
-            self->state.iFile = iFile;
-            self->state.stepsInCurrentFFile = num_forcing_steps_in_iFile;
-            setTimeZoneOffset(&self->state.iFile, &self->state.tmZoneOffsetFracDay, &err);
-            self->state.forcingStep = 1;
-            self->send(self, run_hru_v);
-        },
-
-        
-        [=](done_hru) {
-
-            self->send(self->state.parent, 
-                done_hru_v,
-                self->state.indxGRU);
-            
-            self->quit();
-            return;
-        },
-
-        [=](dt_init_factor, int dt_init_factor) {
-            aout(self) << "Recieved New dt_init_factor to attempt on next run \n";
-        },
-    };
-}
-
-
-
-void Initialize_HRU(stateful_actor<hru_state>* self) {
-
-    setupHRUParam(&self->state.indxHRU, 
-            &self->state.indxGRU,
-            self->state.handle_attrStruct, 
-            self->state.handle_typeStruct, 
-            self->state.handle_idStruct,
-            self->state.handle_mparStruct, 
-            self->state.handle_bparStruct, 
-            self->state.handle_bvarStruct,
-            self->state.handle_dparStruct, 
-            self->state.handle_lookupStruct,
-            self->state.handle_startTime, 
-            self->state.handle_oldTime,
-            &self->state.upArea, &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "Error: HRU_Actor - SetupHRUParam - HRU = " << self->state.indxHRU <<
-        " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU << std::endl;
-        self->quit();
-        return;
-    }
-            
-    Restart(&self->state.indxGRU, 
-            &self->state.indxHRU, 
-            self->state.handle_indxStruct, 
-            self->state.handle_mparStruct, 
-            self->state.handle_progStruct,
-            self->state.handle_diagStruct, 
-            self->state.handle_fluxStruct, 
-            self->state.handle_bvarStruct, 
-            &self->state.dt_init, &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "Error: HRU_Actor - Restart - HRU = " << self->state.indxHRU <<
-        " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU << std::endl;
-        self->quit();
-        return;
-    }
-            
-}
-
-int Run_HRU(stateful_actor<hru_state>* self) {
-    /**********************************************************************
-    ** READ FORCING
-    **********************************************************************/    
-
-    readForcingHRU(&self->state.indxGRU,
-                   &self->state.timestep,
-                   &self->state.forcingStep,
-                   self->state.handle_timeStruct,
-                   self->state.handle_forcStruct, 
-                   &self->state.iFile,
-                   &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "Error: HRU_Actor - ReadForcingHRU - HRU = " << self->state.indxHRU <<
-        " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU << std::endl;
-        aout(self) << "Forcing Step = " << self->state.forcingStep << std::endl;
-        aout(self) << "Timestep = " << self->state.timestep << std::endl;
-        aout(self) << "iFile = " << self->state.iFile << std::endl;
-        aout(self) << "Steps in Forcing File = " << self->state.stepsInCurrentFFile << std::endl;
-        self->quit();
-        return -1;
-    }
-
-    computeTimeForcingHRU(self->state.handle_timeStruct,
-                          self->state.handle_forcStruct, 
-                          &self->state.fracJulDay,
-                          &self->state.yearLength,
-                          &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "Error: HRU_Actor - ComputeTimeForcingHRU - HRU = " << self->state.indxHRU <<
-        " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU << std::endl;
-        aout(self) << "Forcing Step = " << self->state.forcingStep << std::endl;
-        aout(self) << "Timestep = " << self->state.timestep << std::endl;
-        aout(self) << "iFile = " << self->state.iFile << std::endl;
-        aout(self) << "Steps in Forcing File = " << self->state.stepsInCurrentFFile << std::endl;
-        self->quit();
-        return -1;
-    }
-
-    if (self->state.err != 0) { 
-        aout(self) << "*********************************************************\n";
-        aout(self) << "Error: Forcing - HRU = " << self->state.indxHRU <<
-        " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU <<
-        " - Timestep = " << self->state.timestep << "\n" <<
-        "   iFile = "  << self->state.iFile << "\n" <<
-        "   forcing step" << self->state.forcingStep << "\n" <<
-        "   numSteps in forcing file" << self->state.stepsInCurrentFFile << "\n";
-        aout(self) << "*********************************************************\n";
-        return 10;
-    }
-
-    if (self->state.hru_actor_settings.print_output && 
-        self->state.timestep % self->state.hru_actor_settings.output_frequency == 0) {
-        printOutput(self);
-    }
-    
-
-    /**********************************************************************
-    ** RUN_PHYSICS    
-    **********************************************************************/    
-
-    self->state.err = 0;
-    RunPhysics(&self->state.indxHRU,
-        &self->state.timestep,
-        self->state.handle_timeStruct, 
-        self->state.handle_forcStruct,
-        self->state.handle_attrStruct,
-        self->state.handle_typeStruct, 
-        self->state.handle_indxStruct,
-        self->state.handle_mparStruct, 
-        self->state.handle_progStruct,
-        self->state.handle_diagStruct,
-        self->state.handle_fluxStruct,
-        self->state.handle_bvarStruct,
-        self->state.handle_lookupStruct,
-        &self->state.fracJulDay,
-        &self->state.tmZoneOffsetFracDay,
-        &self->state.yearLength,
-        &self->state.computeVegFlux,
-        &self->state.dt_init, 
-        &self->state.dt_init_factor,
-        &self->state.err);
-    if (self->state.err != 0) {
-        aout(self) << "Error: RunPhysics - HRU = " << self->state.indxHRU << 
-            " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU <<
-            " - Timestep = " << self->state.timestep << std::endl;
-        self->quit();
-        return 20;
-    }
-
-    return 0;      
-}
-
-
-void printOutput(stateful_actor<hru_state>* self) {
-        aout(self) << self->state.refGRU << " - Timestep = " << self->state.timestep << std::endl;
-}
-
-}
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/fortran_code/hru_actor.f90 b/build/source/actors/hru_actor/fortran_code/hru_actor.f90
deleted file mode 100644
index 1f14acb8df6cd157653225c25da17c68aade2f5c..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/hru_actor.f90
+++ /dev/null
@@ -1,552 +0,0 @@
-module hru_actor
-USE,intrinsic :: iso_c_binding
-USE nrtype
-USE data_types,only:&
-                    var_i,          &  
-                    var_i8,         &
-                    var_d,          &
-                    var_ilength,    &
-                    var_dlength,    &
-                    flagVec
-implicit none
-
-public::getFirstTimestep
-public::setTimeZoneOffset
-public::prepareOutput
-public::updateCounters
-
-real(dp),parameter  :: verySmall=1e-3_rkind      ! tiny number
-real(dp),parameter  :: smallOffset=1.e-8_rkind   ! small offset (units=days) to force ih=0 at the start of the day
-
-contains
-
-
-! Find the first timestep within the forcing file
-subroutine getFirstTimestep(iFile, iRead, err) bind(C, name="getFirstTimestep")
-  USE globalData,only:forcingDataStruct         ! forcing structure
-  USE globalData,only:vecTime                   ! time structure for forcing 
-  USE globalData,only:dJulianStart              ! julian day of start time of simulation
-  USE globalData,only:data_step                 ! length of the data step (s)
-  USE globalData,only:refJulday_data            ! reference time for data files (fractional julian days)
-   
-  USE multiconst,only:secprday                  ! number of seconds in a day
-  
-  USE nr_utility_module,only:arth               ! get a sequence of numbers
-
-  implicit none
-
-  integer(c_int),intent(in)                               :: iFile
-  integer(c_int),intent(out)                              :: iRead
-  integer(c_int),intent(out)                              :: err
-  ! local variables
-  character(len=256)                                      :: message
-  real(dp)                                                :: timeVal(1)    ! single time value (restrict time read)
-  real(dp),dimension(forcingDataStruct(iFile)%nTimeSteps) :: fileTime      ! array of time from netcdf file
-  real(dp),dimension(forcingDataStruct(iFile)%nTimeSteps) :: diffTime      ! array of time differences
-
-  err=0; message="hru_actor.f90 - getFirstTimeStep"
-
-  ! get time vector & convert units based on offset and data step
-  timeVal(1) = vecTime(iFile)%dat(1)
-  fileTime = arth(0,1,forcingDataStruct(iFile)%nTimeSteps) * data_step/secprday + refJulday_data &
-              + timeVal(1)/forcingDataStruct(iFile)%convTime2Days
-
-  ! find difference of fileTime from currentJulday
-  diffTime=abs(fileTime-dJulianStart)
-  
-  if(any(diffTime < verySmall))then
-    iRead=minloc(diffTime,1)
-  else
-    iRead=-1 ! set to -1 to designinate this forcing file is not the start
-  endif
-  
-end subroutine getFirstTimestep
-
-! set the refTimeString and extract the time to set the tmZonOffsetFracDay
-subroutine setTimeZoneOffset(iFile, tmZoneOffsetFracDay, err) bind(C, name="setTimeZoneOffset")
-  USE globalData,only:forcingDataStruct         ! forcing structure
-
-
-  USE time_utils_module,only:extractTime        ! extract time info from units string
-  USE time_utils_module,only:fracDay            ! compute fractional day
-
-  USE summafilemanager,only:NC_TIME_ZONE
-  implicit none
-
-  integer(c_int),intent(in)             :: iFile
-  real(c_double),intent(out)            :: tmZoneOffsetFracDay
-  integer(c_int),intent(out)            :: err
-
-  ! local variables
-  character(len=256)                    :: message
-  character(len=256)                    :: cmessage
-  integer(i4b)                          :: iyyy,im,id,ih,imin ! date
-  integer(i4b)                          :: ih_tz,imin_tz      ! time zone information
-  real(dp)                              :: dsec,dsec_tz       ! seconds
-
-  err=0; message="hru_actor.f90 - setForcingTimeInfo";
-
- ! define the reference time for the model simulation
- call extractTime(forcingDataStruct(iFile)%refTimeString,& ! input  = units string for time data
-                 iyyy,im,id,ih,imin,dsec,                & ! output = year, month, day, hour, minute, second
-                 ih_tz, imin_tz, dsec_tz,                & ! output = time zone information (hour, minute, second)
-                 err,cmessage)                             ! output = error code and error message
-  if(err/=0)then; message=trim(message)//trim(cmessage); print*, "message"; return; end if
-  
- ! set the timezone offset
- select case(trim(NC_TIME_ZONE))
-    case('ncTime'); tmZoneOffsetFracDay = sign(1, ih_tz) * fracDay(ih_tz,   & ! time zone hour
-                                                                  imin_tz, & ! time zone minute
-                                                                  dsec_tz)   ! time zone second
-    case('utcTime');   tmZoneOffsetFracDay = 0._dp
-    case('localTime'); tmZoneOffsetFracDay = 0._dp
-    case default; err=20; message=trim(message)//'unable to identify time zone info option'; return
-  end select ! (option time zone option)
-
-end subroutine setTimeZoneOffset
-
-
-subroutine readForcingHRU(indxGRU, iStep, iRead, handle_timeStruct, handle_forcStruct, &
-                          iFile, err) bind(C, name="readForcingHRU")
-  USE multiconst,only:secprday                  ! number of seconds in a day
-  ! global Data
-  USE globalData,only:data_step                 ! length of the data step (s)
-  USE globalData,only:dJulianStart              ! julian day of start time of simulation
-  USE globalData,only:refJulday_data            ! reference time for data files (fractional julian days)
-  USE globalData,only:integerMissing            ! integer missing value
-  USE globalData,only:vecTime
-  USE globalData,only:forcingDataStruct
-  USE globalData,only:time_meta,forc_meta
-  USE var_lookup,only:iLookTIME,iLookFORCE
-  USE data_types,only:var_i,var_d
-  USE netcdf                                   ! used for nf90_max_name
-  USE time_utils_module,only:compcalday                 ! convert julian day to calendar date
-
-  implicit none
-
-  integer(c_int),intent(in)               :: indxGRU          ! Index of the GRU in gru_struc
-  integer(c_int),intent(in)               :: istep            ! Model Timestep
-  integer(c_int),intent(in)               :: iRead            ! Model Timestep 
-  type(c_ptr),intent(in),value            :: handle_timeStruct! vector of time data for a given time step
-  type(c_ptr),intent(in),value            :: handle_forcStruct! model parameters
-  integer(c_int),intent(in)               :: iFile            ! index of current forcing file from forcing file list 
-  integer(c_int),intent(out)              :: err              ! Model Timestep
-  ! local variables
-  type(var_i),pointer                     :: timeStruct       !  model time data
-  type(var_d),pointer                     :: forcStruct       !  model forcing data
-  real(dp)                                :: currentJulday    ! Julian day of current time step
-  real(dp)                                :: dataJulDay       ! julian day of current forcing data step being read
-  ! Counters
-  integer(i4b)                            :: iline            ! loop through lines in the file
-  integer(i4b)                            :: iVar
-  integer(i4b)                            :: iNC
-  ! other
-  logical(lgt),dimension(size(forc_meta)) :: checkForce       ! flags to check forcing data variables exist
-  
-  real(dp)                                :: dsec             ! double precision seconds (not used)
-  real(dp),parameter                      :: dataMin=-1._dp   ! minimum allowable data value (all forcing variables should be positive)
-  character(len = nf90_max_name)          :: varName          ! dimenison name
-
-  character(len=256)                      :: message          ! error message
-  character(len=256)                      :: cmessage         ! error message
-
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_forcStruct, forcStruct)
-
-  err=0;message="hru_actor.f90 - readForcingHRU";
-
-  ! determine the julDay of current model step (istep) we need to read
-  currentJulDay = dJulianStart + (data_step*real(iStep-1,dp))/secprday
-
-  timeStruct%var(:) = integerMissing
-  dataJulDay = vecTime(iFile)%dat(iRead)/forcingDataStruct(iFile)%convTime2Days + refJulday_data
- if(abs(currentJulday - dataJulDay) > verySmall)then
-    write(message,'(a,f18.8,a,f18.8)') trim(message)//'date for time step: ',dataJulDay,' differs from the expected date: ',currentJulDay
-    print*, message
-    err=40
-    return
-  end if
-
-  ! convert julian day to time vector
-  ! NOTE: use small offset to force ih=0 at the start of the day
-  call compcalday(dataJulDay+smallOffset,         & ! input  = julian day
-                  timeStruct%var(iLookTIME%iyyy),      & ! output = year
-                  timeStruct%var(iLookTIME%im),        & ! output = month
-                  timeStruct%var(iLookTIME%id),        & ! output = day
-                  timeStruct%var(iLookTIME%ih),        & ! output = hour
-                  timeStruct%var(iLookTIME%imin),dsec, & ! output = minute/second
-                  err,cmessage)                     ! output = error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-  
-  ! check to see if any of the time data is missing -- note that it is OK if ih_tz or imin_tz are missing
-  if((timeStruct%var(iLookTIME%iyyy)==integerMissing) .or. (timeStruct%var(iLookTIME%im)==integerMissing) .or. (timeStruct%var(iLookTIME%id)==integerMissing) .or. (timeStruct%var(iLookTIME%ih)==integerMissing) .or. (timeStruct%var(iLookTIME%imin)==integerMissing))then
-      do iline=1,size(timeStruct%var)
-          if(timeStruct%var(iline)==integerMissing)then; err=40; message=trim(message)//"variableMissing[var='"//trim(time_meta(iline)%varname)//"']"; return; end if
-      end do
-  end if
-
-  ! initialize flags for forcing data
-  checkForce(:) = .false.
-  checkForce(iLookFORCE%time) = .true.  ! time is handled separately
-
-  do iNC=1,forcingDataStruct(iFile)%nVars
-    ! check variable is desired
-    if(forcingDataStruct(iFile)%var_ix(iNC)==integerMissing) cycle
-
-    ! get index in forcing structure
-    iVar = forcingDataStruct(iFile)%var_ix(iNC)
-    checkForce(iVar) = .true.
-
-    ! check individual data value
-    if(forcingDataStruct(iFile)%var(ivar)%dataFromFile(indxGRU,iRead)<dataMin)then
-      write(message,'(a,f13.5)') trim(message)//'forcing data for variable '//trim(varname)//' is less than minimum allowable value ', dataMin
-      err=20; return
-    endif
-    ! put the data into structures
-    forcStruct%var(ivar) = forcingDataStruct(iFile)%var(ivar)%dataFromFile(indxGRU,iRead)
-  end do  ! loop through forcing variables
-  
-  ! check if any forcing data is missing
-  if(count(checkForce)<size(forc_meta))then
-    do iline=1,size(forc_meta)
-    if(.not.checkForce(iline))then
-      message=trim(message)//"checkForce_variableMissing[var='"//trim(forc_meta(iline)%varname)//"']"
-      err=20; return
-    endif    ! if variable is missing
-    end do   ! looping through variables
-  end if   ! if any variables are missing
-end subroutine readForcingHRU 
-
-! This is part 2: from the reading of forcing - separated it so we could call from C++
-subroutine computeTimeForcingHRU(handle_timeStruct, handle_forcStruct, fracJulDay, yearLength, err) bind(C, name="computeTimeForcingHRU")
-  USE var_lookup,only:iLookTIME,iLookFORCE
-  USE time_utils_module,only:compJulday         ! convert calendar date to julian day
-  USE data_types,only:var_i,var_d
-  USE multiconst,only:secprday                  ! number of seconds in a day
-  USE globalData,only:refJulday                 ! reference time (fractional julian days)
-
-  implicit none
-  type(c_ptr),intent(in),value        :: handle_timeStruct     ! vector of time data for a given time step
-  type(c_ptr),intent(in),value        :: handle_forcStruct ! model parameters
-  real(c_double),intent(out)          :: fracJulDay
-  integer(c_int),intent(out)          :: yearLength    
-  integer(c_int),intent(out)          :: err   
-  ! local variables
-  type(var_i),pointer                 :: timeStruct       !  model time data
-  type(var_d),pointer                 :: forcStruct       !  model forcing data
-  real(dp)                            :: startJulDay      ! julian day at the start of the year
-  real(dp)                            :: currentJulday    ! Julian day of current time step
-  character(len=256)                  :: message          ! error message for downwind routine
-  character(len=256)                  :: cmessage         ! error message for downwind routine
-  logical(lgt),parameter              :: checkTime=.false.  ! flag to check the time
-
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_forcStruct, forcStruct)
-
-  err=0; message="hru_actor.f90 - computTimeForcingHRU/"
-
-  ! compute the julian day at the start of the year
-  call compjulday(timeStruct%var(iLookTIME%iyyy),          & ! input  = year
-                  1, 1, 1, 1, 0._dp,                  & ! input  = month, day, hour, minute, second
-                  startJulDay,err,cmessage)             ! output = julian day (fraction of day) + error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-
-  ! compute the fractional julian day for the current time step
-  call compjulday(timeStruct%var(iLookTIME%iyyy),           & ! input  = year
-                  timeStruct%var(iLookTIME%im),             & ! input  = month
-                  timeStruct%var(iLookTIME%id),             & ! input  = day
-                  timeStruct%var(iLookTIME%ih),             & ! input  = hour
-                  timeStruct%var(iLookTIME%imin),0._dp,     & ! input  = minute/second
-                  currentJulday,err,cmessage)            ! output = julian day (fraction of day) + error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-  ! compute the time since the start of the year (in fractional days)
-  fracJulDay = currentJulday - startJulDay
-  ! set timing of current forcing vector (in seconds since reference day)
-  ! NOTE: It is a bit silly to have time information for each HRU and GRU
-  forcStruct%var(iLookFORCE%time) = (currentJulday-refJulday)*secprday
-
-  ! compute the number of days in the current year
-  yearLength = 365
-  if(mod(timeStruct%var(iLookTIME%iyyy),4) == 0)then
-    yearLength = 366
-    if(mod(timeStruct%var(iLookTIME%iyyy),100) == 0)then
-    yearLength = 365
-    if(mod(timeStruct%var(iLookTIME%iyyy),400) == 0)then
-      yearLength = 366
-    end if
-    end if
-  end if
-
-  ! test
-  if(checkTime)then
-    write(*,'(i4,1x,4(i2,1x),f9.3,1x,i4)')  timeStruct%var(iLookTIME%iyyy),           & ! year
-                                            timeStruct%var(iLookTIME%im),             & ! month
-                                            timeStruct%var(iLookTIME%id),             & ! day
-                                            timeStruct%var(iLookTIME%ih),             & ! hour
-                                            timeStruct%var(iLookTIME%imin),           & ! minute
-                                            fracJulDay,                          & ! fractional julian day for the current time step
-                                            yearLength                             ! number of days in the current year
-    !pause ' checking time'
-  end if
-end subroutine computeTimeForcingHRU
-
-! Prepare structure for being sent off to the file access actor
-! call set alarms and calc stats
-subroutine prepareOutput(&
-                        modelTimeStep,      &
-                        ! statistics variables
-                        handle_forcStat,           & ! model forcing data
-                        handle_progStat,           & ! model prognostic (state) variables
-                        handle_diagStat,           & ! model diagnostic variables
-                        handle_fluxStat,           & ! model fluxes
-                        handle_indxStat,           & ! model indices
-                        handle_bvarStat,           & ! basin-average variables
-                        ! primary data structures (scalars)
-                        handle_timeStruct,         & ! x%var(:)     -- model time data
-                        handle_forcStruct,         & ! x%var(:)     -- model forcing data
-                        handle_attrStruct,         & ! x%var(:)     -- local attributes for each HRU
-                        handle_typeStruct,         & ! x%var(:)     -- local classification of soil veg etc. for each HRU
-                        ! primary data structures (variable length vectors)
-                        handle_indxStruct,         & ! x%var(:)%dat -- model indices
-                        handle_mparStruct,         & ! x%var(:)%dat -- model parameters
-                        handle_progStruct,         & ! x%var(:)%dat -- model prognostic (state) variables
-                        handle_diagStruct,         & ! x%var(:)%dat -- model diagnostic variables
-                        handle_fluxStruct,         & ! x%var(:)%dat -- model fluxes
-                        ! basin-average structures
-                        handle_bparStruct,         & ! x%var(:)     -- basin-average parameters
-                        handle_bvarStruct,         & ! x%var(:)%dat -- basin-average variables
-                        handle_statCounter,        &
-                        handle_outputTimeStep,     & ! x%var(:)
-                        handle_resetStats,         & ! x%var(:)
-                        handle_finalizeStats,      & ! x%var(:)
-                        handle_finshTime,          & ! x%var(:)    -- end time for the model simulation
-                        handle_oldTime,            & ! x%var(:)    -- time for the previous model time step
-                        err) bind(C, name="prepareOutput")
-  USE globalData,only:structInfo
-  USE globalData,only:startWrite,endWrite
-
-  USE globalData,only:ixProgress                              ! define frequency to write progress
-  USE globalData,only:ixRestart                               ! define frequency to write restart files
-  USE globalData,only:gru_struc
-
-  USE globalData,only:newOutputFile                           ! define option for new output files
-  USE summa_alarms,only:summa_setWriteAlarms
-
-  USE globalData,only:forc_meta,attr_meta,type_meta           ! metaData structures
-  USE output_stats,only:calcStats                             ! module for compiling output statistics
-  USE var_lookup,only:iLookTIME,iLookDIAG,iLookPROG,iLookINDEX, &
-    iLookFreq,maxvarFreq ! named variables for time data structure
-  USE globalData,only:time_meta,forc_meta,diag_meta,prog_meta,&
-    flux_meta,indx_meta,bvar_meta,bpar_meta,mpar_meta           ! metadata on the model time
-  USE globalData,only:statForc_meta,statProg_meta,statDiag_meta,&
-    statFlux_meta,statIndx_meta,statBvar_meta             ! child metadata for stats
-  ! index of the child data structure
-  USE globalData,only:forcChild_map,progChild_map,diagChild_map,&
-    fluxChild_map,indxChild_map,bvarChild_map             ! index of the child data structure: stats forc
-  implicit none
-  integer(i4b),intent(in)                  :: modelTimeStep   ! time step index
-  type(c_ptr), intent(in), value           :: handle_forcStat !  model forcing data
-  type(c_ptr), intent(in), value           :: handle_progStat !  model prognostic (state) variables
-  type(c_ptr), intent(in), value           :: handle_diagStat !  model diagnostic variables
-  type(c_ptr), intent(in), value           :: handle_fluxStat !  model fluxes
-  type(c_ptr), intent(in), value           :: handle_indxStat !  model indices
-  type(c_ptr), intent(in), value           :: handle_bvarStat !  basin-average variables
-  ! primary data structures (scalars)
-  type(c_ptr), intent(in), value           :: handle_timeStruct !  model time data
-  type(c_ptr), intent(in), value           :: handle_forcStruct !  model forcing data
-  type(c_ptr), intent(in), value           :: handle_attrStruct !  local attributes for each HRU
-  type(c_ptr), intent(in), value           :: handle_typeStruct !  local classification of soil veg etc. for each HRU
-  ! primary data structures (variable length vectors)
-  type(c_ptr), intent(in), value           :: handle_indxStruct !  model indices
-  type(c_ptr), intent(in), value           :: handle_mparStruct !  model parameters
-  type(c_ptr), intent(in), value           :: handle_progStruct !  model prognostic (state) variables
-  type(c_ptr), intent(in), value           :: handle_diagStruct !  model diagnostic variables
-  type(c_ptr), intent(in), value           :: handle_fluxStruct !  model fluxes
-  ! basin-average structures
-  type(c_ptr), intent(in), value           :: handle_bparStruct !  basin-average parameters
-  type(c_ptr), intent(in), value           :: handle_bvarStruct !  basin-average variables
-  ! local HRU variables
-  type(c_ptr), intent(in), value           :: handle_statCounter
-  type(c_ptr), intent(in), value           :: handle_outputTimeStep
-  type(c_ptr), intent(in), value           :: handle_resetStats
-  type(c_ptr), intent(in), value           :: handle_finalizeStats
-  type(c_ptr), intent(in), value           :: handle_finshTime    ! end time for the model simulation
-  type(c_ptr), intent(in), value           :: handle_oldTime      ! time for the previous model time step
-  ! run time variables
-  integer(i4b),intent(out)                 :: err
-  ! local vairiables for pointers
-  type(var_dlength),pointer                :: forcStat        ! model forcing data
-  type(var_dlength),pointer                :: progStat        ! model prognostic (state) variables
-  type(var_dlength),pointer                :: diagStat        ! model diagnostic variables
-  type(var_dlength),pointer                :: fluxStat        ! model fluxes
-  type(var_dlength),pointer                :: indxStat        ! model indices
-  type(var_dlength),pointer                :: bvarStat        ! basin-average variabl
-  type(var_i),pointer                      :: timeStruct      ! model time data
-  type(var_d),pointer                      :: forcStruct      ! model forcing data
-  type(var_d),pointer                      :: attrStruct      ! local attributes for each HRU
-  type(var_i),pointer                      :: typeStruct      ! local classification of soil veg etc. for each HRU
-  type(var_ilength),pointer                :: indxStruct      ! model indices
-  type(var_dlength),pointer                :: mparStruct      ! model parameters
-  type(var_dlength),pointer                :: progStruct      ! model prognostic (state) variables
-  type(var_dlength),pointer                :: diagStruct      ! model diagnostic variables
-  type(var_dlength),pointer                :: fluxStruct      ! model fluxes
-  type(var_d),pointer                      :: bparStruct      ! basin-average parameters
-  type(var_dlength),pointer                :: bvarStruct      ! basin-average variables
-  type(var_i),pointer                      :: statCounter     ! time counter for stats
-  type(var_i),pointer                      :: outputTimeStep  ! timestep in output files
-  type(flagVec),pointer                    :: resetStats      ! flags to reset statistics
-  type(flagVec),pointer                    :: finalizeStats   ! flags to finalize statistics
-  type(var_i),pointer                      :: finshTime       ! end time for the model simulation
-  type(var_i),pointer                      :: oldTime         !
-  ! local variables
-  character(len=256)                       :: message 
-  character(len=256)                       :: cmessage
-  logical(lgt)                             :: defNewOutputFile=.false.
-  integer(i4b)                             :: iFreq             ! index of the output frequency
-  integer(i4b)                             :: iStruct           ! index of model structure
-  logical(lgt)                             :: printProgress=.false.
-  logical(lgt)                             :: printRestart=.false.
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_forcStat, forcStat)
-  call c_f_pointer(handle_progStat, progStat)
-  call c_f_pointer(handle_diagStat, diagStat)
-  call c_f_pointer(handle_fluxStat, fluxStat)
-  call c_f_pointer(handle_indxStat, indxStat)
-  call c_f_pointer(handle_bvarStat, bvarStat)
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_forcStruct, forcStruct)
-  call c_f_pointer(handle_attrStruct, attrStruct)
-  call c_f_pointer(handle_typeStruct, typeStruct)
-  call c_f_pointer(handle_indxStruct, indxStruct)
-  call c_f_pointer(handle_mparStruct, mparStruct)
-  call c_f_pointer(handle_progStruct, progStruct)
-  call c_f_pointer(handle_diagStruct, diagStruct)
-  call c_f_pointer(handle_fluxStruct, fluxStruct)
-  call c_f_pointer(handle_bparStruct, bparStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  call c_f_pointer(handle_statCounter, statCounter)
-  call c_f_pointer(handle_outputTimeStep, outputTimeStep)
-  call c_f_pointer(handle_resetStats, resetStats)
-  call c_f_pointer(handle_finalizeStats, finalizeStats)
-  call c_f_pointer(handle_finshTime, finshTime);
-  call c_f_pointer(handle_oldTime, oldTime)
-  
-  ! Start of Subroutine
-  err=0; message='summa_manageOutputFiles/'
-  ! identify the start of the writing
-  call date_and_time(values=startWrite)
-
-  ! initialize the statistics flags
-  if(modelTimeStep==1)then
-
-    ! initialize time step index
-    allocate(statCounter%var(maxVarFreq))
-    allocate(outputTimeStep%var(maxVarFreq))
-    statCounter%var(1:maxVarFreq) = 1
-    outputTimeStep%var(1:maxVarFreq) = 1
-
-    allocate(resetStats%dat(maxVarFreq))
-    allocate(finalizeStats%dat(maxVarFreq))
-    ! initialize flags to reset/finalize statistics
-    resetStats%dat(:)    = .true.   ! start by resetting statistics
-    finalizeStats%dat(:) = .false.  ! do not finalize stats on the first time step
-
-    ! set stats flag for the timestep-level output
-    finalizeStats%dat(iLookFreq%timestep)=.true.
-  endif  ! if the first time step
-
-  ! Many variables get there values from summa4chm_util.f90:getCommandArguments()
-  call summa_setWriteAlarms(oldTime%var, timeStruct%var, finshTime%var,  &   ! time vectors
-                            newOutputFile,  defNewOutputFile,            &
-                            ixRestart,      printRestart,                &   ! flag to print the restart file
-                            ixProgress,     printProgress,               &   ! flag to print simulation progress
-                            resetStats%dat, finalizeStats%dat,           &   ! flags to reset and finalize stats
-                            statCounter%var,                             &   ! statistics counter
-                            err, cmessage)                                  ! error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
- ! ****************************************************************************
- ! *** calculate output statistics
- ! ****************************************************************************
-  do iStruct=1,size(structInfo)
-    select case(trim(structInfo(iStruct)%structName))
-      case('forc'); call calcStats(forcStat%var, forcStruct%var, statForc_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('prog'); call calcStats(progStat%var, progStruct%var, statProg_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('diag'); call calcStats(diagStat%var, diagStruct%var, statDiag_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('flux'); call calcStats(fluxStat%var, fluxStruct%var, statFlux_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('indx'); call calcStats(indxStat%var, indxStruct%var, statIndx_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)     
-    end select
-    if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
-  end do  ! (looping through structures)
-    
-  ! calc basin stats
-  call calcStats(bvarStat%var(:), bvarStruct%var(:), statBvar_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-  if(err/=0)then; message=trim(message)//trim(cmessage)//'[bvar stats]'; return; endif
-
-end subroutine prepareOutput
-
-
-! Update all of the counters for time and output step
-subroutine updateCounters(handle_timeStruct, handle_statCounter, handle_outputTimeStep, &
-        handle_resetStats, handle_oldTime, handle_finalizeStats) bind(C, name="updateCounters")
-  USE globalData,only:startWrite,endWrite,elapsedWrite
-  USE var_lookup,only:maxvarFreq
-  USE time_utils_module,only:elapsedSec                       ! calculate the elapsed time
-
-  type(c_ptr), intent(in), value           :: handle_statCounter
-  type(c_ptr), intent(in), value           :: handle_outputTimeStep
-  type(c_ptr), intent(in), value           :: handle_resetStats
-  type(c_ptr), intent(in), value           :: handle_oldTime      ! time for the previous model time step
-  type(c_ptr), intent(in), value           :: handle_timeStruct !  model time data
-  type(c_ptr), intent(in), value           :: handle_finalizeStats
-
-  type(var_i),pointer                      :: statCounter     ! time counter for stats
-  type(var_i),pointer                      :: outputTimeStep  ! timestep in output files
-  type(flagVec),pointer                    :: resetStats      ! flags to reset statistics
-  type(var_i),pointer                      :: oldTime         !
-  type(var_i),pointer                      :: timeStruct      ! model time data
-  type(flagVec),pointer                    :: finalizeStats   ! flags to finalize statistics
-
-  integer(i4b)                             :: iFreq
-  
-  call c_f_pointer(handle_statCounter, statCounter)
-  call c_f_pointer(handle_outputTimeStep, outputTimeStep)
-  call c_f_pointer(handle_resetStats, resetStats)
-  call c_f_pointer(handle_oldTime, oldTime)
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_finalizeStats, finalizeStats)
-
-  ! *****************************************************************************
-  ! *** update counters
-  ! *****************************************************************************
-  ! increment output file timestep
-  do iFreq = 1,maxvarFreq
-    statCounter%var(iFreq) = statCounter%var(iFreq)+1
-    if(finalizeStats%dat(iFreq)) outputTimeStep%var(iFreq) = outputTimeStep%var(iFreq) + 1
-  end do
-
- ! if finalized stats, then reset stats on the next time step
- resetStats%dat(:) = finalizeStats%dat(:)
-
- ! save time vector
- oldTime%var(:) = timeStruct%var(:)
-
- ! *****************************************************************************
- ! *** finalize
- ! *****************************************************************************
-
- ! identify the end of the writing
- call date_and_time(values=endWrite)
-
- elapsedWrite = elapsedWrite + elapsedSec(startWrite, endWrite)
-end subroutine updateCounters
-
-end module hru_actor
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/fortran_code/hru_writeOutput.f90 b/build/source/actors/hru_actor/fortran_code/hru_writeOutput.f90
deleted file mode 100644
index a32b1f23f35d8fecae429153ac6a595cb49b77ec..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/hru_writeOutput.f90
+++ /dev/null
@@ -1,340 +0,0 @@
-module HRUwriteoOutput_module
-USE,intrinsic :: iso_c_binding
-
-USE data_types,only:&
-                    var_i,          &  
-                    var_i8,         &
-                    var_d,          &
-                    var_ilength,    &
-                    var_dlength,    &
-                    flagVec
-! named variables to define new output files
-USE netcdf
-USE netcdf_util_module,only:netcdf_err 
-USE nrtype
-USE globalData,only:noNewFiles
-USE globalData,only:newFileEveryOct1
-USE globalData,only:chunkSize               ! size of chunks to write
-USE globalData,only:outputPrecision         ! data structure for output precision
-USE globalData,only:integerMissing            ! missing integer
-! metadata
-USE globalData,only:time_meta                 ! metadata on the model time
-USE globalData,only:forc_meta                 ! metadata on the model forcing data
-USE globalData,only:diag_meta                 ! metadata on the model diagnostic variables
-USE globalData,only:prog_meta                 ! metadata on the model prognostic variables
-USE globalData,only:flux_meta                 ! metadata on the model fluxes
-USE globalData,only:indx_meta                 ! metadata on the model index variables
-USE globalData,only:bvar_meta                 ! metadata on basin-average variables
-USE globalData,only:bpar_meta                 ! basin parameter metadata structure
-USE globalData,only:mpar_meta                 ! local parameter metadata structure
-! child metadata for stats
-USE globalData,only:statForc_meta             ! child metadata for stats
-USE globalData,only:statProg_meta             ! child metadata for stats
-USE globalData,only:statDiag_meta             ! child metadata for stats
-USE globalData,only:statFlux_meta             ! child metadata for stats
-USE globalData,only:statIndx_meta             ! child metadata for stats
-USE globalData,only:statBvar_meta             ! child metadata for stats
-! index of the child data structure
-USE globalData,only:forcChild_map             ! index of the child data structure: stats forc
-USE globalData,only:progChild_map             ! index of the child data structure: stats prog
-USE globalData,only:diagChild_map             ! index of the child data structure: stats diag
-USE globalData,only:fluxChild_map             ! index of the child data structure: stats flux
-USE globalData,only:indxChild_map             ! index of the child data structure: stats indx
-USE globalData,only:bvarChild_map             ! index of the child data structure: stats bvar
-USE globalData,only:outFreq                   ! output frequencies
-! named variables
-USE var_lookup,only:iLookTIME                 ! named variables for time data structure
-USE var_lookup,only:iLookDIAG                 ! named variables for local column model diagnostic variables
-USE var_lookup,only:iLookPROG                 ! named variables for local column model prognostic variables
-USE var_lookup,only:iLookINDEX                ! named variables for local column index variables
-USE var_lookup,only:iLookFreq                 ! named variables for the frequency structure
-USE var_lookup,only:iLookBVAR                 ! named variables for basin parameters
-USE get_ixname_module,only:get_freqName       ! get name of frequency from frequency index
-
-
-implicit none
-private
-public::initStatisticsFlags
-public::writeHRUToOutputStructure
-
-contains
-subroutine initStatisticsFlags(handle_statCounter, handle_outputTimeStep, &
-    handle_resetStats, handle_finalizeStats, err) bind(C, name="initStatisticsFlags")
-  USE var_lookup,only:maxvarFreq                ! maximum number of output files
-  USE var_lookup,only:iLookFreq                 ! named variables for the frequency structure
-  implicit none
-  ! dummy variables
-  type(c_ptr), intent(in), value       :: handle_statCounter
-  type(c_ptr), intent(in), value       :: handle_outputTimeStep
-  type(c_ptr), intent(in), value       :: handle_resetStats
-  type(c_ptr), intent(in), value       :: handle_finalizeStats
-  integer(c_int), intent(out)          :: err
-  ! local variables
-  type(var_i), pointer                 :: statCounter
-  type(var_i), pointer                 :: outputTimeStep
-  type(flagVec), pointer               :: resetStats
-  type(flagVec), pointer               :: finalizeStats
-  ! Convert C pointers to Fortran pointers
-  call c_f_pointer(handle_statCounter, statCounter)
-  call c_f_pointer(handle_outputTimeStep, outputTimeStep)
-  call c_f_pointer(handle_resetStats, resetStats)
-  call c_f_pointer(handle_finalizeStats, finalizeStats)
-  ! Start of Subroutine
-
-  ! initialize the statistics flags
-  allocate(statCounter%var(maxVarFreq), stat=err)
-  allocate(outputTimeStep%var(maxVarFreq), stat=err)
-  statCounter%var(1:maxVarFreq) = 1
-  outputTimeStep%var(1:maxVarFreq) = 1
-
-  allocate(resetStats%dat(maxVarFreq), stat=err)
-  allocate(finalizeStats%dat(maxVarFreq), stat=err)
-  ! initialize flags to reset/finalize statistics
-  resetStats%dat(:)    = .true.   ! start by resetting statistics
-  finalizeStats%dat(:) = .false.  ! do not finalize stats on the first time step
-
-  ! set stats flag for the timestep-level output
-  finalizeStats%dat(iLookFreq%timestep)=.true.
-
-
-end subroutine initStatisticsFlags
-
-subroutine writeHRUToOutputStructure(&
-                            indxHRU,                   &
-                            indxGRU,                   &
-                            outputStep,                & ! index into the output Struc
-                            ! statistics variables
-                            handle_forcStat,           & ! model forcing data
-                            handle_progStat,           & ! model prognostic (state) variables
-                            handle_diagStat,           & ! model diagnostic variables
-                            handle_fluxStat,           & ! model fluxes
-                            handle_indxStat,           & ! model indices
-                            handle_bvarStat,           & ! basin-average variables
-                            ! primary data structures (scalars)
-                            handle_timeStruct,         & ! x%var(:)     -- model time data
-                            handle_forcStruct,         & ! x%var(:)     -- model forcing data
-                            ! primary data structures (variable length vectors)
-                            handle_indxStruct,         & ! x%var(:)%dat -- model indices
-                            handle_mparStruct,         & ! x%var(:)%dat -- model parameters
-                            handle_progStruct,         & ! x%var(:)%dat -- model prognostic (state) variables
-                            handle_diagStruct,         & ! x%var(:)%dat -- model diagnostic variables
-                            handle_fluxStruct,         & ! x%var(:)%dat -- model fluxes
-                            ! basin-average structures
-                            handle_bparStruct,         & ! x%var(:)     -- basin-average parameters
-                            handle_bvarStruct,         & ! x%var(:)%dat -- basin-average variables
-                            ! local HRU data
-                            handle_statCounter,        & ! x%var(:)
-                            handle_outputTimeStep,     & ! x%var(:)
-                            handle_resetStats,         & ! x%var(:)
-                            handle_finalizeStats,      & ! x%var(:)
-                            handle_finshTime,          & ! x%var(:)    -- end time for the model simulation
-                            handle_oldTime,            & ! x%var(:)    -- time for the previous model time step
-                            ! run time variables
-                            err) bind(C, name="writeHRUToOutputStructure") 
-  USE nrtype
-  USE globalData,only:structInfo
-  USE globalData,only:startWrite,endWrite
-  USE globalData,only:maxLayers                               ! maximum number of layers
-  USE globalData,only:maxSnowLayers                           ! maximum number of snow layers
-
-  USE globalData,only:ixProgress                              ! define frequency to write progress
-  USE globalData,only:ixRestart                               ! define frequency to write restart files
-  USE globalData,only:gru_struc
-
-  USE globalData,only:newOutputFile                           ! define option for new output files
-  USE summa_alarms,only:summa_setWriteAlarms
-
-  USE globalData,only:forc_meta,attr_meta,type_meta           ! metaData structures
-  USE output_stats,only:calcStats                             ! module for compiling output statistics
-  USE outputStrucWrite_module,only:writeData,writeBasin       ! module to write model output
-  USE outputStrucWrite_module,only:writeTime                  ! module to write model time
-  USE outputStrucWrite_module,only:writeRestart               ! module to write model Restart
-  USE outputStrucWrite_module,only:writeParm                  ! module to write model parameters
-  USE time_utils_module,only:elapsedSec                       ! calculate the elapsed time
-  USE globalData,only:elapsedWrite                            ! elapsed time to write data
-  USE output_structure_module,only:outputStructure
-  USE netcdf_util_module,only:nc_file_close                   ! close netcdf file
-  USE netcdf_util_module,only:nc_file_open                    ! open netcdf file
-  USE var_lookup,only:maxvarFreq                              ! maximum number of output files
-
-  implicit none
-  integer(c_int),intent(in)             :: indxHRU               ! index of hru in GRU
-  integer(c_int),intent(in)             :: indxGRU               ! index of the GRU
-  integer(c_int),intent(in)             :: outputStep            ! index into the output Struc
-
-  ! statistics variables
-  type(c_ptr),intent(in),value          :: handle_forcStat       ! model forcing data
-  type(c_ptr),intent(in),value          :: handle_progStat       ! model prognostic (state) variables
-  type(c_ptr),intent(in),value          :: handle_diagStat       ! model diagnostic variables
-  type(c_ptr),intent(in),value          :: handle_fluxStat       ! model fluxes
-  type(c_ptr),intent(in),value          :: handle_indxStat       ! model indices
-  type(c_ptr),intent(in),value          :: handle_bvarStat       ! basin-average variables
-  ! primary data structures (scalars)
-  type(c_ptr),intent(in),value          :: handle_timeStruct     ! x%var(:)     -- model time data
-  type(c_ptr),intent(in),value          :: handle_forcStruct     ! x%var(:)     -- model forcing data
-  ! primary data structures (variable length vectors)
-  type(c_ptr),intent(in),value          :: handle_indxStruct     ! x%var(:)%dat -- model indices
-  type(c_ptr),intent(in),value          :: handle_mparStruct     ! x%var(:)%dat -- model parameters
-  type(c_ptr),intent(in),value          :: handle_progStruct     ! x%var(:)%dat -- model prognostic (state) variables
-  type(c_ptr),intent(in),value          :: handle_diagStruct     ! x%var(:)%dat -- model diagnostic variables
-  type(c_ptr),intent(in),value          :: handle_fluxStruct     ! x%var(:)%dat -- model fluxes
-  ! basin-average structures
-  type(c_ptr),intent(in),value          :: handle_bparStruct     ! x%var(:)     -- basin-average parameters
-  type(c_ptr),intent(in),value          :: handle_bvarStruct     ! x%var(:)%dat -- basin-average variables
-  ! local HRU data
-  type(c_ptr),intent(in),value          :: handle_statCounter    ! x%var(:)
-  type(c_ptr),intent(in),value          :: handle_outputTimeStep ! x%var(:)
-  type(c_ptr),intent(in),value          :: handle_resetStats     ! x%var(:)
-  type(c_ptr),intent(in),value          :: handle_finalizeStats  ! x%var(:)
-  type(c_ptr),intent(in),value          :: handle_finshTime      ! x%var(:)    -- end time for the model simulation
-  type(c_ptr),intent(in),value          :: handle_oldTime        ! x%var(:)    -- time for the previous model time step
-  integer(c_int),intent(out)            :: err
-
-  ! local pointers
-  ! statistics variables 
-  type(var_dlength), pointer            :: forcStat        ! model forcing data
-  type(var_dlength), pointer            :: progStat        ! model prognostic (state) variables
-  type(var_dlength), pointer            :: diagStat        ! model diagnostic variables
-  type(var_dlength), pointer            :: fluxStat        ! model fluxes
-  type(var_dlength), pointer            :: indxStat        ! model indices
-  type(var_dlength), pointer            :: bvarStat        ! basin-average variabl
-  ! primary data structures (scalars)
-  type(var_i),pointer                   :: timeStruct      ! model time data
-  type(var_d),pointer                   :: forcStruct      ! model forcing data
-  ! primary data structures (variable length vectors)
-  type(var_ilength),pointer             :: indxStruct      ! model indices
-  type(var_dlength),pointer             :: mparStruct      ! model parameters
-  type(var_dlength),pointer             :: progStruct      ! model prognostic (state) variables
-  type(var_dlength),pointer             :: diagStruct      ! model diagnostic variables
-  type(var_dlength),pointer             :: fluxStruct      ! model fluxes
-  ! basin-average structures
-  type(var_d),pointer                   :: bparStruct      ! basin-average parameters
-  type(var_dlength),pointer             :: bvarStruct      ! basin-average variables
-  ! local HRU data
-  type(var_i),pointer                   :: statCounter     ! time counter for stats
-  type(var_i),pointer                   :: outputTimeStep  ! timestep in output files
-  type(flagVec),pointer                 :: resetStats      ! flags to reset statistics
-  type(flagVec),pointer                 :: finalizeStats   ! flags to finalize statistics
-  type(var_i),pointer                   :: finshTime       ! end time for the model simulation
-  type(var_i),pointer                   :: oldTime         !
-
-  ! local variables
-  character(len=256)                    :: cmessage
-  character(len=256)                    :: message 
-  logical(lgt)                          :: defNewOutputFile=.false.
-  logical(lgt)                          :: printRestart=.false.
-  logical(lgt)                          :: printProgress=.false.
-  character(len=256)                    :: restartFile       ! restart file name
-  character(len=256)                    :: timeString        ! portion of restart file name that contains the write-out time
-  integer(i4b)                          :: iStruct           ! index of model structure
-  integer(i4b)                          :: iFreq             ! index of the output frequency
-  ! convert the C pointers to Fortran pointers
-  call c_f_pointer(handle_forcStat, forcStat)
-  call c_f_pointer(handle_progStat, progStat)
-  call c_f_pointer(handle_diagStat, diagStat)
-  call c_f_pointer(handle_fluxStat, fluxStat)
-  call c_f_pointer(handle_indxStat, indxStat)
-  call c_f_pointer(handle_bvarStat, bvarStat)
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_forcStruct, forcStruct)
-  call c_f_pointer(handle_indxStruct, indxStruct)
-  call c_f_pointer(handle_mparStruct, mparStruct)
-  call c_f_pointer(handle_progStruct, progStruct)
-  call c_f_pointer(handle_diagStruct, diagStruct)
-  call c_f_pointer(handle_fluxStruct, fluxStruct)
-  call c_f_pointer(handle_bparStruct, bparStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  call c_f_pointer(handle_statCounter, statCounter)
-  call c_f_pointer(handle_outputTimeStep, outputTimeStep)
-  call c_f_pointer(handle_resetStats, resetStats)
-  call c_f_pointer(handle_finalizeStats, finalizeStats)
-  call c_f_pointer(handle_finshTime, finshTime)
-  call c_f_pointer(handle_oldTime, oldTime)
-
-  err=0; message='summa_manageOutputFiles/'
-  ! identify the start of the writing
-
-  ! Many variables get there values from summa4chm_util.f90:getCommandArguments()
-  call summa_setWriteAlarms(oldTime%var, timeStruct%var, finshTime%var,  &   ! time vectors
-                            newOutputFile,  defNewOutputFile,            &
-                            ixRestart,      printRestart,                &   ! flag to print the restart file
-                            ixProgress,     printProgress,               &   ! flag to print simulation progress
-                            resetStats%dat, finalizeStats%dat,           &   ! flags to reset and finalize stats
-                            statCounter%var,                             &   ! statistics counter
-                            err, cmessage)                                  ! error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
- ! If we do not do this looping we segfault - I am not sure why
-  outputStructure(1)%finalizeStats(1)%gru(indxGRU)%hru(indxHRU)%tim(outputStep)%dat(:) = finalizeStats%dat(:)
-
- ! ****************************************************************************
- ! *** calculate output statistics
- ! ****************************************************************************
-  do iStruct=1,size(structInfo)
-    select case(trim(structInfo(iStruct)%structName))
-      case('forc'); call calcStats(forcStat%var, forcStruct%var, statForc_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('prog'); call calcStats(progStat%var, progStruct%var, statProg_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('diag'); call calcStats(diagStat%var, diagStruct%var, statDiag_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('flux'); call calcStats(fluxStat%var, fluxStruct%var, statFlux_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-      case('indx'); call calcStats(indxStat%var, indxStruct%var, statIndx_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)     
-    end select
-    if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
-  end do  ! (looping through structures)
-    
-  ! calc basin stats
-  call calcStats(bvarStat%var(:), bvarStruct%var(:), statBvar_meta, resetStats%dat, finalizeStats%dat, statCounter%var, err, cmessage)
-  if(err/=0)then; message=trim(message)//trim(cmessage)//'[bvar stats]'; return; endif
-  
-  ! write basin-average variables
-  call writeBasin(indxGRU,indxHRU,outputStep,finalizeStats%dat, &
-                  outputTimeStep%var,bvar_meta,bvarStat%var,bvarStruct%var,bvarChild_map,err,cmessage)
-  if(err/=0)then; message=trim(message)//trim(cmessage)//'[bvar]'; return; endif
-
-  ! ****************************************************************************
-  ! *** write data
-  ! ****************************************************************************
-  call writeTime(indxGRU,indxHRU,outputStep,finalizeStats%dat, &
-                time_meta,timeStruct%var,err,message)
-
-  ! write the model output to the OutputStructure
-  ! Passes the full metadata structure rather than the stats metadata structure because
-  ! we have the option to write out data of types other than statistics.
-  ! Thus, we must also pass the stats parent->child maps from childStruct.
-  do iStruct=1,size(structInfo)
-    select case(trim(structInfo(iStruct)%structName))
-      case('forc'); call writeData(indxGRU,indxHRU,outputStep,"forc",finalizeStats%dat,&
-                    maxLayers,forc_meta,forcStat,forcStruct,forcChild_map,indxStruct,err,cmessage)
-      case('prog'); call writeData(indxGRU,indxHRU,outputStep,"prog",finalizeStats%dat,&
-                    maxLayers,prog_meta,progStat,progStruct,progChild_map,indxStruct,err,cmessage)
-      case('diag'); call writeData(indxGRU,indxHRU,outputStep,"diag",finalizeStats%dat,&
-                    maxLayers,diag_meta,diagStat,diagStruct,diagChild_map,indxStruct,err,cmessage)
-      case('flux'); call writeData(indxGRU,indxHRU,outputStep,"flux",finalizeStats%dat,&
-                    maxLayers,flux_meta,fluxStat,fluxStruct,fluxChild_map,indxStruct,err,cmessage)
-      case('indx'); call writeData(indxGRU,indxHRU,outputStep,"indx",finalizeStats%dat,&
-                    maxLayers,indx_meta,indxStat,indxStruct,indxChild_map,indxStruct,err,cmessage)
-    end select
-    if(err/=0)then 
-      message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'
-      return
-    endif
-  end do  ! (looping through structures)
-
-  ! *****************************************************************************
-  ! *** update counters
-  ! *****************************************************************************
-
-  ! increment output file timestep
-  do iFreq = 1,maxvarFreq
-    statCounter%var(iFreq) = statCounter%var(iFreq)+1
-    if(finalizeStats%dat(iFreq)) outputTimeStep%var(iFreq) = outputTimeStep%var(iFreq) + 1
-  end do
-
-  ! if finalized stats, then reset stats on the next time step
-  resetStats%dat(:) = finalizeStats%dat(:)
-
-  ! save time vector
-  oldTime%var(:) = timeStruct%var(:)
-
-end subroutine writeHRUToOutputStructure
-
-end module HRUwriteoOutput_module
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/fortran_code/init_hru_actor.f90 b/build/source/actors/hru_actor/fortran_code/init_hru_actor.f90
deleted file mode 100755
index 4089ead9f5c2804099fb5ef57cc1345d7ed0dc11..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/init_hru_actor.f90
+++ /dev/null
@@ -1,280 +0,0 @@
-module INIT_HRU_ACTOR
-! used to declare and allocate summa data structures and initialize model state to known values
-USE,intrinsic :: iso_c_binding
-USE nrtype          ! variable types, etc.
-USE data_types,only:&
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            (i8b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    zLookup               ! x%z(:)%var(:)%lookup(:) -- lookup tables
-                    
-! access missing values
-USE globalData,only:integerMissing   ! missing integer
-USE globalData,only:realMissing      ! missing double precision number
-! named variables for run time options
-USE globalData,only:iRunModeFull,iRunModeGRU,iRunModeHRU
-! metadata structures
-USE globalData,only:time_meta,forc_meta,attr_meta,type_meta ! metadata structures
-USE globalData,only:prog_meta,diag_meta,flux_meta,id_meta   ! metadata structures
-USE globalData,only:mpar_meta,indx_meta                     ! metadata structures
-USE globalData,only:bpar_meta,bvar_meta                     ! metadata structures
-USE globalData,only:averageFlux_meta                        ! metadata for time-step average fluxes
-USE globalData,only:lookup_meta 
-
-! statistics metadata structures
-USE globalData,only:statForc_meta                           ! child metadata for stats
-USE globalData,only:statProg_meta                           ! child metadata for stats
-USE globalData,only:statDiag_meta                           ! child metadata for stats
-USE globalData,only:statFlux_meta                           ! child metadata for stats
-USE globalData,only:statIndx_meta                           ! child metadata for stats
-USE globalData,only:statBvar_meta                           ! child metadata for stats
-! maxvarFreq 
-USE var_lookup,only:maxVarFreq                               ! # of available output frequencies
-
-! safety: set private unless specified otherwise
-implicit none
-private
-public::initHRU
-contains
-
- ! used to declare and allocate summa data structures and initialize model state to known values
- subroutine initHRU(&
-                        indxGRU,            & !  Index of HRU's GRU parent
-                        num_steps,          &
-                        handle_lookupStruct,&
-  						          ! statistics structures
-                        handle_forcStat,    & !  model forcing data
-                        handle_progStat,    & !  model prognostic (state) variables
-                        handle_diagStat,    & !  model diagnostic variables
-                        handle_fluxStat,    & !  model fluxes
-                        handle_indxStat,    & !  model indices
-                        handle_bvarStat,    & !  basin-average variables
-                        ! primary data structures (scalars)
-                        handle_timeStruct,  & !  model time data
-                        handle_forcStruct,  & !  model forcing data
-                        ! primary data structures (variable length vectors)
-                        handle_indxStruct,  & !  model indices
-                        handle_progStruct,  & !  model prognostic (state) variables
-                        handle_diagStruct,  & !  model diagnostic variables
-                        handle_fluxStruct,  & !  model fluxes
-                        ! basin-average structures
-                        handle_bvarStruct,  & !  basin-average variables
-                        ! local HRU data structures
-                        handle_startTime,   & ! start time for the model simulation
-                        handle_finshTime,   & ! end time for the model simulation
-                        handle_refTime,     & ! reference time for the model simulation
-                        handle_oldTime,     & ! time for the previous model time step
-                        ! miscellaneous variables
-                        err) bind(C,name='initHRU')
-  ! ---------------------------------------------------------------------------------------
-  ! * desired modules
-  ! ---------------------------------------------------------------------------------------
-  ! data types
-  USE nrtype                                                  ! variable types, etc.
-  ! subroutines and functions: allocate space
-  USE allocspace_module,only:allocLocal
-  ! timing variables
-  USE globalData,only:startInit,endInit                       ! date/time for the start and end of the initialization
-  USE globalData,only:elapsedRead                             ! elapsed time for the data read
-  USE globalData,only:elapsedWrite                            ! elapsed time for the stats/write
-  USE globalData,only:elapsedPhysics                          ! elapsed time for the physics
-  ! miscellaneous global data
-  USE globalData,only:gru_struc                               ! gru-hru mapping structures
-  USE globalData,only:structInfo                              ! information on the data structures
-  USE globalData,only:numtim
-  USE globalData,only:startTime,finshTime,refTime,oldTime
-
-  USE var_lookup,only:maxvarFreq                              ! maximum number of output files
-  
-  implicit none
-  
-  ! ---------------------------------------------------------------------------------------
-  ! * variables from C++
-  ! ---------------------------------------------------------------------------------------
-  integer(c_int),intent(in)                  :: indxGRU                    ! indx of the parent GRU
-  integer(c_int),intent(out)                 :: num_steps                  ! number of steps in model, local to the HRU                 
-  
-  type(c_ptr), intent(in), value             :: handle_lookupStruct        ! z(:)%var(:)%lookup(:) -- lookup tables
-  ! statistics structures
-  type(c_ptr), intent(in), value             :: handle_forcStat !  model forcing data
-  type(c_ptr), intent(in), value             :: handle_progStat !  model prognostic (state) variables
-  type(c_ptr), intent(in), value             :: handle_diagStat !  model diagnostic variables
-  type(c_ptr), intent(in), value             :: handle_fluxStat !  model fluxes
-  type(c_ptr), intent(in), value             :: handle_indxStat !  model indices
-  type(c_ptr), intent(in), value             :: handle_bvarStat !  basin-average variables
-  ! primary data structures (scalars)
-  type(c_ptr), intent(in), value             :: handle_timeStruct !  model time data
-  type(c_ptr), intent(in), value             :: handle_forcStruct !  model forcing data
-  ! primary data structures (variable length vectors)
-  type(c_ptr), intent(in), value             :: handle_indxStruct !  model indices
-  type(c_ptr), intent(in), value             :: handle_progStruct !  model prognostic (state) variables
-  type(c_ptr), intent(in), value             :: handle_diagStruct !  model diagnostic variables
-  type(c_ptr), intent(in), value             :: handle_fluxStruct !  model fluxes
-  ! basin-average structures
-  type(c_ptr), intent(in), value             :: handle_bvarStruct !  basin-average variables
-  ! ancillary data structures
-  ! local hru data structures
-  type(c_ptr), intent(in), value             :: handle_startTime  ! start time for the model simulation
-  type(c_ptr), intent(in), value             :: handle_finshTime ! end time for the model simulation
-  type(c_ptr), intent(in), value             :: handle_refTime    ! reference time for the model simulation
-  type(c_ptr), intent(in), value             :: handle_oldTime    ! time for the previous model time step 
-  integer(c_int),intent(inout)               :: err  
-  ! ---------------------------------------------------------------------------------------
-  ! * Fortran Variables For Conversion
-  ! ---------------------------------------------------------------------------------------
-  type(zLookup),pointer                      :: lookupStruct               !  z(:)%var(:)%lookup(:) -- lookup tables
-  type(var_dlength),pointer                  :: forcStat                   !  model forcing data
-  type(var_dlength),pointer                  :: progStat                   !  model prognostic (state) variables
-  type(var_dlength),pointer                  :: diagStat                   !  model diagnostic variables
-  type(var_dlength),pointer                  :: fluxStat                   !  model fluxes
-  type(var_dlength),pointer                  :: indxStat                   !  model indices
-  type(var_dlength),pointer                  :: bvarStat                   !  basin-average variabl
-  ! primary data structures (scalars)
-  type(var_i),pointer                        :: timeStruct                 !  model time data
-  type(var_d),pointer                        :: forcStruct                 !  model forcing data
-  ! primary data structures (variable length vectors)
-  type(var_ilength),pointer                  :: indxStruct                 !  model indices
-  type(var_dlength),pointer                  :: progStruct                 !  model prognostic (state) variables
-  type(var_dlength),pointer                  :: diagStruct                 !  model diagnostic variables
-  type(var_dlength),pointer                  :: fluxStruct                 !  model fluxes
-  ! basin-average structures
-  type(var_dlength),pointer                  :: bvarStruct                 !  basin-average variables
-  ! local HRU data structures
-  type(var_i),pointer                        :: startTime_hru              ! start time for the model simulation
-  type(var_i),pointer                        :: finishTime_hru             ! end time for the model simulation
-  type(var_i),pointer                        :: refTime_hru                ! reference time for the model simulation
-  type(var_i),pointer                        :: oldTime_hru                ! time from previous step
-  ! ---------------------------------------------------------------------------------------
-  ! * Local Subroutine Variables
-  ! ---------------------------------------------------------------------------------------
-  character(LEN=256)                         :: message                    ! error message
-  character(LEN=256)                         :: cmessage                   ! error message of downwind routine
-  integer(i4b)                               :: iStruct                    ! looping variables
-  ! ---------------------------------------------------------------------------------------
-  ! * Convert From C++ to Fortran
-  ! ---------------------------------------------------------------------------------------
-  call c_f_pointer(handle_lookupStruct, lookupStruct)
-  call c_f_pointer(handle_forcStat,   forcStat)
-  call c_f_pointer(handle_progStat,   progStat)
-  call c_f_pointer(handle_diagStat,   diagStat)
-  call c_f_pointer(handle_fluxStat,   fluxStat)
-  call c_f_pointer(handle_indxStat,   indxStat)
-  call c_f_pointer(handle_bvarStat,   bvarStat)
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_forcStruct, forcStruct)
-  call c_f_pointer(handle_indxStruct, indxStruct)
-  call c_f_pointer(handle_progStruct, progStruct)
-  call c_f_pointer(handle_diagStruct, diagStruct)
-  call c_f_pointer(handle_fluxStruct, fluxStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  call c_f_pointer(handle_startTime,  startTime_hru)
-  call c_f_pointer(handle_finshTime,  finishTime_hru)
-  call c_f_pointer(handle_refTime,    refTime_hru)
-  call c_f_pointer(handle_oldTime,    oldTime_hru)
-
-  ! ---------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message='summaActors_initialize/'
-
-  ! initialize the start of the initialization
-  call date_and_time(values=startInit)
-
-  ! initialize the elapsed time for cumulative quantities
-  elapsedRead=0._dp
-  elapsedWrite=0._dp
-  elapsedPhysics=0._dp
-
-  ! copy the number of the steps for the hru
-  num_steps = numtim
-
-  ! *****************************************************************************
-  ! *** allocate space for data structures
-  ! *****************************************************************************
-
-  ! allocate time structures
-  do iStruct=1,4
-  select case(iStruct)
-    case(1); call allocLocal(time_meta, startTime_hru, err=err, message=cmessage)  ! start time for the model simulation
-    case(2); call allocLocal(time_meta, finishTime_hru, err=err, message=cmessage)  ! end time for the model simulation
-    case(3); call allocLocal(time_meta, refTime_hru,   err=err, message=cmessage)  ! reference time for the model simulation
-    case(4); call allocLocal(time_meta, oldTime_hru,   err=err, message=cmessage)  ! time from the previous step
-  end select
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-  end do  ! looping through time structures
-
-  ! copy the time variables set up by the job_actor
-  startTime_hru%var(:) = startTime%var(:)
-  finishTime_hru%var(:) = finshTime%var(:)
-  refTime_hru%var(:) = refTime%var(:)
-  oldTime_hru%var(:) = oldTime%var(:)
-
-
-  ! get the number of snow and soil layers
-  associate(&
-  nSnow => gru_struc(indxGRU)%hruInfo(1)%nSnow, & ! number of snow layers for each HRU
-  nSoil => gru_struc(indxGRU)%hruInfo(1)%nSoil  ) ! number of soil layers for each HRU
-
-  ! allocate other data structures
-  do iStruct=1,size(structInfo)
-  ! allocate space  
-  select case(trim(structInfo(iStruct)%structName))    
-    case('time'); call allocLocal(time_meta,timeStruct,err=err,message=cmessage)     ! model forcing data
-    case('forc'); call allocLocal(forc_meta,forcStruct,nSnow,nSoil,err,cmessage);    ! model forcing data
-    case('attr'); cycle ! set by file_access_actor  
-    case('type'); cycle ! set by file_access_actor
-    case('id'  ); cycle ! set by file_access_actor   
-    case('mpar'); cycle ! set by file_access_actor  
-    case('indx'); call allocLocal(indx_meta,indxStruct,nSnow,nSoil,err,cmessage);    ! model variables
-    case('prog'); call allocLocal(prog_meta,progStruct,nSnow,nSoil,err,cmessage);    ! model prognostic (state) variables
-    case('diag'); call allocLocal(diag_meta,diagStruct,nSnow,nSoil,err,cmessage);    ! model diagnostic variables
-    case('flux'); call allocLocal(flux_meta,fluxStruct,nSnow,nSoil,err,cmessage);    ! model fluxes
-    case('bpar'); cycle ! set by file_access_actor
-    case('bvar'); call allocLocal(bvar_meta,bvarStruct,nSnow=0,nSoil=0,err=err,message=cmessage);  ! basin-average variables
-    case('lookup'); call allocLocal(lookup_meta,lookupStruct,err=err,message=cmessage)   ! basin-average variables
-    case('deriv'); cycle
-    case default; err=20; message='unable to find structure name: '//trim(structInfo(iStruct)%structName)
-  end select
-  ! check errors
-  if(err/=0)then
-    message=trim(message)//trim(cmessage)//'[structure =  '//trim(structInfo(iStruct)%structName)//']'
-    print*, message
-    return
-  endif
-  end do  ! looping through data structures
-
-
-  ! *****************************************************************************
-  ! *** allocate space for output statistics data structures
-  ! *****************************************************************************
-  ! loop through data structures
-  do iStruct=1,size(structInfo)
-    ! allocate space
-    select case(trim(structInfo(iStruct)%structName))
-      case('forc'); call allocLocal(statForc_meta(:)%var_info,forcStat,nSnow,nSoil,err,cmessage);    ! model forcing data
-      case('prog'); call allocLocal(statProg_meta(:)%var_info,progStat,nSnow,nSoil,err,cmessage);    ! model prognostic 
-      case('diag'); call allocLocal(statDiag_meta(:)%var_info,diagStat,nSnow,nSoil,err,cmessage);    ! model diagnostic
-      case('flux'); call allocLocal(statFlux_meta(:)%var_info,fluxStat,nSnow,nSoil,err,cmessage);    ! model fluxes
-      case('indx'); call allocLocal(statIndx_meta(:)%var_info,indxStat,nSnow,nSoil,err,cmessage);    ! index vars
-      case('bvar'); call allocLocal(statBvar_meta(:)%var_info,bvarStat,nSnow=0,nSoil=0,err=err,message=cmessage);  ! basin-average variables
-      case default; cycle
-    end select
-    ! check errors
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)//'[statistics for =  '//trim(structInfo(iStruct)%structName)//']'
-      print*, message
-      return
-    endif
-  end do ! iStruct
-
-  ! identify the end of the initialization
-  call date_and_time(values=endInit)
-
-  ! end association to info in data structures
-  end associate
-
- end subroutine initHRU
-
-end module INIT_HRU_ACTOR
diff --git a/build/source/actors/hru_actor/fortran_code/model_run.f90 b/build/source/actors/hru_actor/fortran_code/model_run.f90
deleted file mode 100644
index 3ac77cd6c2063b03e5588f18cbbf470d4ef2abbd..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/model_run.f90
+++ /dev/null
@@ -1,429 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module model_run
-! calls the model physics
-USE,intrinsic :: iso_c_binding
-
-USE data_types,only:&
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            (i8b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    var_dlength_array,   & ! x%struc(:)%dat       (dp)
-                    zLookup
-! access missing values
-USE globalData,only:integerMissing         ! missing integer
-USE globalData,only:realMissing            ! missing double precision number
-
-! provide access to Noah-MP constants
-USE module_sf_noahmplsm,only:isWater       ! parameter for water land cover type
-
-! named variables
-USE globalData,only:yes,no                 ! .true. and .false.
-USE globalData,only:overwriteRSMIN         ! flag to overwrite RSMIN
-USE globalData,only:maxSoilLayers          ! Maximum Number of Soil Layers
-! urban vegetation category (could be local)
-USE globalData,only:urbanVegCategory       ! vegetation category for urban areas
-USE globalData,only:greenVegFrac_monthly   ! fraction of green vegetation in each month (0-1)
-! provide access to the named variables that describe elements of parameter structures
-USE var_lookup,only:iLookTYPE              ! look-up values for classification of veg, soils etc.
-USE var_lookup,only:iLookID                ! look-up values for hru and gru IDs
-USE var_lookup,only:iLookATTR              ! look-up values for local attributes
-USE var_lookup,only:iLookFLUX              ! look-up values for local column model fluxes
-USE var_lookup,only:iLookBVAR              ! look-up values for basin-average model variables
-USE var_lookup,only:iLookTIME              ! named variables for time data structure
-USE var_lookup,only:iLookDIAG              ! look-up values for local column model diagnostic variables
-USE var_lookup,only:iLookINDEX             ! look-up values for local column index variables
-USE var_lookup,only:iLookPROG              ! look-up values for local column model prognostic (state) variables
-USE var_lookup,only:iLookPARAM             ! look-up values for local column model parameters
-USE var_lookup,only:iLookDECISIONS         ! look-up values for model decisions
-USE summa4chm_util,only:handle_err
-
-! Noah-MP parameters
-USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM   ! 2-d tables for stem area index and leaf area index (vegType,month)
-USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB     ! height at the top and bottom of vegetation (vegType)
-USE noahmp_globals,only:RSMIN
-
-! provide access to the named variables that describe model decisions
-USE mDecisions_module,only:&               ! look-up values for LAI decisions
- monthlyTable,& ! LAI/SAI taken directly from a monthly table for different vegetation classes
- specified,&    ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters   
- localColumn, & ! separate groundwater representation in each local soil column
- singleBasin, & ! single groundwater store over the entire basin
- bigBucket
-
-
-! safety: set private unless specified otherwise
-implicit none
-private
-public::runPhysics
-contains
-
-! Runs the model physics for an HRU
-subroutine runPhysics(&
-              indxHRU,             &
-              modelTimeStep,       &
-              ! primary data structures (scalars)
-              handle_timeStruct,   & ! c_ptr to -- model time data
-              handle_forcStruct,   & ! c_ptr to -- model forcing data
-              handle_attrStruct,   & ! c_ptr to -- local attributes for each HRU
-              handle_typeStruct,   & ! c_ptr to -- local classification of soil veg etc. for each HRU
-              ! primary data structures (variable length vectors)
-              handle_indxStruct,   & ! c_ptr to -- model indices
-              handle_mparStruct,   & ! c_ptr to -- model parameters
-              handle_progStruct,   & ! c_ptr to -- model prognostic (state) variables
-              handle_diagStruct,   & ! c_ptr to -- model diagnostic variables
-              handle_fluxStruct,   & ! c_ptr to -- model fluxes
-              ! basin-average structures
-              handle_bvarStruct,   & ! c_ptr to -- basin-average variables
-              handle_lookupStruct, & ! c_ptr to -- lookup structures (enthalpy)
-              fracJulDay,          & ! fraction of the current Julian day
-              tmZoneOffsetFracDay, & ! time zone offset (fraction of the day)
-              yearLength,          & ! number of days in the current year
-              ! run time variables
-              computeVegFlux,      & ! flag to indicate if we are computing fluxes over vegetation
-              dt_init,             & ! used to initialize the length of the sub-step for each HRU
-              dt_init_factor,      & ! Used to adjust the length of the timestep in the event of a failure
-              err) bind(C, name='RunPhysics')
-  ! ---------------------------------------------------------------------------------------
-  ! * desired modules
-  ! ---------------------------------------------------------------------------------------
-  ! data types
-  USE nrtype                                   ! variable types, etc.
-  ! subroutines and functions
-  USE nr_utility_module,only:indexx            ! sort vectors in ascending order
-  USE vegPhenlgy_module,only:vegPhenlgy        ! module to compute vegetation phenology
-  USE time_utils_module,only:elapsedSec        ! calculate the elapsed time
-  USE module_sf_noahmplsm,only:redprm          ! module to assign more Noah-MP parameters
-  USE derivforce_module,only:derivforce        ! module to compute derived forcing data
-  USE coupled_em_module,only:coupled_em        ! module to run the coupled energy and mass model
-  USE qTimeDelay_module,only:qOverland         ! module to route water through an "unresolved" river network
-  ! global data
-  USE globalData,only:model_decisions          ! model decision structure
-  USE globalData,only:startPhysics,endPhysics  ! date/time for the start and end of the initialization
-  USE globalData,only:elapsedPhysics           ! elapsed time for the initialization
-  implicit none
- 
-  ! ---------------------------------------------------------------------------------------
-  ! Dummy Variables
-  ! ---------------------------------------------------------------------------------------
-  integer(c_int),intent(in)                :: indxHRU                ! id of HRU                   
-  integer(c_int),intent(in)                :: modelTimeStep          ! time step index
-  ! primary data structures (scalars)
-  type(c_ptr), intent(in), value           :: handle_timeStruct             ! model time data
-  type(c_ptr), intent(in), value           :: handle_forcStruct             ! model forcing data
-  type(c_ptr), intent(in), value           :: handle_attrStruct             ! local attributes for each HRU
-  type(c_ptr), intent(in), value           :: handle_typeStruct             ! local classification of soil veg etc. for each HRU
-  ! primary data structures (variable length vectors)
-  type(c_ptr), intent(in), value           :: handle_indxStruct             ! model indices
-  type(c_ptr), intent(in), value           :: handle_mparStruct             ! model parameters
-  type(c_ptr), intent(in), value           :: handle_progStruct             ! model prognostic (state) variables
-  type(c_ptr), intent(in), value           :: handle_diagStruct             ! model diagnostic variables
-  type(c_ptr), intent(in), value           :: handle_fluxStruct             ! model fluxes
-  ! basin-average structures
-  type(c_ptr),intent(in),  value           :: handle_bvarStruct             ! basin-average variables
-  type(c_ptr),intent(in),  value           :: handle_lookupStruct
-  real(c_double),intent(inout)             :: fracJulDay
-  real(c_double),intent(inout)             :: tmZoneOffsetFracDay 
-  integer(c_int),intent(inout)             :: yearLength
-  integer(c_int),intent(inout)             :: computeVegFlux         ! flag to indicate if we are computing fluxes over vegetation
-  real(c_double),intent(inout)             :: dt_init
-  integer(c_int),intent(in)                :: dt_init_factor         ! Used to adjust the length of the timestep in the event of a failure
-  integer(c_int),intent(inout)             :: err                    ! error code
-  ! ---------------------------------------------------------------------------------------
-  ! FORTRAN POINTERS
-  ! ---------------------------------------------------------------------------------------
-  type(var_i),pointer                      :: timeStruct                 !  model time data
-  type(var_d),pointer                      :: forcStruct                 !  model forcing data
-  type(var_d),pointer                      :: attrStruct                 !  local attributes for each HRU
-  type(var_i),pointer                      :: typeStruct                 !  local classification of soil veg etc. for each HRU
-  ! primary data structures (variable length vectors)
-  type(var_ilength),pointer                :: indxStruct                 !  model indices
-  type(var_dlength),pointer                :: mparStruct                 !  model parameters
-  type(var_dlength),pointer                :: progStruct                 !  model prognostic (state) variables
-  type(var_dlength),pointer                :: diagStruct                 !  model diagnostic variables
-  type(var_dlength),pointer                :: fluxStruct                 !  model fluxes
-  ! basin-average structures
-  type(var_dlength),pointer                :: bvarStruct                 !  basin-average variables 
-  type(zLookup), pointer                   :: lookupStruct               ! lookup tables
-  ! ---------------------------------------------------------------------------------------
-  ! local variables: general
-  ! ---------------------------------------------------------------------------------------
-  real(dp)                                  :: fracHRU                ! fractional area of a given HRU (-)
-  character(LEN=256)                        :: cmessage               ! error message of downwind routine
-  ! local variables: veg phenology
-  logical(lgt)                              :: computeVegFluxFlag     ! flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-  real(dp)                                  :: notUsed_canopyDepth    ! NOT USED: canopy depth (m)
-  real(dp)                                  :: notUsed_exposedVAI     ! NOT USED: exposed vegetation area index (m2 m-2)
-  integer(i4b)                              :: nSnow                  ! number of snow layers
-  integer(i4b)                              :: nSoil                  ! number of soil layers
-  integer(i4b)                              :: nLayers                ! total number of layers
-  real(dp), allocatable                     :: zSoilReverseSign(:)    ! height at bottom of each soil layer, negative downwards (m)
-  character(len=256)                        :: message                ! error message
-  ! ---------------------------------------------------------------------------------------
-
-  ! ############################ Convert Pointers #############################
-  call c_f_pointer(handle_timeStruct, timeStruct)
-  call c_f_pointer(handle_forcStruct, forcStruct)
-  call c_f_pointer(handle_attrStruct, attrStruct)
-  call c_f_pointer(handle_typeStruct, typeStruct)
-  call c_f_pointer(handle_indxStruct, indxStruct)
-  call c_f_pointer(handle_mparStruct, mparStruct)
-  call c_f_pointer(handle_progStruct, progStruct)
-  call c_f_pointer(handle_diagStruct, diagStruct)
-  call c_f_pointer(handle_fluxStruct, fluxStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  call c_f_pointer(handle_lookupStruct, lookupStruct)
-  ! ############################################################################
-
-  ! ---------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message='runPhysics/'
-  
-  ! *******************************************************************************************
-  ! *** initialize computeVegFlux (flag to indicate if we are computing fluxes over vegetation)
-  ! *******************************************************************************************
-  ! if computeVegFlux changes, then the number of state variables changes, and we need to reoranize the data structures
-  if(modelTimeStep==1)then
-      ! get vegetation phenology
-      ! (compute the exposed LAI and SAI and whether veg is buried by snow)
-      call vegPhenlgy(&
-                      ! input/output: data structures
-                      model_decisions,                & ! intent(in):    model decisions
-                      typeStruct,                     & ! intent(in):    type of vegetation and soil
-                      attrStruct,                     & ! intent(in):    spatial attributes
-                      mparStruct,                     & ! intent(in):    model parameters
-                      progStruct,                     & ! intent(in):    model prognostic variables for a local HRU
-                      diagStruct,                     & ! intent(inout): model diagnostic variables for a local HRU
-                      ! output
-                      computeVegFluxFlag,             & ! intent(out): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-                      notUsed_canopyDepth,            & ! intent(out): NOT USED: canopy depth (m)
-                      notUsed_exposedVAI,             & ! intent(out): NOT USED: exposed vegetation area index (m2 m-2)
-                      fracJulDay,                     &
-                      yearLength,                     &
-                      err,cmessage)                     ! intent(out): error control
-      if(err/=0)then
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-    
-      ! save the flag for computing the vegetation fluxes
-      if(computeVegFluxFlag)      computeVegFlux = yes
-      if(.not.computeVegFluxFlag) computeVegFlux = no
-      
-      ! define the green vegetation fraction of the grid box (used to compute LAI)
-      diagStruct%var(iLookDIAG%scalarGreenVegFraction)%dat(1) = greenVegFrac_monthly(timeStruct%var(iLookTIME%im))
-  end if  ! if the first time step
- 
-
-  ! ****************************************************************************
-  ! *** model simulation
-  ! ****************************************************************************
-
-  
-  !****************************************************************************** 
-  !****************************** From run_oneGRU *******************************
-  !******************************************************************************
-  ! ----- basin initialization --------------------------------------------------------------------------------------------
-  ! initialize runoff variables
-  bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1)    = 0._dp  ! surface runoff (m s-1)
-  bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)     = 0._dp 
-  bvarStruct%var(iLookBVAR%basin__ColumnOutflow)%dat(1)    = 0._dp  ! outflow from all "outlet" HRUs (those with no downstream HRU)
-  bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1)      = 0._dp 
-
-  ! initialize baseflow variables
-  bvarStruct%var(iLookBVAR%basin__AquiferRecharge)%dat(1)  = 0._dp ! recharge to the aquifer (m s-1)
-  bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)  = 0._dp ! baseflow from the aquifer (m s-1)
-  bvarStruct%var(iLookBVAR%basin__AquiferTranspire)%dat(1) = 0._dp ! transpiration loss from the aquifer (m s-1)
-
-  ! initialize total inflow for each layer in a soil column
-  if (modelTimeStep == 0 .and. indxHRU == 1)then
-    fluxStruct%var(iLookFLUX%mLayerColumnInflow)%dat(:) = 0._dp
-  end if
- 
-  ! update the number of layers
-  nSnow   = indxStruct%var(iLookINDEX%nSnow)%dat(1)    ! number of snow layers
-  nSoil   = indxStruct%var(iLookINDEX%nSoil)%dat(1)    ! number of soil layers
-  nLayers = indxStruct%var(iLookINDEX%nLayers)%dat(1)  ! total number of layers
-  
-  computeVegFluxFlag = (ComputeVegFlux == yes)
-
-  !******************************************************************************
-  !****************************** From run_oneHRU *******************************
-  !******************************************************************************
-  ! water pixel: do nothing
-  if (typeStruct%var(iLookTYPE%vegTypeIndex) == isWater) return
-
-  ! get height at bottom of each soil layer, negative downwards (used in Noah MP)
-  allocate(zSoilReverseSign(nSoil),stat=err)
-  if(err/=0)then
-    message=trim(message)//'problem allocating space for zSoilReverseSign'
-    print*, message
-    err=20; return
-  endif
-  zSoilReverseSign(:) = -progStruct%var(iLookPROG%iLayerHeight)%dat(nSnow+1:nLayers)
- 
-  ! populate parameters in Noah-MP modules
-  ! Passing a maxSoilLayer in order to pass the check for NROOT, that is done to avoid making any changes to Noah-MP code.
-  !  --> NROOT from Noah-MP veg tables (as read here) is not used in SUMMA
-  call REDPRM(typeStruct%var(iLookTYPE%vegTypeIndex),      & ! vegetation type index
-              typeStruct%var(iLookTYPE%soilTypeIndex),     & ! soil type
-              typeStruct%var(iLookTYPE%slopeTypeIndex),    & ! slope type index
-              zSoilReverseSign,                            & ! * not used: height at bottom of each layer [NOTE: negative] (m)
-              maxSoilLayers,                               & ! number of soil layers
-              urbanVegCategory)                              ! vegetation category for urban areas
-
-  ! deallocate height at bottom of each soil layer(used in Noah MP)
-  deallocate(zSoilReverseSign,stat=err)
-  if(err/=0)then
-    message=trim(message)//'problem deallocating space for zSoilReverseSign'
-    print*, message
-    err=20; return
-  endif
- 
-
-  ! overwrite the minimum resistance
-  if(overwriteRSMIN) RSMIN = mparStruct%var(iLookPARAM%minStomatalResistance)%dat(1)
-  
-  ! overwrite the vegetation height
-  HVT(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyTop)%dat(1)
-  HVB(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyBottom)%dat(1)
-
-  ! overwrite the tables for LAI and SAI
-  if(model_decisions(iLookDECISIONS%LAI_method)%iDecision == specified)then
-    SAIM(typeStruct%var(iLookTYPE%vegTypeIndex),:) = mparStruct%var(iLookPARAM%winterSAI)%dat(1)
-    LAIM(typeStruct%var(iLookTYPE%vegTypeIndex),:) = mparStruct%var(iLookPARAM%summerLAI)%dat(1)*greenVegFrac_monthly
-  end if
- 
-  ! compute derived forcing variables
-  call derivforce(&
-        timeStruct%var,     & ! vector of time information
-        forcStruct%var,     & ! vector of model forcing data
-        attrStruct%var,     & ! vector of model attributes
-        mparStruct,         & ! data structure of model parameters
-        progStruct,         & ! data structure of model prognostic variables
-        diagStruct,         & ! data structure of model diagnostic variables
-        fluxStruct,         & ! data structure of model fluxes
-        tmZoneOffsetFracDay,& 
-        err,cmessage)       ! error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return 
-  endif
- 
-  ! initialize the number of flux calls
-  diagStruct%var(iLookDIAG%numFluxCalls)%dat(1) = 0._dp
-
-  ! run the model for a single HRU
-  call coupled_em(&
-                  ! model control
-                  indxHRU,            & ! intent(in):    hruID
-                  dt_init,            & ! intent(inout): initial time step
-                  dt_init_factor,     & ! Used to adjust the length of the timestep in the event of a failure
-                  computeVegFluxFlag, & ! intent(inout): flag to indicate if we are computing fluxes over vegetation
-                  ! data structures (input)
-                  typeStruct,         & ! intent(in):    local classification of soil veg etc. for each HRU
-                  attrStruct,         & ! intent(in):    local attributes for each HRU
-                  forcStruct,         & ! intent(in):    model forcing data
-                  mparStruct,         & ! intent(in):    model parameters
-                  bvarStruct,         & ! intent(in):    basin-average model variables
-                  lookupStruct,       &
-                  ! data structures (input-output)
-                  indxStruct,         & ! intent(inout): model indices
-                  progStruct,         & ! intent(inout): model prognostic variables for a local HRU
-                  diagStruct,         & ! intent(inout): model diagnostic variables for a local HRU
-                  fluxStruct,         & ! intent(inout): model fluxes for a local HRU
-                  fracJulDay,         &
-                  yearLength,         &
-                  ! error control
-                  err,cmessage)       ! intent(out): error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; endif 
-
-
-  !************************************* End of run_oneHRU *****************************************
-  ! save the flag for computing the vegetation fluxes
-  if(computeVegFluxFlag)      ComputeVegFlux = yes
-  if(.not.computeVegFluxFlag) ComputeVegFlux = no
-
-  fracHRU = attrStruct%var(iLookATTR%HRUarea) / bvarStruct%var(iLookBVAR%basin__totalArea)%dat(1)
-
-  ! ----- calculate weighted basin (GRU) fluxes --------------------------------------------------------------------------------------
-  
-  ! increment basin surface runoff (m s-1)
-  bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) = bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + fluxStruct%var(iLookFLUX%scalarSurfaceRunoff)%dat(1) * fracHRU
-  
-  !increment basin soil drainage (m s-1)
-  bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)   = bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)  + fluxStruct%var(iLookFLUX%scalarSoilDrainage)%dat(1)  * fracHRU
-  
-  ! increment aquifer variables -- ONLY if aquifer baseflow is computed individually for each HRU and aquifer is run
-  ! NOTE: groundwater computed later for singleBasin
-  if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == localColumn .and. model_decisions(iLookDECISIONS%groundwatr)%iDecision == bigBucket) then
-
-    bvarStruct%var(iLookBVAR%basin__AquiferRecharge)%dat(1)  = bvarStruct%var(iLookBVAR%basin__AquiferRecharge)%dat(1)   + fluxStruct%var(iLookFLUX%scalarSoilDrainage)%dat(1)     * fracHRU
-    bvarStruct%var(iLookBVAR%basin__AquiferTranspire)%dat(1) = bvarStruct%var(iLookBVAR%basin__AquiferTranspire)%dat(1)  + fluxStruct%var(iLookFLUX%scalarAquiferTranspire)%dat(1) * fracHRU
-    bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)  =  bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)  &
-            +  fluxStruct%var(iLookFLUX%scalarAquiferBaseflow)%dat(1) * fracHRU
-    end if
-
-  ! perform the routing
-  associate(totalArea => bvarStruct%var(iLookBVAR%basin__totalArea)%dat(1) )
-
-  ! compute water balance for the basin aquifer
-  if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == singleBasin)then
-    message=trim(message)//'multi_driver/bigBucket groundwater code not transferred from old code base yet'
-    err=20; return
-  end if
-
-  ! calculate total runoff depending on whether aquifer is connected
-  if(model_decisions(iLookDECISIONS%groundwatr)%iDecision == bigBucket) then
-    ! aquifer
-    bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1) = bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + bvarStruct%var(iLookBVAR%basin__ColumnOutflow)%dat(1)/totalArea + bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)
-  else
-    ! no aquifer
-    bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1) = bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + bvarStruct%var(iLookBVAR%basin__ColumnOutflow)%dat(1)/totalArea + bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)
-  endif
-
-  call qOverland(&
-                  ! input
-                  model_decisions(iLookDECISIONS%subRouting)%iDecision,            &  ! intent(in): index for routing method
-                  bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1),            &  ! intent(in): total runoff to the channel from all active components (m s-1)
-                  bvarStruct%var(iLookBVAR%routingFractionFuture)%dat,             &  ! intent(in): fraction of runoff in future time steps (m s-1)
-                  bvarStruct%var(iLookBVAR%routingRunoffFuture)%dat,               &  ! intent(in): runoff in future time steps (m s-1)
-                  ! output
-                  bvarStruct%var(iLookBVAR%averageInstantRunoff)%dat(1),           &  ! intent(out): instantaneous runoff (m s-1)
-                  bvarStruct%var(iLookBVAR%averageRoutedRunoff)%dat(1),            &  ! intent(out): routed runoff (m s-1)
-                  err,message)                                                                  ! intent(out): error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; endif
-  end associate
- 
-  !************************************* End of run_oneGRU *****************************************
- 
-  ! check errors
-  call handle_err(err, cmessage)
-
-end subroutine runPhysics
-
-end module model_run
diff --git a/build/source/actors/hru_actor/fortran_code/restart.f90 b/build/source/actors/hru_actor/fortran_code/restart.f90
deleted file mode 100644
index 44324a5a4f3ef4cd8cc3b59cfdf6cac2e9b633f5..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/restart.f90
+++ /dev/null
@@ -1,249 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module summa_restart
-! read restart data and reset the model state
-USE,intrinsic :: iso_c_binding
-
-
-USE data_types,only:&
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            (i8b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength            ! x%var(:)%dat        (dp)
-
-! access missing values
-USE globalData,only:integerMissing   ! missing integer
-USE globalData,only:realMissing      ! missing double precision number
-
-! named variables
-USE var_lookup,only:iLookPROG                               ! look-up values for local column model prognostic (state) variables
-USE var_lookup,only:iLookDIAG                               ! look-up values for local column model diagnostic variables
-USE var_lookup,only:iLookFLUX                               ! look-up values for local column model fluxes
-USE var_lookup,only:iLookBVAR                               ! look-up values for basin-average model variables
-USE var_lookup,only:iLookDECISIONS                          ! look-up values for model decisions
-
-! safety: set private unless specified otherwise
-implicit none
-private
-public::Restart
-contains
-
-! read restart data and reset the model state
-subroutine Restart(&
-                indxGRU,    & ! index of GRU in gru_struc
-                indxHRU,    & ! index of HRU in gru_struc
-                ! primary data structures (variable length vectors)
-                handle_indxStruct, & ! c_ptr to -- model indices
-                handle_mparStruct, & ! c_ptr to -- model parameters
-                handle_progStruct, & ! c_ptr to -- model prognostic (state) variables
-                handle_diagStruct, & ! c_ptr to -- model diagnostic variables
-                handle_fluxStruct, & ! c_ptr to -- model fluxes
-                ! basin-average structures
-                handle_bvarStruct, & ! x%var(:)%dat        -- basin-average variables
-                dt_init,    & ! used to initialize the length of the sub-step for each HRU
-                err) bind(C,name='Restart')
-  ! ---------------------------------------------------------------------------------------
-  ! * desired modules
-  ! ---------------------------------------------------------------------------------------
-  ! data types
-  USE nrtype                                                  ! variable types, etc.
-  ! functions and subroutines
-  USE time_utils_module,only:elapsedSec                       ! calculate the elapsed time
-  USE read_icond_gru_hru_module,only:read_icond               ! module to read initial conditions
-  USE check_icond4chm_module,only:check_icond4chm             ! module to check initial conditions
-  USE var_derive_module,only:calcHeight                       ! module to calculate height at layer interfaces and layer mid-point
-  USE var_derive_module,only:v_shortcut                       ! module to calculate "short-cut" variables
-  USE var_derive_module,only:rootDensty                       ! module to calculate the vertical distribution of roots
-  USE var_derive_module,only:satHydCond                       ! module to calculate the saturated hydraulic conductivity in each soil layer
-  ! global data structures
-  USE globalData,only:model_decisions                         ! model decision structure
-  ! timing variables
-  USE globalData,only:startRestart,endRestart                 ! date/time for the start and end of reading model restart files
-  USE globalData,only:elapsedRestart                          ! elapsed time to read model restart files
-  ! model decisions
-  USE mDecisions_module,only:&                                ! look-up values for the choice of method for the spatial representation of groundwater
-    localColumn, & ! separate groundwater representation in each local soil column
-    singleBasin    ! single groundwater store over the entire basin
-  implicit none
-  ! ---------------------------------------------------------------------------------------
-  ! Dummy variables
-  ! ---------------------------------------------------------------------------------------
-  integer(c_int),intent(in)                  :: indxGRU            !  index of GRU in gru_struc
-  integer(c_int),intent(in)                  :: indxHRU            !  index of HRU in gru_struc
-  ! primary data structures (variable length vectors)
-  type(c_ptr), intent(in), value          :: handle_indxStruct !  model indices
-  type(c_ptr), intent(in), value          :: handle_mparStruct !  model parameters
-  type(c_ptr), intent(in), value          :: handle_progStruct !  model prognostic (state) variables
-  type(c_ptr), intent(in), value          :: handle_diagStruct !  model diagnostic variables
-  type(c_ptr), intent(in), value          :: handle_fluxStruct !  model fluxes
-  ! define the basin-average structures
-  type(c_ptr), intent(in), value          :: handle_bvarStruct !  basin-average variables
-  real(c_double), intent(inout)           :: dt_init
-  integer(c_int), intent(inout)           :: err
-  ! ---------------------------------------------------------------------------------------
-  ! Fortran Pointers
-  ! ---------------------------------------------------------------------------------------
-  ! primary data structures (variable length vectors)
-  type(var_ilength),pointer              :: indxStruct                 !  model indices
-  type(var_dlength),pointer              :: mparStruct                 !  model parameters
-  type(var_dlength),pointer              :: progStruct                 !  model prognostic (state) variables
-  type(var_dlength),pointer              :: diagStruct                 !  model diagnostic variables
-  type(var_dlength),pointer              :: fluxStruct                 !  model fluxes
-  ! define the basin-average structures
-  type(var_dlength),pointer              :: bvarStruct                 !  basin-average variables
-  ! ---------------------------------------------------------------------------------------
-  ! local variables
-  ! ---------------------------------------------------------------------------------------
-  character(len=256)                       :: message            ! error message
-  character(LEN=256)                       :: cmessage           ! error message of downwind routine
-  character(LEN=256)                       :: restartFile        ! restart file name
-  integer(i4b)                             :: nGRU
-  ! ---------------------------------------------------------------------------------------
-
-  ! #############################################################################
-  call c_f_pointer(handle_indxStruct, indxStruct)
-  call c_f_pointer(handle_mparStruct, mparStruct)
-  call c_f_pointer(handle_progStruct, progStruct)
-  call c_f_pointer(handle_diagStruct, diagStruct)
-  call c_f_pointer(handle_fluxStruct, fluxStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  ! #############################################################################
-
-  ! initialize error control
-  err=0; message='hru_actor_readRestart/'
-  nGRU = 1
-
-  ! *****************************************************************************
-  ! *** read/check initial conditions
-  ! *****************************************************************************
-  ! read initial conditions
-  call read_icond(&
-                  indxGRU,                       & ! intent(in):    index of GRU in gru_struc
-                  indxHRU,                       & ! intent(in):    index of HRU in gru_struc
-                  mparStruct,                    & ! intent(in):    model parameters
-                  progStruct,                    & ! intent(inout): model prognostic variables
-                  bvarStruct,                    & ! intent(inout): model basin (GRU) variables
-                  indxStruct,                    & ! intent(inout): model indices
-                  err,cmessage)                    ! intent(out):   error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
-  ! check initial conditions
-  call check_icond4chm(&
-                    indxGRU,                        & ! intent(in):   index of GRU in gru_struc
-                    indxHRU,                        & ! intent(in):   index of HRU in gru_struc           
-                    progStruct,                     & ! intent(in):   model prognostic (state) variables
-                    mparStruct,                     & ! intent(in):   model parameters
-                    indxStruct,                     & ! intent(in):   layer indexes
-                    err,cmessage)                   ! intent(out):   error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
-
-  ! *****************************************************************************
-  ! *** compute ancillary variables
-  ! *****************************************************************************
-
-  ! re-calculate height of each layer
-  call calcHeight(indxStruct,   & ! layer type
-                  progStruct,   & ! model prognostic (state) variables for a local HRU
-                  err,cmessage)                       ! error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
-  ! calculate vertical distribution of root density
-  call rootDensty(mparStruct,   & ! vector of model parameters
-                  indxStruct,   & ! data structure of model indices
-                  progStruct,   & ! data structure of model prognostic (state) variables
-                  diagStruct,   & ! data structure of model diagnostic variables
-                  err,cmessage)                       ! error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
-  ! calculate saturated hydraulic conductivity in each soil layer
-  call satHydCond(mparStruct,   & ! vector of model parameters
-                  indxStruct,   & ! data structure of model indices
-                  progStruct,   & ! data structure of model prognostic (state) variables
-                  fluxStruct,   & ! data structure of model fluxes
-                  err,cmessage)                       ! error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
-  ! calculate "short-cut" variables such as volumetric heat capacity
-  call v_shortcut(mparStruct,   & ! vector of model parameters
-                  diagStruct,   & ! data structure of model diagnostic variables
-                  err,cmessage)                       ! error control
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
-
-  ! initialize canopy drip
-  ! NOTE: canopy drip from the previous time step is used to compute throughfall for the current time step
-  fluxStruct%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp  ! not used
-
-  ! *****************************************************************************
-  ! *** initialize aquifer storage
-  ! *****************************************************************************
-
-  ! initialize aquifer storage
-  ! NOTE: this is ugly: need to add capabilities to initialize basin-wide state variables
-
-  ! There are two options for groundwater:
-  !  (1) where groundwater is included in the local column (i.e., the HRUs); and
-  !  (2) where groundwater is included for the single basin (i.e., the GRUS, where multiple HRUS drain into a GRU).
-
-  ! For water balance calculations it is important to ensure that the local aquifer storage is zero if groundwater is treated as a basin-average state variable (singleBasin);
-  !  and ensure that basin-average aquifer storage is zero when groundwater is included in the local columns (localColumn).
-
-  ! select groundwater option
-  select case(model_decisions(iLookDECISIONS%spatial_gw)%iDecision)
-
-   ! the basin-average aquifer storage is not used if the groundwater is included in the local column
-   case(localColumn)
-    bvarStruct%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 0._dp ! set to zero to be clear that there is no basin-average aquifer storage in this configuration
-
-   ! the local column aquifer storage is not used if the groundwater is basin-average
-   ! (i.e., where multiple HRUs drain to a basin-average aquifer)
-   case(singleBasin)
-    bvarStruct%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 1._dp
-    progStruct%var(iLookPROG%scalarAquiferStorage)%dat(1) = 0._dp  ! set to zero to be clear that there is no local aquifer storage in this configuration
-
-   ! error check
-   case default
-    message=trim(message)//'unable to identify decision for regional representation of groundwater'
-    return
-
-  end select  ! groundwater option
-
-  ! *****************************************************************************
-  ! *** initialize time step
-  ! *****************************************************************************
-
-  ! initialize time step length
-  dt_init = progStruct%var(iLookPROG%dt_init)%dat(1) ! seconds
-   
-
-  ! *****************************************************************************
-  ! *** finalize
-  ! *****************************************************************************
-
-end subroutine Restart
-
-end module summa_restart
-
-
-
-
diff --git a/build/source/actors/hru_actor/fortran_code/setup_hru.f90 b/build/source/actors/hru_actor/fortran_code/setup_hru.f90
deleted file mode 100644
index a1ff54ec786270ddfaa3dfe6d1dc7656296035bd..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/setup_hru.f90
+++ /dev/null
@@ -1,511 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module SummaActors_setup
-USE,intrinsic :: iso_c_binding
-
-! initializes parameter data structures (e.g. vegetation and soil parameters).
-
-USE data_types,only:&
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            (i8b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    zLookup
-
-! access missing values
-USE globalData,only:integerMissing   ! missing integer
-USE globalData,only:realMissing      ! missing double precision number
-
-! named variables
-USE var_lookup,only:iLookATTR                               ! look-up values for local attributes
-USE var_lookup,only:iLookTYPE                               ! look-up values for classification of veg, soils etc.
-USE var_lookup,only:iLookPARAM                              ! look-up values for local column model parameters
-USE var_lookup,only:iLookID                                 ! look-up values for local column model parameters
-USE var_lookup,only:iLookBVAR                               ! look-up values for basin-average model variables
-USE var_lookup,only:iLookDECISIONS                          ! look-up values for model decisions
-USE globalData,only:urbanVegCategory                        ! vegetation category for urban areas
-
-! metadata structures
-USE globalData,only:mpar_meta,bpar_meta                     ! parameter metadata structures
-
-! named variables to define the decisions for snow layers
-USE mDecisions_module,only:&
-  sameRulesAllLayers, & ! SNTHERM option: same combination/sub-dividion rules applied to all layers
-  rulesDependLayerIndex ! CLM option: combination/sub-dividion rules depend on layer index
-
-! named variables to define LAI decisions
-USE mDecisions_module,only:&
- monthlyTable,& ! LAI/SAI taken directly from a monthly table for different vegetation classes
- specified      ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
-
-! safety: set private unless specified otherwise
-implicit none
-private
-public::setupHRUParam
-public::SOIL_VEG_GEN_PARM
-contains
-
-! initializes parameter data structures (e.g. vegetation and soil parameters).
-subroutine setupHRUParam(&
-                  indxGRU,                 & ! ID of hru
-                  indxHRU,                 & ! Index of the parent GRU of the HRU 
-                  ! primary data structures (scalars)
-                  handle_attrStruct,              & ! local attributes for each HRU
-                  handle_typeStruct,              & ! local classification of soil veg etc. for each HRU
-                  handle_idStruct,                & ! local classification of soil veg etc. for each HRU
-                  ! primary data structures (variable length vectors)
-                  handle_mparStruct,              & ! model parameters
-                  handle_bparStruct,              & ! basin-average parameters
-                  handle_bvarStruct,              & ! basin-average variables
-                  handle_dparStruct,              & ! default model parameters
-                  handle_lookupStruct,            & ! lookup tables
-                  ! local HRU data
-                  handle_startTime,               & ! start time for the model simulation
-                  handle_oldTime,                 & ! time for the previous model time step
-                  ! miscellaneous variables
-                  upArea,                  & ! area upslope of each HRU,
-                  err) bind(C, name='setupHRUParam')
-  ! ---------------------------------------------------------------------------------------
-  ! * desired modules
-  ! ---------------------------------------------------------------------------------------
-  USE nrtype                                                  ! variable types, etc.
-  ! subroutines and functions
-  use time_utils_module,only:elapsedSec                       ! calculate the elapsed time
-  USE mDecisions_module,only:mDecisions                       ! module to read model decisions
-  USE ffile_info_module,only:ffile_info                       ! module to read information on forcing datafile
-  ! USE read_attribute_module,only:read_attribute               ! module to read local attributes
-  USE paramCheck_module,only:paramCheck                       ! module to check consistency of model parameters
-  USE pOverwrite_module,only:pOverwrite                       ! module to overwrite default parameter values with info from the Noah tables
-  USE ConvE2Temp_module,only:E2T_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
-  USE t2enthalpy_module,only:T2E_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
-  USE var_derive_module,only:fracFuture                       ! module to calculate the fraction of runoff in future time steps (time delay histogram)
-  USE module_sf_noahmplsm,only:read_mp_veg_parameters         ! module to read NOAH vegetation tables
-  ! global data structures
-  USE globalData,only:gru_struc                               ! gru-hru mapping structures
-  USE globalData,only:localParFallback                        ! local column default parameters
-  USE globalData,only:model_decisions                         ! model decision structure
-  USE globalData,only:greenVegFrac_monthly                    ! fraction of green vegetation in each month (0-1)
-  ! output constraints
-  USE globalData,only:maxLayers                               ! maximum number of layers
-  USE globalData,only:maxSnowLayers                           ! maximum number of snow layers
-  ! timing variables
-  USE globalData,only:startSetup,endSetup                     ! date/time for the start and end of the parameter setup
-  USE globalData,only:elapsedSetup                            ! elapsed time for the parameter setup
-  ! Noah-MP parameters
-  USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM                    ! 2-d tables for stem area index and leaf area index (vegType,month)
-  USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB                      ! height at the top and bottom of vegetation (vegType)
-
-  ! ---------------------------------------------------------------------------------------
-  ! * variables
-  ! ---------------------------------------------------------------------------------------
-  implicit none
-  ! dummy variables
-  ! calling variables
-  integer(c_int),intent(in)                :: indxGRU              ! Index of the parent GRU of the HRU
-  integer(c_int),intent(in)                :: indxHRU              ! ID to locate correct HRU from netcdf file  
-  type(c_ptr), intent(in), value           :: handle_attrStruct    ! local attributes for each HRU
-  type(c_ptr), intent(in), value           :: handle_typeStruct    ! local classification of soil veg etc. for each HRU
-  type(c_ptr), intent(in), value           :: handle_idStruct      !  
-  type(c_ptr), intent(in), value           :: handle_mparStruct    ! model parameters
-  type(c_ptr), intent(in), value           :: handle_bparStruct    ! basin-average parameters
-  type(c_ptr), intent(in), value           :: handle_bvarStruct    ! basin-average variables
-  type(c_ptr), intent(in), value           :: handle_dparStruct    ! default model parameters
-  type(c_ptr), intent(in), value           :: handle_lookupStruct     ! start time for the model simulation
-  type(c_ptr), intent(in), value           :: handle_startTime     ! start time for the model simulation
-  type(c_ptr), intent(in), value           :: handle_oldTime       ! time for the previous model time step
-  real(c_double),intent(inout)             :: upArea
-  integer(c_int),intent(inout)             :: err
-
-  ! local variables
-  type(var_d),pointer                      :: attrStruct           ! local attributes for each HRU
-  type(var_i),pointer                      :: typeStruct           ! local classification of soil veg etc. for each HRU
-  type(var_i8),pointer                     :: idStruct             !
-  type(var_dlength),pointer                :: mparStruct           ! model parameters
-  type(var_d),pointer                      :: bparStruct           ! basin-average parameters
-  type(var_dlength),pointer                :: bvarStruct           ! basin-average variables
-  type(var_d),pointer                      :: dparStruct           ! default model parameters
-  type(zLookup),pointer                    :: lookupStruct         ! default model parameters
-  type(var_i),pointer                      :: startTime            ! start time for the model simulation
-  type(var_i),pointer                      :: oldTime              ! time for the previous model time step
-  character(len=256)                       :: message              ! error message
-  character(len=256)                       :: cmessage             ! error message of downwind routine
-   
-  ! ---------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message='setupHRUParam/'
-
-  ! convert to fortran pointer from C++ pointer
-  call c_f_pointer(handle_attrStruct, attrStruct)
-  call c_f_pointer(handle_typeStruct, typeStruct)
-  call c_f_pointer(handle_idStruct, idStruct)
-  call c_f_pointer(handle_mparStruct, mparStruct)
-  call c_f_pointer(handle_bparStruct, bparStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  call c_f_pointer(handle_dparStruct, dparStruct)
-  call c_f_pointer(handle_lookupStruct, lookupStruct)
-  call c_f_pointer(handle_startTime, startTime)
-  call c_f_pointer(handle_oldTime, oldTime)
-
-  ! ffile_info and mDecisions moved to their own seperate subroutine call
-  
-  oldTime%var(:) = startTime%var(:)
-
-  ! get the maximum number of snow layers
-  select case(model_decisions(iLookDECISIONS%snowLayers)%iDecision)
-    case(sameRulesAllLayers);    maxSnowLayers = 100
-    case(rulesDependLayerIndex); maxSnowLayers = 5
-    case default; err=20; 
-        message=trim(message)//'unable to identify option to combine/sub-divide snow layers'
-        print*, message
-        return
-  end select ! (option to combine/sub-divide snow layers)
-
-  ! get the maximum number of layers
-  maxLayers = gru_struc(1)%hruInfo(1)%nSoil + maxSnowLayers
-
-  ! define monthly fraction of green vegetation
-  greenVegFrac_monthly = (/0.01_dp, 0.02_dp, 0.03_dp, 0.07_dp, 0.50_dp, 0.90_dp, 0.95_dp, 0.96_dp, 0.65_dp, 0.24_dp, 0.11_dp, 0.02_dp/)
-
-  ! define urban vegetation category
-  select case(trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision))
-    case('USGS');                     urbanVegCategory =    1
-    case('MODIFIED_IGBP_MODIS_NOAH'); urbanVegCategory =   13
-    case('plumberCABLE');             urbanVegCategory = -999
-    case('plumberCHTESSEL');          urbanVegCategory = -999
-    case('plumberSUMMA');             urbanVegCategory = -999
-    case default
-      message=trim(message)//'unable to identify vegetation category'
-      print*, message
-      return
-  end select
-
-  ! *****************************************************************************
-  ! *** compute derived model variables that are pretty much constant for the basin as a whole
-  ! *****************************************************************************
-  ! calculate the fraction of runoff in future time steps
-  call fracFuture(bparStruct%var,    &  ! vector of basin-average model parameters
-                  bvarStruct,        &  ! data structure of basin-average variables
-                  err,cmessage)                   ! error control
-  if(err/=0)then;message=trim(message)//trim(cmessage);print*,message;return;endif
-
-  ! check that the parameters are consistent
-  call paramCheck(mparStruct,err,cmessage)
-  if(err/=0)then;message=trim(message)//trim(cmessage);print*,message;return;endif
-
-  ! calculate a look-up table for the temperature-enthalpy conversion
-  call E2T_lookup(mparStruct,err,cmessage)
-  if(err/=0)then;message=trim(message)//trim(cmessage);print*, message;return;endif
-
-  ! overwrite the vegetation height
-  HVT(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyTop)%dat(1)
-  HVB(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyBottom)%dat(1)
-
-  ! overwrite the tables for LAI and SAI
-  if(model_decisions(iLookDECISIONS%LAI_method)%iDecision == specified)then
-    SAIM(typeStruct%var(iLookTYPE%vegTypeIndex),:) = mparStruct%var(iLookPARAM%winterSAI)%dat(1)
-    LAIM(typeStruct%var(iLookTYPE%vegTypeIndex),:) = mparStruct%var(iLookPARAM%summerLAI)%dat(1)*greenVegFrac_monthly
-  endif
-
-  ! compute total area of the upstream HRUS that flow into each HRU
-  upArea = 0._dp
-  ! Check if lateral flows exists within the HRU
-  if(typeStruct%var(iLookTYPE%downHRUindex)==typeStruct%var(iLookID%hruId))then
-    upArea = upArea + attrStruct%var(iLookATTR%HRUarea)
-  endif
-
-  ! identify the total basin area for a GRU (m2)
-  associate(totalArea => bvarStruct%var(iLookBVAR%basin__totalArea)%dat(1) )
-    totalArea = 0._dp
-    totalArea = totalArea + attrStruct%var(iLookATTR%HRUarea)
-  end associate
-
-end subroutine setupHRUParam
-
-! **************************************************************************************************
-! private subroutine SOIL_VEG_GEN_PARM: Read soil, vegetation and other model parameters (from NOAH)
-! **************************************************************************************************
-!-----------------------------------------------------------------
-SUBROUTINE SOIL_VEG_GEN_PARM(FILENAME_VEGTABLE, FILENAME_SOILTABLE, FILENAME_GENERAL, MMINLU, MMINSL)
- !-----------------------------------------------------------------
-  use module_sf_noahlsm, only : shdtbl, nrotbl, rstbl, rgltbl, &
-       &                        hstbl, snuptbl, maxalb, laimintbl, &
-       &                        bb, drysmc, f11, maxsmc, laimaxtbl, &
-       &                        emissmintbl, emissmaxtbl, albedomintbl, &
-       &                        albedomaxtbl, wltsmc, qtz, refsmc, &
-       &                        z0mintbl, z0maxtbl, &
-       &                        satpsi, satdk, satdw, &
-       &                        theta_res, theta_sat, vGn_alpha, vGn_n, k_soil, &  ! MPC add van Genutchen parameters
-       &                        fxexp_data, lvcoef_data, &
-       &                        lutype, maxalb, &
-       &                        slope_data, frzk_data, bare, cmcmax_data, &
-       &                        cfactr_data, csoil_data, czil_data, &
-       &                        refkdt_data, natural, refdk_data, &
-       &                        rsmax_data, salp_data, sbeta_data, &
-       &                        zbot_data, smhigh_data, smlow_data, &
-       &                        lucats, topt_data, slcats, slpcats, sltype
-
-  IMPLICIT NONE
-
-  CHARACTER(LEN=*), INTENT(IN) :: FILENAME_VEGTABLE, FILENAME_SOILTABLE, FILENAME_GENERAL
-  CHARACTER(LEN=*), INTENT(IN) :: MMINLU, MMINSL
-  integer :: LUMATCH, IINDEX, LC, NUM_SLOPE
-  integer :: ierr
-  INTEGER , PARAMETER :: OPEN_OK = 0
-
-  character*128 :: mess , message
-
-  !-----SPECIFY VEGETATION RELATED CHARACTERISTICS :
-  !             ALBBCK: SFC albedo (in percentage)
-  !                 Z0: Roughness length (m)
-  !             SHDFAC: Green vegetation fraction (in percentage)
-  !  Note: The ALBEDO, Z0, and SHDFAC values read from the following table
-  !          ALBEDO, amd Z0 are specified in LAND-USE TABLE; and SHDFAC is
-  !          the monthly green vegetation data
-  !             CMXTBL: MAX CNPY Capacity (m)
-  !             NROTBL: Rooting depth (layer)
-  !              RSMIN: Mimimum stomatal resistance (s m-1)
-  !              RSMAX: Max. stomatal resistance (s m-1)
-  !                RGL: Parameters used in radiation stress function
-  !                 HS: Parameter used in vapor pressure deficit functio
-  !               TOPT: Optimum transpiration air temperature. (K)
-  !             CMCMAX: Maximum canopy water capacity
-  !             CFACTR: Parameter used in the canopy inteception calculati
-  !               SNUP: Threshold snow depth (in water equivalent m) that
-  !                     implies 100% snow cover
-  !                LAI: Leaf area index (dimensionless)
-  !             MAXALB: Upper bound on maximum albedo over deep snow
-  !
-  !-----READ IN VEGETAION PROPERTIES FROM VEGPARM.TBL
-  !
-
-  OPEN(19, FILE=trim(FILENAME_VEGTABLE),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
-  IF(ierr .NE. OPEN_OK ) THEN
-     WRITE(message,FMT='(A)') &
-          'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening VEGPARM.TBL'
-     CALL wrf_error_fatal ( message )
-  END IF
-
-  LUMATCH=0
-
-  FIND_LUTYPE : DO WHILE (LUMATCH == 0)
-     READ (19,*,END=2002)
-     READ (19,*,END=2002)LUTYPE
-     READ (19,*)LUCATS,IINDEX
-
-     IF(LUTYPE.EQ.MMINLU)THEN
-        WRITE( mess , * ) 'LANDUSE TYPE = ' // TRIM ( LUTYPE ) // ' FOUND', LUCATS,' CATEGORIES'
-        ! CALL wrf_message( mess )
-        LUMATCH=1
-     ELSE
-       ! call wrf_message ( "Skipping over LUTYPE = " // TRIM ( LUTYPE ) )
-        DO LC = 1, LUCATS+12
-           read(19,*)
-        ENDDO
-     ENDIF
-  ENDDO FIND_LUTYPE
-  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
-  IF ( SIZE(SHDTBL)       < LUCATS .OR. &
-       SIZE(NROTBL)       < LUCATS .OR. &
-       SIZE(RSTBL)        < LUCATS .OR. &
-       SIZE(RGLTBL)       < LUCATS .OR. &
-       SIZE(HSTBL)        < LUCATS .OR. &
-       SIZE(SNUPTBL)      < LUCATS .OR. &
-       SIZE(MAXALB)       < LUCATS .OR. &
-       SIZE(LAIMINTBL)    < LUCATS .OR. &
-       SIZE(LAIMAXTBL)    < LUCATS .OR. &
-       SIZE(Z0MINTBL)     < LUCATS .OR. &
-       SIZE(Z0MAXTBL)     < LUCATS .OR. &
-       SIZE(ALBEDOMINTBL) < LUCATS .OR. &
-       SIZE(ALBEDOMAXTBL) < LUCATS .OR. &
-       SIZE(EMISSMINTBL ) < LUCATS .OR. &
-       SIZE(EMISSMAXTBL ) < LUCATS ) THEN
-     CALL wrf_error_fatal('Table sizes too small for value of LUCATS in module_sf_noahdrv.F')
-  ENDIF
-
-  IF(LUTYPE.EQ.MMINLU)THEN
-     DO LC=1,LUCATS
-        READ (19,*)IINDEX,SHDTBL(LC),                        &
-             NROTBL(LC),RSTBL(LC),RGLTBL(LC),HSTBL(LC), &
-             SNUPTBL(LC),MAXALB(LC), LAIMINTBL(LC),     &
-             LAIMAXTBL(LC),EMISSMINTBL(LC),             &
-             EMISSMAXTBL(LC), ALBEDOMINTBL(LC),         &
-             ALBEDOMAXTBL(LC), Z0MINTBL(LC), Z0MAXTBL(LC)
-     ENDDO
-
-     READ (19,*)
-     READ (19,*)TOPT_DATA
-     READ (19,*)
-     READ (19,*)CMCMAX_DATA
-     READ (19,*)
-     READ (19,*)CFACTR_DATA
-     READ (19,*)
-     READ (19,*)RSMAX_DATA
-     READ (19,*)
-     READ (19,*)BARE
-     READ (19,*)
-     READ (19,*)NATURAL
-  ENDIF
-
-2002 CONTINUE
-
-  CLOSE (19)
-  IF (LUMATCH == 0) then
-     CALL wrf_error_fatal ("Land Use Dataset '"//MMINLU//"' not found in VEGPARM.TBL.")
-  ENDIF
-
-!
-!-----READ IN SOIL PROPERTIES FROM SOILPARM.TBL
-!
-  OPEN(19, FILE=trim(FILENAME_SOILTABLE),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
-  IF(ierr .NE. OPEN_OK ) THEN
-     WRITE(message,FMT='(A)') &
-          'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening SOILPARM.TBL'
-     CALL wrf_error_fatal ( message )
-  END IF
-
-  WRITE(mess,*) 'INPUT SOIL TEXTURE CLASSIFICATION = ', TRIM ( MMINSL )
-  ! CALL wrf_message( mess )
-
-  LUMATCH=0
-
-  ! MPC add a new soil table
-  FIND_soilTYPE : DO WHILE (LUMATCH == 0)
-   READ (19,*)
-   READ (19,*,END=2003)SLTYPE
-   READ (19,*)SLCATS,IINDEX
-   IF(SLTYPE.EQ.MMINSL)THEN
-     WRITE( mess , * ) 'SOIL TEXTURE CLASSIFICATION = ', TRIM ( SLTYPE ) , ' FOUND', &
-          SLCATS,' CATEGORIES'
-     ! CALL wrf_message ( mess )
-     LUMATCH=1
-   ELSE
-    ! call wrf_message ( "Skipping over SLTYPE = " // TRIM ( SLTYPE ) )
-    DO LC = 1, SLCATS
-     read(19,*)
-    ENDDO
-   ENDIF
-  ENDDO FIND_soilTYPE
-  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
-  IF ( SIZE(BB    ) < SLCATS .OR. &
-       SIZE(DRYSMC) < SLCATS .OR. &
-       SIZE(F11   ) < SLCATS .OR. &
-       SIZE(MAXSMC) < SLCATS .OR. &
-       SIZE(REFSMC) < SLCATS .OR. &
-       SIZE(SATPSI) < SLCATS .OR. &
-       SIZE(SATDK ) < SLCATS .OR. &
-       SIZE(SATDW ) < SLCATS .OR. &
-       SIZE(WLTSMC) < SLCATS .OR. &
-       SIZE(QTZ   ) < SLCATS  ) THEN
-     CALL wrf_error_fatal('Table sizes too small for value of SLCATS in module_sf_noahdrv.F')
-  ENDIF
-
-  ! MPC add new soil table
-  select case(trim(SLTYPE))
-   case('STAS','STAS-RUC')  ! original soil tables
-     DO LC=1,SLCATS
-        READ (19,*) IINDEX,BB(LC),DRYSMC(LC),F11(LC),MAXSMC(LC),&
-             REFSMC(LC),SATPSI(LC),SATDK(LC), SATDW(LC),   &
-             WLTSMC(LC), QTZ(LC)
-     ENDDO
-   case('ROSETTA')          ! new soil table
-     DO LC=1,SLCATS
-        READ (19,*) IINDEX,&
-             ! new soil parameters (from Rosetta)
-             theta_res(LC), theta_sat(LC),        &
-             vGn_alpha(LC), vGn_n(LC), k_soil(LC), &
-             ! original soil parameters
-             BB(LC),DRYSMC(LC),F11(LC),MAXSMC(LC),&
-             REFSMC(LC),SATPSI(LC),SATDK(LC), SATDW(LC),   &
-             WLTSMC(LC), QTZ(LC)
-     ENDDO
-   case default
-     CALL wrf_message( 'SOIL TEXTURE IN INPUT FILE DOES NOT ' )
-     CALL wrf_message( 'MATCH SOILPARM TABLE'                 )
-     CALL wrf_error_fatal ( 'INCONSISTENT OR MISSING SOILPARM FILE' )
-  end select
-
-2003 CONTINUE
-
-  CLOSE (19)
-
-  IF(LUMATCH.EQ.0)THEN
-     CALL wrf_message( 'SOIL TEXTURE IN INPUT FILE DOES NOT ' )
-     CALL wrf_message( 'MATCH SOILPARM TABLE'                 )
-     CALL wrf_error_fatal ( 'INCONSISTENT OR MISSING SOILPARM FILE' )
-  ENDIF
-
-!
-!-----READ IN GENERAL PARAMETERS FROM GENPARM.TBL
-!
-  OPEN(19, FILE=trim(FILENAME_GENERAL),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
-  IF(ierr .NE. OPEN_OK ) THEN
-     WRITE(message,FMT='(A)') &
-          'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening GENPARM.TBL'
-     CALL wrf_error_fatal ( message )
-  END IF
-
-  READ (19,*)
-  READ (19,*)
-  READ (19,*) NUM_SLOPE
-
-  SLPCATS=NUM_SLOPE
-! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
-  IF ( SIZE(slope_data) < NUM_SLOPE ) THEN
-     CALL wrf_error_fatal('NUM_SLOPE too large for slope_data array in module_sf_noahdrv')
-  ENDIF
-
-  DO LC=1,SLPCATS
-     READ (19,*)SLOPE_DATA(LC)
-  ENDDO
-
-  READ (19,*)
-  READ (19,*)SBETA_DATA
-  READ (19,*)
-  READ (19,*)FXEXP_DATA
-  READ (19,*)
-  READ (19,*)CSOIL_DATA
-  READ (19,*)
-  READ (19,*)SALP_DATA
-  READ (19,*)
-  READ (19,*)REFDK_DATA
-  READ (19,*)
-  READ (19,*)REFKDT_DATA
-  READ (19,*)
-  READ (19,*)FRZK_DATA
-  READ (19,*)
-  READ (19,*)ZBOT_DATA
-  READ (19,*)
-  READ (19,*)CZIL_DATA
-  READ (19,*)
-  READ (19,*)SMLOW_DATA
-  READ (19,*)
-  READ (19,*)SMHIGH_DATA
-  READ (19,*)
-  READ (19,*)LVCOEF_DATA
-  CLOSE (19)
-
-!-----------------------------------------------------------------
-END SUBROUTINE SOIL_VEG_GEN_PARM
-!-----------------------------------------------------------------
-
-end module SummaActors_setup
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/fortran_code/setup_hru_sundials.f90 b/build/source/actors/hru_actor/fortran_code/setup_hru_sundials.f90
deleted file mode 100644
index c6443c5b6493643cc2c3c040b6ecb2802e5c41cf..0000000000000000000000000000000000000000
--- a/build/source/actors/hru_actor/fortran_code/setup_hru_sundials.f90
+++ /dev/null
@@ -1,518 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module SummaActors_setup
-USE,intrinsic :: iso_c_binding
-
-! initializes parameter data structures (e.g. vegetation and soil parameters).
-
-USE data_types,only:&
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            (i8b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    zLookup
-
-! access missing values
-USE globalData,only:integerMissing   ! missing integer
-USE globalData,only:realMissing      ! missing double precision number
-
-! named variables
-USE var_lookup,only:iLookATTR                               ! look-up values for local attributes
-USE var_lookup,only:iLookTYPE                               ! look-up values for classification of veg, soils etc.
-USE var_lookup,only:iLookPARAM                              ! look-up values for local column model parameters
-USE var_lookup,only:iLookID                                 ! look-up values for local column model parameters
-USE var_lookup,only:iLookBVAR                               ! look-up values for basin-average model variables
-USE var_lookup,only:iLookDECISIONS                          ! look-up values for model decisions
-USE globalData,only:urbanVegCategory                        ! vegetation category for urban areas
-
-! metadata structures
-USE globalData,only:mpar_meta,bpar_meta                     ! parameter metadata structures
-
-! named variables to define the decisions for snow layers
-USE mDecisions_module,only:&
-  sameRulesAllLayers, & ! SNTHERM option: same combination/sub-dividion rules applied to all layers
-  rulesDependLayerIndex ! CLM option: combination/sub-dividion rules depend on layer index
-
-! named variables to define LAI decisions
-USE mDecisions_module,only:&
- monthlyTable,& ! LAI/SAI taken directly from a monthly table for different vegetation classes
- specified      ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
-
-! safety: set private unless specified otherwise
-implicit none
-private
-public::setupHRUParam
-public::SOIL_VEG_GEN_PARM
-contains
-
-! initializes parameter data structures (e.g. vegetation and soil parameters).
-subroutine setupHRUParam(&
-                  indxGRU,                 & ! ID of hru
-                  indxHRU,                 & ! Index of the parent GRU of the HRU 
-                  ! primary data structures (scalars)
-                  handle_attrStruct,              & ! local attributes for each HRU
-                  handle_typeStruct,              & ! local classification of soil veg etc. for each HRU
-                  handle_idStruct,                & ! local classification of soil veg etc. for each HRU
-                  ! primary data structures (variable length vectors)
-                  handle_mparStruct,              & ! model parameters
-                  handle_bparStruct,              & ! basin-average parameters
-                  handle_bvarStruct,              & ! basin-average variables
-                  handle_dparStruct,              & ! default model parameters
-                  handle_lookupStruct,            & ! lookup tables
-                  ! local HRU data
-                  handle_startTime,               & ! start time for the model simulation
-                  handle_oldTime,                 & ! time for the previous model time step
-                  ! miscellaneous variables
-                  upArea,                  & ! area upslope of each HRU,
-                  err) bind(C, name='setupHRUParam')
-  ! ---------------------------------------------------------------------------------------
-  ! * desired modules
-  ! ---------------------------------------------------------------------------------------
-  USE nrtype                                                  ! variable types, etc.
-  ! subroutines and functions
-  use time_utils_module,only:elapsedSec                       ! calculate the elapsed time
-  USE mDecisions_module,only:mDecisions                       ! module to read model decisions
-  USE ffile_info_module,only:ffile_info                       ! module to read information on forcing datafile
-  ! USE read_attribute_module,only:read_attribute               ! module to read local attributes
-  USE paramCheck_module,only:paramCheck                       ! module to check consistency of model parameters
-  USE pOverwrite_module,only:pOverwrite                       ! module to overwrite default parameter values with info from the Noah tables
-  USE ConvE2Temp_module,only:E2T_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
-  USE t2enthalpy_module,only:T2E_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
-  USE var_derive_module,only:fracFuture                       ! module to calculate the fraction of runoff in future time steps (time delay histogram)
-  USE module_sf_noahmplsm,only:read_mp_veg_parameters         ! module to read NOAH vegetation tables
-  ! global data structures
-  USE globalData,only:gru_struc                               ! gru-hru mapping structures
-  USE globalData,only:localParFallback                        ! local column default parameters
-  USE globalData,only:model_decisions                         ! model decision structure
-  USE globalData,only:greenVegFrac_monthly                    ! fraction of green vegetation in each month (0-1)
-  ! output constraints
-  USE globalData,only:maxLayers                               ! maximum number of layers
-  USE globalData,only:maxSnowLayers                           ! maximum number of snow layers
-  ! timing variables
-  USE globalData,only:startSetup,endSetup                     ! date/time for the start and end of the parameter setup
-  USE globalData,only:elapsedSetup                            ! elapsed time for the parameter setup
-  ! Noah-MP parameters
-  USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM                    ! 2-d tables for stem area index and leaf area index (vegType,month)
-  USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB                      ! height at the top and bottom of vegetation (vegType)
-
-  ! ---------------------------------------------------------------------------------------
-  ! * variables
-  ! ---------------------------------------------------------------------------------------
-  implicit none
-  ! dummy variables
-  ! calling variables
-  integer(c_int),intent(in)                :: indxGRU              ! Index of the parent GRU of the HRU
-  integer(c_int),intent(in)                :: indxHRU              ! ID to locate correct HRU from netcdf file  
-  type(c_ptr), intent(in), value           :: handle_attrStruct    ! local attributes for each HRU
-  type(c_ptr), intent(in), value           :: handle_typeStruct    ! local classification of soil veg etc. for each HRU
-  type(c_ptr), intent(in), value           :: handle_idStruct      !  
-  type(c_ptr), intent(in), value           :: handle_mparStruct    ! model parameters
-  type(c_ptr), intent(in), value           :: handle_bparStruct    ! basin-average parameters
-  type(c_ptr), intent(in), value           :: handle_bvarStruct    ! basin-average variables
-  type(c_ptr), intent(in), value           :: handle_dparStruct    ! default model parameters
-  type(c_ptr), intent(in), value           :: handle_lookupStruct     ! start time for the model simulation
-  type(c_ptr), intent(in), value           :: handle_startTime     ! start time for the model simulation
-  type(c_ptr), intent(in), value           :: handle_oldTime       ! time for the previous model time step
-  real(c_double),intent(inout)             :: upArea
-  integer(c_int),intent(inout)             :: err
-
-  ! local variables
-  type(var_d),pointer                      :: attrStruct           ! local attributes for each HRU
-  type(var_i),pointer                      :: typeStruct           ! local classification of soil veg etc. for each HRU
-  type(var_i8),pointer                     :: idStruct             !
-  type(var_dlength),pointer                :: mparStruct           ! model parameters
-  type(var_d),pointer                      :: bparStruct           ! basin-average parameters
-  type(var_dlength),pointer                :: bvarStruct           ! basin-average variables
-  type(var_d),pointer                      :: dparStruct           ! default model parameters
-  type(zLookup),pointer                    :: lookupStruct         ! default model parameters
-  type(var_i),pointer                      :: startTime            ! start time for the model simulation
-  type(var_i),pointer                      :: oldTime              ! time for the previous model time step
-  character(len=256)                       :: message              ! error message
-  character(len=256)                       :: cmessage             ! error message of downwind routine
-   
-  ! ---------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message='setupHRUParam/'
-
-  ! convert to fortran pointer from C++ pointer
-  call c_f_pointer(handle_attrStruct, attrStruct)
-  call c_f_pointer(handle_typeStruct, typeStruct)
-  call c_f_pointer(handle_idStruct, idStruct)
-  call c_f_pointer(handle_mparStruct, mparStruct)
-  call c_f_pointer(handle_bparStruct, bparStruct)
-  call c_f_pointer(handle_bvarStruct, bvarStruct)
-  call c_f_pointer(handle_dparStruct, dparStruct)
-  call c_f_pointer(handle_lookupStruct, lookupStruct)
-  call c_f_pointer(handle_startTime, startTime)
-  call c_f_pointer(handle_oldTime, oldTime)
-
-  ! ffile_info and mDecisions moved to their own seperate subroutine call
-  
-  oldTime%var(:) = startTime%var(:)
-
-  ! get the maximum number of snow layers
-  select case(model_decisions(iLookDECISIONS%snowLayers)%iDecision)
-    case(sameRulesAllLayers);    maxSnowLayers = 100
-    case(rulesDependLayerIndex); maxSnowLayers = 5
-    case default; err=20; 
-        message=trim(message)//'unable to identify option to combine/sub-divide snow layers'
-        print*, message
-        return
-  end select ! (option to combine/sub-divide snow layers)
-
-  ! get the maximum number of layers
-  maxLayers = gru_struc(1)%hruInfo(1)%nSoil + maxSnowLayers
-
-  ! define monthly fraction of green vegetation
-  greenVegFrac_monthly = (/0.01_dp, 0.02_dp, 0.03_dp, 0.07_dp, 0.50_dp, 0.90_dp, 0.95_dp, 0.96_dp, 0.65_dp, 0.24_dp, 0.11_dp, 0.02_dp/)
-
-  ! define urban vegetation category
-  select case(trim(model_decisions(iLookDECISIONS%vegeParTbl)%cDecision))
-    case('USGS');                     urbanVegCategory =    1
-    case('MODIFIED_IGBP_MODIS_NOAH'); urbanVegCategory =   13
-    case('plumberCABLE');             urbanVegCategory = -999
-    case('plumberCHTESSEL');          urbanVegCategory = -999
-    case('plumberSUMMA');             urbanVegCategory = -999
-    case default
-      message=trim(message)//'unable to identify vegetation category'
-      print*, message
-      return
-  end select
-
-  ! *****************************************************************************
-  ! *** compute derived model variables that are pretty much constant for the basin as a whole
-  ! *****************************************************************************
-  ! calculate the fraction of runoff in future time steps
-  call fracFuture(bparStruct%var,    &  ! vector of basin-average model parameters
-                  bvarStruct,        &  ! data structure of basin-average variables
-                  err,cmessage)                   ! error control
-  if(err/=0)then;message=trim(message)//trim(cmessage);print*,message;return;endif
-
-  ! check that the parameters are consistent
-  call paramCheck(mparStruct,err,cmessage)
-  if(err/=0)then;message=trim(message)//trim(cmessage);print*,message;return;endif
-
-  ! calculate a look-up table for the temperature-enthalpy conversion
-  call E2T_lookup(mparStruct,err,cmessage)
-  if(err/=0)then;message=trim(message)//trim(cmessage);print*, message;return;endif
-
-  ! calculate a lookup table to compute enthalpy from temperature
-  call T2E_lookup(gru_struc(indxGRU)%hruInfo(1)%nSoil,   &   ! intent(in):    number of soil layers
-                  mparStruct,        &   ! intent(in):    parameter data structure
-                  lookupStruct,      &   ! intent(inout): lookup table data structure
-                  err,cmessage)                              ! intent(out):   error control
-  if(err/=0)then; message=trim(message)//trim(cmessage);print*,message;return;endif
-
-  ! overwrite the vegetation height
-  HVT(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyTop)%dat(1)
-  HVB(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyBottom)%dat(1)
-
-  ! overwrite the tables for LAI and SAI
-  if(model_decisions(iLookDECISIONS%LAI_method)%iDecision == specified)then
-    SAIM(typeStruct%var(iLookTYPE%vegTypeIndex),:) = mparStruct%var(iLookPARAM%winterSAI)%dat(1)
-    LAIM(typeStruct%var(iLookTYPE%vegTypeIndex),:) = mparStruct%var(iLookPARAM%summerLAI)%dat(1)*greenVegFrac_monthly
-  endif
-
-  ! compute total area of the upstream HRUS that flow into each HRU
-  upArea = 0._dp
-  ! Check if lateral flows exists within the HRU
-  if(typeStruct%var(iLookTYPE%downHRUindex)==typeStruct%var(iLookID%hruId))then
-    upArea = upArea + attrStruct%var(iLookATTR%HRUarea)
-  endif
-
-  ! identify the total basin area for a GRU (m2)
-  associate(totalArea => bvarStruct%var(iLookBVAR%basin__totalArea)%dat(1) )
-    totalArea = 0._dp
-    totalArea = totalArea + attrStruct%var(iLookATTR%HRUarea)
-  end associate
-
-end subroutine setupHRUParam
-
-! **************************************************************************************************
-! private subroutine SOIL_VEG_GEN_PARM: Read soil, vegetation and other model parameters (from NOAH)
-! **************************************************************************************************
-!-----------------------------------------------------------------
-SUBROUTINE SOIL_VEG_GEN_PARM(FILENAME_VEGTABLE, FILENAME_SOILTABLE, FILENAME_GENERAL, MMINLU, MMINSL)
- !-----------------------------------------------------------------
-  use module_sf_noahlsm, only : shdtbl, nrotbl, rstbl, rgltbl, &
-       &                        hstbl, snuptbl, maxalb, laimintbl, &
-       &                        bb, drysmc, f11, maxsmc, laimaxtbl, &
-       &                        emissmintbl, emissmaxtbl, albedomintbl, &
-       &                        albedomaxtbl, wltsmc, qtz, refsmc, &
-       &                        z0mintbl, z0maxtbl, &
-       &                        satpsi, satdk, satdw, &
-       &                        theta_res, theta_sat, vGn_alpha, vGn_n, k_soil, &  ! MPC add van Genutchen parameters
-       &                        fxexp_data, lvcoef_data, &
-       &                        lutype, maxalb, &
-       &                        slope_data, frzk_data, bare, cmcmax_data, &
-       &                        cfactr_data, csoil_data, czil_data, &
-       &                        refkdt_data, natural, refdk_data, &
-       &                        rsmax_data, salp_data, sbeta_data, &
-       &                        zbot_data, smhigh_data, smlow_data, &
-       &                        lucats, topt_data, slcats, slpcats, sltype
-
-  IMPLICIT NONE
-
-  CHARACTER(LEN=*), INTENT(IN) :: FILENAME_VEGTABLE, FILENAME_SOILTABLE, FILENAME_GENERAL
-  CHARACTER(LEN=*), INTENT(IN) :: MMINLU, MMINSL
-  integer :: LUMATCH, IINDEX, LC, NUM_SLOPE
-  integer :: ierr
-  INTEGER , PARAMETER :: OPEN_OK = 0
-
-  character*128 :: mess , message
-
-  !-----SPECIFY VEGETATION RELATED CHARACTERISTICS :
-  !             ALBBCK: SFC albedo (in percentage)
-  !                 Z0: Roughness length (m)
-  !             SHDFAC: Green vegetation fraction (in percentage)
-  !  Note: The ALBEDO, Z0, and SHDFAC values read from the following table
-  !          ALBEDO, amd Z0 are specified in LAND-USE TABLE; and SHDFAC is
-  !          the monthly green vegetation data
-  !             CMXTBL: MAX CNPY Capacity (m)
-  !             NROTBL: Rooting depth (layer)
-  !              RSMIN: Mimimum stomatal resistance (s m-1)
-  !              RSMAX: Max. stomatal resistance (s m-1)
-  !                RGL: Parameters used in radiation stress function
-  !                 HS: Parameter used in vapor pressure deficit functio
-  !               TOPT: Optimum transpiration air temperature. (K)
-  !             CMCMAX: Maximum canopy water capacity
-  !             CFACTR: Parameter used in the canopy inteception calculati
-  !               SNUP: Threshold snow depth (in water equivalent m) that
-  !                     implies 100% snow cover
-  !                LAI: Leaf area index (dimensionless)
-  !             MAXALB: Upper bound on maximum albedo over deep snow
-  !
-  !-----READ IN VEGETAION PROPERTIES FROM VEGPARM.TBL
-  !
-
-  OPEN(19, FILE=trim(FILENAME_VEGTABLE),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
-  IF(ierr .NE. OPEN_OK ) THEN
-     WRITE(message,FMT='(A)') &
-          'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening VEGPARM.TBL'
-     CALL wrf_error_fatal ( message )
-  END IF
-
-  LUMATCH=0
-
-  FIND_LUTYPE : DO WHILE (LUMATCH == 0)
-     READ (19,*,END=2002)
-     READ (19,*,END=2002)LUTYPE
-     READ (19,*)LUCATS,IINDEX
-
-     IF(LUTYPE.EQ.MMINLU)THEN
-        WRITE( mess , * ) 'LANDUSE TYPE = ' // TRIM ( LUTYPE ) // ' FOUND', LUCATS,' CATEGORIES'
-        ! CALL wrf_message( mess )
-        LUMATCH=1
-     ELSE
-       ! call wrf_message ( "Skipping over LUTYPE = " // TRIM ( LUTYPE ) )
-        DO LC = 1, LUCATS+12
-           read(19,*)
-        ENDDO
-     ENDIF
-  ENDDO FIND_LUTYPE
-  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
-  IF ( SIZE(SHDTBL)       < LUCATS .OR. &
-       SIZE(NROTBL)       < LUCATS .OR. &
-       SIZE(RSTBL)        < LUCATS .OR. &
-       SIZE(RGLTBL)       < LUCATS .OR. &
-       SIZE(HSTBL)        < LUCATS .OR. &
-       SIZE(SNUPTBL)      < LUCATS .OR. &
-       SIZE(MAXALB)       < LUCATS .OR. &
-       SIZE(LAIMINTBL)    < LUCATS .OR. &
-       SIZE(LAIMAXTBL)    < LUCATS .OR. &
-       SIZE(Z0MINTBL)     < LUCATS .OR. &
-       SIZE(Z0MAXTBL)     < LUCATS .OR. &
-       SIZE(ALBEDOMINTBL) < LUCATS .OR. &
-       SIZE(ALBEDOMAXTBL) < LUCATS .OR. &
-       SIZE(EMISSMINTBL ) < LUCATS .OR. &
-       SIZE(EMISSMAXTBL ) < LUCATS ) THEN
-     CALL wrf_error_fatal('Table sizes too small for value of LUCATS in module_sf_noahdrv.F')
-  ENDIF
-
-  IF(LUTYPE.EQ.MMINLU)THEN
-     DO LC=1,LUCATS
-        READ (19,*)IINDEX,SHDTBL(LC),                        &
-             NROTBL(LC),RSTBL(LC),RGLTBL(LC),HSTBL(LC), &
-             SNUPTBL(LC),MAXALB(LC), LAIMINTBL(LC),     &
-             LAIMAXTBL(LC),EMISSMINTBL(LC),             &
-             EMISSMAXTBL(LC), ALBEDOMINTBL(LC),         &
-             ALBEDOMAXTBL(LC), Z0MINTBL(LC), Z0MAXTBL(LC)
-     ENDDO
-
-     READ (19,*)
-     READ (19,*)TOPT_DATA
-     READ (19,*)
-     READ (19,*)CMCMAX_DATA
-     READ (19,*)
-     READ (19,*)CFACTR_DATA
-     READ (19,*)
-     READ (19,*)RSMAX_DATA
-     READ (19,*)
-     READ (19,*)BARE
-     READ (19,*)
-     READ (19,*)NATURAL
-  ENDIF
-
-2002 CONTINUE
-
-  CLOSE (19)
-  IF (LUMATCH == 0) then
-     CALL wrf_error_fatal ("Land Use Dataset '"//MMINLU//"' not found in VEGPARM.TBL.")
-  ENDIF
-
-!
-!-----READ IN SOIL PROPERTIES FROM SOILPARM.TBL
-!
-  OPEN(19, FILE=trim(FILENAME_SOILTABLE),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
-  IF(ierr .NE. OPEN_OK ) THEN
-     WRITE(message,FMT='(A)') &
-          'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening SOILPARM.TBL'
-     CALL wrf_error_fatal ( message )
-  END IF
-
-  WRITE(mess,*) 'INPUT SOIL TEXTURE CLASSIFICATION = ', TRIM ( MMINSL )
-  ! CALL wrf_message( mess )
-
-  LUMATCH=0
-
-  ! MPC add a new soil table
-  FIND_soilTYPE : DO WHILE (LUMATCH == 0)
-   READ (19,*)
-   READ (19,*,END=2003)SLTYPE
-   READ (19,*)SLCATS,IINDEX
-   IF(SLTYPE.EQ.MMINSL)THEN
-     WRITE( mess , * ) 'SOIL TEXTURE CLASSIFICATION = ', TRIM ( SLTYPE ) , ' FOUND', &
-          SLCATS,' CATEGORIES'
-     ! CALL wrf_message ( mess )
-     LUMATCH=1
-   ELSE
-    ! call wrf_message ( "Skipping over SLTYPE = " // TRIM ( SLTYPE ) )
-    DO LC = 1, SLCATS
-     read(19,*)
-    ENDDO
-   ENDIF
-  ENDDO FIND_soilTYPE
-  ! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
-  IF ( SIZE(BB    ) < SLCATS .OR. &
-       SIZE(DRYSMC) < SLCATS .OR. &
-       SIZE(F11   ) < SLCATS .OR. &
-       SIZE(MAXSMC) < SLCATS .OR. &
-       SIZE(REFSMC) < SLCATS .OR. &
-       SIZE(SATPSI) < SLCATS .OR. &
-       SIZE(SATDK ) < SLCATS .OR. &
-       SIZE(SATDW ) < SLCATS .OR. &
-       SIZE(WLTSMC) < SLCATS .OR. &
-       SIZE(QTZ   ) < SLCATS  ) THEN
-     CALL wrf_error_fatal('Table sizes too small for value of SLCATS in module_sf_noahdrv.F')
-  ENDIF
-
-  ! MPC add new soil table
-  select case(trim(SLTYPE))
-   case('STAS','STAS-RUC')  ! original soil tables
-     DO LC=1,SLCATS
-        READ (19,*) IINDEX,BB(LC),DRYSMC(LC),F11(LC),MAXSMC(LC),&
-             REFSMC(LC),SATPSI(LC),SATDK(LC), SATDW(LC),   &
-             WLTSMC(LC), QTZ(LC)
-     ENDDO
-   case('ROSETTA')          ! new soil table
-     DO LC=1,SLCATS
-        READ (19,*) IINDEX,&
-             ! new soil parameters (from Rosetta)
-             theta_res(LC), theta_sat(LC),        &
-             vGn_alpha(LC), vGn_n(LC), k_soil(LC), &
-             ! original soil parameters
-             BB(LC),DRYSMC(LC),F11(LC),MAXSMC(LC),&
-             REFSMC(LC),SATPSI(LC),SATDK(LC), SATDW(LC),   &
-             WLTSMC(LC), QTZ(LC)
-     ENDDO
-   case default
-     CALL wrf_message( 'SOIL TEXTURE IN INPUT FILE DOES NOT ' )
-     CALL wrf_message( 'MATCH SOILPARM TABLE'                 )
-     CALL wrf_error_fatal ( 'INCONSISTENT OR MISSING SOILPARM FILE' )
-  end select
-
-2003 CONTINUE
-
-  CLOSE (19)
-
-  IF(LUMATCH.EQ.0)THEN
-     CALL wrf_message( 'SOIL TEXTURE IN INPUT FILE DOES NOT ' )
-     CALL wrf_message( 'MATCH SOILPARM TABLE'                 )
-     CALL wrf_error_fatal ( 'INCONSISTENT OR MISSING SOILPARM FILE' )
-  ENDIF
-
-!
-!-----READ IN GENERAL PARAMETERS FROM GENPARM.TBL
-!
-  OPEN(19, FILE=trim(FILENAME_GENERAL),FORM='FORMATTED',STATUS='OLD',IOSTAT=ierr)
-  IF(ierr .NE. OPEN_OK ) THEN
-     WRITE(message,FMT='(A)') &
-          'module_sf_noahlsm.F: soil_veg_gen_parm: failure opening GENPARM.TBL'
-     CALL wrf_error_fatal ( message )
-  END IF
-
-  READ (19,*)
-  READ (19,*)
-  READ (19,*) NUM_SLOPE
-
-  SLPCATS=NUM_SLOPE
-! prevent possible array overwrite, Bill Bovermann, IBM, May 6, 2008
-  IF ( SIZE(slope_data) < NUM_SLOPE ) THEN
-     CALL wrf_error_fatal('NUM_SLOPE too large for slope_data array in module_sf_noahdrv')
-  ENDIF
-
-  DO LC=1,SLPCATS
-     READ (19,*)SLOPE_DATA(LC)
-  ENDDO
-
-  READ (19,*)
-  READ (19,*)SBETA_DATA
-  READ (19,*)
-  READ (19,*)FXEXP_DATA
-  READ (19,*)
-  READ (19,*)CSOIL_DATA
-  READ (19,*)
-  READ (19,*)SALP_DATA
-  READ (19,*)
-  READ (19,*)REFDK_DATA
-  READ (19,*)
-  READ (19,*)REFKDT_DATA
-  READ (19,*)
-  READ (19,*)FRZK_DATA
-  READ (19,*)
-  READ (19,*)ZBOT_DATA
-  READ (19,*)
-  READ (19,*)CZIL_DATA
-  READ (19,*)
-  READ (19,*)SMLOW_DATA
-  READ (19,*)
-  READ (19,*)SMHIGH_DATA
-  READ (19,*)
-  READ (19,*)LVCOEF_DATA
-  CLOSE (19)
-
-!-----------------------------------------------------------------
-END SUBROUTINE SOIL_VEG_GEN_PARM
-!-----------------------------------------------------------------
-
-end module SummaActors_setup
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/hru_actor.cpp b/build/source/actors/hru_actor/hru_actor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dec18f1d98dfec96f827d4e4a71e22f9c4b5f4f6
--- /dev/null
+++ b/build/source/actors/hru_actor/hru_actor.cpp
@@ -0,0 +1,216 @@
+#include "hru_actor.hpp"
+
+namespace caf {
+
+behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
+                   HRU_Actor_Settings hru_actor_settings, 
+                   caf::actor file_access_actor, 
+                   caf::actor parent) {
+    
+    // Actor References
+    self->state.file_access_actor = file_access_actor;
+    self->state.parent            = parent;
+    // Indexes into global structures
+    self->state.indxHRU           = 1;
+    self->state.indxGRU           = indxGRU;
+    self->state.refGRU            = refGRU;
+    // Get the settings for the HRU
+    self->state.hru_actor_settings = hru_actor_settings;
+    self->state.dt_init_factor = hru_actor_settings.dt_init_factor;
+
+    // Initialize HRU data and statistics structures
+    initHRU(&self->state.indxGRU, &self->state.num_steps, self->state.hru_data, &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "Error: HRU_Actor - Initialize - HRU = " << self->state.indxHRU  
+                   << " - indxGRU = " << self->state.indxGRU 
+                   << " - refGRU = "<< self->state.refGRU
+                   << "\nError Code = " << self->state.err << "\n";
+        self->quit();
+    }
+
+    // Get the number of timesteps required until needing to write
+    self->request(self->state.file_access_actor, 
+                  caf::infinite,
+                  get_num_output_steps_v)
+                  .await([=](int num_steps){
+                        self->state.num_steps_until_write = num_steps;
+                        Initialize_HRU(self);
+                        // Get Forcing information from the File Access Actor to start the simulation
+                        self->send(self->state.file_access_actor, access_forcing_v, self->state.iFile, self);
+                  });
+
+    return {
+        [=](num_steps_before_write, int num_steps) {
+            self->state.num_steps_until_write = num_steps;
+            self->state.output_structure_step_index = 1;
+        },
+
+        // Run HRU for a number of timesteps
+        [=](run_hru) {
+            int err = 0;
+
+            while(self->state.num_steps_until_write > 0) {
+                if (self->state.forcingStep > self->state.stepsInCurrentFFile) {
+                    self->send(self->state.file_access_actor, access_forcing_v, self->state.iFile+1, self);
+                    break;
+                }
+
+                self->state.num_steps_until_write--;
+
+                err = Run_HRU(self); // Simulate a Timestep
+                if (err != 0) {
+                
+#ifdef SUNDIALS_ACTIVE                        
+                        get_sundials_tolerances(self->state.hru_data, &self->state.rtol, &self->state.atol);
+                        self->send(self->state.parent, err_atom_v, self, self->state.rtol, self->state.atol);
+#else                        
+                        self->send(self->state.parent, hru_error::run_physics_unhandleable, self);
+#endif
+
+                    self->quit();
+                    return;
+                }
+
+                self->state.timestep++;
+                self->state.forcingStep++;
+                self->state.output_structure_step_index++;
+                
+                if (self->state.timestep > self->state.num_steps) {
+                    self->send(self, done_hru_v);
+                    break;
+                }
+
+            }
+            // Our output structure is full
+            if (self->state.num_steps_until_write <= 0) {
+                self->send(self->state.file_access_actor, write_output_v, self->state.indxGRU, self->state.indxHRU, self);
+            }
+        },
+
+
+        [=](new_forcing_file, int num_forcing_steps_in_iFile, int iFile) {
+            int err;
+            self->state.iFile = iFile;
+            self->state.stepsInCurrentFFile = num_forcing_steps_in_iFile;
+            setTimeZoneOffset(&self->state.iFile, self->state.hru_data, &err);
+            self->state.forcingStep = 1;
+            self->send(self, run_hru_v);
+        },
+
+        
+        [=](done_hru) {
+            self->send(self->state.parent,done_hru_v,self->state.indxGRU);
+            self->quit();
+            return;
+        },
+
+        [=](dt_init_factor, int dt_init_factor) {
+            aout(self) << "Recieved New dt_init_factor to attempt on next run \n";
+        },
+    };
+}
+
+
+
+void Initialize_HRU(stateful_actor<hru_state>* self) {
+
+    setupHRUParam(&self->state.indxGRU,
+                  &self->state.indxHRU,
+                  self->state.hru_data,
+                  &self->state.upArea, 
+                  &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "Error: HRU_Actor - SetupHRUParam - HRU = " << self->state.indxHRU
+                   << " - indxGRU = " << self->state.indxGRU 
+                   << " - refGRU = " << self->state.refGRU << "\n";
+        self->quit();
+        return;
+    }
+            
+    summa_readRestart(&self->state.indxGRU, 
+                      &self->state.indxHRU,
+                      self->state.hru_data,
+                      &self->state.dt_init, 
+                      &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "Error: HRU_Actor - summa_readRestart - HRU = " << self->state.indxHRU
+                   << " - indxGRU = " << self->state.indxGRU 
+                   << " - refGRU = " << self->state.refGRU << "\n";
+        self->quit();
+        return;
+    }
+#ifdef SUNDIALS_ACTIVE
+    if (self->state.hru_actor_settings.rel_tol > 0 && self->state.hru_actor_settings.abs_tol > 0)
+        set_sundials_tolerances(self->state.hru_data, &self->state.hru_actor_settings.rel_tol, &self->state.hru_actor_settings.abs_tol);
+#endif           
+}
+
+int Run_HRU(stateful_actor<hru_state>* self) {
+    /**********************************************************************
+    ** READ FORCING
+    **********************************************************************/    
+
+    HRU_readForcing(&self->state.indxGRU,
+                    &self->state.timestep,
+                    &self->state.forcingStep,
+                    &self->state.iFile,
+                    self->state.hru_data,
+                    &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "Error---HRU_Actor: ReadForcingHRU\n" 
+                   << "\tIndxGRU = "               << self->state.indxGRU << "\n"
+                   << "\tRefGRU = "                << self->state.refGRU << "\n"
+                   << "\tForcing Step = "          << self->state.forcingStep << "\n"
+                   << "\tTimestep = "              << self->state.timestep << "\n"
+                   << "\tiFile = "                 << self->state.iFile << "\n"
+                   << "\tSteps in Forcing File = " << self->state.stepsInCurrentFFile << "\n";
+        self->quit();
+        return -1;
+    }
+
+    if (self->state.hru_actor_settings.print_output && 
+        self->state.timestep % self->state.hru_actor_settings.output_frequency == 0) {
+        // Print the current timestep    
+        aout(self) << self->state.refGRU << " - Timestep = " << self->state.timestep << "\n";
+    }
+    
+
+    /**********************************************************************
+    ** RUN_PHYSICS    
+    **********************************************************************/    
+
+    self->state.err = 0;
+    RunPhysics(&self->state.indxHRU,
+               &self->state.timestep,
+               self->state.hru_data,
+               &self->state.dt_init, 
+               &self->state.dt_init_factor,
+               &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "Error---RunPhysics:\n"
+                   << "\tIndxGRU = "  << self->state.indxGRU 
+                   << "\tRefGRU = "   << self->state.refGRU 
+                   << "\tTimestep = " << self->state.timestep <<  "\n";
+        self->quit();
+        return 20;
+    }
+
+    hru_writeOutput(&self->state.indxHRU, 
+                    &self->state.indxGRU,
+                    &self->state.timestep,
+                    &self->state.output_structure_step_index,
+                    self->state.hru_data,
+                    &self->state.err);
+    if (self->state.err != 0) {
+        aout(self) << "Error: HRU_Actor - writeHRUToOutputStructure - HRU = " << self->state.indxHRU
+                << " - indxGRU = " << self->state.indxGRU << " - refGRU = " << self->state.refGRU
+                << "\nError = " << self->state.err  << "\n";
+        self->quit();
+        return 21;
+    }
+
+    return 0;      
+}
+
+
+}
\ No newline at end of file
diff --git a/build/source/actors/hru_actor/hru_init.f90 b/build/source/actors/hru_actor/hru_init.f90
new file mode 100755
index 0000000000000000000000000000000000000000..7e4c77b78a03e824869d9b220b0bf219cfd4bd09
--- /dev/null
+++ b/build/source/actors/hru_actor/hru_init.f90
@@ -0,0 +1,545 @@
+module INIT_HRU_ACTOR
+! used to declare and allocate summa data structures and initialize model state to known values
+USE,intrinsic :: iso_c_binding
+USE nrtype          ! variable types, etc.
+USE data_types,only:&
+                    ! no spatial dimension
+                    var_i,               & ! x%var(:)            (i4b)
+                    var_i8,              & ! x%var(:)            (i8b)
+                    var_d,               & ! x%var(:)            (dp)
+                    var_ilength,         & ! x%var(:)%dat        (i4b)
+                    var_dlength            ! x%var(:)%dat        (dp)
+#ifdef V4_ACTIVE
+USE data_types,only:zlookup               ! x%z(:)%var(:)%lookup(:) -- lookup tables
+#endif
+USE actor_data_types,only:hru_type             ! hru_type
+                    
+! access missing values
+USE globalData,only:integerMissing   ! missing integer
+USE globalData,only:realMissing      ! missing double precision number
+! named variables for run time options
+USE globalData,only:iRunModeFull,iRunModeGRU,iRunModeHRU
+! metadata structures
+USE globalData,only:time_meta,forc_meta,attr_meta,type_meta ! metadata structures
+USE globalData,only:prog_meta,diag_meta,flux_meta,id_meta   ! metadata structures
+USE globalData,only:mpar_meta,indx_meta                     ! metadata structures
+USE globalData,only:bpar_meta,bvar_meta                     ! metadata structures
+USE globalData,only:averageFlux_meta                        ! metadata for time-step average fluxes
+#ifdef V4_ACTIVE
+USE globalData,only:lookup_meta 
+#endif
+! statistics metadata structures
+USE globalData,only:statForc_meta                           ! child metadata for stats
+USE globalData,only:statProg_meta                           ! child metadata for stats
+USE globalData,only:statDiag_meta                           ! child metadata for stats
+USE globalData,only:statFlux_meta                           ! child metadata for stats
+USE globalData,only:statIndx_meta                           ! child metadata for stats
+USE globalData,only:statBvar_meta                           ! child metadata for stats
+! maxvarFreq 
+USE var_lookup,only:maxVarFreq                               ! # of available output frequencies
+! named variables
+USE var_lookup,only:iLookATTR                               ! look-up values for local attributes
+USE var_lookup,only:iLookTYPE                               ! look-up values for classification of veg, soils etc.
+USE var_lookup,only:iLookPARAM                              ! look-up values for local column model parameters
+USE var_lookup,only:iLookID                                 ! look-up values for local column model parameters
+
+USE var_lookup,only:iLookPROG                               ! look-up values for local column model prognostic (state) variables
+USE var_lookup,only:iLookDIAG                               ! look-up values for local column model diagnostic variables
+USE var_lookup,only:iLookFLUX                               ! look-up values for local column model fluxes
+USE var_lookup,only:iLookBVAR                               ! look-up values for basin-average model variables
+USE var_lookup,only:iLookDECISIONS                          ! look-up values for model decisions
+USE globalData,only:urbanVegCategory                        ! vegetation category for urban areas
+
+! named variables to define LAI decisions
+USE mDecisions_module,only:&
+ monthlyTable,& ! LAI/SAI taken directly from a monthly table for different vegetation classes
+ specified      ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
+
+! safety: set private unless specified otherwise
+implicit none
+private
+public::initHRU
+public::setupHRUParam
+public::summa_readRestart
+contains
+! **************************************************************************************************
+! public subroutine initHRU: ! used to declare and allocate summa data structures and initialize model state to known values
+! **************************************************************************************************
+subroutine initHRU(indxGRU,            & !  Index of HRU's GRU parent
+                   num_steps,          &
+                   handle_hru_data,    &
+                   err) bind(C,name='initHRU')
+  ! ---------------------------------------------------------------------------------------
+  ! * desired modules
+  ! ---------------------------------------------------------------------------------------
+  ! data types
+  USE nrtype                                                  ! variable types, etc.
+  ! subroutines and functions: allocate space
+  USE allocspace_module,only:allocLocal
+  ! timing variables
+  USE globalData,only:startInit,endInit                       ! date/time for the start and end of the initialization
+  USE globalData,only:elapsedRead                             ! elapsed time for the data read
+  USE globalData,only:elapsedWrite                            ! elapsed time for the stats/write
+  USE globalData,only:elapsedPhysics                          ! elapsed time for the physics
+  ! miscellaneous global data
+  USE globalData,only:gru_struc                               ! gru-hru mapping structures
+  USE globalData,only:structInfo                              ! information on the data structures
+  USE globalData,only:numtim
+  USE globalData,only:startTime,finshTime,refTime,oldTime
+
+  USE var_lookup,only:maxvarFreq                              ! maximum number of output files
+  USE var_lookup,only:iLookFreq                               ! output frequency lookup table
+  implicit none
+  
+  ! ---------------------------------------------------------------------------------------
+  ! * variables from C++
+  ! ---------------------------------------------------------------------------------------
+  integer(c_int),intent(in)                  :: indxGRU                    ! indx of the parent GRU
+  integer(c_int),intent(out)                 :: num_steps                  ! number of steps in model, local to the HRU                 
+  type(c_ptr), intent(in), value             :: handle_hru_data            ! hru data structure (hru_type
+  ! ancillary data structures
+  integer(c_int),intent(inout)               :: err  
+  ! ---------------------------------------------------------------------------------------
+  ! * Fortran Variables For Conversion
+  ! ---------------------------------------------------------------------------------------
+  type(hru_type),pointer                     :: hru_data                   ! hru data structure (hru_type
+  ! ---------------------------------------------------------------------------------------
+  ! * Local Subroutine Variables
+  ! ---------------------------------------------------------------------------------------
+  character(LEN=256)                         :: message                    ! error message
+  character(LEN=256)                         :: cmessage                   ! error message of downwind routine
+  integer(i4b)                               :: iStruct                    ! looping variables
+  ! ---------------------------------------------------------------------------------------
+  ! * Convert From C++ to Fortran
+  ! ---------------------------------------------------------------------------------------
+  call c_f_pointer(handle_hru_data,   hru_data)
+  ! ---------------------------------------------------------------------------------------
+  ! initialize error control
+  err=0; message='hru_init/'
+
+  ! initialize the start of the initialization
+  call date_and_time(values=startInit)
+
+  ! initialize the elapsed time for cumulative quantities
+  elapsedRead=0._dp
+  elapsedWrite=0._dp
+  elapsedPhysics=0._dp
+
+  ! copy the number of the steps for the hru
+  num_steps = numtim
+
+  ! *****************************************************************************
+  ! *** allocate space for data structures
+  ! *****************************************************************************
+
+  ! allocate time structures
+  do iStruct=1,4
+  select case(iStruct)
+    case(1); call allocLocal(time_meta, hru_data%startTime_hru, err=err, message=cmessage)  ! start time for the model simulation
+    case(2); call allocLocal(time_meta, hru_data%finishTime_hru, err=err, message=cmessage)  ! end time for the model simulation
+    case(3); call allocLocal(time_meta, hru_data%refTime_hru,   err=err, message=cmessage)  ! reference time for the model simulation
+    case(4); call allocLocal(time_meta, hru_data%oldTime_hru,   err=err, message=cmessage)  ! time from the previous step
+  end select
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
+  end do  ! looping through time structures
+
+  ! copy the time variables set up by the job_actor
+  hru_data%startTime_hru%var(:) = startTime%var(:)
+  hru_data%finishTime_hru%var(:) = finshTime%var(:)
+  hru_data%refTime_hru%var(:) = refTime%var(:)
+  hru_data%oldTime_hru%var(:) = oldTime%var(:)
+
+
+  ! get the number of snow and soil layers
+  associate(&
+  nSnow => gru_struc(indxGRU)%hruInfo(1)%nSnow, & ! number of snow layers for each HRU
+  nSoil => gru_struc(indxGRU)%hruInfo(1)%nSoil  ) ! number of soil layers for each HRU
+
+  ! allocate other data structures
+  do iStruct=1,size(structInfo)
+  ! allocate space  
+  select case(trim(structInfo(iStruct)%structName))    
+    case('time'); call allocLocal(time_meta,hru_data%timeStruct,err=err,message=cmessage)     ! model time data
+    case('forc'); call allocLocal(forc_meta,hru_data%forcStruct,nSnow,nSoil,err,cmessage);    ! model forcing data
+    case('attr'); call allocLocal(attr_meta,hru_data%attrStruct,nSnow,nSoil,err,cmessage);    ! model attribute data
+    case('type'); call allocLocal(type_meta,hru_data%typeStruct,nSnow,nSoil,err,cmessage);    ! model type data
+    case('id'  ); call allocLocal(id_meta,hru_data%idStruct,nSnow,nSoil,err,cmessage);        ! model id data
+    case('mpar'); call allocLocal(mpar_meta,hru_data%mparStruct,nSnow,nSoil,err,cmessage);    ! model parameters  
+    case('indx'); call allocLocal(indx_meta,hru_data%indxStruct,nSnow,nSoil,err,cmessage);    ! model variables
+    case('prog'); call allocLocal(prog_meta,hru_data%progStruct,nSnow,nSoil,err,cmessage);    ! model prognostic (state) variables
+    case('diag'); call allocLocal(diag_meta,hru_data%diagStruct,nSnow,nSoil,err,cmessage);    ! model diagnostic variables
+    case('flux'); call allocLocal(flux_meta,hru_data%fluxStruct,nSnow,nSoil,err,cmessage);    ! model fluxes
+    case('bpar'); call allocLocal(bpar_meta,hru_data%bparStruct,nSnow=0,nSoil=0,err=err,message=cmessage);  ! basin-average variables
+    case('bvar'); call allocLocal(bvar_meta,hru_data%bvarStruct,nSnow=0,nSoil=0,err=err,message=cmessage);  ! basin-average variables
+    case('lookup'); cycle ! allocated in t2enthalpy.f90
+    case('deriv'); cycle
+    case default; err=20; message='unable to find structure name: '//trim(structInfo(iStruct)%structName)
+  end select
+  ! check errors
+  if(err/=0)then
+    message=trim(message)//trim(cmessage)//'[structure =  '//trim(structInfo(iStruct)%structName)//']'
+    print*, message
+    return
+  endif
+  end do  ! looping through data structures
+
+  ! allocate space for default model parameters
+	! NOTE: This is done here, rather than in the loop above, because dpar is not one of the "standard" data structures
+	call allocLocal(mpar_meta,hru_data%dparStruct,nSnow,nSoil,err,cmessage);    ! default model parameters
+	if(err/=0)then; message=trim(message)//trim(cmessage)//' [problem allocating dparStruct]'; print*,message;return;endif
+	 
+
+
+  ! *****************************************************************************
+  ! *** allocate space for output statistics data structures
+  ! *****************************************************************************
+  ! loop through data structures
+  do iStruct=1,size(structInfo)
+    ! allocate space
+    select case(trim(structInfo(iStruct)%structName))
+      case('forc'); call allocLocal(statForc_meta(:)%var_info,hru_data%forcStat,nSnow,nSoil,err,cmessage);    ! model forcing data
+      case('prog'); call allocLocal(statProg_meta(:)%var_info,hru_data%progStat,nSnow,nSoil,err,cmessage);    ! model prognostic 
+      case('diag'); call allocLocal(statDiag_meta(:)%var_info,hru_data%diagStat,nSnow,nSoil,err,cmessage);    ! model diagnostic
+      case('flux'); call allocLocal(statFlux_meta(:)%var_info,hru_data%fluxStat,nSnow,nSoil,err,cmessage);    ! model fluxes
+      case('indx'); call allocLocal(statIndx_meta(:)%var_info,hru_data%indxStat,nSnow,nSoil,err,cmessage);    ! index vars
+      case('bvar'); call allocLocal(statBvar_meta(:)%var_info,hru_data%bvarStat,nSnow=0,nSoil=0,err=err,message=cmessage);  ! basin-average variables
+      case default; cycle
+    end select
+    ! check errors
+    if(err/=0)then
+      message=trim(message)//trim(cmessage)//'[statistics for =  '//trim(structInfo(iStruct)%structName)//']'
+      print*, message
+      return
+    endif
+  end do ! iStruct
+
+
+  ! Intilaize the statistics data structures
+  allocate(hru_data%statCounter%var(maxVarFreq), stat=err)
+  allocate(hru_data%outputTimeStep%var(maxVarFreq), stat=err)
+  allocate(hru_data%resetStats%dat(maxVarFreq), stat=err)
+  allocate(hru_data%finalizeStats%dat(maxVarFreq), stat=err)
+  hru_data%statCounter%var(1:maxVarFreq) = 1
+  hru_data%outputTimeStep%var(1:maxVarFreq) = 1
+  ! initialize flags to reset/finalize statistics
+  hru_data%resetStats%dat(:)    = .true.   ! start by resetting statistics
+  hru_data%finalizeStats%dat(:) = .false.  ! do not finalize stats on the first time step
+  ! set stats flag for the timestep-level output
+  hru_data%finalizeStats%dat(iLookFreq%timestep)=.true.
+
+  ! identify the end of the initialization
+  call date_and_time(values=endInit)
+
+  ! end association to info in data structures
+  end associate
+
+end subroutine initHRU
+
+
+
+! **************************************************************************************************
+! public subroutine setupHRUParam: initializes parameter data structures (e.g. vegetation and soil parameters).
+! **************************************************************************************************
+subroutine setupHRUParam(indxGRU,                 & ! ID of hru
+                         indxHRU,                 & ! Index of the parent GRU of the HRU 
+                         handle_hru_data,         &
+                         upArea,                  & ! area upslope of each HRU,
+                         err) bind(C, name='setupHRUParam')
+  ! ---------------------------------------------------------------------------------------
+  ! * desired modules
+  ! ---------------------------------------------------------------------------------------
+  USE nrtype                                                  ! variable types, etc.
+  USE output_structure_module,only:outputStructure
+  ! subroutines and functions
+  use time_utils_module,only:elapsedSec                       ! calculate the elapsed time
+  USE mDecisions_module,only:mDecisions                       ! module to read model decisions
+  USE paramCheck_module,only:paramCheck                       ! module to check consistency of model parameters
+  USE pOverwrite_module,only:pOverwrite                       ! module to overwrite default parameter values with info from the Noah tables
+  USE ConvE2Temp_module,only:E2T_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
+#ifdef V4_ACTIVE  
+  USE t2enthalpy_module,only:T2E_lookup                       ! module to calculate a look-up table for the temperature-enthalpy conversion
+#endif
+  USE var_derive_module,only:fracFuture                       ! module to calculate the fraction of runoff in future time steps (time delay histogram)
+  USE module_sf_noahmplsm,only:read_mp_veg_parameters         ! module to read NOAH vegetation tables
+  ! global data structures
+  USE globalData,only:gru_struc                               ! gru-hru mapping structures
+  USE globalData,only:localParFallback                        ! local column default parameters
+  USE globalData,only:model_decisions                         ! model decision structure
+  USE globalData,only:greenVegFrac_monthly                    ! fraction of green vegetation in each month (0-1)
+  ! output constraints
+  USE globalData,only:maxLayers                               ! maximum number of layers
+  USE globalData,only:maxSnowLayers                           ! maximum number of snow layers
+  ! timing variables
+  USE globalData,only:startSetup,endSetup                     ! date/time for the start and end of the parameter setup
+  USE globalData,only:elapsedSetup                            ! elapsed time for the parameter setup
+  ! Noah-MP parameters
+  USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM                    ! 2-d tables for stem area index and leaf area index (vegType,month)
+  USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB                      ! height at the top and bottom of vegetation (vegType)
+
+  ! ---------------------------------------------------------------------------------------
+  ! * variables
+  ! ---------------------------------------------------------------------------------------
+  implicit none
+  ! dummy variables
+  ! calling variables
+  integer(c_int),intent(in)                :: indxGRU              ! Index of the parent GRU of the HRU
+  integer(c_int),intent(in)                :: indxHRU              ! ID to locate correct HRU from netcdf file 
+  type(c_ptr), intent(in), value           :: handle_hru_data      ! pointer to the hru data structure (for error messages
+  real(c_double),intent(inout)             :: upArea
+  integer(c_int),intent(inout)             :: err
+
+  ! local variables
+  type(hru_type),pointer                   :: hru_data             ! local hru data structure
+
+  integer(i4b)                             :: ivar                 ! loop counter
+  integer(i4b)                             :: i_z                  ! loop counter
+  character(len=256)                       :: message              ! error message
+  character(len=256)                       :: cmessage             ! error message of downwind routine
+
+  ! ---------------------------------------------------------------------------------------
+  ! initialize error control
+  err=0; message='setupHRUParam/'
+
+  ! convert to fortran pointer from C++ pointer
+  call c_f_pointer(handle_hru_data, hru_data)
+
+  ! ffile_info and mDecisions moved to their own seperate subroutine call
+
+  hru_data%oldTime_hru%var(:) = hru_data%startTime_hru%var(:)
+
+  ! Copy the attrStruct
+  hru_data%attrStruct%var(:) = outputStructure(1)%attrStruct%gru(indxGRU)%hru(indxHRU)%var(:)
+  ! Copy the typeStruct
+  hru_data%typeStruct%var(:) = outputStructure(1)%typeStruct%gru(indxGRU)%hru(indxHRU)%var(:)
+  ! Copy the idStruct
+  hru_data%idStruct%var(:) = outputStructure(1)%idStruct%gru(indxGRU)%hru(indxHRU)%var(:)
+
+  ! Copy the mparStruct
+  hru_data%mparStruct%var(:) = outputStructure(1)%mparStruct%gru(indxGRU)%hru(indxHRU)%var(:)
+  ! Copy the bparStruct
+  hru_data%bparStruct%var(:) = outputStructure(1)%bparStruct%gru(indxGRU)%var(:)
+  ! Copy the dparStruct
+  hru_data%dparStruct%var(:) = outputStructure(1)%dparStruct%gru(indxGRU)%hru(indxHRU)%var(:)
+  ! Copy the bvarStruct
+  do ivar=1, size(outputStructure(1)%bvarStruct_init%gru(indxGRU)%var(:))
+    hru_data%bvarStruct%var(ivar)%dat(:) = outputStructure(1)%bvarStruct_init%gru(indxGRU)%var(ivar)%dat(:)
+  enddo
+  ! Copy the lookup Struct if its allocated
+#ifdef V4_ACTIVE
+  if (allocated(outputStructure(1)%lookupStruct%gru(indxGRU)%hru(indxHRU)%z)) then
+    do i_z=1, size(outputStructure(1)%lookupStruct%gru(indxGRU)%hru(indxHRU)%z(:))
+      do iVar=1, size(outputStructure(1)%lookupStruct%gru(indxGRU)%hru(indxHRU)%z(i_z)%var(:))
+        hru_data%lookupStruct%z(i_z)%var(ivar)%lookup(:) = outputStructure(1)%lookupStruct%gru(indxGRU)%hru(indxHRU)%z(i_z)%var(iVar)%lookup(:)
+      end do
+    end do
+  endif
+#endif
+  ! Copy the progStruct_init
+  do ivar=1, size(outputStructure(1)%progStruct_init%gru(indxGRU)%hru(indxHRU)%var(:))
+    hru_data%progStruct%var(ivar)%dat(:) = outputStructure(1)%progStruct_init%gru(indxGRU)%hru(indxHRU)%var(ivar)%dat(:)
+  enddo
+  ! copy the indexStruct_init
+  do ivar=1, size(outputStructure(1)%indxStruct_init%gru(indxGRU)%hru(indxHRU)%var(:))
+    hru_data%indxStruct%var(ivar)%dat(:) = outputStructure(1)%indxStruct_init%gru(indxGRU)%hru(indxHRU)%var(ivar)%dat(:)
+  enddo
+end subroutine setupHRUParam
+
+
+! **************************************************************************************************
+! public subroutine summa_readRestart: read restart data and reset the model state
+! **************************************************************************************************
+subroutine summa_readRestart(indxGRU,         & ! index of GRU in gru_struc
+                            indxHRU,          & ! index of HRU in gru_struc
+                            handle_hru_data,  & ! data structure for the HRU
+                            dt_init,          & ! used to initialize the length of the sub-step for each HRU
+                            err) bind(C,name='summa_readRestart')
+  ! ---------------------------------------------------------------------------------------
+  ! * desired modules
+  ! ---------------------------------------------------------------------------------------
+  ! data types
+  USE nrtype                                                  ! variable types, etc.
+  ! functions and subroutines
+  USE time_utils_module,only:elapsedSec                       ! calculate the elapsed time
+  ! USE read_icond_module,only:read_icond               ! module to read initial conditions
+  ! USE check_icond4chm_module,only:check_icond4chm             ! module to check initial conditions
+  USE var_derive_module,only:calcHeight                       ! module to calculate height at layer interfaces and layer mid-point
+  USE var_derive_module,only:v_shortcut                       ! module to calculate "short-cut" variables
+  USE var_derive_module,only:rootDensty                       ! module to calculate the vertical distribution of roots
+  USE var_derive_module,only:satHydCond                       ! module to calculate the saturated hydraulic conductivity in each soil layer
+  ! global data structures
+  USE globalData,only:model_decisions                         ! model decision structure
+  ! timing variables
+  USE globalData,only:startRestart,endRestart                 ! date/time for the start and end of reading model restart files
+  USE globalData,only:elapsedRestart                          ! elapsed time to read model restart files
+  ! model decisions
+  USE mDecisions_module,only:&                                ! look-up values for the choice of method for the spatial representation of groundwater
+  localColumn, & ! separate groundwater representation in each local soil column
+  singleBasin    ! single groundwater store over the entire basin
+  implicit none
+  ! ---------------------------------------------------------------------------------------
+  ! Dummy variables
+  ! ---------------------------------------------------------------------------------------
+  integer(c_int),intent(in)               :: indxGRU            !  index of GRU in gru_struc
+  integer(c_int),intent(in)               :: indxHRU            !  index of HRU in gru_struc
+  type(c_ptr), intent(in), value          :: handle_hru_data   !  data structure for the HRU
+
+  real(c_double), intent(inout)           :: dt_init
+  integer(c_int), intent(inout)           :: err
+  ! ---------------------------------------------------------------------------------------
+  ! Fortran Pointers
+  ! ---------------------------------------------------------------------------------------
+  type(hru_type),pointer                  :: hru_data
+  ! ---------------------------------------------------------------------------------------
+  ! local variables
+  ! ---------------------------------------------------------------------------------------
+  integer(i4b)                            :: ivar               ! index of variable
+  character(len=256)                      :: message            ! error message
+  character(LEN=256)                      :: cmessage           ! error message of downwind routine
+  character(LEN=256)                      :: restartFile        ! restart file name
+  integer(i4b)                            :: nGRU
+  ! ---------------------------------------------------------------------------------------
+
+  call c_f_pointer(handle_hru_data, hru_data)
+
+  ! initialize error control
+  err=0; message='hru_actor_readRestart/'
+
+
+  ! *****************************************************************************
+  ! *** compute ancillary variables
+  ! *****************************************************************************
+
+  ! re-calculate height of each layer
+  call calcHeight(hru_data%indxStruct,   & ! layer type
+      hru_data%progStruct,   & ! model prognostic (state) variables for a local HRU
+      err,cmessage)                       ! error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
+
+  ! calculate vertical distribution of root density
+  call rootDensty(hru_data%mparStruct,   & ! vector of model parameters
+      hru_data%indxStruct,   & ! data structure of model indices
+      hru_data%progStruct,   & ! data structure of model prognostic (state) variables
+      hru_data%diagStruct,   & ! data structure of model diagnostic variables
+      err,cmessage)                       ! error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
+
+  ! calculate saturated hydraulic conductivity in each soil layer
+  call satHydCond(hru_data%mparStruct,   & ! vector of model parameters
+      hru_data%indxStruct,   & ! data structure of model indices
+      hru_data%progStruct,   & ! data structure of model prognostic (state) variables
+      hru_data%fluxStruct,   & ! data structure of model fluxes
+      err,cmessage)                       ! error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
+
+  ! calculate "short-cut" variables such as volumetric heat capacity
+  call v_shortcut(hru_data%mparStruct,   & ! vector of model parameters
+      hru_data%diagStruct,   & ! data structure of model diagnostic variables
+      err,cmessage)                       ! error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
+
+  ! initialize canopy drip
+  ! NOTE: canopy drip from the previous time step is used to compute throughfall for the current time step
+  hru_data%fluxStruct%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp  ! not used
+
+  ! *****************************************************************************
+  ! *** initialize aquifer storage
+  ! *****************************************************************************
+
+  ! initialize aquifer storage
+  ! NOTE: this is ugly: need to add capabilities to initialize basin-wide state variables
+
+  ! There are two options for groundwater:
+  !  (1) where groundwater is included in the local column (i.e., the HRUs); and
+  !  (2) where groundwater is included for the single basin (i.e., the GRUS, where multiple HRUS drain into a GRU).
+
+  ! For water balance calculations it is important to ensure that the local aquifer storage is zero if groundwater is treated as a basin-average state variable (singleBasin);
+  !  and ensure that basin-average aquifer storage is zero when groundwater is included in the local columns (localColumn).
+
+  ! select groundwater option
+  select case(model_decisions(iLookDECISIONS%spatial_gw)%iDecision)
+
+  ! the basin-average aquifer storage is not used if the groundwater is included in the local column
+  case(localColumn)
+  hru_data%bvarStruct%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 0._dp ! set to zero to be clear that there is no basin-average aquifer storage in this configuration
+
+  ! the local column aquifer storage is not used if the groundwater is basin-average
+  ! (i.e., where multiple HRUs drain to a basin-average aquifer)
+  case(singleBasin)
+  hru_data%bvarStruct%var(iLookBVAR%basin__AquiferStorage)%dat(1) = 1._dp
+  hru_data%progStruct%var(iLookPROG%scalarAquiferStorage)%dat(1) = 0._dp  ! set to zero to be clear that there is no local aquifer storage in this configuration
+
+  ! error check
+  case default
+  message=trim(message)//'unable to identify decision for regional representation of groundwater'
+  return
+
+  end select  ! groundwater option
+
+  ! *****************************************************************************
+  ! *** initialize time step
+  ! *****************************************************************************
+
+  ! initialize time step length
+  dt_init = hru_data%progStruct%var(iLookPROG%dt_init)%dat(1) ! seconds
+
+end subroutine summa_readRestart
+
+! Set the HRU's relative and absolute tolerances
+subroutine setIDATolerances(handle_hru_data,    &
+                            relTolTempCas,      &
+                            absTolTempCas,      &
+                            relTolTempVeg,      &
+                            absTolTempVeg,      &
+                            relTolWatVeg,       &
+                            absTolWatVeg,       &
+                            relTolTempSoilSnow, &
+                            absTolTempSoilSnow, &
+                            relTolWatSnow,      &
+                            absTolWatSnow,      &
+                            relTolMatric,       &
+                            absTolMatric,       &
+                            relTolAquifr,       &
+                            absTolAquifr) bind(C, name="setIDATolerances")
+  USE data_types,only:var_dlength
+  USE var_lookup,only:iLookPARAM
+
+  implicit none
+
+  type(c_ptr), intent(in), value          :: handle_hru_data    !  model time data
+  real(c_double),intent(in)               :: relTolTempCas
+  real(c_double),intent(in)               :: absTolTempCas
+  real(c_double),intent(in)               :: relTolTempVeg
+  real(c_double),intent(in)               :: absTolTempVeg
+  real(c_double),intent(in)               :: relTolWatVeg
+  real(c_double),intent(in)               :: absTolWatVeg
+  real(c_double),intent(in)               :: relTolTempSoilSnow
+  real(c_double),intent(in)               :: absTolTempSoilSnow
+  real(c_double),intent(in)               :: relTolWatSnow
+  real(c_double),intent(in)               :: absTolWatSnow
+  real(c_double),intent(in)               :: relTolMatric
+  real(c_double),intent(in)               :: absTolMatric
+  real(c_double),intent(in)               :: relTolAquifr
+  real(c_double),intent(in)               :: absTolAquifr
+  ! local variables
+  type(hru_type),pointer                  :: hru_data          !  model time data
+
+  call c_f_pointer(handle_hru_data, hru_data)
+
+#ifdef SUNDIALS_ACTIVE
+  hru_data%mparStruct%var(iLookPARAM%relTolTempCas)%dat(1)       = relTolTempCas 
+  hru_data%mparStruct%var(iLookPARAM%absTolTempCas)%dat(1)       = absTolTempCas
+  hru_data%mparStruct%var(iLookPARAM%relTolTempVeg)%dat(1)       = relTolTempVeg
+  hru_data%mparStruct%var(iLookPARAM%absTolTempVeg)%dat(1)       = absTolTempVeg
+  hru_data%mparStruct%var(iLookPARAM%relTolWatVeg)%dat(1)        = relTolWatVeg
+  hru_data%mparStruct%var(iLookPARAM%absTolWatVeg)%dat(1)        = absTolWatVeg
+  hru_data%mparStruct%var(iLookPARAM%relTolTempSoilSnow)%dat(1)  = relTolTempSoilSnow
+  hru_data%mparStruct%var(iLookPARAM%absTolTempSoilSnow)%dat(1)  = absTolTempSoilSnow
+  hru_data%mparStruct%var(iLookPARAM%relTolWatSnow)%dat(1)       = relTolWatSnow
+  hru_data%mparStruct%var(iLookPARAM%absTolWatSnow)%dat(1)       = absTolWatSnow
+  hru_data%mparStruct%var(iLookPARAM%relTolMatric)%dat(1)        = relTolMatric
+  hru_data%mparStruct%var(iLookPARAM%absTolMatric)%dat(1)        = absTolMatric
+  hru_data%mparStruct%var(iLookPARAM%relTolAquifr)%dat(1)        = relTolAquifr
+  hru_data%mparStruct%var(iLookPARAM%absTolAquifr)%dat(1)        = absTolAquifr
+#endif
+end subroutine setIDATolerances
+end module INIT_HRU_ACTOR
diff --git a/build/source/actors/hru_actor/hru_modelRun.f90 b/build/source/actors/hru_actor/hru_modelRun.f90
new file mode 100644
index 0000000000000000000000000000000000000000..efd46871b937f89d89c08c68b0dbe31fadfa90b4
--- /dev/null
+++ b/build/source/actors/hru_actor/hru_modelRun.f90
@@ -0,0 +1,415 @@
+! SUMMA - Structure for Unifying Multiple Modeling Alternatives
+! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
+!
+! This file is part of SUMMA
+!
+! For more information see: http://www.ral.ucar.edu/projects/summa
+!
+! This program is free software: you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation, either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+module summa_modelRun
+! calls the model physics
+USE,intrinsic :: iso_c_binding
+
+
+USE actor_data_types,only:hru_type
+! access missing values
+USE globalData,only:integerMissing         ! missing integer
+USE globalData,only:realMissing            ! missing double precision number
+
+! provide access to Noah-MP constants
+USE module_sf_noahmplsm,only:isWater       ! parameter for water land cover type
+
+! named variables
+USE globalData,only:yes,no                 ! .true. and .false.
+USE globalData,only:overwriteRSMIN         ! flag to overwrite RSMIN
+USE globalData,only:maxSoilLayers          ! Maximum Number of Soil Layers
+! urban vegetation category (could be local)
+USE globalData,only:urbanVegCategory       ! vegetation category for urban areas
+USE globalData,only:greenVegFrac_monthly   ! fraction of green vegetation in each month (0-1)
+! provide access to the named variables that describe elements of parameter structures
+USE var_lookup,only:iLookTYPE              ! look-up values for classification of veg, soils etc.
+USE var_lookup,only:iLookID                ! look-up values for hru and gru IDs
+USE var_lookup,only:iLookATTR              ! look-up values for local attributes
+USE var_lookup,only:iLookFLUX              ! look-up values for local column model fluxes
+USE var_lookup,only:iLookBVAR              ! look-up values for basin-average model variables
+USE var_lookup,only:iLookTIME              ! named variables for time data structure
+USE var_lookup,only:iLookDIAG              ! look-up values for local column model diagnostic variables
+USE var_lookup,only:iLookINDEX             ! look-up values for local column index variables
+USE var_lookup,only:iLookPROG              ! look-up values for local column model prognostic (state) variables
+USE var_lookup,only:iLookPARAM             ! look-up values for local column model parameters
+USE var_lookup,only:iLookDECISIONS         ! look-up values for model decisions
+
+! Noah-MP parameters
+USE NOAHMP_VEG_PARAMETERS,only:SAIM,LAIM   ! 2-d tables for stem area index and leaf area index (vegType,month)
+USE NOAHMP_VEG_PARAMETERS,only:HVT,HVB     ! height at the top and bottom of vegetation (vegType)
+USE noahmp_globals,only:RSMIN
+
+! provide access to the named variables that describe model decisions
+USE mDecisions_module,only:&               ! look-up values for LAI decisions
+ monthlyTable,& ! LAI/SAI taken directly from a monthly table for different vegetation classes
+ specified,&    ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters   
+ localColumn, & ! separate groundwater representation in each local soil column
+ singleBasin, & ! single groundwater store over the entire basin
+ bigBucket
+
+
+! safety: set private unless specified otherwise
+implicit none
+private
+public::runPhysics
+#ifdef SUNDIALS_ACTIVE
+public::get_sundials_tolerances
+public::set_sundials_tolerances
+#endif
+contains
+
+! Runs the model physics for an HRU
+subroutine runPhysics(&
+              indxHRU,             &
+              modelTimeStep,       &
+              handle_hru_data,     &
+              dt_init,             & ! used to initialize the length of the sub-step for each HRU
+              dt_init_factor,      & ! used to adjust the length of the timestep in the event of a failure
+              err) bind(C, name='RunPhysics')
+  ! ---------------------------------------------------------------------------------------
+  ! * desired modules
+  ! ---------------------------------------------------------------------------------------
+  ! data types
+  USE nrtype                                   ! variable types, etc.
+  ! subroutines and functions
+  USE nr_utility_module,only:indexx            ! sort vectors in ascending order
+  USE vegPhenlgy_module,only:vegPhenlgy        ! module to compute vegetation phenology
+  USE time_utils_module,only:elapsedSec        ! calculate the elapsed time
+  USE module_sf_noahmplsm,only:redprm          ! module to assign more Noah-MP parameters
+  USE derivforce_module,only:derivforce        ! module to compute derived forcing data
+  USE coupled_em_module,only:coupled_em        ! module to run the coupled energy and mass model
+  USE qTimeDelay_module,only:qOverland         ! module to route water through an "unresolved" river network
+  ! global data
+  USE globalData,only:model_decisions          ! model decision structure
+  USE globalData,only:startPhysics,endPhysics  ! date/time for the start and end of the initialization
+  USE globalData,only:elapsedPhysics           ! elapsed time for the initialization
+  implicit none
+ 
+  ! ---------------------------------------------------------------------------------------
+  ! Dummy Variables
+  ! ---------------------------------------------------------------------------------------
+  integer(c_long),intent(in)                :: indxHRU                ! id of HRU                   
+  integer(c_int), intent(in)                :: modelTimeStep          ! time step index
+  type(c_ptr),    intent(in), value         :: handle_hru_data        ! c_ptr to -- hru data
+  real(c_double), intent(inout)             :: dt_init                ! used to initialize the length of the sub-step for each HRU
+  integer(c_int), intent(in)                :: dt_init_factor         ! used to adjust the length of the timestep in the event of a failure
+  integer(c_int), intent(inout)             :: err                    ! error code
+  ! ---------------------------------------------------------------------------------------
+  ! FORTRAN POINTERS
+  ! ---------------------------------------------------------------------------------------
+  type(hru_type),pointer                    :: hru_data               ! hru data
+
+  ! ---------------------------------------------------------------------------------------
+  ! local variables: general
+  ! ---------------------------------------------------------------------------------------
+  real(dp)                                  :: fracHRU                ! fractional area of a given HRU (-)
+  character(LEN=256)                        :: cmessage               ! error message of downwind routine
+  ! local variables: veg phenology
+  logical(lgt)                              :: computeVegFluxFlag     ! flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
+  real(dp)                                  :: notUsed_canopyDepth    ! NOT USED: canopy depth (m)
+  real(dp)                                  :: notUsed_exposedVAI     ! NOT USED: exposed vegetation area index (m2 m-2)
+  integer(i4b)                              :: nSnow                  ! number of snow layers
+  integer(i4b)                              :: nSoil                  ! number of soil layers
+  integer(i4b)                              :: nLayers                ! total number of layers
+  real(dp), allocatable                     :: zSoilReverseSign(:)    ! height at bottom of each soil layer, negative downwards (m)
+  character(len=256)                        :: message                ! error message
+  ! ---------------------------------------------------------------------------------------
+
+  call c_f_pointer(handle_hru_data, hru_data)
+
+  ! ---------------------------------------------------------------------------------------
+  ! initialize error control
+  err=0; message='runPhysics/'
+  
+  ! *******************************************************************************************
+  ! *** initialize computeVegFlux (flag to indicate if we are computing fluxes over vegetation)
+  ! *******************************************************************************************
+  ! if computeVegFlux changes, then the number of state variables changes, and we need to reoranize the data structures
+  if(modelTimeStep==1)then
+      ! get vegetation phenology
+      ! (compute the exposed LAI and SAI and whether veg is buried by snow)
+      call vegPhenlgy(&
+                      ! model control
+                      hru_data%fracJulDay,             & ! intent(in):    fractional julian days since the start of year
+                      hru_data%yearLength,             & ! intent(in):    number of days in the current year
+                      ! input/output: data structures
+                      model_decisions,        & ! intent(in):    model decisions
+                      hru_data%typeStruct,    & ! intent(in):    type of vegetation and soil
+                      hru_data%attrStruct,    & ! intent(in):    spatial attributes
+                      hru_data%mparStruct,    & ! intent(in):    model parameters
+                      hru_data%progStruct,    & ! intent(in):    model prognostic variables for a local HRU
+                      hru_data%diagStruct,    & ! intent(inout): model diagnostic variables for a local HRU
+                      ! output
+                      computeVegFluxFlag,     & ! intent(out): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
+                      notUsed_canopyDepth,    & ! intent(out): NOT USED: canopy depth (m)
+                      notUsed_exposedVAI,     & ! intent(out): NOT USED: exposed vegetation area index (m2 m-2)
+                      err,cmessage)                     ! intent(out): error control
+      if(err/=0)then;message=trim(message)//trim(cmessage); print*, message; return; endif
+
+    
+      ! save the flag for computing the vegetation fluxes
+      if(computeVegFluxFlag)      hru_data%computeVegFlux = yes
+      if(.not.computeVegFluxFlag) hru_data%computeVegFlux = no
+      
+      ! define the green vegetation fraction of the grid box (used to compute LAI)
+      hru_data%diagStruct%var(iLookDIAG%scalarGreenVegFraction)%dat(1) = greenVegFrac_monthly(hru_data%timeStruct%var(iLookTIME%im))
+  end if  ! if the first time step
+ 
+
+  ! ****************************************************************************
+  ! *** model simulation
+  ! ****************************************************************************
+
+  
+  !****************************************************************************** 
+  !****************************** From run_oneGRU *******************************
+  !******************************************************************************
+  ! ----- basin initialization --------------------------------------------------------------------------------------------
+  ! initialize runoff variables
+  hru_data%bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1)    = 0._dp  ! surface runoff (m s-1)
+  hru_data%bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)     = 0._dp 
+  hru_data%bvarStruct%var(iLookBVAR%basin__ColumnOutflow)%dat(1)    = 0._dp  ! outflow from all "outlet" HRUs (those with no downstream HRU)
+  hru_data%bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1)      = 0._dp 
+
+  ! initialize baseflow variables
+  hru_data%bvarStruct%var(iLookBVAR%basin__AquiferRecharge)%dat(1)  = 0._dp ! recharge to the aquifer (m s-1)
+  hru_data%bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)  = 0._dp ! baseflow from the aquifer (m s-1)
+  hru_data%bvarStruct%var(iLookBVAR%basin__AquiferTranspire)%dat(1) = 0._dp ! transpiration loss from the aquifer (m s-1)
+
+  ! initialize total inflow for each layer in a soil column
+  if (modelTimeStep == 0 .and. indxHRU == 1)then
+    hru_data%fluxStruct%var(iLookFLUX%mLayerColumnInflow)%dat(:) = 0._dp
+  end if
+ 
+  ! update the number of layers
+  nSnow   = hru_data%indxStruct%var(iLookINDEX%nSnow)%dat(1)    ! number of snow layers
+  nSoil   = hru_data%indxStruct%var(iLookINDEX%nSoil)%dat(1)    ! number of soil layers
+  nLayers = hru_data%indxStruct%var(iLookINDEX%nLayers)%dat(1)  ! total number of layers
+  
+  computeVegFluxFlag = (hru_data%ComputeVegFlux == yes)
+
+  !******************************************************************************
+  !****************************** From run_oneHRU *******************************
+  !******************************************************************************
+  ! water pixel: do nothing
+  if (hru_data%typeStruct%var(iLookTYPE%vegTypeIndex) == isWater) return
+
+  ! get height at bottom of each soil layer, negative downwards (used in Noah MP)
+  allocate(zSoilReverseSign(nSoil),stat=err)
+  if(err/=0)then; message=trim(message)//'problem allocating space for zSoilReverseSign'; print*, message; return; endif
+
+  zSoilReverseSign(:) = -hru_data%progStruct%var(iLookPROG%iLayerHeight)%dat(nSnow+1:nLayers)
+ 
+  ! populate parameters in Noah-MP modules
+  ! Passing a maxSoilLayer in order to pass the check for NROOT, that is done to avoid making any changes to Noah-MP code.
+  !  --> NROOT from Noah-MP veg tables (as read here) is not used in SUMMA
+  call REDPRM(hru_data%typeStruct%var(iLookTYPE%vegTypeIndex),      & ! vegetation type index
+              hru_data%typeStruct%var(iLookTYPE%soilTypeIndex),     & ! soil type
+              hru_data%typeStruct%var(iLookTYPE%slopeTypeIndex),    & ! slope type index
+              zSoilReverseSign,                            & ! * not used: height at bottom of each layer [NOTE: negative] (m)
+              maxSoilLayers,                               & ! number of soil layers
+              urbanVegCategory)                              ! vegetation category for urban areas
+
+  ! deallocate height at bottom of each soil layer(used in Noah MP)
+  deallocate(zSoilReverseSign,stat=err)
+  if(err/=0)then;message=trim(message)//'problem deallocating space for zSoilReverseSign'; print*, message; return; endif
+ 
+
+  ! overwrite the minimum resistance
+  if(overwriteRSMIN) RSMIN = hru_data%mparStruct%var(iLookPARAM%minStomatalResistance)%dat(1)
+  
+  ! overwrite the vegetation height
+  HVT(hru_data%typeStruct%var(iLookTYPE%vegTypeIndex)) = hru_data%mparStruct%var(iLookPARAM%heightCanopyTop)%dat(1)
+  HVB(hru_data%typeStruct%var(iLookTYPE%vegTypeIndex)) = hru_data%mparStruct%var(iLookPARAM%heightCanopyBottom)%dat(1)
+
+  ! overwrite the tables for LAI and SAI
+  if(model_decisions(iLookDECISIONS%LAI_method)%iDecision == specified)then
+    SAIM(hru_data%typeStruct%var(iLookTYPE%vegTypeIndex),:) = hru_data%mparStruct%var(iLookPARAM%winterSAI)%dat(1)
+    LAIM(hru_data%typeStruct%var(iLookTYPE%vegTypeIndex),:) = hru_data%mparStruct%var(iLookPARAM%summerLAI)%dat(1)*greenVegFrac_monthly
+  end if
+ 
+  ! compute derived forcing variables
+  call derivforce(&
+        hru_data%timeStruct%var,     & ! vector of time information
+        hru_data%forcStruct%var,     & ! vector of model forcing data
+        hru_data%attrStruct%var,     & ! vector of model attributes
+        hru_data%mparStruct,         & ! data structure of model parameters
+        hru_data%progStruct,         & ! data structure of model prognostic variables
+        hru_data%diagStruct,         & ! data structure of model diagnostic variables
+        hru_data%fluxStruct,         & ! data structure of model fluxes
+        hru_data%tmZoneOffsetFracDay,         & ! time zone offset in fractional days
+        err,cmessage)                  ! error control
+  if(err/=0)then;err=20; message=trim(message)//cmessage; print*, message; return; endif
+ 
+  ! initialize the number of flux calls
+  hru_data%diagStruct%var(iLookDIAG%numFluxCalls)%dat(1) = 0._dp
+
+  ! run the model for a single HRU
+  call coupled_em(&
+                  ! model control
+                  indxHRU,                     & ! intent(in):    hruID
+                  dt_init,                     & ! intent(inout): initial time step
+                  dt_init_factor,              & ! Used to adjust the length of the timestep in the event of a failure
+                  computeVegFluxFlag,          & ! intent(inout): flag to indicate if we are computing fluxes over vegetation
+                  hru_data%fracJulDay,                  & ! intent(in):    fractional julian days since the start of year
+                  hru_data%yearLength,                  & ! intent(in):    number of days in the current year
+                  ! data structures (input)
+                  hru_data%typeStruct,         & ! intent(in):    local classification of soil veg etc. for each HRU
+                  hru_data%attrStruct,         & ! intent(in):    local attributes for each HRU
+                  hru_data%forcStruct,         & ! intent(in):    model forcing data
+                  hru_data%mparStruct,         & ! intent(in):    model parameters
+                  hru_data%bvarStruct,         & ! intent(in):    basin-average model variables
+#ifdef V4_ACTIVE                  
+                  hru_data%lookupStruct,       &
+#endif
+                  ! data structures (input-output)
+                  hru_data%indxStruct,         & ! intent(inout): model indices
+                  hru_data%progStruct,         & ! intent(inout): model prognostic variables for a local HRU
+                  hru_data%diagStruct,         & ! intent(inout): model diagnostic variables for a local HRU
+                  hru_data%fluxStruct,         & ! intent(inout): model fluxes for a local HRU
+                  ! error control
+                  err,cmessage)       ! intent(out): error control
+  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); print*, message; return; endif;
+
+
+  !************************************* End of run_oneHRU *****************************************
+  ! save the flag for computing the vegetation fluxes
+  if(computeVegFluxFlag)      hru_data%ComputeVegFlux = yes
+  if(.not.computeVegFluxFlag) hru_data%ComputeVegFlux = no
+
+  fracHRU = hru_data%attrStruct%var(iLookATTR%HRUarea) / hru_data%bvarStruct%var(iLookBVAR%basin__totalArea)%dat(1)
+
+  ! ----- calculate weighted basin (GRU) fluxes --------------------------------------------------------------------------------------
+  
+  ! increment basin surface runoff (m s-1)
+  hru_data%bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) = hru_data%bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + hru_data%fluxStruct%var(iLookFLUX%scalarSurfaceRunoff)%dat(1) * fracHRU
+  
+  !increment basin soil drainage (m s-1)
+  hru_data%bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)   = hru_data%bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)  + hru_data%fluxStruct%var(iLookFLUX%scalarSoilDrainage)%dat(1)  * fracHRU
+  
+  ! increment aquifer variables -- ONLY if aquifer baseflow is computed individually for each HRU and aquifer is run
+  ! NOTE: groundwater computed later for singleBasin
+  if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == localColumn .and. model_decisions(iLookDECISIONS%groundwatr)%iDecision == bigBucket) then
+
+    hru_data%bvarStruct%var(iLookBVAR%basin__AquiferRecharge)%dat(1)  = hru_data%bvarStruct%var(iLookBVAR%basin__AquiferRecharge)%dat(1)   + hru_data%fluxStruct%var(iLookFLUX%scalarSoilDrainage)%dat(1)     * fracHRU
+    hru_data%bvarStruct%var(iLookBVAR%basin__AquiferTranspire)%dat(1) = hru_data%bvarStruct%var(iLookBVAR%basin__AquiferTranspire)%dat(1)  + hru_data%fluxStruct%var(iLookFLUX%scalarAquiferTranspire)%dat(1) * fracHRU
+    hru_data%bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)  =  hru_data%bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)  &
+            +  hru_data%fluxStruct%var(iLookFLUX%scalarAquiferBaseflow)%dat(1) * fracHRU
+    end if
+
+  ! perform the routing
+  associate(totalArea => hru_data%bvarStruct%var(iLookBVAR%basin__totalArea)%dat(1) )
+
+  ! compute water balance for the basin aquifer
+  if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == singleBasin)then
+    message=trim(message)//'multi_driver/bigBucket groundwater code not transferred from old code base yet'
+    err=20; print*, message; return
+  end if
+
+  ! calculate total runoff depending on whether aquifer is connected
+  if(model_decisions(iLookDECISIONS%groundwatr)%iDecision == bigBucket) then
+    ! aquifer
+    hru_data%bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1) = hru_data%bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + hru_data%bvarStruct%var(iLookBVAR%basin__ColumnOutflow)%dat(1)/totalArea + hru_data%bvarStruct%var(iLookBVAR%basin__AquiferBaseflow)%dat(1)
+  else
+    ! no aquifer
+    hru_data%bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1) = hru_data%bvarStruct%var(iLookBVAR%basin__SurfaceRunoff)%dat(1) + hru_data%bvarStruct%var(iLookBVAR%basin__ColumnOutflow)%dat(1)/totalArea + hru_data%bvarStruct%var(iLookBVAR%basin__SoilDrainage)%dat(1)
+  endif
+
+  call qOverland(&! input
+                  model_decisions(iLookDECISIONS%subRouting)%iDecision,            &  ! intent(in): index for routing method
+                  hru_data%bvarStruct%var(iLookBVAR%basin__TotalRunoff)%dat(1),             &  ! intent(in): total runoff to the channel from all active components (m s-1)
+                  hru_data%bvarStruct%var(iLookBVAR%routingFractionFuture)%dat,             &  ! intent(in): fraction of runoff in future time steps (m s-1)
+                  hru_data%bvarStruct%var(iLookBVAR%routingRunoffFuture)%dat,               &  ! intent(in): runoff in future time steps (m s-1)
+                  ! output
+                  hru_data%bvarStruct%var(iLookBVAR%averageInstantRunoff)%dat(1),           &  ! intent(out): instantaneous runoff (m s-1)
+                  hru_data%bvarStruct%var(iLookBVAR%averageRoutedRunoff)%dat(1),            &  ! intent(out): routed runoff (m s-1)
+                  err,message)                                                                  ! intent(out): error control
+  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); print*, message; return; endif;
+  end associate
+ 
+  !************************************* End of run_oneGRU *****************************************
+
+end subroutine runPhysics
+
+! *******************************************************************************************
+! *** get_sundials_tolerances
+! *******************************************************************************************
+#ifdef SUNDIALS_ACTIVE
+subroutine get_sundials_tolerances(handle_hru_data, rtol, atol) bind(C, name='get_sundials_tolerances')
+  USE var_lookup,only: iLookPARAM
+  implicit none
+
+  ! dummy variables
+  type(c_ptr),    intent(in), value         :: handle_hru_data        ! c_ptr to -- hru data
+  real(c_double), intent(out)               :: rtol                   ! relative tolerance
+  real(c_double), intent(out)               :: atol                   ! absolute tolerance
+  ! local variables
+  type(hru_type),pointer                    :: hru_data               ! hru data
+  call c_f_pointer(handle_hru_data, hru_data)
+
+  ! get tolerances
+  rtol = hru_data%mparStruct%var(iLookPARAM%relTolWatSnow)%dat(1) 
+  atol = hru_data%mparStruct%var(iLookPARAM%absTolWatSnow)%dat(1)
+end subroutine get_sundials_tolerances
+
+! *******************************************************************************************
+! *** get_sundials_tolerances
+! *******************************************************************************************
+subroutine set_sundials_tolerances(handle_hru_data, rtol, atol) bind(C, name='set_sundials_tolerances')
+  USE var_lookup,only: iLookPARAM
+  implicit none
+
+  ! dummy variables
+  type(c_ptr),    intent(in), value         :: handle_hru_data        ! c_ptr to -- hru data
+  real(c_double), intent(in)               :: rtol                   ! relative tolerance
+  real(c_double), intent(in)               :: atol                   ! absolute tolerance
+  ! local variables
+  type(hru_type),pointer                    :: hru_data               ! hru data
+  call c_f_pointer(handle_hru_data, hru_data)
+
+
+  ! Set rtols
+  hru_data%mparStruct%var(iLookPARAM%relConvTol_liquid)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relConvTol_matric)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relConvTol_energy)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relConvTol_aquifr)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolTempCas)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolTempVeg)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolWatVeg)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolTempSoilSnow)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolWatSnow)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolMatric)%dat(1) = rtol  
+  hru_data%mparStruct%var(iLookPARAM%relTolAquifr)%dat(1) = rtol  
+  ! Set atols
+  hru_data%mparStruct%var(iLookPARAM%absConvTol_liquid)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absConvTol_matric)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absConvTol_energy)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absConvTol_aquifr)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolTempCas)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolTempVeg)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolWatVeg)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolTempSoilSnow)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolWatSnow)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolMatric)%dat(1) = atol 
+  hru_data%mparStruct%var(iLookPARAM%absTolAquifr)%dat(1) = atol 
+end subroutine set_sundials_tolerances
+#endif
+
+end module summa_modelRun
diff --git a/build/source/actors/hru_actor/hru_read.f90 b/build/source/actors/hru_actor/hru_read.f90
new file mode 100644
index 0000000000000000000000000000000000000000..5ebd87658be6d34a715531976b355fcd45571bac
--- /dev/null
+++ b/build/source/actors/hru_actor/hru_read.f90
@@ -0,0 +1,278 @@
+module hru_read
+
+
+USE,intrinsic :: iso_c_binding
+USE nrtype
+USE data_types,only:&
+                    var_i,          &  
+                    var_i8,         &
+                    var_d,          &
+                    var_ilength,    &
+                    var_dlength,    &
+                    flagVec
+
+USE actor_data_types,only:hru_type
+implicit none
+public::setTimeZoneOffset
+public::HRU_readForcing
+private::getFirstTimeStep
+
+
+real(dp),parameter  :: verySmall=1e-3_rkind      ! tiny number
+real(dp),parameter  :: smallOffset=1.e-8_rkind   ! small offset (units=days) to force ih=0 at the start of the day
+
+contains
+
+! set the refTimeString and extract the time to set the tmZonOffsetFracDay
+subroutine setTimeZoneOffset(iFile, handle_hru_data, err) bind(C, name="setTimeZoneOffset")
+  USE access_forcing_module,only:forcingDataStruct         ! forcing structure
+  USE time_utils_module,only:extractTime        ! extract time info from units string
+  USE time_utils_module,only:fracDay            ! compute fractional day
+  USE summafilemanager,only:NC_TIME_ZONE
+  implicit none
+
+  integer(c_int),intent(in)             :: iFile
+  type(c_ptr),intent(in),value          :: handle_hru_data  ! vector of time data for a given time step
+  integer(c_int),intent(out)            :: err
+
+  ! local variables
+  type(hru_type),pointer                :: hru_data         !  model time data
+  character(len=256)                    :: message
+  character(len=256)                    :: cmessage
+  integer(i4b)                          :: iyyy,im,id,ih,imin ! date
+  integer(i4b)                          :: ih_tz,imin_tz      ! time zone information
+  real(dp)                              :: dsec,dsec_tz       ! seconds
+
+  call c_f_pointer(handle_hru_data, hru_data)
+  err=0; message="hru_actor.f90 - setForcingTimeInfo";
+
+  ! define the reference time for the model simulation
+  call extractTime(forcingDataStruct(iFile)%refTimeString, & ! input  = units string for time data
+                   iyyy,im,id,ih,imin,dsec,                & ! output = year, month, day, hour, minute, second
+                   ih_tz, imin_tz, dsec_tz,                & ! output = time zone information (hour, minute, second)
+                   err,cmessage)                             ! output = error code and error message
+  if(err/=0)then; message=trim(message)//trim(cmessage); print*, "message"; return; end if
+  
+  ! set the timezone offset
+  select case(trim(NC_TIME_ZONE))
+    case('ncTime');     hru_data%tmZoneOffsetFracDay = sign(1, ih_tz) * fracDay(ih_tz,   & ! time zone hour
+                                                                                imin_tz, & ! time zone minute
+                                                                                dsec_tz)   ! time zone second
+    case('utcTime');   hru_data%tmZoneOffsetFracDay = 0._dp
+    case('localTime'); hru_data%tmZoneOffsetFracDay = 0._dp
+    case default; err=20; message=trim(message)//'unable to identify time zone info option'; return
+  end select ! (option time zone option)
+
+end subroutine setTimeZoneOffset
+
+subroutine HRU_readForcing(indxGRU, iStep, iRead, iFile, handle_hru_data, err) bind(C, name="HRU_readForcing")
+  USE multiconst,only:secprday                  ! number of seconds in a day
+  USE time_utils_module,only:compJulDay         ! convert calendar date to julian day
+  ! global Data
+  USE globalData,only:data_step                 ! length of the data step (s)
+  USE globalData,only:dJulianStart              ! julian day of start time of simulation
+  USE globalData,only:refJulDay_data            ! reference time for data files (fractional julian days)
+  USE globalData,only:integerMissing            ! integer missing value
+  USE access_forcing_module,only:vecTime
+  USE access_forcing_module,only:forcingDataStruct
+  USE globalData,only:time_meta,forc_meta
+  USE var_lookup,only:iLookTIME,iLookFORCE
+  USE data_types,only:var_i,var_d
+  USE netcdf,only:nf90_max_name                                   ! used for nf90_max_name
+  USE time_utils_module,only:compcalday                 ! convert julian day to calendar date
+  USE globalData,only:refJulDay                 ! reference time (fractional julian days)
+
+  implicit none
+
+  integer(c_int),intent(in)               :: indxGRU          ! Index of the GRU in gru_struc
+  integer(c_int),intent(in)               :: istep            ! Model Timestep
+  integer(c_int),intent(inout)            :: iRead            ! Model Timestep 
+  integer(c_int),intent(in)               :: iFile            ! index of current forcing file from forcing file list 
+  type(c_ptr),intent(in),value            :: handle_hru_data  ! vector of time data for a given time step
+  integer(c_int),intent(out)              :: err              ! Model Timestep
+  ! local variables
+  type(hru_type),pointer                  :: hru_data         !  model time data
+  real(dp)                                :: currentJulDay    ! Julian day of current time step
+  real(dp)                                :: dataJulDay       ! julian day of current forcing data step being read
+  real(dp)                                :: startJulDay      ! julian day at the start of the year
+  
+  ! Counters
+  integer(i4b)                            :: iline            ! loop through lines in the file
+  integer(i4b)                            :: iVar
+  integer(i4b)                            :: iNC
+  ! other
+  logical(lgt),dimension(size(forc_meta)) :: checkForce       ! flags to check forcing data variables exist
+  logical(lgt),parameter                  :: checkTime=.false.! flag to check the time
+  
+  real(dp)                                :: dsec             ! double precision seconds (not used)
+  real(dp),parameter                      :: dataMin=-1._dp   ! minimum allowable data value (all forcing variables should be positive)
+  character(len = nf90_max_name)          :: varName          ! dimenison name
+
+  character(len=256)                      :: message          ! error message
+  character(len=256)                      :: cmessage         ! error message
+
+  call c_f_pointer(handle_hru_data, hru_data)
+  err=0;message="hru_actor.f90 - readForcingHRU";
+
+  if(istep == 1) then
+    call getFirstTimestep(iFile, iRead, err)
+    if(err/=0)then; message=trim(message)//"getFirstTimestep"; print*,message;return; end if
+  endif
+  
+  ! determine the julDay of current model step (istep) we need to read
+  currentJulDay = dJulianStart + (data_step*real(iStep-1,dp))/secprday
+
+  hru_data%timeStruct%var(:) = integerMissing
+  dataJulDay = vecTime(iFile)%dat(iRead)/forcingDataStruct(iFile)%convTime2Days + refJulDay_data
+  if(abs(currentJulDay - dataJulDay) > verySmall)then
+    write(message,'(a,f18.8,a,f18.8)') trim(message)//'date for time step: ',dataJulDay,' differs from the expected date: ',currentJulDay
+    print*, message
+    err=40
+    return
+  end if
+  
+  ! convert julian day to time vector
+  ! NOTE: use small offset to force ih=0 at the start of the day
+  call compcalday(dataJulDay+smallOffset,         & ! input  = julian day
+                  hru_data%timeStruct%var(iLookTIME%iyyy),      & ! output = year
+                  hru_data%timeStruct%var(iLookTIME%im),        & ! output = month
+                  hru_data%timeStruct%var(iLookTIME%id),        & ! output = day
+                  hru_data%timeStruct%var(iLookTIME%ih),        & ! output = hour
+                  hru_data%timeStruct%var(iLookTIME%imin),dsec, & ! output = minute/second
+                  err,cmessage)                     ! output = error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
+    
+  ! check to see if any of the time data is missing -- note that it is OK if ih_tz or imin_tz are missing
+  if((hru_data%timeStruct%var(iLookTIME%iyyy)==integerMissing) .or. (hru_data%timeStruct%var(iLookTIME%im)==integerMissing) .or. (hru_data%timeStruct%var(iLookTIME%id)==integerMissing) .or. (hru_data%timeStruct%var(iLookTIME%ih)==integerMissing) .or. (hru_data%timeStruct%var(iLookTIME%imin)==integerMissing))then
+      do iline=1,size(hru_data%timeStruct%var)
+          if(hru_data%timeStruct%var(iline)==integerMissing)then; err=40; message=trim(message)//"variableMissing[var='"//trim(time_meta(iline)%varname)//"']"; return; end if
+      end do
+  end if
+
+  ! initialize flags for forcing data
+  checkForce(:) = .false.
+  checkForce(iLookFORCE%time) = .true.  ! time is handled separately
+
+  do iNC=1,forcingDataStruct(iFile)%nVars
+    ! check variable is desired
+    if(forcingDataStruct(iFile)%var_ix(iNC)==integerMissing) cycle
+
+    ! get index in forcing structure
+    iVar = forcingDataStruct(iFile)%var_ix(iNC)
+    checkForce(iVar) = .true.
+
+    ! check individual data value
+    if(forcingDataStruct(iFile)%var(ivar)%dataFromFile(indxGRU,iRead)<dataMin)then
+      write(message,'(a,f13.5)') trim(message)//'forcing data for variable '//trim(varname)//' is less than minimum allowable value ', dataMin
+      err=20; return
+    endif
+    ! put the data into structures
+    hru_data%forcStruct%var(ivar) = forcingDataStruct(iFile)%var(ivar)%dataFromFile(indxGRU,iRead)
+  end do  ! loop through forcing variables
+    
+  ! check if any forcing data is missing
+  if(count(checkForce)<size(forc_meta))then
+    do iline=1,size(forc_meta)
+    if(.not.checkForce(iline))then
+      message=trim(message)//"checkForce_variableMissing[var='"//trim(forc_meta(iline)%varname)//"']"
+      err=20; return
+    endif    ! if variable is missing
+    end do   ! looping through variables
+  end if   ! if any variables are missing
+
+
+ ! **********************************************************************************************
+ ! ***** part 2: compute time
+ ! **********************************************************************************************
+  ! compute the julian day at the start of the year
+  call compjulday(hru_data%timeStruct%var(iLookTIME%iyyy),          & ! input  = year
+                  1, 1, 1, 1, 0._dp,                  & ! input  = month, day, hour, minute, second
+                  startJulDay,err,cmessage)             ! output = julian day (fraction of day) + error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
+
+  ! compute the fractional julian day for the current time step
+  call compjulday(hru_data%timeStruct%var(iLookTIME%iyyy),           & ! input  = year
+                  hru_data%timeStruct%var(iLookTIME%im),             & ! input  = month
+                  hru_data%timeStruct%var(iLookTIME%id),             & ! input  = day
+                  hru_data%timeStruct%var(iLookTIME%ih),             & ! input  = hour
+                  hru_data%timeStruct%var(iLookTIME%imin),0._dp,     & ! input  = minute/second
+                  currentJulDay,err,cmessage)            ! output = julian day (fraction of day) + error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
+  ! compute the time since the start of the year (in fractional days)
+  hru_data%fracJulDay = currentJulDay - startJulDay
+  ! set timing of current forcing vector (in seconds since reference day)
+  ! NOTE: It is a bit silly to have time information for each HRU and GRU
+  hru_data%forcStruct%var(iLookFORCE%time) = (currentJulDay-refJulDay)*secprday
+
+  ! compute the number of days in the current year
+  hru_data%yearLength = 365
+  if(mod(hru_data%timeStruct%var(iLookTIME%iyyy),4) == 0)then
+    hru_data%yearLength = 366
+    if(mod(hru_data%timeStruct%var(iLookTIME%iyyy),100) == 0)then
+    hru_data%yearLength = 365
+    if(mod(hru_data%timeStruct%var(iLookTIME%iyyy),400) == 0)then
+      hru_data%yearLength = 366
+    end if
+    end if
+  end if
+
+  ! test
+  if(checkTime)then
+    write(*,'(i4,1x,4(i2,1x),f9.3,1x,i4)')  hru_data%timeStruct%var(iLookTIME%iyyy),           & ! year
+                                            hru_data%timeStruct%var(iLookTIME%im),             & ! month
+                                            hru_data%timeStruct%var(iLookTIME%id),             & ! day
+                                            hru_data%timeStruct%var(iLookTIME%ih),             & ! hour
+                                            hru_data%timeStruct%var(iLookTIME%imin),           & ! minute
+                                            hru_data%fracJulDay,                          & ! fractional julian day for the current time step
+                                            hru_data%yearLength                             ! number of days in the current year
+    !pause ' checking time'
+  end if
+
+
+
+
+end subroutine HRU_readForcing 
+
+ ! Find the first timestep within the forcing file
+subroutine getFirstTimestep(iFile, iRead, err)
+  USE access_forcing_module,only:forcingDataStruct         ! forcing structure
+  USE access_forcing_module,only:vecTime                   ! time structure for forcing 
+  USE globalData,only:dJulianStart              ! julian day of start time of simulation
+  USE globalData,only:data_step                 ! length of the data step (s)
+  USE globalData,only:refJulDay_data            ! reference time for data files (fractional julian days)
+    
+  USE multiconst,only:secprday                  ! number of seconds in a day
+  
+  USE nr_utility_module,only:arth               ! get a sequence of numbers
+
+  implicit none
+
+  integer(i4b),intent(in)                                 :: iFile
+  integer(i4b),intent(out)                                :: iRead
+  integer(i4b),intent(out)                                :: err
+  ! local variables
+  character(len=256)                                      :: message
+  real(dp)                                                :: timeVal(1)    ! single time value (restrict time read)
+  real(dp),dimension(forcingDataStruct(iFile)%nTimeSteps) :: fileTime      ! array of time from netcdf file
+  real(dp),dimension(forcingDataStruct(iFile)%nTimeSteps) :: diffTime      ! array of time differences
+
+  err=0; message="hru_actor.f90 - getFirstTimeStep"
+
+  ! get time vector & convert units based on offset and data step
+  timeVal(1) = vecTime(iFile)%dat(1)
+  fileTime = arth(0,1,forcingDataStruct(iFile)%nTimeSteps) * data_step/secprday + refJulDay_data &
+              + timeVal(1)/forcingDataStruct(iFile)%convTime2Days
+
+  ! find difference of fileTime from currentJulDay
+  diffTime=abs(fileTime-dJulianStart)
+  
+  if(any(diffTime < verySmall))then
+    iRead=minloc(diffTime,1)
+  else
+    iRead=-1 ! set to -1 to designinate this forcing file is not the start
+  endif
+  
+end subroutine getFirstTimestep
+
+end module hru_read
+
diff --git a/build/source/actors/hru_actor/fortran_code/outputStrucWrite.f90 b/build/source/actors/hru_actor/hru_writeOutput.f90
old mode 100755
new mode 100644
similarity index 66%
rename from build/source/actors/hru_actor/fortran_code/outputStrucWrite.f90
rename to build/source/actors/hru_actor/hru_writeOutput.f90
index 37b4b74517376e572cdb695c3b255561b0f90026..66dba0cd69622ec286b28f55e40e2af2651e9185
--- a/build/source/actors/hru_actor/fortran_code/outputStrucWrite.f90
+++ b/build/source/actors/hru_actor/hru_writeOutput.f90
@@ -1,81 +1,227 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-! Module contains subroutines for writing to the global output strucutre
-module outputStrucWrite_module
-
-! NetCDF types
-USE netcdf
-USE netcdf_util_module,only:netcdf_err                    ! netcdf error handling function
-
-! top-level data types
-USE nrtype
-
-! missing values
-USE globalData,only: integerMissing, realMissing
-
-! provide access to global data
-USE globalData,only:gru_struc                             ! gru->hru mapping structure
-USE output_structure_module,only:outputStructure
-
+module HRUwriteoOutput_module
+USE,intrinsic :: iso_c_binding
 
-! provide access to the derived types to define the data structures
 USE data_types,only:&
-                    ! final data vectors
-                    dlength,             & ! var%dat
-                    ilength,             & ! var%dat
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            integer(8)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    ! no variable dimension
-                    hru_i,               & ! x%hru(:)            (i4b)
-                    hru_d,               & ! x%hru(:)            (dp)
-                    ! gru dimension
-                    gru_int,             & ! x%gru(:)%var(:)     (i4b)
-                    gru_double,          & ! x%gru(:)%var(:)     (dp)
-                    gru_intVec,          & ! x%gru(:)%var(:)%dat (i4b)
-                    gru_doubleVec,       & ! x%gru(:)%var(:)%dat (dp)
-                    ! gru+hru dimension
-                    gru_hru_int,         & ! x%gru(:)%hru(:)%var(:)     (i4b)
-                    gru_hru_int8,        & ! x%gru(:)%hru(:)%var(:)     integer(8)
-                    gru_hru_double,      & ! x%gru(:)%hru(:)%var(:)     (dp)
-                    gru_hru_intVec,      & ! x%gru(:)%hru(:)%var(:)%dat (i4b)
-                    gru_hru_doubleVec      ! x%gru(:)%hru(:)%var(:)%dat (dp)
-
+                    dlength,        & ! var%dat
+                    ilength,        & ! var%dat
+                    var_i,          &  
+                    var_i8,         &
+                    var_d,          &
+                    
+                    var_ilength,    &
+                    var_dlength,    &
+                    flagVec
+USE actor_data_types,only:hru_type
+! named variables to define new output files
+USE netcdf
+USE netcdf_util_module,only:netcdf_err 
+USE nrtype
+USE globalData,only:noNewFiles
+USE globalData,only:newFileEveryOct1
+USE globalData,only:chunkSize               ! size of chunks to write
+USE globalData,only:outputPrecision         ! data structure for output precision
+USE globalData,only:integerMissing            ! missing integer
+! metadata
+USE globalData,only:time_meta                 ! metadata on the model time
+USE globalData,only:forc_meta                 ! metadata on the model forcing data
+USE globalData,only:diag_meta                 ! metadata on the model diagnostic variables
+USE globalData,only:prog_meta                 ! metadata on the model prognostic variables
+USE globalData,only:flux_meta                 ! metadata on the model fluxes
+USE globalData,only:indx_meta                 ! metadata on the model index variables
+USE globalData,only:bvar_meta                 ! metadata on basin-average variables
+USE globalData,only:bpar_meta                 ! basin parameter metadata structure
+USE globalData,only:mpar_meta                 ! local parameter metadata structure
+! child metadata for stats
+USE globalData,only:statForc_meta             ! child metadata for stats
+USE globalData,only:statProg_meta             ! child metadata for stats
+USE globalData,only:statDiag_meta             ! child metadata for stats
+USE globalData,only:statFlux_meta             ! child metadata for stats
+USE globalData,only:statIndx_meta             ! child metadata for stats
+USE globalData,only:statBvar_meta             ! child metadata for stats
+! index of the child data structure
+USE globalData,only:forcChild_map             ! index of the child data structure: stats forc
+USE globalData,only:progChild_map             ! index of the child data structure: stats prog
+USE globalData,only:diagChild_map             ! index of the child data structure: stats diag
+USE globalData,only:fluxChild_map             ! index of the child data structure: stats flux
+USE globalData,only:indxChild_map             ! index of the child data structure: stats indx
+USE globalData,only:bvarChild_map             ! index of the child data structure: stats bvar
+USE globalData,only:outFreq                   ! output frequencies
+! named variables
+USE var_lookup,only:iLookTIME                 ! named variables for time data structure
+USE var_lookup,only:iLookDIAG                 ! named variables for local column model diagnostic variables
+USE var_lookup,only:iLookPROG                 ! named variables for local column model prognostic variables
+USE var_lookup,only:iLookINDEX                ! named variables for local column index variables
+USE var_lookup,only:iLookFreq                 ! named variables for the frequency structure
+USE var_lookup,only:iLookBVAR                 ! named variables for basin parameters
 ! vector lengths
 USE var_lookup, only: maxvarFreq ! number of output frequencies
 USE var_lookup, only: maxvarStat ! number of statistics
+USE get_ixname_module,only:get_freqName       ! get name of frequency from frequency index
+USE output_structure_module,only:outputStructure
+
 
 implicit none
 private
+public::hru_writeOutput
 public::writeParm
 public::writeData
 public::writeBasin
 public::writeTime
 public::writeRestart
-! define dimension lengths
 integer(i4b),parameter      :: maxSpectral=2              ! maximum number of spectral bands
 contains
+subroutine hru_writeOutput(&
+                            indxHRU,                   &
+                            indxGRU,                   &
+                            timestep,                  & ! model timestep
+                            outputStep,                & ! index into the output Struc
+                            handle_hru_data,           & ! local HRU data  
+                            err) bind(C, name="hru_writeOutput") 
+  USE nrtype
+  USE globalData,only:structInfo
+  USE globalData,only:startWrite,endWrite
+  USE globalData,only:maxLayers                               ! maximum number of layers
+  USE globalData,only:maxSnowLayers                           ! maximum number of snow layers
+
+  USE globalData,only:ixProgress                              ! define frequency to write progress
+  USE globalData,only:ixRestart                               ! define frequency to write restart files
+  USE globalData,only:gru_struc
+
+  USE globalData,only:newOutputFile                           ! define option for new output files
+  USE summa_alarms,only:summa_setWriteAlarms
+
+  USE globalData,only:forc_meta,attr_meta,type_meta           ! metaData structures
+  USE output_stats,only:calcStats                             ! module for compiling output statistics
+  USE time_utils_module,only:elapsedSec                       ! calculate the elapsed time
+  USE globalData,only:elapsedWrite                            ! elapsed time to write data
+  USE output_structure_module,only:outputStructure
+  USE netcdf_util_module,only:nc_file_close                   ! close netcdf file
+  USE netcdf_util_module,only:nc_file_open                    ! open netcdf file
+  USE var_lookup,only:maxvarFreq                              ! maximum number of output files
+
+  implicit none
+  integer(c_int),intent(in)             :: indxHRU               ! index of hru in GRU
+  integer(c_int),intent(in)             :: indxGRU               ! index of the GRU
+  integer(c_int),intent(in)             :: timestep              ! model timestep
+  integer(c_int),intent(in)             :: outputStep            ! index into the output Struc
+  type(c_ptr),intent(in),value          :: handle_hru_data       ! local HRU data
+  integer(c_int),intent(out)            :: err
+
+  ! local pointers
+  type(hru_type), pointer               :: hru_data              ! local HRU data
+  ! local variables
+  character(len=256)                    :: cmessage
+  character(len=256)                    :: message 
+  logical(lgt)                          :: defNewOutputFile=.false.
+  logical(lgt)                          :: printRestart=.false.
+  logical(lgt)                          :: printProgress=.false.
+  character(len=256)                    :: restartFile       ! restart file name
+  character(len=256)                    :: timeString        ! portion of restart file name that contains the write-out time
+  integer(i4b)                          :: iStruct           ! index of model structure
+  integer(i4b)                          :: iFreq             ! index of the output frequency
+  ! convert the C pointers to Fortran pointers
+  call c_f_pointer(handle_hru_data, hru_data)
+  err=0; message='summa_manageOutputFiles/'
+  ! identify the start of the writing
+
+  ! Many variables get there values from summa4chm_util.f90:getCommandArguments()
+  call summa_setWriteAlarms(hru_data%oldTime_hru%var, hru_data%timeStruct%var, hru_data%finishTime_hru%var,  &   ! time vectors
+                            newOutputFile,  defNewOutputFile,            &
+                            ixRestart,      printRestart,                &   ! flag to print the restart file
+                            ixProgress,     printProgress,               &   ! flag to print simulation progress
+                            hru_data%resetStats%dat, hru_data%finalizeStats%dat,           &   ! flags to reset and finalize stats
+                            hru_data%statCounter%var,                             &   ! statistics counter
+                            err, cmessage)                                  ! error control
+  if(err/=0)then; message=trim(message)//trim(cmessage); return; endif
+
+  ! Write Parameters to output structure if this is the first
+  if (timestep == 1)then
+    do iStruct=1,size(structInfo)
+      select case(trim(structInfo(iStruct)%structName))
+        case('attr'); call writeParm(indxGRU,indxHRU,gru_struc(indxGRU)%hruInfo(indxHRU)%hru_ix,hru_data%attrStruct,attr_meta,structInfo(iStruct)%structName,err,cmessage)
+        case('type'); call writeParm(indxGRU,indxHRU,gru_struc(indxGRU)%hruInfo(indxHRU)%hru_ix,hru_data%typeStruct,type_meta,structInfo(iStruct)%structName,err,cmessage)
+        case('mpar'); call writeParm(indxGRU,indxHRU,gru_struc(indxGRU)%hruInfo(indxHRU)%hru_ix,hru_data%mparStruct,mpar_meta,structInfo(iStruct)%structName,err,cmessage)
+      end select
+      if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
+    end do  ! (looping through structures)
+    call writeParm(indxGRU,indxHRU,indxGRU,hru_data%bparStruct,bpar_meta,'bpar',err,cmessage)
+    if(err/=0)then; message=trim(message)//trim(cmessage)//'[bpar]'; return; endif
+  endif
+
+
+
+ ! If we do not do this looping we segfault - I am not sure why
+  outputStructure(1)%finalizeStats%gru(indxGRU)%hru(indxHRU)%tim(outputStep)%dat(:) = hru_data%finalizeStats%dat(:)
+
+ ! ****************************************************************************
+ ! *** calculate output statistics
+ ! ****************************************************************************
+  do iStruct=1,size(structInfo)
+    select case(trim(structInfo(iStruct)%structName))
+      case('forc'); call calcStats(hru_data%forcStat%var, hru_data%forcStruct%var, statForc_meta, hru_data%resetStats%dat, hru_data%finalizeStats%dat, hru_data%statCounter%var, err, cmessage)
+      case('prog'); call calcStats(hru_data%progStat%var, hru_data%progStruct%var, statProg_meta, hru_data%resetStats%dat, hru_data%finalizeStats%dat, hru_data%statCounter%var, err, cmessage)
+      case('diag'); call calcStats(hru_data%diagStat%var, hru_data%diagStruct%var, statDiag_meta, hru_data%resetStats%dat, hru_data%finalizeStats%dat, hru_data%statCounter%var, err, cmessage)
+      case('flux'); call calcStats(hru_data%fluxStat%var, hru_data%fluxStruct%var, statFlux_meta, hru_data%resetStats%dat, hru_data%finalizeStats%dat, hru_data%statCounter%var, err, cmessage)
+      case('indx'); call calcStats(hru_data%indxStat%var, hru_data%indxStruct%var, statIndx_meta, hru_data%resetStats%dat, hru_data%finalizeStats%dat, hru_data%statCounter%var, err, cmessage)     
+    end select
+    if(err/=0)then; message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'; return; endif
+  end do  ! (looping through structures)
+    
+  ! calc basin stats
+  call calcStats(hru_data%bvarStat%var(:), hru_data%bvarStruct%var(:), statBvar_meta, hru_data%resetStats%dat, hru_data%finalizeStats%dat, hru_data%statCounter%var, err, cmessage)
+  if(err/=0)then; message=trim(message)//trim(cmessage)//'[bvar stats]'; return; endif
+  
+  ! write basin-average variables
+  call writeBasin(indxGRU,indxHRU,outputStep,hru_data%finalizeStats%dat, &
+                  hru_data%outputTimeStep%var,bvar_meta,hru_data%bvarStat%var,hru_data%bvarStruct%var,bvarChild_map,err,cmessage)
+  if(err/=0)then; message=trim(message)//trim(cmessage)//'[bvar]'; return; endif
+
+  ! ****************************************************************************
+  ! *** write data
+  ! ****************************************************************************
+  call writeTime(indxGRU,indxHRU,outputStep,hru_data%finalizeStats%dat, &
+                time_meta,hru_data%timeStruct%var,err,message)
+
+  ! write the model output to the OutputStructure
+  ! Passes the full metadata structure rather than the stats metadata structure because
+  ! we have the option to write out data of types other than statistics.
+  ! Thus, we must also pass the stats parent->child maps from childStruct.
+  do iStruct=1,size(structInfo)
+    select case(trim(structInfo(iStruct)%structName))
+      case('forc'); call writeData(indxGRU,indxHRU,outputStep,"forc",hru_data%finalizeStats%dat,&
+                    maxLayers,forc_meta,hru_data%forcStat,hru_data%forcStruct,forcChild_map,hru_data%indxStruct,err,cmessage)
+      case('prog'); call writeData(indxGRU,indxHRU,outputStep,"prog",hru_data%finalizeStats%dat,&
+                    maxLayers,prog_meta,hru_data%progStat,hru_data%progStruct,progChild_map,hru_data%indxStruct,err,cmessage)
+      case('diag'); call writeData(indxGRU,indxHRU,outputStep,"diag",hru_data%finalizeStats%dat,&
+                    maxLayers,diag_meta,hru_data%diagStat,hru_data%diagStruct,diagChild_map,hru_data%indxStruct,err,cmessage)
+      case('flux'); call writeData(indxGRU,indxHRU,outputStep,"flux",hru_data%finalizeStats%dat,&
+                    maxLayers,flux_meta,hru_data%fluxStat,hru_data%fluxStruct,fluxChild_map,hru_data%indxStruct,err,cmessage)
+      case('indx'); call writeData(indxGRU,indxHRU,outputStep,"indx",hru_data%finalizeStats%dat,&
+                    maxLayers,indx_meta,hru_data%indxStat,hru_data%indxStruct,indxChild_map,hru_data%indxStruct,err,cmessage)
+    end select
+    if(err/=0)then 
+      message=trim(message)//trim(cmessage)//'['//trim(structInfo(iStruct)%structName)//']'
+      return
+    endif
+  end do  ! (looping through structures)
+
+  ! *****************************************************************************
+  ! *** update counters
+  ! *****************************************************************************
+
+  ! increment output file timestep
+  do iFreq = 1,maxvarFreq
+    hru_data%statCounter%var(iFreq) = hru_data%statCounter%var(iFreq)+1
+    if(hru_data%finalizeStats%dat(iFreq)) hru_data%outputTimeStep%var(iFreq) = hru_data%outputTimeStep%var(iFreq) + 1
+  end do
+
+  ! if finalized stats, then reset stats on the next time step
+  hru_data%resetStats%dat(:) = hru_data%finalizeStats%dat(:)
+
+  ! save time vector
+  hru_data%oldTime_hru%var(:) = hru_data%timeStruct%var(:)
+
+end subroutine hru_writeOutput
 
 ! **********************************************************************************************************
 ! public subroutine writeParm: write model parameters
@@ -100,7 +246,7 @@ subroutine writeParm(indxGRU,indxHRU,ispatial,struct,meta,structName,err,message
   integer(i4b)                :: iVar             ! loop through variables
 
   ! initialize error control
-  err=0;message="outputStrucWrite.f90-writeParm/"
+  err=0;message="hru_modelwrite.f90-writeParm/"
 
   ! loop through local column model parameters
   do iVar = 1,size(meta)
@@ -116,17 +262,17 @@ subroutine writeParm(indxGRU,indxHRU,ispatial,struct,meta,structName,err,message
       select type (struct)
         class is (var_i)
         if (structName == "type")then
-          outputStructure(1)%typeStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar) = struct%var(iVar)
+          outputStructure(1)%typeStruct%gru(indxGRU)%hru(indxHRU)%var(iVar) = struct%var(iVar)
         end if
         class is (var_i8)
         
         class is (var_d)
         if (structName == "attr")then
-          outputStructure(1)%attrStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar) = struct%var(iVar)
+          outputStructure(1)%attrStruct%gru(indxGRU)%hru(indxHRU)%var(iVar) = struct%var(iVar)
         end if
         class is (var_dlength)
         if (structName == "mpar")then
-          outputStructure(1)%mparStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar) = struct%var(iVar)
+          outputStructure(1)%mparStruct%gru(indxGRU)%hru(indxHRU)%var(iVar) = struct%var(iVar)
         end if
         
         class default; err=20; message=trim(message)//'unknown variable type (with HRU)'; return
@@ -138,7 +284,7 @@ subroutine writeParm(indxGRU,indxHRU,ispatial,struct,meta,structName,err,message
       select type (struct)
         class is (var_d)
         if (structName == "bpar")then
-          outputStructure(1)%bparStruct(1)%gru(indxGRU)%var(iVar) = struct%var(iVar) ! this will overwrite data
+          outputStructure(1)%bparStruct%gru(indxGRU)%var(iVar) = struct%var(iVar) ! this will overwrite data
           print*, "bpar"
         end if
         class is (var_i8)
@@ -194,7 +340,7 @@ subroutine writeData(indxGRU,indxHRU,iStep,structName,finalizeStats, &
   integer(i4b),parameter           :: ixInteger=1001    ! named variable for integer
   integer(i4b),parameter           :: ixReal=1002       ! named variable for real
   ! initialize error control
-  err=0;message="outputStrucWrite.f90-writeData/"
+  err=0;message="hru_modelwrite.f90-writeData/"
 
   ! loop through output frequencies
   do iFreq=1,maxvarFreq
@@ -213,7 +359,7 @@ subroutine writeData(indxGRU,indxHRU,iStep,structName,finalizeStats, &
         ! Write the time step values
         select type(dat)      ! forcStruc
           class is (var_d)    ! x%var(:)
-            outputStructure(1)%forcStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep) = dat%var(iVar)
+            outputStructure(1)%forcStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep) = dat%var(iVar)
           class default; err=20; message=trim(message)//'time variable must be of type var_d (forcing data structure)'; return
         end select
       end if  ! id time
@@ -230,15 +376,15 @@ subroutine writeData(indxGRU,indxHRU,iStep,structName,finalizeStats, &
           class is (var_dlength)
             select case(trim(structName))
             case('forc')
-              outputStructure(1)%forcStat(1)%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
+              outputStructure(1)%forcStat%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
             case('prog')
-              outputStructure(1)%progStat(1)%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
+              outputStructure(1)%progStat%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
             case('diag')
-              outputStructure(1)%diagStat(1)%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
+              outputStructure(1)%diagStat%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
             case('flux')
-              outputStructure(1)%fluxStat(1)%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
+              outputStructure(1)%fluxStat%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
             case('indx')
-              outputStructure(1)%indxStat(1)%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
+              outputStructure(1)%indxStat%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat%var(map(iVar))%dat(iFreq)
             case default
               err=21; message=trim(message)//"Stats structure not found"; return
             end select
@@ -250,11 +396,11 @@ subroutine writeData(indxGRU,indxHRU,iStep,structName,finalizeStats, &
 
         ! get the model layers
         nSoil   = indx%var(iLookIndex%nSoil)%dat(1)
-        outputStructure(1)%indxStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iLookIndex%nSoil)%tim(iStep)%dat(1) = nSoil
+        outputStructure(1)%indxStruct%gru(indxGRU)%hru(indxHRU)%var(iLookIndex%nSoil)%tim(iStep)%dat(1) = nSoil
         nSnow   = indx%var(iLookIndex%nSnow)%dat(1)
-        outputStructure(1)%indxStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iLookIndex%nSnow)%tim(iStep)%dat(1) = nSnow
+        outputStructure(1)%indxStruct%gru(indxGRU)%hru(indxHRU)%var(iLookIndex%nSnow)%tim(iStep)%dat(1) = nSnow
         nLayers = indx%var(iLookIndex%nLayers)%dat(1)
-        outputStructure(1)%indxStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iLookIndex%nLayers)%tim(iStep)%dat(1) = nLayers
+        outputStructure(1)%indxStruct%gru(indxGRU)%hru(indxHRU)%var(iLookIndex%nLayers)%tim(iStep)%dat(1) = nLayers
 
         ! get the length of each data vector
         select case (meta(iVar)%varType)
@@ -273,16 +419,16 @@ subroutine writeData(indxGRU,indxHRU,iStep,structName,finalizeStats, &
           class is (var_dlength)
             select case(trim(structName))
               case('prog')
-                outputStructure(1)%progStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(:) = dat%var(iVar)%dat(:)
+                outputStructure(1)%progStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(1:datLength) = dat%var(iVar)%dat(:)
               case('diag')
-                outputStructure(1)%diagStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(:) = dat%var(iVar)%dat(:)
+                outputStructure(1)%diagStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(1:datLength) = dat%var(iVar)%dat(:)
               case('flux')
-                outputStructure(1)%fluxStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(:) = dat%var(iVar)%dat(:)
+                outputStructure(1)%fluxStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(1:datLength) = dat%var(iVar)%dat(:)
               case default
                 err=21; message=trim(message)//'data structure not found for output'
             end select
           class is (var_ilength) 
-            outputStructure(1)%indxStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(:) = dat%var(iVar)%dat(:)
+            outputStructure(1)%indxStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(1:datLength) = dat%var(iVar)%dat(:)
           class default; err=20; message=trim(message)//'data must not be scalarv and either of type var_dlength or var_ilength'; return
         end select
 
@@ -338,7 +484,7 @@ subroutine writeBasin(indxGRU,indxHRU,iStep,finalizeStats,&
  integer(i4b)                  :: iStat             ! statistics index
  integer(i4b)                  :: iFreq             ! frequency index
  ! initialize error control
- err=0;message="outputStrucWrite.f90-writeBasin/"
+ err=0;message="hru_modelwrite.f90-writeBasin/"
 
  ! loop through output frequencies
  do iFreq=1,maxvarFreq
@@ -362,10 +508,10 @@ subroutine writeBasin(indxGRU,indxHRU,iStep,finalizeStats,&
    select case (meta(iVar)%varType)
 
     case (iLookVarType%scalarv)
-      outputStructure(1)%bvarStat(1)%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat(map(iVar))%dat(iFreq)
+      outputStructure(1)%bvarStat%gru(indxGRU)%hru(indxHRU)%var(map(iVar))%tim(iStep)%dat(iFreq) = stat(map(iVar))%dat(iFreq)
     case (iLookVarType%routing)
      if (iFreq==1 .and. outputTimestep(iFreq)==1) then
-      outputStructure(1)%bvarStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(iFreq) = dat(iVar)%dat(iFreq)
+      outputStructure(1)%bvarStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep)%dat(iFreq) = dat(iVar)%dat(iFreq)
      end if
 
     case default
@@ -402,7 +548,7 @@ subroutine writeTime(indxGRU,indxHRU,iStep,finalizeStats,meta,dat,err,message)
  integer(i4b)                  :: iVar              ! variable index
  integer(i4b)                  :: iFreq             ! frequency index
  ! initialize error control
- err=0;message="outputStrucWrite.f90-writeTime/"
+ err=0;message="hru_modelwrite.f90-writeTime/"
 
  ! loop through output frequencies
  do iFreq=1,maxvarFreq
@@ -417,7 +563,7 @@ subroutine writeTime(indxGRU,indxHRU,iStep,finalizeStats,meta,dat,err,message)
    if (meta(iVar)%statIndex(iFreq)/=iLookStat%inst) cycle
 
    ! add to outputStructure
-   outputStructure(1)%timeStruct(1)%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep) = dat(iVar)
+   outputStructure(1)%timeStruct%gru(indxGRU)%hru(indxHRU)%var(iVar)%tim(iStep) = dat(iVar)
    if (err/=0) message=trim(message)//trim(meta(iVar)%varName)
    if (err/=0) then; err=20; return; end if
 
@@ -699,4 +845,4 @@ subroutine writeRestart(filename,         & ! intent(in): name of restart file
 
 end subroutine writeRestart
 
-end module outputStrucWrite_module
+end module HRUwriteoOutput_module
\ No newline at end of file
diff --git a/build/source/actors/job_actor/GRU.cpp b/build/source/actors/job_actor/GRU.cpp
index 520c36d973425ab5225bed179d3db4303731cd8c..3f81ab2d39ca9e0d1b8f3711fd1c4aef7485b82e 100644
--- a/build/source/actors/job_actor/GRU.cpp
+++ b/build/source/actors/job_actor/GRU.cpp
@@ -4,12 +4,20 @@
 #include <fstream>
 
 
+int is_success(const gru_state& state) {
 
-GRU::GRU(int global_gru_index, int local_gru_index, caf::actor gru_actor, int dt_init_factor, int max_attempt) {
+  return(state == gru_state::succeeded) ? 1 : 0;
+}
+
+
+GRU::GRU(int global_gru_index, int local_gru_index, caf::actor gru_actor, 
+         int dt_init_factor, double rel_tol, double abs_tol, int max_attempt) {
   this->global_gru_index = global_gru_index;
   this->local_gru_index = local_gru_index;
   this->gru_actor = gru_actor;
   this->dt_init_factor = dt_init_factor;
+  this->rel_tol = rel_tol;
+  this->abs_tol = abs_tol;
   this->attempts_left = max_attempt;
   this->state = gru_state::running;
 }
@@ -48,6 +56,14 @@ double GRU::getWriteOutputDuration() {
   return this->write_output_duration;
 }
 
+double GRU::getRelTol() {
+  return this->rel_tol;
+}
+
+double GRU::getAbsTol() {
+  return this->abs_tol;
+}
+
 double GRU::getAttemptsLeft() {
   return this->attempts_left;
 }
@@ -77,6 +93,13 @@ void GRU::setWriteOutputDuration(double write_output_duration) {
   this->write_output_duration = write_output_duration;
 }
 
+void GRU::setRelTol(double rel_tol) {
+  this->rel_tol = rel_tol;
+}
+void GRU::setAbsTol(double abs_tol) {
+  this->abs_tol = abs_tol;
+}
+
 void GRU::setSuccess() {
   this->state = gru_state::succeeded;
 }
diff --git a/build/source/actors/job_actor/job_actor.cpp b/build/source/actors/job_actor/job_actor.cpp
index 06c811819f48a414d80ce04ba28eaeb25ea9d9b0..e8da6c96cb890e2f2475b675adaf8c0c1c1ac62d 100644
--- a/build/source/actors/job_actor/job_actor.cpp
+++ b/build/source/actors/job_actor/job_actor.cpp
@@ -1,12 +1,4 @@
 #include "job_actor.hpp"
-#include "file_access_actor.hpp"
-#include "json.hpp"
-#include <chrono>
-#include <thread>
-#include "message_atoms.hpp"
-#include "job_actor_subroutine_wrappers.hpp"
-#include "hru_actor.hpp"
-#include "gru_actor.hpp"
 
 using json = nlohmann::json;
 using chrono_time = std::chrono::time_point<std::chrono::system_clock>;
@@ -15,9 +7,12 @@ using chrono_time = std::chrono::time_point<std::chrono::system_clock>;
 namespace caf {
 
 // First Actor that is spawned that is not the Coordinator Actor.
-behavior job_actor(stateful_actor<job_state>* self, int start_gru, int num_gru, 
-    File_Access_Actor_Settings file_access_actor_settings, Job_Actor_Settings job_actor_settings, 
-    HRU_Actor_Settings hru_actor_settings, caf::actor parent) {
+behavior job_actor(stateful_actor<job_state>* self, 
+                   int start_gru, int num_gru, 
+                   File_Access_Actor_Settings file_access_actor_settings, 
+                   Job_Actor_Settings job_actor_settings, 
+                   HRU_Actor_Settings hru_actor_settings, 
+                   caf::actor parent) {
     
     self->set_down_handler([=](const down_msg& dm) {
         aout(self) << "\n\n ********** DOWN HANDLER ********** \n";
@@ -55,178 +50,218 @@ behavior job_actor(stateful_actor<job_state>* self, int start_gru, int num_gru,
     gethostname(host, HOST_NAME_MAX);
     self->state.hostname = host;
     
-    // Initalize global variables
+    // Initalize global variables calling Fortran Routines
     int err = 0;
-    setTimesDirsAndFiles(self->state.job_actor_settings.file_manager_path.c_str(), &err);
-    if (err != 0) {
-        aout(self) << "ERROR: Job_Actor - setTimesDirsAndFiles\n";
-        return {}; // Failure
-    }
-    defineGlobalData(&self->state.start_gru, &err);
-    if (err != 0) {
-        aout(self) << "ERROR: Job_Actor - defineGlobalData\n";
-        return {}; // Failure
-    }
-    readDimension(&self->state.num_gru, &self->state.num_hru, &self->state.start_gru, &err);
-    if (err != 0) {
-        aout(self) << "ERROR: Job_Actor - readDimension\n";
-        return {}; // Failure
-    }
-    readIcondNLayers(&self->state.num_gru, &err);
-    if (err != 0) {
-        aout(self) << "ERROR: Job_Actor - readIcondNLayers\n";
-        return {}; // Failure
-    }
-    allocateTimeStructure(&err);
-    if (err != 0) {
-        aout(self) << "ERROR: Job_Actor - allocateTimeStructure\n";
-        return {}; // Failure
-    }
+
+
+    /*
+    Calls: 
+      - summa_SetTimesDirsAndFiles()
+      - summa_defineGlobalData()
+      - read_icond_nlayers()
+      - Allocates time structures
+    */
+    job_init_fortran(self->state.job_actor_settings.file_manager_path.c_str(),
+                     &self->state.start_gru,
+                     &self->state.num_gru,
+                     &self->state.num_hru,
+                     &err);
+    if (err != 0) { aout(self) << "\nERROR: Job_Actor - job_init_fortran\n"; return {}; }
+    
 
     // Spawn the file_access_actor. This will return the number of forcing files we are working with
-    self->state.file_access_actor = self->spawn(file_access_actor, self->state.start_gru, self->state.num_gru, 
-        self->state.file_access_actor_settings, self);
+    self->state.file_access_actor = self->spawn(file_access_actor, 
+                                                self->state.start_gru, 
+                                                self->state.num_gru, 
+                                                self->state.file_access_actor_settings, 
+                                                self);
 
 
-    aout(self) << "Job Actor Initalized \n";
+    aout(self) << "Job Actor Initialized \n";
 
     return {
 
         [=](init_gru) {
-            initGRUs(self);
-        },
+          auto& gru_container = self->state.gru_container;
+
+          gru_container.gru_start_time = std::chrono::high_resolution_clock::now();
+          gru_container.run_attempts_left = self->state.max_run_attempts;
+          gru_container.run_attempts_left--;
+
+
+          // Spawn the GRUs
+          for(int i = 0; i < gru_container.num_gru_in_run_domain; i++) {
+            auto global_gru_index = gru_container.gru_list.size() + self->state.start_gru;
+            auto local_gru_index = gru_container.gru_list.size() + 1; // Fortran reference starts at 1
+
+            auto gru = self->spawn(hru_actor, 
+                                    global_gru_index,
+                                    local_gru_index,               
+                                    self->state.hru_actor_settings,                                
+                                    self->state.file_access_actor, 
+                                    self);
+
+            // Create the GRU object (Job uses this to keep track of GRU status)
+            gru_container.gru_list.push_back(new GRU(global_gru_index, 
+                                                     local_gru_index, 
+                                                     gru, 
+                                                     self->state.dt_init_start_factor, 
+                                                     self->state.hru_actor_settings.rel_tol,
+                                                     self->state.hru_actor_settings.abs_tol,
+                                                     self->state.max_run_attempts));    
+          }
+        }, // end init_gru
 
         [=](done_hru, int local_gru_index) {
-          chrono_time end_point = std::chrono::high_resolution_clock::now();
-          double total_duration = std::chrono::duration_cast<std::chrono::seconds>(end_point - 
-                                    self->state.gru_container.gru_start_time).count();
-
-          aout(self) << "\nJob_Actor: GRU Finished: \n" <<
-                        "          global_gru_index = " << 
-                        self->state.gru_container.gru_list[local_gru_index-1]->getGlobalGRUIndex() << "\n" <<
-                        "          local_gru_index = " << local_gru_index << "\n" <<
-                        "          total_duration = " << total_duration << "\n\n";
+          auto& gru_container = self->state.gru_container;
+          using namespace std::chrono;
+          
+          chrono_time end_point = high_resolution_clock::now();
+          double total_duration = duration_cast<seconds>(end_point - gru_container.gru_start_time).count();
+
+          aout(self) << "\nJob_Actor: GRU Finished: \n" 
+                     << "          global_gru_index = " 
+                     << gru_container.gru_list[local_gru_index-1]->getGlobalGRUIndex() << "\n"
+                     << "          local_gru_index = " << local_gru_index << "\n"
+                     << "          total_duration = " << total_duration << "\n\n";
           // Update Timing
-          self->state.gru_container.gru_list[local_gru_index-1]->setRunTime(total_duration);
-          self->state.gru_container.gru_list[local_gru_index-1]->setInitDuration(-1);
-          self->state.gru_container.gru_list[local_gru_index-1]->setForcingDuration(-1);
-          self->state.gru_container.gru_list[local_gru_index-1]->setRunPhysicsDuration(-1);
-          self->state.gru_container.gru_list[local_gru_index-1]->setWriteOutputDuration(-1);
+          gru_container.gru_list[local_gru_index-1]->setRunTime(total_duration);
+          gru_container.gru_list[local_gru_index-1]->setInitDuration(-1);
+          gru_container.gru_list[local_gru_index-1]->setForcingDuration(-1);
+          gru_container.gru_list[local_gru_index-1]->setRunPhysicsDuration(-1);
+          gru_container.gru_list[local_gru_index-1]->setWriteOutputDuration(-1);
 
-          self->state.gru_container.gru_list[local_gru_index-1]->setSuccess();
+          gru_container.gru_list[local_gru_index-1]->setSuccess();
 
-          self->state.gru_container.num_gru_done++;
+          gru_container.num_gru_done++;
 
-          // Check if we have finished all active GRUs
-          if (self->state.gru_container.num_gru_done >= self->state.gru_container.num_gru_in_run_domain) {
-            
+          
+          // Check if all GRUs are finished
+          if (gru_container.num_gru_done >= gru_container.num_gru_in_run_domain) {
             // Check for failures
-            if(self->state.gru_container.num_gru_failed == 0 || self->state.gru_container.run_attempts_left == 0) {
-              //TODO: RENAME DEALLOCATE_STURCTURES this is more of a finalize
-              std::vector<serializable_netcdf_gru_actor_info> netcdf_gru_info = getGruNetcdfInfo(
-                                                                                    self->state.max_run_attempts,
-                                                                                    self->state.gru_container.gru_list);
-              self->send(self->state.file_access_actor, deallocate_structures_v, netcdf_gru_info);
-            
+            if(self->state.gru_container.num_gru_failed == 0 || self->state.max_run_attempts == 1) {
+              self->send(self, finalize_v); 
             } else {
-              aout(self) << "Job_Actor: Restarting GRUs that Failed\n";
-              self->state.gru_container.num_gru_done = 0;
-              self->state.gru_container.num_gru_in_run_domain = self->state.gru_container.num_gru_failed;
-              self->state.gru_container.num_gru_failed = 0;
-              self->send(self->state.file_access_actor, restart_failures_v);
-
-              for(auto GRU : self->state.gru_container.gru_list) {
-                if(GRU->isFailed()) {
-                    GRU->setRunning();
-                    GRU->decrementAttemptsLeft();
-                    self->state.hru_actor_settings.dt_init_factor *= 2;
-                    auto global_gru_index = GRU->getGlobalGRUIndex();
-                    auto local_gru_index = GRU->getLocalGRUIndex();
-                    auto gru_actor = self->spawn(hru_actor, 
-                              global_gru_index, 
-                              local_gru_index, 
-                              self->state.hru_actor_settings,
-                              self->state.file_access_actor, 
-                              self);
-                    self->state.gru_container.gru_list[local_gru_index-1]->setGRUActor(gru_actor);
-                }
-              }
-
-
+              self->send(self, restart_failures_v);
             }
           }
-        },
 
-        [=](const error& err, caf::actor src) {
-            aout(self) << "\n\n ********** ERROR HANDLER \n";
-            switch(err.category()) {
-                case type_id_v<hru_error>:
-                    aout(self) << "HRU Error: " << to_string(err) << "\n";
-                    handleGRUError(self, err, src);
-                    break;
-                case type_id_v<file_access_error>:
-                    aout(self) << "File Access Error: " << to_string(err) << "\n";
-                    break;
-                default:
-                    aout(self) << "Unknown Error: " << to_string(err) << "\n";
-                    break;
-            }
         },
 
+        [=](restart_failures) {
+          aout(self) << "Job_Actor: Restarting GRUs that Failed\n";
+
+          self->state.gru_container.num_gru_done = 0;
+          self->state.gru_container.num_gru_in_run_domain = self->state.gru_container.num_gru_failed;
+          self->state.gru_container.num_gru_failed = 0;
+
+          self->send(self->state.file_access_actor, restart_failures_v); // notify file_access_actor
 
-        [=](file_access_actor_done, double read_duration, double write_duration) {
-            int err = 0;
-            // Delete GRUs
-            for (auto GRU : self->state.gru_container.gru_list) {
-                delete GRU;
+          // Set Sundials tolerance or decrease timestep length
+          if (self->state.hru_actor_settings.rel_tol > 0 && self->state.hru_actor_settings.abs_tol > 0) {
+            self->state.hru_actor_settings.rel_tol /= 10;
+            self->state.hru_actor_settings.abs_tol /= 10;
+          } else {
+            self->state.hru_actor_settings.dt_init_factor *= 2;
+          }
+
+
+          for(auto GRU : self->state.gru_container.gru_list) {
+            if(GRU->isFailed()) {
+              GRU->setRunning();
+              GRU->decrementAttemptsLeft();
+              auto global_gru_index = GRU->getGlobalGRUIndex();
+              auto local_gru_index = GRU->getLocalGRUIndex();
+              auto gru_actor = self->spawn(hru_actor, 
+                                           global_gru_index, 
+                                           local_gru_index, 
+                                           self->state.hru_actor_settings,
+                                           self->state.file_access_actor, 
+                                           self);
+              self->state.gru_container.gru_list[local_gru_index-1]->setGRUActor(gru_actor);
             }
-            self->state.gru_container.gru_list.clear();
+          }
+        },
 
+        [=](finalize) {
+            
+            std::vector<serializable_netcdf_gru_actor_info> 
+                netcdf_gru_info = getGruNetcdfInfo(self->state.max_run_attempts,self->state.gru_container.gru_list);
+              
+              
+            
+            self->state.num_gru_failed = std::count_if(netcdf_gru_info.begin(), netcdf_gru_info.end(), [](auto& gru_info) {
+                  return !gru_info.successful;
+              });
+
+            self->request(self->state.file_access_actor, infinite, finalize_v).await(
+                [=](std::tuple<double, double> read_write_duration) {
+                  int err = 0;
+                  for (auto GRU : self->state.gru_container.gru_list) {
+                    delete GRU;
+                  }
+                  self->state.gru_container.gru_list.clear();
+                  
+                  self->state.job_timing.updateEndPoint("total_duration");
+
+                  aout(self) << "\n________________PRINTING JOB_ACTOR TIMING INFO RESULTS________________\n"
+                             << "Total Duration = " << self->state.job_timing.getDuration("total_duration").value_or(-1.0) << " Seconds\n"
+                             << "Total Duration = " << self->state.job_timing.getDuration("total_duration").value_or(-1.0) / 60 << " Minutes\n"
+                             << "Total Duration = " << (self->state.job_timing.getDuration("total_duration").value_or(-1.0) / 60) / 60 << " Hours\n"
+                             << "________________________________________________________________________\n\n";
+
+                  deallocateJobActor(&err);
+
+                    // Tell Parent we are done
+                  self->send(self->state.parent, 
+                              done_job_v, 
+                              self->state.num_gru_failed, 
+                              self->state.job_timing.getDuration("total_duration").value_or(-1.0),
+                              std::get<0>(read_write_duration), 
+                              std::get<1>(read_write_duration));
+                  self->quit();
+
+            });
 
-            self->state.job_timing.updateEndPoint("total_duration");
+        },
 
-            aout(self) << "\n________________PRINTING JOB_ACTOR TIMING INFO RESULTS________________\n";
-            aout(self) << "Total Duration = " << self->state.job_timing.getDuration("total_duration").value_or(-1.0) << " Seconds\n";
-            aout(self) << "Total Duration = " << self->state.job_timing.getDuration("total_duration").value_or(-1.0) / 60 << " Minutes\n";
-            aout(self) << "Total Duration = " << (self->state.job_timing.getDuration("total_duration").value_or(-1.0) / 60) / 60 << " Hours\n\n";
+        // Handle Sundials Error
+        [=](err_atom, caf::actor src, double rtol, double atol) {
+          self->state.hru_actor_settings.rel_tol = rtol;
+          self->state.hru_actor_settings.abs_tol = atol;
+          handleGRUError(self, src);
+        },
 
-            deallocateJobActor(&err);
-            // Tell Parent we are done
-            self->send(self->state.parent, 
-                    done_job_v, 
-                    self->state.num_gru_failed, 
-                    self->state.job_timing.getDuration("total_duration").value_or(-1.0),
-                    read_duration, write_duration);
-            self->quit();
+        [=](const error& err, caf::actor src) {
+          
+          aout(self) << "\n\n ********** ERROR HANDLER \n";
+          
+          switch(err.category()) {
+            
+            case type_id_v<hru_error>:
+              aout(self) << "HRU Error: " << to_string(err) << "\n";
+              handleGRUError(self, src);
+
+              break;
+            case type_id_v<file_access_error>:
+              if (err == file_access_error::mDecisions_error) {
+                aout(self) << "Check mDecisions File For Correctness";
+              } else {
+                aout(self) << "File Access Error: " << to_string(err) << "No Handling Implemented\n";
+              }
+              for (auto GRU : self->state.gru_container.gru_list) {
+                self->send_exit(GRU->getGRUActor(), exit_reason::user_shutdown);
+              }
+              self->quit();
+              break;
+            default:
+              aout(self) << "Unknown Error: " << to_string(err) << "\n";
+              break;
+          }
         },
     };
 }
 
-void initGRUs(stateful_actor<job_state>* self) {
-  self->state.gru_container.gru_start_time = std::chrono::high_resolution_clock::now();
-  self->state.gru_container.run_attempts_left = self->state.max_run_attempts;
-  self->state.gru_container.run_attempts_left--;
-  for(int i = 0; i < self->state.gru_container.num_gru_in_run_domain; i++) {
-      // Spawn the GRU Actor
-      auto global_gru_index = self->state.gru_container.gru_list.size() + self->state.start_gru;
-      auto local_gru_index = self->state.gru_container.gru_list.size() + 1; // Fortran reference starts at 1
-      auto gru = self->spawn(hru_actor, 
-                              global_gru_index, 
-                              local_gru_index, 
-                              self->state.hru_actor_settings,
-                              self->state.file_access_actor, 
-                              self);
-
-      // Create the GRU object
-      self->state.gru_container.gru_list.push_back(
-              new GRU(global_gru_index, 
-                      local_gru_index, 
-                      gru, 
-                      self->state.dt_init_start_factor, 
-                      self->state.max_run_attempts));    
-  }
-}
-
 std::vector<serializable_netcdf_gru_actor_info> getGruNetcdfInfo(int max_run_attempts, std::vector<GRU*> &gru_list) {
 
     std::vector<serializable_netcdf_gru_actor_info> gru_netcdf_info;
@@ -240,7 +275,9 @@ std::vector<serializable_netcdf_gru_actor_info> getGruNetcdfInfo(int max_run_att
         gru_info.write_output_duration = gru->getWriteOutputDuration();
         
         gru_info.num_attempts = max_run_attempts - gru->getAttemptsLeft() + 1;
-        gru_info.successful = success(gru->getStatus());
+        gru_info.successful = is_success(gru->getStatus());
+        gru_info.rel_tol = gru->getRelTol();
+        gru_info.abs_tol = gru->getAbsTol();
 
         gru_netcdf_info.push_back(gru_info);
 
@@ -248,57 +285,36 @@ std::vector<serializable_netcdf_gru_actor_info> getGruNetcdfInfo(int max_run_att
     return gru_netcdf_info;
 }
 
-void handleGRUError(stateful_actor<job_state>* self, const error& err, caf::actor src) {
 
-    // Find the GRU that failed
-    for(auto GRU : self->state.gru_container.gru_list) {
-        if (GRU->getGRUActor() == src) {
-            GRU->setFailed();
-            GRU->decrementAttemptsLeft();
-            self->state.gru_container.num_gru_done++;
-            self->state.gru_container.num_gru_failed++;
-            self->send(self->state.file_access_actor, run_failure_v, GRU->getLocalGRUIndex());
-            
-            // Check if we have finished all active GRUs
-            if (self->state.gru_container.num_gru_done >= self->state.gru_container.num_gru_in_run_domain) {
-                // Check for failures
-                if(self->state.gru_container.num_gru_failed == 0 || self->state.max_run_attempts == 1) {
-                    //TODO: RENAME DEALLOCATE_STURCTURES this is more of a finalize
-                    std::vector<serializable_netcdf_gru_actor_info> netcdf_gru_info = getGruNetcdfInfo(
-                                                                                            self->state.max_run_attempts,
-                                                                                            self->state.gru_container.gru_list);
-                    self->send(self->state.file_access_actor, deallocate_structures_v, netcdf_gru_info);
-                
-                } else {
-                    aout(self) << "Job_Actor: Restarting GRUs that Failed\n";
-                    self->send(self->state.file_access_actor, restart_failures_v);
-                    self->state.gru_container.num_gru_done = 0;
-                    self->state.gru_container.num_gru_in_run_domain = self->state.gru_container.num_gru_failed;
-                    self->state.gru_container.num_gru_failed = 0;
-                    for(auto GRU : self->state.gru_container.gru_list) {
-                        if(GRU->isFailed()) {
-                            GRU->setRunning();
-                            GRU->decrementAttemptsLeft();
-                            self->state.hru_actor_settings.dt_init_factor *= 2;
-                            auto global_gru_index = GRU->getGlobalGRUIndex();
-                            auto local_gru_index = GRU->getLocalGRUIndex();
-                            auto gru_actor = self->spawn(hru_actor, 
-                                    global_gru_index, 
-                                    local_gru_index, 
-                                    self->state.hru_actor_settings,
-                                    self->state.file_access_actor, 
-                                    self);
-                            self->state.gru_container.gru_list[local_gru_index-1]->setGRUActor(gru_actor);
-                        }
-                    }
 
-                }
-            }
-            break;
-        }
-    }
 
+void handleGRUError(stateful_actor<job_state>* self, caf::actor src) {
+  auto it = std::find_if(self->state.gru_container.gru_list.begin(), 
+                          self->state.gru_container.gru_list.end(),
+                          [src](auto& gru) {
+                          return gru->getGRUActor() == src;
+                        });
+
+  if (it != self->state.gru_container.gru_list.end()) {
+    (*it)->setFailed();
+    (*it)->decrementAttemptsLeft();
+
+    self->state.gru_container.num_gru_done++;
+    self->state.gru_container.num_gru_failed++;
+    self->send(self->state.file_access_actor, run_failure_v, (*it)->getLocalGRUIndex());
+  } else {
+    aout(self) << "ERROR: Job_Actor: Could not find GRU in GRU_Container\n";
+  }
 
+  // Check if all GRUs are finished
+  if (self->state.gru_container.num_gru_done >= self->state.gru_container.num_gru_in_run_domain) {
+    // Check for failures
+    if(self->state.gru_container.num_gru_failed == 0 || self->state.max_run_attempts == 1) {
+      self->send(self, finalize_v); 
+    } else {
+      self->send(self, restart_failures_v);
+    }
+  }
 
 }
 
diff --git a/build/source/actors/job_actor/job_actor.f90 b/build/source/actors/job_actor/job_actor.f90
index 18f5fb7c0c3756e31888054ef3ba8566e1fb69af..10eb1d1271ea23aa8da31183e54bf975485e2880 100644
--- a/build/source/actors/job_actor/job_actor.f90
+++ b/build/source/actors/job_actor/job_actor.f90
@@ -1,29 +1,136 @@
 module job_actor
-    USE, intrinsic :: iso_c_binding
+  USE, intrinsic :: iso_c_binding
+  
+  ! global data
+  USE globalData,only:integerMissing      ! missing integer value
+  USE globalData,only:realMissing         ! missing double precision value
     
     
-    implicit none
-    public::allocateTimeStructure
-    public::deallocateJobActor
+  implicit none
+  public::job_init_fortran
+  public::deallocateJobActor
 
     contains
 
-subroutine allocateTimeStructure(err) bind(C, name="allocateTimeStructure")
-    USE globalData,only:startTime,finshTime,refTime,oldTime
-    USE allocspace_module,only:allocLocal
-    USE globalData,only:time_meta
+subroutine job_init_fortran(file_manager, start_gru, num_gru,&
+                            num_hru, err) bind(C, name="job_init_fortran")
+  USE nrtype  ! variable types, etc.
+  
+  USE summaFileManager,only:summa_SetTimesDirsAndFiles       ! sets directories and filenames
+  USE summa_globalData,only:summa_defineGlobalData           ! used to define global summa data structures
+  
+  USE cppwrap_auxiliary,only:c_f_string           ! Convert C String to Fortran String
+  
+  ! provide access to file paths
+  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
+  USE summaFileManager,only:STATE_PATH                        ! optional path to state/init. condition files (defaults to SETTINGS_PATH)
+  USE summaFileManager,only:MODEL_INITCOND                    ! name of model initial conditions file
+  USE summaFileManager,only:LOCAL_ATTRIBUTES                  ! name of model initial attributes file
+  
+  ! subroutines and functions: read dimensions (NOTE: NetCDF)
+  USE read_attrb_module,only:read_dimension              ! module to read dimensions of GRU and HRU
+  USE read_icond_module,only:read_icond_nlayers               ! module to read initial condition dimensions
+
+  USE globalData,only:indx_meta                     ! metadata structures
+  USE globalData,only:startTime,finshTime,refTime,oldTime
+  USE allocspace_module,only:allocLocal
+  USE globalData,only:time_meta
+
+  ! Variables that were set by getCommandArguments()
+  USE globalData,only: startGRU          ! index of the starting GRU for parallelization run
+  USE globalData,only: checkHRU          ! index of the HRU for a single HRU run
+  USE globalData,only: iRunMode          ! define the current running mode    
+  USE globalData,only:iRunModeFull, iRunModeGRU, iRunModeHRU  ! define the running modes
+  USE globalData,only:output_fileSuffix                       ! suffix for the output file
+  
+  implicit none
+
+  ! dummy variables
+  character(kind=c_char,len=1),intent(in)   :: file_manager
+  integer(c_int),intent(inout)              :: start_gru
+  integer(c_int),intent(inout)              :: num_gru
+  integer(c_int),intent(inout)              :: num_hru
+  integer(c_int),intent(out)                :: err
+
+  ! local variables
+  character(len=256)                        :: summaFileManagerIn
+  character(len=256)                        :: restartFile        ! restart file name
+  character(len=256)                        :: attrFile           ! attributes file name
+  integer(i4b)                              :: fileGRU            ! [used for filenames] number of GRUs in the input file
+  integer(i4b)                              :: fileHRU            ! [used for filenames] number of HRUs in the input file
+  character(len=128)                        :: fmtGruOutput       ! a format string used to write start and end GRU in output file names
+
+  
+  character(len=256)                        :: message
+
+  ! Convert C Variables to Fortran Variables
+  call c_f_string(file_manager, summaFileManagerIn, 256)
+  summaFileManagerIn = trim(summaFileManagerIn)
+
+
+  ! Set variables that were previosuly set by getCommandArguments()
+  startGRU=start_gru
+  iRunMode=iRunModeGRU
+  checkHRU=integerMissing
+
+  call summa_SetTimesDirsAndFiles(summaFileManagerIn,err,message)
+  if(err/=0)then; print*, trim(message); return; endif
+
+  call summa_defineGlobalData(err, message)
+  if(err/=0)then; print*, trim(message); return; endif
+  
+  ! *****************************************************************************
+  ! *** read the number of GRUs and HRUs
+  ! *****************************************************************************
+  ! obtain the HRU and GRU dimensions in the LocalAttribute file
+  attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES)
+  select case (iRunMode)
+    case(iRunModeFull); err=20; message='iRunModeFull not implemented for Actors Code'
+    case(iRunModeGRU ); call read_dimension(trim(attrFile),fileGRU,fileHRU,num_gru,num_hru,err,message,startGRU=start_gru)
+    case(iRunModeHRU ); err=20; message='iRunModeHRU not implemented for Actors Code'
+  end select
+  if(err/=0)then; print*, trim(message); return; endif
+
+  ! *****************************************************************************
+  ! *** define the suffix for the model output file
+  ! *****************************************************************************
+  ! set up the output file names as: OUTPUT_PREFIX'_'output_fileSuffix'_'startGRU-endGRU_outfreq.nc or OUTPUT_PREFIX'_'output_fileSuffix'_'HRU_outfreq.nc;
+  if (output_fileSuffix(1:1) /= '_') output_fileSuffix='_'//trim(output_fileSuffix)   ! separate output_fileSuffix from others by underscores
+  if (output_fileSuffix(len_trim(output_fileSuffix):len_trim(output_fileSuffix)) == '_') output_fileSuffix(len_trim(output_fileSuffix):len_trim(output_fileSuffix)) = ' '
+  select case (iRunMode)
+    case(iRunModeGRU)
+      ! left zero padding for startGRU and endGRU
+      write(fmtGruOutput,"(i0)") ceiling(log10(real(fileGRU)+0.1))                      ! maximum width of startGRU and endGRU
+      fmtGruOutput = "i"//trim(fmtGruOutput)//"."//trim(fmtGruOutput)                   ! construct the format string for startGRU and endGRU
+      fmtGruOutput = "('_G',"//trim(fmtGruOutput)//",'-',"//trim(fmtGruOutput)//")"
+      write(output_fileSuffix((len_trim(output_fileSuffix)+1):len(output_fileSuffix)),fmtGruOutput) start_gru,start_gru+num_gru-1
+    case(iRunModeHRU)
+      write(output_fileSuffix((len_trim(output_fileSuffix)+1):len(output_fileSuffix)),"('_H',i0)") checkHRU
+  end select
+
+
+  ! *****************************************************************************
+  ! *** read the number of snow and soil layers
+  ! *****************************************************************************
+  ! set restart filename and read the number of snow and soil layers from the initial conditions (restart) file
+  if(STATE_PATH == '') then
+    restartFile = trim(SETTINGS_PATH)//trim(MODEL_INITCOND)
+  else
+    restartFile = trim(STATE_PATH)//trim(MODEL_INITCOND)
+  endif
+  call read_icond_nlayers(trim(restartFile),num_gru,indx_meta,err,message)
+  if(err/=0)then; print*, trim(message); return; endif
+
+
+  ! Allocate the time structures
+  call allocLocal(time_meta, startTime, err=err, message=message)
+  call allocLocal(time_meta, finshTime, err=err, message=message)
+  call allocLocal(time_meta, refTime,   err=err, message=message)
+  call allocLocal(time_meta, oldTime,   err=err, message=message)
+  if(err/=0)then; print*, trim(message); return; endif
+
+end subroutine job_init_fortran
 
-    implicit none
-    ! dummy variables
-    integer(c_int),intent(inout)      :: err
-    ! local variables
-    character(len=256)              :: cmessage
-
-    call allocLocal(time_meta, startTime, err=err, message=cmessage)
-    call allocLocal(time_meta, finshTime, err=err, message=cmessage)
-    call allocLocal(time_meta, refTime,   err=err, message=cmessage)
-    call allocLocal(time_meta, oldTime,   err=err, message=cmessage)
-end subroutine
 
 subroutine deallocateJobActor(err) bind(C, name="deallocateJobActor")
     USE globalData,only:structInfo                              ! information on the data structures
diff --git a/build/source/actors/main.cpp b/build/source/actors/main.cpp
index ca5b8eea2d3ef962c2f380d95c349d46f6a599bd..debf0c7123201957760ae6f06c70e6dbcdad6bec 100644
--- a/build/source/actors/main.cpp
+++ b/build/source/actors/main.cpp
@@ -7,35 +7,60 @@
 #include "global.hpp"
 #include "settings_functions.hpp"
 #include "message_atoms.hpp"
-#include "client/client.hpp"
+#include "client.hpp"
 #include <string>
 #include <bits/stdc++.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <iostream>
 #include "json.hpp"
+#include <memory>
 #include <optional>
 
 using namespace caf;
 
+const std::string command_line_help = "Summa-Actors is in active development and some features may not be available.\n"
+    "Usage: summa_actors -m master_file [-g startGRU countGRU] [-c config_file] [-b backup_server] [-s server_mode]\n"
+    "Available options: \n"
+    "\t-m, --master:         Define path/name of master file (can be specified in config)\n"
+    "\t-g, --gru:            Run a subset of countGRU GRUs starting from index startGRU \n"
+    "\t-c, --config:         Path name of the Summa-Actors config file (optional but recommended)\n"
+    "\t    --gen-config:     Generate a config file \n"
+    "\t-b, --backup-server:  Start backup server, requires a server and config_file \n"
+    "\t-s, --server-mode:    Enable server mode \n"
+    "\t-h, --help:           Print this help message \n"
+    "\nUnimplemented Options: \n"
+    "\t-n --newFile          Define frequency [noNewFiles,newFileEveryOct1] of new output files\n"
+    "\t-s --suffix           Add fileSuffix to the output files\n"
+    "\t-h --hru              Run a single HRU with index of iHRU\n"
+    "\t-r --restart          Define frequency [y,m,d,e,never] to write restart files\n"
+    "\t-p --progress         Define frequency [m,d,h,never] to print progress\n"
+    "\t-v --version          Display version information of the current build\n";
+
 
 /* Configuration class that handles the config and 
 /  command line options for the actors program */
 class config : public actor_system_config {
     public:
-        int startGRU = -1;
+        int startGRU = -1;  
         int countGRU = -1;
+        std::string master_file = "";
         std::string config_file = "";
+        bool generate_config = false;
         bool backup_server = false;
         bool server_mode = false;
+        bool help = false;
     
     config() {
         opt_group{custom_options_, "global"}
-            .add(startGRU, "gru,g", "Starting GRU Index")
-            .add(countGRU, "numGRU,n", "Total Number of GRUs")
-            .add(config_file, "config,c", "Path name of the config directory")
+            .add(master_file,   "master,m", "Path/name of master file")
+            .add(startGRU,      "gru,g", "Starting GRU Index")
+            .add(countGRU,      "countGRU,t", "Number of GRUs to run in subset")
+            .add(config_file,   "config,c", "Path name of the config directory")
+            .add(generate_config, "gen-config", "Generate a config file")
             .add(backup_server, "backup-server,b", "flag to denote if the server starting is a backup server")
-            .add(server_mode, "server-mode,s", "enable server mode");
+            .add(server_mode,   "server-mode,s", "enable server mode")
+            .add(help,          "help,h", "Print this help message");
     }
 };
 
@@ -72,8 +97,8 @@ void run_client(actor_system& system, const config& cfg, Distributed_Settings di
 }
 
 void run_server(actor_system& system, const config& cfg, Distributed_Settings distributed_settings, 
-    Summa_Actor_Settings summa_actor_settings, File_Access_Actor_Settings file_access_actor_settings,
-    Job_Actor_Settings job_actor_settings, HRU_Actor_Settings hru_actor_settings) {
+                Summa_Actor_Settings summa_actor_settings, File_Access_Actor_Settings file_access_actor_settings,
+                Job_Actor_Settings job_actor_settings, HRU_Actor_Settings hru_actor_settings) {
     scoped_actor self{system};
     int err;
 
@@ -85,18 +110,23 @@ void run_server(actor_system& system, const config& cfg, Distributed_Settings di
     // Check if we have are the backup server
     if (cfg.backup_server) {          
         auto server = system.spawn(summa_backup_server_init,
-            distributed_settings,summa_actor_settings,file_access_actor_settings,
-            job_actor_settings,hru_actor_settings);
+                                   distributed_settings,
+                                   summa_actor_settings,
+                                   file_access_actor_settings,
+                                   job_actor_settings,
+                                   hru_actor_settings);
+
         publish_server(server, distributed_settings.port);
         connect_client(server, distributed_settings.servers_list[0], distributed_settings.port);
-        // self->send(server, connect_as_backup_v);
 
     } else {     
-        auto server = system.spawn(summa_server_init, distributed_settings,
-                               summa_actor_settings, 
-                               file_access_actor_settings, 
-                               job_actor_settings, 
-                               hru_actor_settings);                   
+        auto server = system.spawn(summa_server_init, 
+                                   distributed_settings,
+                                   summa_actor_settings, 
+                                   file_access_actor_settings, 
+                                   job_actor_settings, 
+                                   hru_actor_settings);  
+                 
         publish_server(server, distributed_settings.port);
     }
 
@@ -106,61 +136,98 @@ void run_server(actor_system& system, const config& cfg, Distributed_Settings di
 void caf_main(actor_system& sys, const config& cfg) {
     scoped_actor self{sys};
     int err;
-    struct stat file_to_check;
-    // Check if config file exists
-    if (stat(cfg.config_file.c_str(), &file_to_check) != 0) {
-        aout(self) << "Config File Path Does Not Exist\n";
-        aout(self) << "EXAMPLE: ./summa_actors -g 1 -n 10 -c location/of/config \n";
+
+    if (cfg.generate_config) {
+        std::cout << "Generating Config File" << std::endl;
+        generate_config_file();
         return;
     }
 
+    struct stat file_to_check;
+    if (stat(cfg.master_file.c_str(), &file_to_check) != 0 && cfg.master_file != "") { // Check if master file exists
+        aout(self) << "ERROR: Master File Path Does Not Exist\n" << command_line_help; return;
+    } else if (stat(cfg.config_file.c_str(), &file_to_check) != 0 && cfg.config_file != "") { // Check if config file exists
+        aout(self) << "ERROR: Config File Path Does Not Exist\n" << command_line_help; return;
+    }
+
     Distributed_Settings distributed_settings = readDistributedSettings(cfg.config_file);
     Summa_Actor_Settings summa_actor_settings = readSummaActorSettings(cfg.config_file);
     File_Access_Actor_Settings file_access_actor_settings = readFileAccessActorSettings(cfg.config_file);
     Job_Actor_Settings job_actor_settings = readJobActorSettings(cfg.config_file);
     HRU_Actor_Settings hru_actor_settings = readHRUActorSettings(cfg.config_file);
+
+    // -m setting overides config file
+    if (cfg.master_file != "") {
+        job_actor_settings.file_manager_path = cfg.master_file;
+    }
+    
     
     aout(self) << "Printing Settings For SUMMA Simulation\n";
     check_settings_from_json(distributed_settings,
-                            summa_actor_settings, 
-                            file_access_actor_settings, 
-                            job_actor_settings,
-                            hru_actor_settings);
+                             summa_actor_settings, 
+                             file_access_actor_settings, 
+                             job_actor_settings,
+                             hru_actor_settings);
 
     if (distributed_settings.distributed_mode) {
         // only command line arguments needed are config_file and server-mode
         if (cfg.server_mode) {
-            run_server(sys, cfg, distributed_settings, summa_actor_settings, 
-                file_access_actor_settings, job_actor_settings, hru_actor_settings);
+            run_server(sys, 
+                       cfg, 
+                       distributed_settings, 
+                       summa_actor_settings, 
+                       file_access_actor_settings, 
+                       job_actor_settings, 
+                       hru_actor_settings);
         } else {
-            run_client(sys, cfg, distributed_settings);
+            run_client(sys, 
+                       cfg, 
+                       distributed_settings);
         }
 
     } else {
-        // Configure command line arguments
-        if (cfg.startGRU == -1) {
-            aout(self) << "Starting GRU was not defined!! " << 
-                "startGRU is set with the \"-g\" option\n";
-            aout(self) << "EXAMPLE: ./summaMain -g 1 -n 10 -c location/of/config \n";
-            return;
-        }
-        if (cfg.countGRU == -1) {
-            aout(self) << "Number of GRUs was not defined!! " <<
-                "countGRU is set with the \"-n\" option\n";
-            aout(self) << "EXAMPLE: ./summaMain -g 1 -n 10 -c location/of/config \n";
-            return;
-        }
-        if (cfg.config_file == "") {
-            aout(self) << "File Manager was not defined!! " << 
-                "fileManger is set with the \"-c\" option\n";
-            aout(self) << "EXAMPLE: ./summaMain -g 1 -n 10 -c location/of/config \n";
-            return;
-        }
 
-        auto summa = sys.spawn(summa_actor, cfg.startGRU, cfg.countGRU, summa_actor_settings, 
-            file_access_actor_settings, job_actor_settings, hru_actor_settings, self);
+        auto summa = sys.spawn(summa_actor, 
+                               cfg.startGRU, 
+                               cfg.countGRU, 
+                               summa_actor_settings, 
+                               file_access_actor_settings, 
+                               job_actor_settings, 
+                               hru_actor_settings, 
+                               self);
     }
     
 }
 
-CAF_MAIN(id_block::summa, io::middleman)
+int main(int argc, char** argv) {
+    // Parse command line arguments
+    
+    // Insert -t for countGRU so CAF can differentiate the argument
+    std::vector<std::string> args(argv, argv + argc);
+    for (auto it = args.begin(); it != args.end(); ++it) {
+        if (*it == "-g" && std::next(it) != args.end()) {
+            auto count_gru = std::find_if(std::next(it), args.end(), [](const std::string& arg) {
+                return std::isdigit(arg.front());
+            });
+            if (count_gru != args.end()) {
+                args.insert(std::next(count_gru), "-t");
+            }
+            break;
+        }
+        else if (*it == "-h" || *it == "--help") {
+            std::cout << command_line_help << std::endl;
+            return 0;
+        }
+    }
+    char** argv2 = new char*[args.size()];
+    for (int i = 0; i < args.size(); ++i) {
+        argv2[i] = new char[args[i].size() + 1];
+        strcpy(argv2[i], args[i].c_str());
+    }
+
+    argc = args.size();
+    exec_main_init_meta_objects<id_block::summa, io::middleman>();
+    caf::core::init_global_meta_objects(); 
+    return exec_main<>(caf_main, argc, argv2);
+
+}
diff --git a/build/source/actors/summa_actor/batch/batch.cpp b/build/source/actors/summa_actor/batch.cpp
similarity index 98%
rename from build/source/actors/summa_actor/batch/batch.cpp
rename to build/source/actors/summa_actor/batch.cpp
index 074ab6e064cd46aacc0a598644e9f74869e8804c..ae895c6d5ff454a8eaf652ea01f8734b405e963c 100644
--- a/build/source/actors/summa_actor/batch/batch.cpp
+++ b/build/source/actors/summa_actor/batch.cpp
@@ -1,4 +1,4 @@
-#include "batch/batch.hpp"
+#include "batch.hpp"
 
 Batch::Batch(int batch_id, int start_hru, int num_hru){
     this->batch_id = batch_id;
diff --git a/build/source/actors/summa_actor/batch/batch_container.cpp b/build/source/actors/summa_actor/batch_container.cpp
similarity index 98%
rename from build/source/actors/summa_actor/batch/batch_container.cpp
rename to build/source/actors/summa_actor/batch_container.cpp
index bac590b9dbcf3ff536440901a28434c6d2ef0315..b5ae235d4a3fb4c1409eac258d578ccef9bbec61 100644
--- a/build/source/actors/summa_actor/batch/batch_container.cpp
+++ b/build/source/actors/summa_actor/batch_container.cpp
@@ -1,4 +1,4 @@
-#include "batch/batch_container.hpp"
+#include "batch_container.hpp"
 
 Batch_Container::Batch_Container(int total_hru_count, int num_hru_per_batch) {
     this->total_hru_count = total_hru_count;
diff --git a/build/source/actors/summa_actor/client/client.cpp b/build/source/actors/summa_actor/client.cpp
similarity index 97%
rename from build/source/actors/summa_actor/client/client.cpp
rename to build/source/actors/summa_actor/client.cpp
index 8c48b4696f920f5b18182932545dc2dbb1ee11af..79ce7daa2f0075cdf3450abce7aca227a59dace7 100644
--- a/build/source/actors/summa_actor/client/client.cpp
+++ b/build/source/actors/summa_actor/client.cpp
@@ -1,4 +1,4 @@
-#include "client/client.hpp"
+#include "client.hpp"
 
 Client::Client(int id, caf::actor client_actor, std::string hostname) {
     this->id = id;
diff --git a/build/source/actors/summa_actor/client/client_container.cpp b/build/source/actors/summa_actor/client_container.cpp
similarity index 98%
rename from build/source/actors/summa_actor/client/client_container.cpp
rename to build/source/actors/summa_actor/client_container.cpp
index 7aff8cbb99dd8e58bfd62c41dfff0f963680383f..bd76fffee6dee72f1e8bb300a183ec9debfde6cb 100644
--- a/build/source/actors/summa_actor/client/client_container.cpp
+++ b/build/source/actors/summa_actor/client_container.cpp
@@ -1,4 +1,4 @@
-#include "client/client_container.hpp"
+#include "client_container.hpp"
 
 
 Client_Container::Client_Container() {
diff --git a/build/source/actors/summa_actor/summa_actor.cpp b/build/source/actors/summa_actor/summa_actor.cpp
index e69812ab8512766458546c8348f85f97e61f16e8..3af72090a65a2df4455c5f1f7d75cb2cd0c0cf3f 100644
--- a/build/source/actors/summa_actor/summa_actor.cpp
+++ b/build/source/actors/summa_actor/summa_actor.cpp
@@ -37,45 +37,55 @@ behavior summa_actor(stateful_actor<summa_actor_state>* self, int startGRU, int
 
 	return {
 		[=](done_job, int numFailed, double job_duration, double read_duration, double write_duration) {
+			auto& timing_info = self->state.timing_info_for_jobs;
+
+
 			self->state.numFailed += numFailed;
 
-			self->state.timing_info_for_jobs.job_duration.push_back(job_duration);
-			self->state.timing_info_for_jobs.job_read_duration.push_back(read_duration);
-			self->state.timing_info_for_jobs.job_write_duration.push_back(write_duration);
+			timing_info.job_duration.push_back(job_duration);
+			timing_info.job_read_duration.push_back(read_duration);
+			timing_info.job_write_duration.push_back(write_duration);
 
 			if (self->state.numGRU <= 0) {
 				self->state.summa_actor_timing.updateEndPoint("total_duration");
 
-				for (std::vector<int>::size_type i = 0; i < self->state.timing_info_for_jobs.job_duration.size(); i++) {
-					aout(self) << "\n________________Job " << i + 1 << " Info_______________\n";
-					aout(self) << "Job Duration = " << self->state.timing_info_for_jobs.job_duration[i] << "\n";
-					aout(self) << "Job Read Duration = " << self->state.timing_info_for_jobs.job_read_duration[i] << "\n";
-					aout(self) << "Job Write Duration = " << self->state.timing_info_for_jobs.job_write_duration[i] << "\n";
+
+
+				for (size_t i = 0; i < timing_info.job_duration.size(); ++i) {
+					
+   				 	 
+    				aout(self) << "\n________________Job " << i + 1 << " Info_____________\n"
+               				   << "Job Duration = " << timing_info.job_duration[i] << "\n"
+               				   << "Job Read Duration = " << timing_info.job_read_duration[i] << "\n"
+               				   << "Job Write Duration = " << timing_info.job_write_duration[i] << "\n"
+							   << "_____________________________________________________\n\n";
 				}
 
 
+				double total_read_duration = std::accumulate(timing_info.job_read_duration.begin(),
+															 timing_info.job_read_duration.end(),
+															 0.0);
+				double total_write_duration = std::accumulate(timing_info.job_write_duration.begin(),
+															  timing_info.job_write_duration.end(),
+															  0.0);
 				
-				aout(self) << "\n________________SUMMA_ACTOR TIMING INFO________________\n";
-				aout(self) << "Total Duration = " << self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0) << " Seconds\n";
-				aout(self) << "Total Duration = " << self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0) / 60 << " Minutes\n";
-				aout(self) << "Total Duration = " << (self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0) / 60) / 60 << " Hours\n\n";
-				double total_read_duration = std::accumulate(self->state.timing_info_for_jobs.job_read_duration.begin(),
-																		self->state.timing_info_for_jobs.job_read_duration.end(),
-																		0.0);
-				aout(self) << "Total Read Duration = " << total_read_duration  << "Seconds \n";
-				double total_write_duration = std::accumulate(self->state.timing_info_for_jobs.job_write_duration.begin(),
-																		self->state.timing_info_for_jobs.job_write_duration.end(),
-																		0.0);
-				aout(self) << "Total Write Duration = " << total_write_duration << "Seconds \n";
-				aout(self) << "Program Finished \n";
+				aout(self) << "\n________________SUMMA INFO________________\n"
+						   << "Total Duration = " << self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0) << " Seconds\n"
+						   << "Total Duration = " << self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0) / 60 << " Minutes\n"
+						   << "Total Duration = " << (self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0) / 60) / 60 << " Hours\n"
+						   << "Total Read Duration = " << total_read_duration  << "Seconds\n"
+						   << "Total Write Duration = " << total_write_duration << "Seconds\n"
+						   << "Num Failed = " << self->state.numFailed << "\n"
+						   << "___________________Program Finished__________________\n"; 
+
+
 
 				self->send(self->state.parent, done_batch_v, 
-					self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0), 
-					total_read_duration,
-					total_write_duration);		
+						   self->state.summa_actor_timing.getDuration("total_duration").value_or(-1.0), 
+						   total_read_duration,
+						   total_write_duration);		
 
 			} else {
-				// spawn a new job
 				spawnJob(self);
 			}
 		},
@@ -94,8 +104,8 @@ void spawnJob(stateful_actor<summa_actor_state>* self) {
 		// spawn the job actor
 		aout(self) << "\n Starting Job with startGRU = " << self->state.startGRU << "\n";
 		self->state.currentJob = self->spawn(job_actor, self->state.startGRU, self->state.summa_actor_settings.max_gru_per_job, 
-			self->state.file_access_actor_settings, self->state.job_actor_settings, 
-			self->state.hru_actor_settings, self);
+											 self->state.file_access_actor_settings, self->state.job_actor_settings, 
+											 self->state.hru_actor_settings, self);
 		
 		// Update GRU count
 		self->state.numGRU = self->state.numGRU - self->state.summa_actor_settings.max_gru_per_job;
@@ -104,8 +114,8 @@ void spawnJob(stateful_actor<summa_actor_state>* self) {
 	} else {
 
 		self->state.currentJob = self->spawn(job_actor, self->state.startGRU, self->state.numGRU, 
-			self->state.file_access_actor_settings, self->state.job_actor_settings, 
-			self->state.hru_actor_settings, self);
+										     self->state.file_access_actor_settings, self->state.job_actor_settings, 
+											 self->state.hru_actor_settings, self);
 		self->state.numGRU = 0;
 	}
 }
diff --git a/build/source/driver/summaActors_alarms.f90 b/build/source/driver/summaActors_alarms.f90
deleted file mode 100644
index 572a2a1f6c34913780e7c431485f9602bbd0c6e7..0000000000000000000000000000000000000000
--- a/build/source/driver/summaActors_alarms.f90
+++ /dev/null
@@ -1,167 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module summa_alarms
-! used to set alarms to write model output
-
-! named variables to define new output files
-USE globalData, only: noNewFiles              ! no new output files
-USE globalData, only: newFileEveryOct1        ! create a new file on Oct 1 every year (start of the USA water year)
-
-! named variables to write restart files
-USE globalData, only: ixRestart_iy            ! named variable to print a re-start file once per year
-USE globalData, only: ixRestart_im            ! named variable to print a re-start file once per month
-USE globalData, only: ixRestart_id            ! named variable to print a re-start file once per day
-USE globalData, only: ixRestart_end           ! named variable to print a re-start file at the end of a run
-USE globalData, only: ixRestart_never         ! named variable to print a re-start file never
-
-! named variables to print progress
-USE globalData, only: ixProgress_im           ! named variable to print progress once per month
-USE globalData, only: ixProgress_id           ! named variable to print progress once per day
-USE globalData, only: ixProgress_ih           ! named variable to print progress once per hour
-USE globalData, only: ixProgress_it           ! named variable to print progress once per timestep
-USE globalData, only: ixProgress_never        ! named variable to print progress never
-
-! named variable for time structures
-USE var_lookup,only:iLookTIME                 ! named variables for time data structure
-USE var_lookup,only:iLookFreq                 ! named variables for the frequency structure
-
-! structure dimensions
-USE var_lookup,only:maxvarFreq                ! maximum number of output files
-
-! safety: set private unless specified otherwise
-implicit none
-private
-public::summa_setWriteAlarms
-contains
-
-! used to set alarms to write model output
-subroutine summa_setWriteAlarms(oldTime, newTime, endTime,     &   ! time vectors
-                              newOutputFile, defNewOutputFile, &   ! flag to define new output file
-                              ixRestart,     printRestart,     &   ! flag to print the restart file
-                              ixProgress,    printProgress,    &   ! flag to print simulation progress
-                              resetStats,    finalizeStats,    &   ! flags to reset and finalize stats
-                              statCounter,                     &   ! statistics counter
-                              err,message)                         ! error control
-  ! ---------------------------------------------------------------------------------------
-  ! data types
-  USE nrtype                                                  ! variable types, etc.
-  ! ---------------------------------------------------------------------------------------
-  implicit none
-  ! dummy variables: time vectors
-  integer(i4b),intent(in)               :: oldTime(:)         ! time vector from the previous time step
-  integer(i4b),intent(in)               :: newTime(:)         ! time vector from the current time step
-  integer(i4b),intent(in)               :: endTime(:)         ! time vector at the end of the simulation
-  ! dummy variables: model decisions
-  integer(i4b),intent(in)               :: newOutputFile      ! option for the new output file
-  integer(i4b),intent(in)               :: ixRestart          ! option to write the restart file
-  integer(i4b),intent(in)               :: ixProgress         ! option to print simulation progress
-  logical(lgt),intent(in)               :: resetStats(:)      ! flags to reset statistics
-  ! dummy variables: alarms
-  logical(lgt),intent(out)              :: defNewOutputFile   ! flag to define new output file
-  logical(lgt),intent(out)              :: printRestart       ! flag to write the restart file
-  logical(lgt),intent(out)              :: printProgress      ! flag to print simulation progress
-  ! dummy variables: controls on statistics output
-  logical(lgt),intent(out)              :: finalizeStats(:)   ! flags to finalize statistics
-  integer(i4b),intent(out)              :: statCounter(:)     ! index in model output for different output frequencies
-  ! dummy variables: error control
-  integer(i4b),intent(out)              :: err                ! error code
-  character(*),intent(out)              :: message            ! error message
-  ! ---------------------------------------------------------------------------------------
-  ! local variables
-  integer(i4b)                          :: iFreq              ! loop through frequencies
-  ! ---------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message='summa_setWriteAlarms/'
-
-  ! *****************************************************************************
-  ! *** define the need to create the model output file
-  ! *****************************************************************************
-
-  ! define the need to create a new output file
-  select case(newOutputFile)
-
-    ! (don't create a new output files)
-    case(noNewFiles); defNewOutputFile=.false.
-
-    ! (check for the start of the USA water year)
-    case(newFileEveryOct1)
-    defNewOutputFile = (newTime(iLookTIME%im) == 10 .and. &             ! month = October
-                        newTime(iLookTIME%im) /= oldTime(iLookTIME%im)) ! first timestep in October
-
-    ! (check that we found the option)
-    case default; err=20; message=trim(message)//'unable to identify the option to define new output files'; return
-
-  end select
-
-  ! *****************************************************************************
-  ! *** define the need to create a restart file
-  ! *****************************************************************************
-  select case(ixRestart)
-    case(ixRestart_iy);    printRestart = (newTime(iLookTIME%im) == 1 .and. newTime(iLookTIME%id) == 1 .and. &
-                                          newTime(iLookTIME%ih) == 0 .and. newTime(iLookTIME%imin) == 0)
-    case(ixRestart_im);    printRestart = (newTime(iLookTIME%id) == 1 .and. newTime(iLookTIME%ih) == 0 .and. &
-                                          newTime(iLookTIME%imin) == 0)
-    case(ixRestart_id);    printRestart = (newTime(iLookTIME%ih) == 0 .and. newTime(iLookTIME%imin) == 0)
-    case(ixRestart_end);   printRestart = (newTime(iLookTIME%im)   == endTime(iLookTIME%im) .and. &
-                                          newTime(iLookTIME%id)   == endTime(iLookTIME%id) .and. &
-                                          newTime(iLookTIME%ih)   == endTime(iLookTIME%ih) .and. &
-                                          newTime(iLookTIME%imin) == endTime(iLookTIME%imin))    ! newTime does not have a '24h', won't write ending state if end_h=24
-    case(ixRestart_never); printRestart = .false.
-    case default; err=20; message=trim(message)//'unable to identify option for the restart file'; return
-  end select
-
-  ! *****************************************************************************
-  ! *** define the need to print progress
-  ! *****************************************************************************
-  select case(ixProgress)
-    case(ixProgress_im);    printProgress = (newTime(iLookTIME%im) /= oldTime(iLookTIME%im))  ! start month missed
-    case(ixProgress_id);    printProgress = (newTime(iLookTIME%id) /= oldTime(iLookTIME%id))  ! start day missed
-    case(ixProgress_ih);    printProgress = (newTime(iLookTIME%imin) == 0)
-    case(ixProgress_it);    printProgress = .true.
-    case(ixProgress_never); printProgress = .false.
-    case default; err=20; message=trim(message)//'unable to identify option to print progress'; return
-  end select
-
-  ! *****************************************************************************
-  ! *** reset counters/flags for model statistics
-  ! *****************************************************************************
-
-  ! reset output counters/flags
-  do iFreq=1,maxVarFreq  ! loop through output frequencies
-
-    ! define the need to finalize statistics
-    ! NOTE: time vector is configured so that ih=0 at the start of the day, hence day in oldTime and timeStruct%var differ
-    select case(iFreq)
-      case(iLookFreq%day     ); finalizeStats(iFreq)=(oldTime(iLookTIME%id  )/=newTime(iLookTIME%id  ))  ! daily aggregation
-      case(iLookFreq%month   ); finalizeStats(iFreq)=(oldTime(iLookTIME%im  )/=newTime(iLookTIME%im  ))  ! monthly aggregation
-      case(iLookFreq%annual  ); finalizeStats(iFreq)=(oldTime(iLookTIME%iyyy)/=newTime(iLookTIME%iyyy))  ! yearly (annual) aggregation
-      case(iLookFreq%timestep); finalizeStats(iFreq)=.true.          ! timestep-level output (no temporal aggregation)
-      case default; err=20; message=trim(message)//'unable to identify output frequency'; return
-    end select
-
-    ! reset ouput timestep
-    if(resetStats(iFreq)) statCounter(iFreq)=1
-
-  end do ! looping through output frequencies
-
-end subroutine summa_setWriteAlarms
-
-end module summa_alarms
\ No newline at end of file
diff --git a/build/source/driver/summaActors_globalData.f90 b/build/source/driver/summaActors_globalData.f90
deleted file mode 100755
index efd6b18169b19d2c698843770dc5074a0bd6e894..0000000000000000000000000000000000000000
--- a/build/source/driver/summaActors_globalData.f90
+++ /dev/null
@@ -1,190 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module summa_globalData
-! used to declare and allocate global summa data structures
-USE, intrinsic :: iso_c_binding
-
-! access missing values
-USE globalData,only:integerMissing   ! missing integer
-USE globalData,only:realMissing      ! missing double precision number
-
-! size of data structures
-USE var_lookup,only:maxvarForc      ! forcing data:             maximum number variables
-USE var_lookup,only:maxvarProg      ! prognostic variables:     maximum number variables
-USE var_lookup,only:maxvarDiag      ! diagnostic variables:     maximum number variables
-USE var_lookup,only:maxvarFlux      ! model fluxes:             maximum number variables
-USE var_lookup,only:maxvarIndx      ! model indices:            maximum number variables
-USE var_lookup,only:maxvarBvar      ! basin-average variables:  maximum number variables
-
-! metadata structures
-USE globalData,only:time_meta,forc_meta,attr_meta,type_meta ! metadata structures
-USE globalData,only:prog_meta,diag_meta,flux_meta           ! metadata structures
-USE globalData,only:mpar_meta,indx_meta                     ! metadata structures
-USE globalData,only:bpar_meta,bvar_meta                     ! metadata structures
-USE globalData,only:averageFlux_meta                        ! metadata for time-step average fluxes
-
-! statistics metadata structures
-USE globalData,only:statForc_meta                           ! child metadata for stats
-USE globalData,only:statProg_meta                           ! child metadata for stats
-USE globalData,only:statDiag_meta                           ! child metadata for stats
-USE globalData,only:statFlux_meta                           ! child metadata for stats
-USE globalData,only:statIndx_meta                           ! child metadata for stats
-USE globalData,only:statBvar_meta                           ! child metadata for stats
-
-! mapping from original to child structures
-USE globalData,only:forcChild_map                           ! index of the child data structure: stats forc
-USE globalData,only:progChild_map                           ! index of the child data structure: stats prog
-USE globalData,only:diagChild_map                           ! index of the child data structure: stats diag
-USE globalData,only:fluxChild_map                           ! index of the child data structure: stats flux
-USE globalData,only:indxChild_map                           ! index of the child data structure: stats indx
-USE globalData,only:bvarChild_map                           ! index of the child data structure: stats bvar
-
-USE globalData,only:startGRU
-! safety: set private unless specified otherwise
-implicit none
-private
-public::summa_defineGlobalData
-contains
-
-subroutine summa_defineGlobalData(start_gru_index, err) bind(C, name="defineGlobalData")
-  ! ---------------------------------------------------------------------------------------
-  ! * desired modules
-  ! ---------------------------------------------------------------------------------------
-  ! data types
-  USE nrtype                                                  ! variable types, etc.
-  ! subroutines and functions: initial priming
-  USE,intrinsic :: ieee_arithmetic                            ! IEEE arithmetic (obviously)
-  ! subroutines and functions: define metadata structures
-  USE popMetadat_module,only:popMetadat                       ! module to populate metadata structures
-  USE flxMapping_module,only:flxMapping                       ! module to map fluxes to states
-  USE checkStruc_module,only:checkStruc                       ! module to check metadata structures
-  USE childStruc_module,only:childStruc                       ! module to create a child data structure
-  ! miscellaneous global data
-  USE globalData,only:dNaN                                    ! double precision NaN
-  USE globalData,only:doJacobian                              ! flag to compute the Jacobian
-  USE globalData,only:structInfo                              ! information on the data structures
-  ! named variables that describe elements of child  model structures
-  USE var_lookup,only:iLookVarType                            ! look-up values for variable type structure
-  USE var_lookup,only:childFLUX_MEAN                          ! look-up values for timestep-average model fluxes
-  ! ---------------------------------------------------------------------------------------
-  ! * variables
-  ! ---------------------------------------------------------------------------------------
-  implicit none
-  ! dummy variables
-  integer(c_int),intent(in)             :: start_gru_index    ! Index of the starting GRU (-g option from user)
-  integer(c_int),intent(out)            :: err                ! error code
-  ! local variables
-  character(len=256)                    :: message            ! error message
-  character(LEN=256)                    :: cmessage           ! error message of downwind routine
-  logical(lgt), dimension(maxvarFlux)   :: flux_mask          ! mask defining desired flux variables
-  logical(lgt), dimension(maxvarForc)   :: statForc_mask      ! mask defining forc stats
-  logical(lgt), dimension(maxvarProg)   :: statProg_mask      ! mask defining prog stats
-  logical(lgt), dimension(maxvarDiag)   :: statDiag_mask      ! mask defining diag stats
-  logical(lgt), dimension(maxvarFlux)   :: statFlux_mask      ! mask defining flux stats
-  logical(lgt), dimension(maxvarIndx)   :: statIndx_mask      ! mask defining indx stats
-  logical(lgt), dimension(maxvarBvar)   :: statBvar_mask      ! mask defining bvar stats
-  integer(i4b)                          :: iStruct            ! index of data structure
-  ! ---------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message='summa_defineGlobalData/'
-
-  ! initialize the Jacobian flag
-  doJacobian=.false.        ! initialize the Jacobian flag
-
-  ! define double precision NaNs (shared in globalData)
-  dNaN = ieee_value(1._dp, ieee_quiet_nan)
-
-  ! populate metadata for all model variables
-  call popMetadat(err,cmessage)
-  if(err/=0)then
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return 
-  endif
-
-  ! define mapping between fluxes and states
-  call flxMapping(err,cmessage)
-  if(err/=0)then
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return 
-  endif
-
-  ! check data structures
-  call checkStruc(err,cmessage)
-  if(err/=0)then 
-    message=trim(message)//trim(cmessage) 
-    print*, message
-    return 
-  endif
-
-  ! define the mask to identify the subset of variables in the "child" data structure (just scalar variables)
-  flux_mask = (flux_meta(:)%vartype==iLookVarType%scalarv)
-
-  ! create the averageFlux metadata structure
-  call childStruc(flux_meta, flux_mask, averageFlux_meta, childFLUX_MEAN, err, cmessage)
-  if(err/=0)then 
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! child metadata structures - so that we do not carry full stats structures around everywhere
-  ! only carry stats for variables with output frequency > model time step
-  statForc_mask = (forc_meta(:)%vartype==iLookVarType%scalarv.and.forc_meta(:)%varDesire)
-  statProg_mask = (prog_meta(:)%vartype==iLookVarType%scalarv.and.prog_meta(:)%varDesire)
-  statDiag_mask = (diag_meta(:)%vartype==iLookVarType%scalarv.and.diag_meta(:)%varDesire)
-  statFlux_mask = (flux_meta(:)%vartype==iLookVarType%scalarv.and.flux_meta(:)%varDesire)
-  statIndx_mask = (indx_meta(:)%vartype==iLookVarType%scalarv.and.indx_meta(:)%varDesire)
-  statBvar_mask = (bvar_meta(:)%vartype==iLookVarType%scalarv.and.bvar_meta(:)%varDesire)
-
-  ! create the stats metadata structures
-  do iStruct=1,size(structInfo)
-    select case (trim(structInfo(iStruct)%structName))
-      case('forc'); call childStruc(forc_meta,statForc_mask,statForc_meta,forcChild_map,err,cmessage)
-      case('prog'); call childStruc(prog_meta,statProg_mask,statProg_meta,progChild_map,err,cmessage)
-      case('diag'); call childStruc(diag_meta,statDiag_mask,statDiag_meta,diagChild_map,err,cmessage)
-      case('flux'); call childStruc(flux_meta,statFlux_mask,statFlux_meta,fluxChild_map,err,cmessage)
-      case('indx'); call childStruc(indx_meta,statIndx_mask,statIndx_meta,indxChild_map,err,cmessage)
-      case('bvar'); call childStruc(bvar_meta,statBvar_mask,statBvar_meta,bvarChild_map,err,cmessage)
-    end select
-    ! check errors
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)//'[statistics for =  '//trim(structInfo(iStruct)%structName)//']' 
-      print*, message 
-      return 
-    endif
-  end do ! iStruct
-
-  ! set all stats metadata to correct var types
-  statForc_meta(:)%vartype = iLookVarType%outstat
-  statProg_meta(:)%vartype = iLookVarType%outstat
-  statDiag_meta(:)%vartype = iLookVarType%outstat
-  statFlux_meta(:)%vartype = iLookVarType%outstat
-  statIndx_meta(:)%vartype = iLookVarType%outstat
-  statBvar_meta(:)%vartype = iLookVarType%outstat
-
-  ! Set the startGRU
-  startGRU = start_gru_index
-
-end subroutine summa_defineGlobalData
-
-end module summa_globalData
diff --git a/build/source/driver/summaActors_type.f90 b/build/source/driver/summaActors_type.f90
deleted file mode 100755
index 960064b727c9a466b04a88cb8fc69c33c4367cd9..0000000000000000000000000000000000000000
--- a/build/source/driver/summaActors_type.f90
+++ /dev/null
@@ -1,24 +0,0 @@
-
-MODULE summa4chm_type
-! used to define master summa data structure
-! *****************************************************************************
-! * higher-level derived data types
-! *****************************************************************************
-USE nrtype          ! variable types, etc.
-USE data_types,only:&
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            (i8b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    gru_hru_doubleVec
-implicit none
-private
-
-! ************************************************************************
-! * master summa data type
-! *****************************************************************************
-
-
-END MODULE summa4chm_type
diff --git a/build/source/driver/summaActors_util.f90 b/build/source/driver/summaActors_util.f90
deleted file mode 100755
index 0b761071dc6c4ce7ebb79b7a75f61e157d373dd0..0000000000000000000000000000000000000000
--- a/build/source/driver/summaActors_util.f90
+++ /dev/null
@@ -1,165 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module summa4chm_util
-! utilities to manage summa simulation
-
-! data types
-USE nrtype                              ! high-level data types
-
-! global data
-USE globalData,only:integerMissing      ! missing integer value
-USE globalData,only:realMissing         ! missing double precision value
-
-! provide access to file IDs
-USE globalData,only:ncid               ! file id of netcdf output file
-
-! privacy
-implicit none
-private
-
-! routines to make public
-public::stop_program
-public::handle_err
-contains
-
- ! **************************************************************************************************
- ! error handler
- ! **************************************************************************************************
- ! TODO: will need to change how output files are closed
- subroutine handle_err(err,message)
- USE netcdf_util_module,only:nc_file_close             ! module to handle netcdf stuff for inputs and outputs
- implicit none
- ! dummy variables
- integer(i4b),intent(in)            :: err             ! error code
- character(*),intent(in)            :: message         ! error message
- ! local variables
- integer(i4b)                       :: iFreq           ! loop through output frequencies
- integer(i4b)                       :: nc_err          ! error code of nc_close
- character(len=256)                 :: cmessage        ! error message of the downwind routine
- ! ---------------------------------------------------------------------------------------
- ! return if A-OK
- if(err==0) return
-
- ! process error messages
- if (err>0) then
-  write(*,'(//a/)') 'FATAL ERROR: '//trim(message)
- else
-  write(*,'(//a/)') 'WARNING: '//trim(message); print*,'(can keep going, but stopping anyway)'
- endif
-
- ! close any remaining output files
- do iFreq = 1,size(ncid)
-  if (ncid(iFreq)/=integerMissing) then
-   call nc_file_close(ncid(iFreq),nc_err,cmessage)
-   if(nc_err/=0) print*, trim(cmessage)
-  end if
- end do
-
- stop 1
- end subroutine handle_err
-
- ! **************************************************************************************************
- ! stop_program: stop program execution
- ! **************************************************************************************************
- subroutine stop_program(err,message)
- ! used to stop program execution
- ! desired modules
- USE netcdf                                            ! netcdf libraries
- USE time_utils_module,only:elapsedSec                 ! calculate the elapsed time
- ! global data
- USE globalData,only: nThreads                         ! number of threads
- USE globalData,only: startInit                        ! date/time for the start of the initialization
- USE globalData,only: elapsedInit                      ! elapsed time for the initialization
- USE globalData,only: elapsedSetup                     ! elapsed time for the parameter setup
- USE globalData,only: elapsedRestart                   ! elapsed time to read the restart data
- USE globalData,only: elapsedRead                      ! elapsed time for the data read
- USE globalData,only: elapsedWrite                     ! elapsed time for the stats/write
- USE globalData,only: elapsedPhysics                   ! elapsed time for the physics
- implicit none
- ! define dummy variables
- integer(i4b),intent(in)            :: err             ! error code
- character(*),intent(in)            :: message         ! error messgage
- ! define the local variables
- integer(i4b),parameter             :: outunit=6       ! write to screen
- integer(i4b)                       :: endModelRun(8)  ! final time
- integer(i4b)                       :: localErr        ! local error code
- integer(i4b)                       :: iFreq           ! loop through output frequencies
- real(dp)                           :: elpSec          ! elapsed seconds
-
- ! close any remaining output files
- ! NOTE: use the direct NetCDF call with no error checking since the file may already be closed
- do iFreq = 1,size(ncid)
-  if (ncid(iFreq)/=integerMissing) localErr = nf90_close(ncid(iFreq))
- end do
-
- ! get the final date and time
- call date_and_time(values=endModelRun)
- elpSec = elapsedSec(startInit,endModelRun)
-
- ! print initial and final date and time
- write(outunit,"(/,A,I4,'-',I2.2,'-',I2.2,2x,I2,':',I2.2,':',I2.2,'.',I3.3)") 'initial date/time = ',startInit(1:3),  startInit(5:8)
- write(outunit,"(A,I4,'-',I2.2,'-',I2.2,2x,I2,':',I2.2,':',I2.2,'.',I3.3)")   '  final date/time = ',endModelRun(1:3),endModelRun(5:8)
-
- ! print elapsed time for the initialization
- write(outunit,"(/,A,1PG15.7,A)")                                             '     elapsed init = ', elapsedInit,           ' s'
- write(outunit,"(A,1PG15.7)")                                                 '    fraction init = ', elapsedInit/elpSec
-
- ! print elapsed time for the parameter setup
- write(outunit,"(/,A,1PG15.7,A)")                                             '    elapsed setup = ', elapsedSetup,          ' s'
- write(outunit,"(A,1PG15.7)")                                                 '   fraction setup = ', elapsedSetup/elpSec
-
- ! print elapsed time to read the restart data
- write(outunit,"(/,A,1PG15.7,A)")                                             '  elapsed restart = ', elapsedRestart,        ' s'
- write(outunit,"(A,1PG15.7)")                                                 ' fraction restart = ', elapsedRestart/elpSec
-
- ! print elapsed time for the data read
- write(outunit,"(/,A,1PG15.7,A)")                                             '     elapsed read = ', elapsedRead,           ' s'
- write(outunit,"(A,1PG15.7)")                                                 '    fraction read = ', elapsedRead/elpSec
-
- ! print elapsed time for the data write
- write(outunit,"(/,A,1PG15.7,A)")                                             '    elapsed write = ', elapsedWrite,          ' s'
- write(outunit,"(A,1PG15.7)")                                                 '   fraction write = ', elapsedWrite/elpSec
-
- ! print elapsed time for the physics
- write(outunit,"(/,A,1PG15.7,A)")                                             '  elapsed physics = ', elapsedPhysics,        ' s'
- write(outunit,"(A,1PG15.7)")                                                 ' fraction physics = ', elapsedPhysics/elpSec
-
- ! print total elapsed time
- write(outunit,"(/,A,1PG15.7,A)")                                             '     elapsed time = ', elpSec,                ' s'
- write(outunit,"(A,1PG15.7,A)")                                               '       or           ', elpSec/60_dp,          ' m'
- write(outunit,"(A,1PG15.7,A)")                                               '       or           ', elpSec/3600_dp,        ' h'
- write(outunit,"(A,1PG15.7,A/)")                                              '       or           ', elpSec/86400_dp,       ' d'
-
- ! print the number of threads
- write(outunit,"(A,i10,/)")                                                   '   number threads = ', nThreads
-
- ! stop with message
- if(err==0)then
-  print*,'FORTRAN STOP: '//trim(message)
-  stop
- else
-  print*,'FATAL ERROR: '//trim(message)
-  stop 1
- endif
-
- end subroutine
-
-end module summa4chm_util
diff --git a/build/source/driver/summaversion.inc b/build/source/driver/summaversion.inc
deleted file mode 100644
index de9a3c3c316d2d654d2dd02f63e195017ca5adda..0000000000000000000000000000000000000000
--- a/build/source/driver/summaversion.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-character(len=64), parameter     :: summaVersion = 'v3.0.3'
-character(len=64), parameter     :: buildTime = 'Sun Apr 11 23:44:54 CST 2021'
-character(len=64), parameter     :: gitBranch = 'master-0-gf34d5e4'
-character(len=64), parameter     :: gitHash = 'f34d5e46474ccfdc2d9675df3f6ed43f321fcb48'
diff --git a/build/source/dshare/csv_file.f90 b/build/source/dshare/csv_file.f90
deleted file mode 100644
index 165809bffbddaf2d5781dc209f1e50c26540b837..0000000000000000000000000000000000000000
--- a/build/source/dshare/csv_file.f90
+++ /dev/null
@@ -1,274 +0,0 @@
-! csv_file.f90 --
-!     Small module to facilitate writing CSV-files
-!
-!     $Id: csv_file.f90,v 1.2 2006/03/26 19:03:53 arjenmarkus Exp $
-!
-!     The module contains the following subroutines:
-!     csv_next_record       Advance to the next record
-!     csv_write_integer     Write a single integer to the CSV-file
-!     csv_write_real        Write a single real to the CSV-file
-!     csv_write_dble        Write a single double-precision real to the
-!                           CSV-file
-!     csv_write_char        Write a single character string to the
-!                           CSV-file
-!     csv_write_integer_1d  Write a 1D array of integers to the CSV-file
-!     csv_write_real_1d     Write a 1D array of reals to the CSV-file
-!     csv_write_dble_1d     Write a 1D array of double-precision real to
-!                           the CSV-file
-!     csv_write_char_1d     Write a 1D array of character strings to the
-!                           CSV-file
-!     csv_write_integer_2d  Write a 2D array of integers to the CSV-file
-!     csv_write_real_2d     Write a 2D array of reals to the CSV-file
-!     csv_write_dble_2d     Write a 2D array of double-precision real to
-!                           the CSV-file
-!     csv_write_char_2d     Write a 2D array of character strings to the
-!                           CSV-file
-!
-!     For convenience, the generic name "csv_write" can be used
-!     instead of the individual routines.
-!
-!     The file to write to must already be opened as a LU-number
-!     is passed.
-!
-!     Layout of the CSV-file:
-!     - single items are written to the end of the current record
-!     - one-dimensional items are also written to the end of the current
-!       record
-!     - two-dimensional items are written to separate records, one for
-!       each row
-!     - except for the two-dimensional versions, all routines allow
-!       you to suppress advancing to the next record:
-!       - for single items you must indicate whether to advance or not
-!       - for one-dimensional items, the argument is optional. Default
-!         is to advance.
-!
-!     Note on the format:
-!     CSV-files apparently come in different guises (Kernighan and Pike,
-!     The practice of Programming, Addison-Wesley, 1999). This module
-!     uses the following rules:
-!     - items are always separated by a single comma (,)
-!     - string items are delimited by double quotes (")
-!     - embedded double quotes are treated by doubling the quote
-!     - trailing blanks are considered irrelevant
-!
-module csv_file
-    implicit none
-    interface csv_write
-        module procedure csv_write_integer
-        module procedure csv_write_integer_1d
-        module procedure csv_write_integer_2d
-        module procedure csv_write_char
-        module procedure csv_write_char_1d
-        module procedure csv_write_char_2d
-        module procedure csv_write_real
-        module procedure csv_write_real_1d
-        module procedure csv_write_real_2d
-        module procedure csv_write_dble
-        module procedure csv_write_dble_1d
-        module procedure csv_write_dble_2d
-    end interface
-contains
-
-! csv_next_record --
-!     Go to the next record (convenience routine)
-! Arguments:
-!     lun        LU-number of the CSV-file
-! Result:
-!     The current record is closed, the next write will be to the
-!     new record
-! Note:
-!     This is a convenience routine, it may result in a superfluous
-!     comma at the end of the previous record. This does not seem to
-!     be problematic, though, for MS Excel
-!
-subroutine csv_next_record( lun )
-    integer, intent(in)   :: lun
-
-    write(lun,'(a)') ''
-end subroutine csv_next_record
-
-! csv_write_integer/real/dble --
-!     Write a single integer/real/double precision real to the CSV-file
-! Arguments:
-!     lun        LU-number of the CSV-file
-!     value      Value to write
-!     advance    Advance (.true.) or not, so that more items can be
-!                written to the same record
-! Result:
-!     The value is written to the current record of the CSV-file
-!
-subroutine csv_write_integer( lun, value, advance )
-    integer, intent(in)   :: lun
-    integer, intent(in)   :: value
-    logical, intent(in)   :: advance
-
-    character(len=40)     :: buffer
-    write( buffer, '(I10)' ) value
-    buffer = adjustl(buffer)
-    if ( advance ) then
-       write(lun,'(a)') trim(buffer)
-    else
-       ! Most probably: write the comma only when needed
-       ! - depends on other actions
-       write(lun,'(a,a)',advance='no') trim(buffer), ','
-    endif
-end subroutine csv_write_integer
-
-subroutine csv_write_real( lun, value, advance )
-    integer, intent(in)   :: lun
-    real, intent(in)      :: value
-    logical, intent(in)   :: advance
-
-    character(len=40)     :: buffer
-    write( buffer, '(G14.6)' ) value
-    buffer = adjustl(buffer)
-    if ( advance ) then
-       write(lun,'(a)') trim(buffer)
-    else
-       ! Most probably: write the comma only when needed
-       ! - depends on other actions
-       write(lun,'(a,a)',advance='no') trim(buffer), ','
-    endif
-end subroutine csv_write_real
-
-subroutine csv_write_dble( lun, value, advance )
-    integer, intent(in)                    :: lun
-    real(kind=kind(1.0d0)), intent(in)     :: value
-    logical, intent(in)                    :: advance
-
-    character(len=40)     :: buffer
-    write( buffer, '(G20.12)' ) value
-    buffer = adjustl(buffer)
-    if ( advance ) then
-       write(lun,'(a)') trim(buffer)
-    else
-       ! Most probably: write the comma only when needed
-       ! - depends on other actions
-       write(lun,'(a,a)',advance='no') trim(buffer), ','
-    endif
-end subroutine csv_write_dble
-
-! csv_write_char --
-!     Write a single character string to the CSV-file
-! Arguments:
-!     lun        LU-number of the CSV-file
-!     value      Value to write
-!     advance    Advance (.true.) or not, so that more items can be
-!                written to the same record
-! Result:
-!     The value is written to the current record of the CSV-file
-!
-subroutine csv_write_char( lun, value, advance )
-    integer, intent(in)            :: lun
-    character(len=*), intent(in)   :: value
-    logical, intent(in)            :: advance
-
-    integer                        :: k
-    integer                        :: pos
-    integer                        :: posb
-    character(len=2*len(value))    :: buffer
-
-    buffer = value
-
-    !
-    ! Check for nasty characters (")
-    !
-    k    = index( value,'"')
-    pos  = 1
-    posb = 1
-    do while ( k .ge. 1 )
-        buffer(posb:)   = value(pos:)
-        buffer(posb+k:) = '"' // value(pos+k:)
-        pos             = pos  + k + 1
-        posb            = posb + k + 2
-        k               = index( value(pos:),'"')
-    enddo
-
-    if ( advance ) then
-       write(lun,'(3a)') '"',trim(buffer),'"'
-    else
-       write(lun,'(3a,a)',advance='no') '"',trim(buffer), '"', ','
-    endif
-end subroutine csv_write_char
-
-! csv_write_integer/real/dble_1d --
-!     Write a one-dimensional array of items to the CSV-file
-! Arguments:
-!     lun        LU-number of the CSV-file
-!     array      Array to write
-!     advance    Advance (.true.) or not, so that more items can be
-!                written to the same record
-! Result:
-!     The array is written to the current record of the CSV-file
-! Note:
-!     Because the four routines of this type differ only in
-!     the data type, we use an include file for the body.
-!
-subroutine csv_write_integer_1d( lun, array, advance )
-    integer, dimension(:), intent(in)   :: array
-
-    include 'csv_file_1d.f90'
-
-end subroutine csv_write_integer_1d
-
-subroutine csv_write_real_1d( lun, array, advance )
-    real, dimension(:), intent(in)   :: array
-
-    include 'csv_file_1d.f90'
-
-end subroutine csv_write_real_1d
-
-subroutine csv_write_dble_1d( lun, array, advance )
-    real(kind=kind(1.0d0)), dimension(:), intent(in)   :: array
-
-    include 'csv_file_1d.f90'
-
-end subroutine csv_write_dble_1d
-
-subroutine csv_write_char_1d( lun, array, advance )
-    character(len=*), dimension(:), intent(in)   :: array
-
-    include 'csv_file_1d.f90'
-
-end subroutine csv_write_char_1d
-
-! csv_write_integer/real/dble_2d --
-!     Write a two-dimensional array of items to the CSV-file
-! Arguments:
-!     lun        LU-number of the CSV-file
-!     array      Array to write
-! Result:
-!     The array is written to the current record of the CSV-file
-! Note:
-!     Because the four routines of this type differ only in
-!     the data type, we use an include file for the body.
-!
-subroutine csv_write_integer_2d( lun, array )
-    integer, dimension(:,:), intent(in)   :: array
-
-    include 'csv_file_2d.f90'
-
-end subroutine csv_write_integer_2d
-
-subroutine csv_write_real_2d( lun, array )
-    real, dimension(:,:), intent(in)   :: array
-
-    include 'csv_file_2d.f90'
-
-end subroutine csv_write_real_2d
-
-subroutine csv_write_dble_2d( lun, array )
-    real(kind=kind(1.0d0)), dimension(:,:), intent(in)   :: array
-
-    include 'csv_file_2d.f90'
-
-end subroutine csv_write_dble_2d
-
-subroutine csv_write_char_2d( lun, array )
-    character(len=*), dimension(:,:), intent(in)   :: array
-
-    include 'csv_file_2d.f90'
-
-end subroutine csv_write_char_2d
-
-end module csv_file
diff --git a/build/source/dshare/csv_file_1d.f90 b/build/source/dshare/csv_file_1d.f90
deleted file mode 100644
index 485fec1eed73e7e4aaf9419511c250d03c97b94d..0000000000000000000000000000000000000000
--- a/build/source/dshare/csv_file_1d.f90
+++ /dev/null
@@ -1,22 +0,0 @@
-! cvs_file_1d.f90 --
-!     Include file for csv_file.f90:
-!     contains the body of the one-dimensional version of the
-!     writing routines.
-!
-!     $Id: csv_file_1d.f90,v 1.2 2006/03/26 19:03:53 arjenmarkus Exp $
-!
-    integer, intent(in)                 :: lun
-    logical, intent(in), optional       :: advance
-
-    logical                             :: adv
-    integer                             :: i
-
-    adv = .true.
-    if ( present(advance) ) adv = advance
-
-    do i = 1,size(array)-1
-        call csv_write( lun, array(i), .false. )
-    enddo
-    call csv_write( lun, array(size(array)), adv )
-!
-! end of body
diff --git a/build/source/dshare/csv_file_2d.f90 b/build/source/dshare/csv_file_2d.f90
deleted file mode 100644
index 24d5e4f7f3710a549247b841c9051700e5a3ac7f..0000000000000000000000000000000000000000
--- a/build/source/dshare/csv_file_2d.f90
+++ /dev/null
@@ -1,19 +0,0 @@
-! cvs_file_2d.f90 --
-!     Include file for csv_file.f90:
-!     contains the body of the two-dimensional version of the
-!     writing routines.
-!
-!     $Id: csv_file_2d.f90,v 1.2 2006/03/26 19:03:53 arjenmarkus Exp $
-!
-    integer, intent(in)                 :: lun
-
-    logical                             :: adv
-    integer                             :: i
-
-    adv = .true.
-
-    do i = 1,size(array,2)
-        call csv_write( lun, array(:,i), adv )
-    enddo
-!
-! end of body
diff --git a/build/source/dshare/data_types.f90 b/build/source/dshare/data_types.f90
deleted file mode 100755
index bdf57bc5195e31862f8663bc53e8ff6efc8d300e..0000000000000000000000000000000000000000
--- a/build/source/dshare/data_types.f90
+++ /dev/null
@@ -1,493 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-MODULE data_types
-  USE, intrinsic :: iso_c_binding
-
- ! used to define model data structures
- USE nrtype, integerMissing=>nr_integerMissing
- USE var_lookup,only:maxvarFreq
- USE var_lookup,only:maxvarStat
- implicit none
- ! constants necessary for variable defs
- private
-
- ! ***********************************************************************************************************
- ! Define the model decisions
- ! ***********************************************************************************************************
- ! the model decision structure
- type,public  :: model_options
-  character(len=64)                      :: cOption   = 'notPopulatedYet'
-  character(len=64)                      :: cDecision = 'notPopulatedYet'
-  integer(i4b)                           :: iDecision = integerMissing
- end type model_options
-
- ! ***********************************************************************************************************
- ! Define metadata for model forcing datafile
- ! ***********************************************************************************************************
- ! define a derived type for the data in the file
- type,public  :: file_info
-  character(len=256)                     :: filenmData='notPopulatedYet' ! name of data file
-  integer(i4b)                           :: nVars                        ! number of variables in the file
-  integer(i4b)                           :: nTimeSteps                   ! number of timesteps in the file
-  integer(i4b),allocatable               :: var_ix(:)                    ! index of each forcing data variable in the data structure
-  integer(i4b),allocatable               :: data_id(:)                   ! netcdf variable id for each forcing data variable
-  character(len=256),allocatable         :: varName(:)                   ! netcdf variable name for each forcing data variable
-  real(rkind)                            :: firstJulDay                  ! first julian day in forcing file
-  real(rkind)                            :: convTime2Days                ! factor to convert time to days
- end type file_info
-
- ! ***********************************************************************************************************
- ! Wrapping of file_info (prevents a segmentation fault)
- ! ***********************************************************************************************************
- type,public :: file_info_array
-  type(file_info), allocatable         :: ffile_list(:)
- end type file_info_array
-
- type,public :: forcingFileData
-  real(rkind), dimension (:,:), allocatable   :: dataFromFile
- end type forcingFileData
-
- type,public :: var_forc
-  type(forcingFileData), allocatable   :: var(:)       ! var(:)%dataFromFile(:,:)
-  character(len=256)                   :: refTimeString
-  real(rkind)                          :: convTime2Days
-  integer(i4b)                         :: nVars
-  integer(i4b),allocatable             :: var_ix(:)
-  real(rkind)                          :: tmZoneOffsetFracDay
-  real(rkind)                          :: refJulDay_data 
-  integer(i4b)                         :: nTimeSteps    ! Number of Timesteps in the file
- end type var_forc
-
-  ! ***********************************************************************************************************
-  ! Define GRU_Actor var_id structure
-  ! ***********************************************************************************************************
-  type,public,bind(C) :: netcdf_gru_actor_info
-    integer(C_INT) :: run_time_var_id
-    integer(C_INT) :: init_duration_var_id
-    integer(C_INT) :: forcing_duration_var_id
-    integer(C_INT) :: run_physics_duration_var_id
-    integer(C_INT) :: write_output_duration_var_id
-    integer(C_INT) :: state_var_id
-    integer(C_INT) :: num_attempts_var_id
-  end type netcdf_gru_actor_info
-
-  type,public,bind(C) :: serializable_netcdf_gru_actor_info
-    real(C_DOUBLE) :: run_time
-    real(C_DOUBLE) :: init_duration
-    real(C_DOUBLE) :: forcing_duration
-    real(C_DOUBLE) :: run_physics_duration
-    real(C_DOUBLE) :: write_output_duration
-    integer(C_INT) :: successful
-    integer(C_INT) :: num_attempts
-  end type serializable_netcdf_gru_actor_info
-
- ! ***********************************************************************************************************
- ! Define metadata on model parameters
- ! ***********************************************************************************************************
- ! define a data type to store model parameter information
- type,public  :: par_info
-  real(rkind)                               :: default_val              ! default parameter value
-  real(rkind)                               :: lower_limit              ! lower bound
-  real(rkind)                               :: upper_limit              ! upper bound
- endtype par_info
-
- ! ***********************************************************************************************************
- ! Define variable metadata
- ! ***********************************************************************************************************
- ! define derived type for model variables, including name, description, and units
- type,public :: var_info
-  character(len=64)                      :: varname   = 'empty'         ! variable name
-  character(len=128)                     :: vardesc   = 'empty'         ! variable description
-  character(len=64)                      :: varunit   = 'empty'         ! variable units
-  integer(i4b)                           :: vartype   = integerMissing  ! variable type
-  integer(i4b),dimension(maxvarFreq)     :: ncVarID   = integerMissing  ! netcdf variable id (missing if frequency is not desired)
-  integer(i4b),dimension(maxvarFreq)     :: statIndex = integerMissing  ! index of desired statistic for temporal aggregation
-  logical(lgt)                           :: varDesire = .false.         ! flag to denote if the variable is desired for model output
- endtype var_info
-
- ! define extended data type (include indices to map onto parent data type)
- type,extends(var_info),public :: extended_info
-  integer(i4b)                           :: ixParent         ! index in the parent data structure
- endtype extended_info
-
- ! define extended data type (includes named variables for the states affected by each flux)
- type,extends(var_info),public :: flux2state
-  integer(i4b)                           :: state1           ! named variable of the 1st state affected by the flux
-  integer(i4b)                           :: state2           ! named variable of the 2nd state affected by the flux
- endtype flux2state
-
- ! ***********************************************************************************************************
- ! Define summary of data structures
- ! ***********************************************************************************************************
- ! data structure information
- type,public :: struct_info
-  character(len=32)                      :: structName  ! name of the data structure
-  character(len=32)                      :: lookName    ! name of the look-up variables
-  integer(i4b)                           :: nVar        ! number of variables in each data structure
- end type struct_info
-
- ! ***********************************************************************************************************
- ! Define data types to map between GRUs and HRUs
- ! ***********************************************************************************************************
-
- ! hru info data structure
- type, public :: hru_info
-  integer(i4b)                          :: hru_nc                   ! index of the hru in the netcdf file
-  integer(i4b)                          :: hru_ix                   ! index of the hru in the run domain
-  integer(8)                            :: hru_id                   ! id (non-sequential number) of the hru
-  integer(i4b)                          :: nSnow                    ! number of snow layers
-  integer(i4b)                          :: nSoil                    ! number of soil layers
- endtype hru_info
-
- ! define mapping from GRUs to the HRUs
- type, public :: gru2hru_map
-  integer(8)                            :: gru_id                   ! id of the gru
-  integer(i4b)                          :: hruCount                 ! total number of hrus in the gru
-  type(hru_info), allocatable           :: hruInfo(:)               ! basic information of HRUs within the gru
-  integer(i4b)                          :: gru_nc                   ! index of gru in the netcdf file
- endtype gru2hru_map
-
- ! define the mapping from the HRUs to the GRUs
- type, public :: hru2gru_map
-  integer(i4b)                          :: gru_ix                   ! index of gru which the hru belongs to
-  integer(i4b)                          :: localHRU_ix              ! index of a hru within a gru (start from 1 per gru)
- endtype hru2gru_map
-
-
- ! define type for init_cond
-  type, public :: init_cond
-    real(rkind), allocatable            ::  var_data(:,:)             ! initial condition data
-  endtype init_cond
-
- ! ***********************************************************************************************************
- ! Define hierarchal derived data types
- ! ***********************************************************************************************************
- ! define derived types to hold multivariate data for a single variable (different variables have different length)
- ! NOTE: use derived types here to facilitate adding the "variable" dimension
- ! ** double precision type
- type, public :: dlength
-  real(rkind),allocatable             :: dat(:)    ! dat(:)
- endtype dlength
- ! ** integer type (4 byte)
- type, public :: ilength
-  integer(i4b),allocatable            :: dat(:)    ! dat(:)
- endtype ilength
- ! ** integer type (8 byte)
- type, public :: i8length
-  integer(8),allocatable              :: dat(:)    ! dat(:)
- endtype i8length
- ! ** logical type
- type, public :: flagVec
-  logical(lgt),allocatable            :: dat(:)    ! dat(:)
- endtype flagVec
-
- type, public :: time_dlength
-   type(dlength),allocatable          :: tim(:)    ! tim(:)%dat
- endtype time_dlength
- 
- type, public :: time_ilength
-   type(ilength),allocatable          :: tim(:)    ! tim(:)%dat
- endtype time_ilength
-
- type, public :: time_d
-   real(rkind),allocatable            :: tim(:)    ! tim(:)
- endtype time_d
-
- type, public :: time_i
-   integer(i4b),allocatable           :: tim(:)    ! tim(:)
- endtype time_i
-
- type, public :: time_flagVec
-    type(flagVec),allocatable         :: tim(:)    ! tim(:)%dat
- end type time_flagVec
-
-
-
- ! define derived types to hold data for multiple variables
- ! NOTE: use derived types here to facilitate adding extra dimensions (e.g., spatial)
-
- ! ** double precision type of variable length
- type, public :: var_dlength
-  type(dlength),allocatable           :: var(:)    ! var(:)%dat
- endtype var_dlength
- ! ** integer type of variable length (4 byte)
- type, public :: var_ilength
-  type(ilength),allocatable           :: var(:)    ! var(:)%dat
- endtype var_ilength
- ! ** integer type of variable length (8 byte)
- type, public :: var_i8length
-  type(i8length),allocatable          :: var(:)    ! var(:)%dat
- endtype var_i8length
- ! ** logical type of variable length
- type, public :: var_flagVec
-  type(flagVec),allocatable           :: var(:)    ! var(:)%dat
- endtype var_flagVec
-
- ! ** double precision type of variable length with storage
- ! for each time_step
- type, public :: var_time_dlength
-   type(time_dlength),allocatable     :: var(:)   ! var(:)%tim(:)%dat
- endtype var_time_dlength
-
-! ** integer type of variable length with storage
-! for each time_step
-type, public :: var_time_ilength
-   type(time_ilength),allocatable     :: var(:)   ! var(:)%tim(:)%dat
-endtype var_time_ilength
-
- ! ** double precision type of fixed length
- type, public :: var_d
-  real(rkind),allocatable             :: var(:)    ! var(:)
- endtype var_d
- ! ** integer type of fixed length (4 byte)
- type, public :: var_i
-  integer(i4b),allocatable            :: var(:)    ! var(:)
- endtype var_i
- ! ** integer type of fixed length (8 byte)
- type, public :: var_i8
-  integer(8),allocatable              :: var(:)    ! var(:)
- endtype var_i8
- ! this needs to be here to compile on Graham
- type, public :: time_i8
-   type(var_i8),allocatable           :: tim(:)    ! tim(:)
- endtype time_i8
-
- type, public :: var_time_d
-   type(time_d),allocatable           :: var(:)     ! var(:)%tim
- endtype var_time_d
-
- type, public :: var_time_i
-   type(time_i),allocatable            :: var(:)     ! var(:)%tim
- endtype var_time_i
-
- type, public :: var_time_i8
-   type(time_i8),allocatable           :: var(:)     ! var(:)%tim
- endtype var_time_i8
-
- ! ** double precision type of fixed length
- type, public :: hru_d
-  real(rkind),allocatable             :: hru(:)    ! hru(:)
- endtype hru_d
- ! ** integer type of fixed length (4 byte)
- type, public :: hru_i
-  integer(i4b),allocatable            :: hru(:)    ! hru(:)
- endtype hru_i
- ! ** integer type of fixed length (8 byte)
- type, public :: hru_i8
-  integer(8),allocatable              :: hru(:)    ! hru(:)
- endtype hru_i8
-
-
- ! ***********************************************************************************************************
- ! Type for handling lateral-flows
- ! ***********************************************************************************************************
- type,public :: var_dlength_array
-  type(var_dlength), allocatable      :: struc(:) ! struc(:)var(:)%dat
- end type var_dlength_array   
-
- ! define derived types to hold JUST the HRU dimension
- ! ** double precision type of variable length
- type, public :: hru_doubleVec
-  type(var_dlength),allocatable      :: hru(:)     ! hru(:)%var(:)%dat
- endtype hru_doubleVec
- ! ** integer type of variable length (4 byte)
- type, public :: hru_intVec
-  type(var_ilength),allocatable      :: hru(:)     ! hru(:)%var(:)%dat
- endtype hru_intVec
- ! ** integer type of variable length (8 byte)
- type, public :: hru_int8Vec
-  type(var_i8length),allocatable     :: hru(:)     ! hru(:)%var(:)%dat
- endtype hru_int8Vec
- ! ** double precision type of fixed length
- type, public :: hru_double
-  type(var_d),allocatable            :: hru(:)     ! hru(:)%var(:)
- endtype hru_double
- ! ** integer type of fixed length (4 byte)
- type, public :: hru_int
-  type(var_i),allocatable            :: hru(:)     ! hru(:)%var(:)
- endtype hru_int
- ! ** integer type of fixed length (8 byte)
- type, public :: hru_int8
-  type(var_i8),allocatable           :: hru(:)     ! hru(:)%var(:)
- endtype hru_int8
-
-
- type, public :: hru_time_double
-   type(var_time_d),allocatable      :: hru(:)     ! hru(:)%tim(:)%var
- endtype hru_time_double
-
- type, public :: hru_time_int
-   type(var_time_i),allocatable      :: hru(:)     ! hru(:)%tim(:)%var
- endtype hru_time_int
-
- type, public :: hru_time_int8
-   type(var_time_i8),allocatable     :: hru(:)     ! hru(:)%tim(:)%var
- endtype hru_time_int8
-
- ! ** double precission type of timestep variable length
- type, public :: hru_time_doubleVec
-   type(var_time_dlength), allocatable :: hru(:)
- endtype hru_time_doubleVec
-
- type, public :: hru_time_intVec
-   type(var_time_ilength), allocatable :: hru(:)
- endtype hru_time_intVec
-
- type, public :: hru_time_flagVec
-  type(time_flagVec),allocatable       :: hru(:)  ! hru(:)%tim(:)%dat          
- endtype hru_time_flagVec
-
- ! define derived types to hold JUST the HRU dimension
- ! ** double precision type of variable length
- type, public :: gru_doubleVec
-  type(var_dlength),allocatable      :: gru(:)     ! gru(:)%var(:)%dat
- endtype gru_doubleVec
- ! ** integer type of variable length (4 byte)
- type, public :: gru_intVec
-  type(var_ilength),allocatable      :: gru(:)     ! gru(:)%var(:)%dat
- endtype gru_intVec
- ! ** integer type of variable length (8 byte)
- type, public :: gru_int8Vec
-  type(var_i8length),allocatable     :: gru(:)     ! gru(:)%var(:)%dat
- endtype gru_int8Vec
- ! ** double precision type of fixed length
- type, public :: gru_double
-  type(var_d),allocatable            :: gru(:)     ! gru(:)%var(:)
- endtype gru_double
- ! ** integer type of variable length (4 byte)
- type, public :: gru_int
-  type(var_i),allocatable            :: gru(:)     ! gru(:)%var(:)
- endtype gru_int
- ! ** integer type of variable length (8 byte)
- type, public :: gru_int8
-  type(var_i8),allocatable           :: gru(:)     ! gru(:)%var(:)
- endtype gru_int8
-
- type,public :: gru_hru_time_flagVec
-  type(hru_time_flagVec),allocatable :: gru(:)  ! gru(:)%hru(:)%tim(:)%dat(:)
- endtype gru_hru_time_flagVec           
-
- type, public :: gru_hru_time_double
-   type(hru_time_double),allocatable :: gru(:)
- endtype gru_hru_time_double
-
- type, public :: gru_hru_time_int
-   type(hru_time_int), allocatable   :: gru(:)
- endtype gru_hru_time_int
-
- type, public :: gru_hru_time_int8
-   type(hru_time_int8), allocatable  :: gru(:)  
- endtype gru_hru_time_int8 
-
- ! define derived types to hold BOTH the GRU and HRU dimension
- ! ** double precision type of variable length
- type, public :: gru_hru_doubleVec
-  type(hru_doubleVec),allocatable    :: gru(:)     ! gru(:)%hru(:)%var(:)%dat
- endtype gru_hru_doubleVec
- ! ** integer type of variable length (4 byte)
- type, public :: gru_hru_intVec
-  type(hru_intVec),allocatable       :: gru(:)     ! gru(:)%hru(:)%var(:)%dat
- endtype gru_hru_intVec
- ! ** integer type of variable length (8 byte)
- type, public :: gru_hru_int8Vec
-  type(hru_int8Vec),allocatable      :: gru(:)     ! gru(:)%hru(:)%var(:)%dat
- endtype gru_hru_int8Vec
- ! ** double precision type of fixed length
- type, public :: gru_hru_double
-  type(hru_double),allocatable       :: gru(:)     ! gru(:)%hru(:)%var(:)
- endtype gru_hru_double
- ! ** integer type of variable length (4 byte)
- type, public :: gru_hru_int
-  type(hru_int),allocatable          :: gru(:)     ! gru(:)%hru(:)%var(:)
- endtype gru_hru_int
- ! ** integer type of variable length (8 byte)
- type, public :: gru_hru_int8
-  type(hru_int8),allocatable         :: gru(:)     ! gru(:)%hru(:)%var(:)
- endtype gru_hru_int8
- ! ** double precision type of fixed length
- type, public :: gru_d
-  type(hru_d),allocatable            :: gru(:)    ! gru(:)%hru(:)
- endtype gru_d
- ! ** integer type of fixed length
- type, public :: gru_i
-  type(hru_i),allocatable            :: gru(:)    ! gru(:)%hru(:)
- endtype gru_i
-
- type, public :: gru_hru_time_doubleVec
-  type(hru_time_doubleVec),allocatable :: gru(:)
- endtype gru_hru_time_doubleVec
-
- type, public :: gru_hru_time_intVec
-  type(hru_time_intVec),allocatable    :: gru(:)
- endtype gru_hru_time_intVec
-
- ! Sundials lookup table type
- type, public :: dLookup
- real(rkind),allocatable              :: lookup(:)   ! lookup(:)
- endtype dLookup
- ! ** double precision type for a variable number of soil layers; variable length
- type, public :: vLookup
-  type(dLookup),allocatable           :: var(:)      ! var(:)%lookup(:)
- endtype vLookup
- type, public :: zLookup
-  type(vLookup),allocatable           :: z(:)        ! z(:)%var(:)%lookup(:)
- endtype zLookup
-
- type, public :: summa_output_type
-
-  ! define the statistics structures
-  type(gru_hru_time_doubleVec),allocatable          :: forcStat(:)                   ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model forcing data
-  type(gru_hru_time_doubleVec),allocatable          :: progStat(:)                   ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model prognostic (state) variables
-  type(gru_hru_time_doubleVec),allocatable          :: diagStat(:)                   ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model diagnostic variables
-  type(gru_hru_time_doubleVec),allocatable          :: fluxStat(:)                   ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model fluxes
-  type(gru_hru_time_doubleVec),allocatable          :: indxStat(:)                   ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model indices
-  type(gru_hru_time_doubleVec),allocatable          :: bvarStat(:)                   ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- basin-average variabl
-
-  ! define the primary data structures (scalars)
-  type(gru_hru_time_int),allocatable                :: timeStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)     -- model time data
-  type(gru_hru_time_double),allocatable             :: forcStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)     -- model forcing data
-  type(gru_hru_double),allocatable                  :: attrStruct(:)                 ! x%gru(:)%hru(:)%var(:)            -- local attributes for each HRU, DOES NOT CHANGE OVER TIMESTEPS
-  type(gru_hru_int),allocatable                     :: typeStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)     -- local classification of soil veg etc. for each HRU, DOES NOT CHANGE OVER TIMESTEPS
-  type(gru_hru_int8),allocatable                    :: idStruct(:)                   ! x%gru(:)%hru(:)%var(:)
-
-  ! define the primary data structures (variable length vectors)
-  type(gru_hru_time_intVec),allocatable             :: indxStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model indices
-  type(gru_hru_doubleVec),allocatable               :: mparStruct(:)                 ! x%gru(:)%hru(:)%var(:)%dat        -- model parameters, DOES NOT CHANGE OVER TIMESTEPS TODO: MAYBE
-  type(gru_hru_time_doubleVec),allocatable          :: progStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model prognostic (state) variables
-  type(gru_hru_time_doubleVec),allocatable          :: diagStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model diagnostic variables
-  type(gru_hru_time_doubleVec),allocatable          :: fluxStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- model fluxes
-
-  ! define the basin-average structures
-  type(gru_double),allocatable                      :: bparStruct(:)                 ! x%gru(:)%var(:)                   -- basin-average parameters, DOES NOT CHANGE OVER TIMESTEPS
-  type(gru_hru_time_doubleVec),allocatable          :: bvarStruct(:)                 ! x%gru(:)%hru(:)%var(:)%tim(:)%dat -- basin-average variables
-
-  ! define the ancillary data structures
-  type(gru_hru_double),allocatable                  :: dparStruct(:)                 ! x%gru(:)%hru(:)%var(:)
-
-  ! finalize stats structure
-  type(gru_hru_time_flagVec),allocatable            :: finalizeStats(:)              ! x%gru(:)%hru(:)%tim(:)%dat -- flags on when to write to file
-
-  integer(i4b)                                      :: nTimeSteps
- end type summa_output_type
-
-
-END MODULE data_types
-
diff --git a/build/source/dshare/globalData.f90 b/build/source/dshare/globalData.f90
deleted file mode 100755
index 12b02658801f88c1ca48bf9bd8362681dba84f88..0000000000000000000000000000000000000000
--- a/build/source/dshare/globalData.f90
+++ /dev/null
@@ -1,326 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-! ----------------------------------------------------------------------------------------------------------------
-! * part 1: parameters that are fixed across multiple instantiations
-! ----------------------------------------------------------------------------------------------------------------
-
-MODULE globalData
-  ! data types
-  USE nrtype
-  USE netcdf
-  USE,intrinsic :: ieee_arithmetic    ! IEEE arithmetic
-  USE data_types,only:gru2hru_map     ! mapping between the GRUs and HRUs
-  USE data_types,only:hru2gru_map     ! mapping between the GRUs and HRUs
-  USE data_types,only:model_options   ! the model decision structure
-  USE data_types,only:file_info       ! metadata for model forcing datafile
-  USE data_types,only:par_info        ! default parameter values and parameter bounds
-  USE data_types,only:var_info        ! metadata for variables in each model structure
-  USE data_types,only:flux2state      ! extended metadata to define flux-to-state mapping
-  USE data_types,only:extended_info   ! extended metadata for variables in each model structure
-  USE data_types,only:struct_info     ! summary information on all data structures
-  USE data_types,only:var_i           ! vector of integers
-  USE data_types,only:var_dlength
-  USE data_types,only:var_dlength_array
-  USE data_types,only:var_forc
-  USE data_types,only:dlength
-  USE data_types,only:ilength
-  USE data_types,only:init_cond
-
-  ! number of variables in each data structure
-  USE var_lookup,only:maxvarTime      ! time:                     maximum number variables
-  USE var_lookup,only:maxvarForc      ! forcing data:             maximum number variables
-  USE var_lookup,only:maxvarAttr      ! attributes:               maximum number variables
-  USE var_lookup,only:maxvarType      ! type index:               maximum number variables
-  USE var_lookup,only:maxvarId        ! IDs index:                maximum number variables
-  USE var_lookup,only:maxvarProg      ! prognostic variables:     maximum number variables
-  USE var_lookup,only:maxvarDiag      ! diagnostic variables:     maximum number variables
-  USE var_lookup,only:maxvarFlux      ! model fluxes:             maximum number variables
-  USE var_lookup,only:maxvarDeriv     ! model derivatives:        maximum number variables
-  USE var_lookup,only:maxvarIndx      ! model indices:            maximum number variables
-  USE var_lookup,only:maxvarMpar      ! model parameters:         maximum number variables
-  USE var_lookup,only:maxvarBvar      ! basin-average variables:  maximum number variables
-  USE var_lookup,only:maxvarBpar      ! basin-average parameters: maximum number variables
-  USE var_lookup,only:maxvarDecisions ! maximum number of decisions
-  USE var_lookup,only:maxvarFreq      ! maximum number of output files
-  USE var_lookup,only:maxvarLookup
-  implicit none
-  private
-
-  ! ----------------------------------------------------------------------------------------------------------------
-  ! * part 1: parameters that are fixed across multiple instantiations
-  ! ----------------------------------------------------------------------------------------------------------------
-
-  ! define missing values                      ! master summa data type
-
-  ! define missing values
-  real(rkind),parameter,public                :: quadMissing    = nr_quadMissing    ! (from nrtype) missing quadruple precision number
-  real(rkind),parameter,public                :: realMissing    = nr_realMissing    ! (from nrtype) missing double precision number
-  integer(i4b),parameter,public               :: integerMissing = nr_integerMissing ! (from nrtype) missing integer
-
-  ! define run modes
-  integer(i4b),parameter,public               :: iRunModeFull=1          ! named variable defining running mode as full run (all GRUs)
-  integer(i4b),parameter,public               :: iRunModeGRU=2           ! named variable defining running mode as GRU-parallelization run (GRU subset)
-  integer(i4b),parameter,public               :: iRunModeHRU=3           ! named variable defining running mode as single-HRU run (ONE HRU)
-
-
-  ! define progress modes
-  integer(i4b),parameter,public               :: ixProgress_im=1000      ! named variable to print progress once per month
-  integer(i4b),parameter,public               :: ixProgress_id=1001      ! named variable to print progress once per day
-  integer(i4b),parameter,public               :: ixProgress_ih=1002      ! named variable to print progress once per hour
-  integer(i4b),parameter,public               :: ixProgress_never=1003   ! named variable to print progress never
-  integer(i4b),parameter,public               :: ixProgress_it=1004      ! named variable to print progress every timestep
-
-  ! define restart frequency
-  integer(i4b),parameter,public               :: ixRestart_iy=1000       ! named variable to print a re-start file once per year
-  integer(i4b),parameter,public               :: ixRestart_im=1001       ! named variable to print a re-start file once per month
-  integer(i4b),parameter,public               :: ixRestart_id=1002       ! named variable to print a re-start file once per day
-  integer(i4b),parameter,public               :: ixRestart_end=1003      ! named variable to print a re-start file at the end of a run
-  integer(i4b),parameter,public               :: ixRestart_never=1004    ! named variable to print a re-start file never
-
-  ! define output file frequency
-  integer(i4b),parameter,public               :: noNewFiles=1001         ! no new output files
-  integer(i4b),parameter,public               :: newFileEveryOct1=1002   ! create a new file on Oct 1 every year (start of the USA water year)
-  ! =======-------
-  type(var_dlength),pointer,public            :: fluxStructLateralFlow(:)   !  model fluxes
-
-  ! define named variables for "yes" and "no"
-  integer(i4b),parameter,public               :: no=0                    ! .false.
-  integer(i4b),parameter,public               :: yes=1                   ! .true.
-
-  ! define named variables to describe the domain type
-  integer(i4b),parameter,public               :: iname_cas =1000         ! named variable to denote a canopy air space state variable
-  integer(i4b),parameter,public               :: iname_veg =1001         ! named variable to denote a vegetation state variable
-  integer(i4b),parameter,public               :: iname_soil=1002         ! named variable to denote a soil layer
-  integer(i4b),parameter,public               :: iname_snow=1003         ! named variable to denote a snow layer
-  integer(i4b),parameter,public               :: iname_aquifer=1004      ! named variable to denote a snow layer
-
-  ! define named variables to describe the state variable type
-  integer(i4b),parameter,public               :: iname_nrgCanair=2001    ! named variable defining the energy of the canopy air space
-  integer(i4b),parameter,public               :: iname_nrgCanopy=2002    ! named variable defining the energy of the vegetation canopy
-  integer(i4b),parameter,public               :: iname_watCanopy=2003    ! named variable defining the mass of total water on the vegetation canopy
-  integer(i4b),parameter,public               :: iname_liqCanopy=2004    ! named variable defining the mass of liquid water on the vegetation canopy
-  integer(i4b),parameter,public               :: iname_nrgLayer=3001     ! named variable defining the energy state variable for snow+soil layers
-  integer(i4b),parameter,public               :: iname_watLayer=3002     ! named variable defining the total water state variable for snow+soil layers
-  integer(i4b),parameter,public               :: iname_liqLayer=3003     ! named variable defining the liquid  water state variable for snow+soil layers
-  integer(i4b),parameter,public               :: iname_matLayer=3004     ! named variable defining the matric head state variable for soil layers
-  integer(i4b),parameter,public               :: iname_lmpLayer=3005     ! named variable defining the liquid matric potential state variable for soil layers
-  integer(i4b),parameter,public               :: iname_watAquifer=3006   ! named variable defining the water storage in the aquifer
-
-  ! define named variables to describe the form and structure of the band-diagonal matrices used in the numerical solver
-  ! NOTE: This indexing scheme provides the matrix structure expected by lapack. Specifically, lapack requires kl extra rows for additional storage.
-  !       Consequently, all indices are offset by kl and the total number of bands for storage is 2*kl+ku+1 instead of kl+ku+1.
-  integer(i4b),parameter,public               :: nRHS=1                  ! number of unknown variables on the RHS of the linear system A.X=B
-  integer(i4b),parameter,public               :: ku=3                    ! number of super-diagonal bands
-  integer(i4b),parameter,public               :: kl=4                    ! number of sub-diagonal bands
-  integer(i4b),parameter,public               :: ixDiag=kl+ku+1          ! index for the diagonal band
-  integer(i4b),parameter,public               :: nBands=2*kl+ku+1        ! length of the leading dimension of the band diagonal matrix
-
-  ! define named variables for the type of matrix used in the numerical solution.
-  integer(i4b),parameter,public               :: ixFullMatrix=1001       ! named variable for the full Jacobian matrix
-  integer(i4b),parameter,public               :: ixBandMatrix=1002       ! named variable for the band diagonal matrix
-
-  ! define indices describing the first and last layers of the Jacobian to print (for debugging)
-  integer(i4b),parameter,public               :: iJac1=16                ! first layer of the Jacobian to print
-  integer(i4b),parameter,public               :: iJac2=20                ! last layer of the Jacobian to print
-
-  ! define limit checks
-  real(rkind),parameter,public                :: verySmall=tiny(1.0_dp)  ! a very small number
-  real(rkind),parameter,public                :: veryBig=1.e+20_dp       ! a very big number
-
-  ! define algorithmic control parameters
-  real(rkind),parameter,public                :: dx = 1.e-8_dp           ! finite difference increment
-
-  ! define summary information on all data structures
-  integer(i4b),parameter                      :: nStruct=14              ! number of data structures
-  type(struct_info),parameter,public,dimension(nStruct) :: structInfo=(/&
-                   struct_info('time',  'TIME' , maxvarTime ), &        ! the time data structure
-                   struct_info('forc',  'FORCE', maxvarForc ), &        ! the forcing data structure
-                   struct_info('attr',  'ATTR' , maxvarAttr ), &        ! the attribute data structure
-                   struct_info('type',  'TYPE' , maxvarType ), &        ! the type data structure
-                   struct_info('id'  ,  'ID'   , maxvarId   ), &        ! the type data structure
-                   struct_info('mpar',  'PARAM', maxvarMpar ), &        ! the model parameter data structure
-                   struct_info('bpar',  'BPAR' , maxvarBpar ), &        ! the basin parameter data structure
-                   struct_info('bvar',  'BVAR' , maxvarBvar ), &        ! the basin variable data structure
-                   struct_info('indx',  'INDEX', maxvarIndx ), &        ! the model index data structure
-                   struct_info('prog',  'PROG',  maxvarProg ), &        ! the prognostic (state) variable data structure
-                   struct_info('diag',  'DIAG' , maxvarDiag ), &        ! the diagnostic variable data structure
-                   struct_info('flux',  'FLUX' , maxvarFlux ), &        ! the flux data structure
-                   struct_info('deriv', 'DERIV', maxvarDeriv), &        ! the model derivative data structure
-                   struct_info('lookup', 'LOOKUP',maxvarLookup) /)
-  ! fixed model decisions
-  logical(lgt)          , parameter, public   :: overwriteRSMIN=.false.  ! flag to overwrite RSMIN
-  integer(i4b)          , parameter, public   :: maxSoilLayers=10000     ! Maximum Number of Soil Layers
-
-  ! ----------------------------------------------------------------------------------------------------------------
-  ! * part 2: globally constant variables/structures that require initialization
-  ! ----------------------------------------------------------------------------------------------------------------
-
-  ! define Indian bread (NaN)
-  real(rkind),save,public                        :: dNaN
-
-  ! define default parameter values and parameter bounds
-  type(par_info),save,public                  :: localParFallback(maxvarMpar) ! local column default parameters
-  type(par_info),save,public                  :: basinParFallback(maxvarBpar) ! basin-average default parameters
-
-  ! define vectors of metadata
-  type(var_info),save,public                  :: time_meta(maxvarTime)        ! model time information
-  type(var_info),save,public                  :: forc_meta(maxvarForc)        ! model forcing data
-  type(var_info),save,public                  :: attr_meta(maxvarAttr)        ! local attributes
-  type(var_info),save,public                  :: type_meta(maxvarType)        ! local classification of veg, soil, etc.
-  type(var_info),save,public                  :: id_meta(maxvarId)            ! local classification of veg, soil, etc.
-  type(var_info),save,public                  :: mpar_meta(maxvarMpar)        ! local model parameters for each HRU
-  type(var_info),save,public                  :: indx_meta(maxvarIndx)        ! local model indices for each HRU
-  type(var_info),save,public                  :: prog_meta(maxvarProg)        ! local state variables for each HRU
-  type(var_info),save,public                  :: diag_meta(maxvarDiag)        ! local diagnostic variables for each HRU
-  type(var_info),save,public                  :: flux_meta(maxvarFlux)        ! local model fluxes for each HRU
-  type(var_info),save,public                  :: deriv_meta(maxvarDeriv)      ! local model derivatives for each HRU
-  type(var_info),save,public                  :: lookup_meta(maxvarLookup)    ! local lookup tables for each HRU
-  type(var_info),save,public                  :: bpar_meta(maxvarBpar)        ! basin parameters for aggregated processes
-  type(var_info),save,public                  :: bvar_meta(maxvarBvar)        ! basin variables for aggregated processes
-
-  ! ancillary metadata structures
-  type(flux2state),   save,public             :: flux2state_orig(maxvarFlux)  ! named variables for the states affected by each flux (original)
-  type(flux2state),   save,public             :: flux2state_liq(maxvarFlux)   ! named variables for the states affected by each flux (liquid water)
-  type(extended_info),save,public,allocatable :: averageFlux_meta(:)          ! timestep-average model fluxes
-
-  ! mapping from original to child structures
-  integer(i4b),save,public,allocatable        :: forcChild_map(:)             ! index of the child data structure: stats forc
-  integer(i4b),save,public,allocatable        :: progChild_map(:)             ! index of the child data structure: stats prog
-  integer(i4b),save,public,allocatable        :: diagChild_map(:)             ! index of the child data structure: stats diag
-  integer(i4b),save,public,allocatable        :: fluxChild_map(:)             ! index of the child data structure: stats flux
-  integer(i4b),save,public,allocatable        :: indxChild_map(:)             ! index of the child data structure: stats indx
-  integer(i4b),save,public,allocatable        :: bvarChild_map(:)             ! index of the child data structure: stats bvar
-
-  ! child metadata structures
-  type(extended_info),save,public,allocatable :: statForc_meta(:)             ! child metadata for stats
-  type(extended_info),save,public,allocatable :: statProg_meta(:)             ! child metadata for stats
-  type(extended_info),save,public,allocatable :: statDiag_meta(:)             ! child metadata for stats
-  type(extended_info),save,public,allocatable :: statFlux_meta(:)             ! child metadata for stats
-  type(extended_info),save,public,allocatable :: statIndx_meta(:)             ! child metadata for stats
-  type(extended_info),save,public,allocatable :: statBvar_meta(:)             ! child metadata for stats
-
-  ! ----------------------------------------------------------------------------------------------------------------
-  ! * part 3: run time variables
-  ! ----------------------------------------------------------------------------------------------------------------
-
-  ! define the model decisions
-  type(model_options),save,public                :: model_decisions(maxvarDecisions)  ! the model decision structure
-
-  ! define index variables describing the indices of the first and last HRUs in the forcing file
-  integer(i4b),save,public                       :: ixHRUfile_min                     ! minimum index
-  integer(i4b),save,public                       :: ixHRUfile_max                     ! maximum index
-
-  ! define mapping structures
-  type(gru2hru_map),allocatable,save,public      :: gru_struc(:)                      ! gru2hru map
-  type(hru2gru_map),allocatable,save,public      :: index_map(:)                      ! hru2gru map
-
-  ! define variables used for the vegetation phenology
-  real(rkind),dimension(12),save,public          :: greenVegFrac_monthly              ! fraction of green vegetation in each month (0-1)
-
-  ! define the model output file
-  character(len=256),save,public                 :: fileout=''                        ! output filename
-  character(len=256),save,public                 :: output_fileSuffix=''              ! suffix for the output file
-
-  ! define controls on model output
-  logical(lgt),dimension(maxvarFreq),save,public :: finalizeStats=.false.          ! flags to reset statistics
-  integer(i4b),save,public                       :: maxLayers                      ! maximum number of layers
-  integer(i4b),save,public                       :: maxSnowLayers                  ! maximum number of snow layers
-
-  ! define control variables
-  integer(i4b),save,public                       :: startGRU                          ! index of the starting GRU for parallelization run
-  integer(i4b),save,public                       :: checkHRU                          ! index of the HRU for a single HRU run
-  integer(i4b),save,public                       :: iRunMode                          ! define the current running mode
-  integer(i4b),save,public                       :: nThreads=1                        ! number of threads
-  integer(i4b),save,public                       :: ixProgress=ixProgress_id          ! define frequency to write progress
-  integer(i4b),save,public                       :: ixRestart=ixRestart_never         ! define frequency to write restart files
-  integer(i4b),save,public                       :: newOutputFile=noNewFiles          ! define option for new output files
-
-  ! define common variables
-  integer(i4b),save,public                       :: numtim                      ! number of time steps
-  integer(i4b),save,public                       :: nHRUrun                     ! number of HRUs in the run domain
-  integer(i4b),save,public                       :: nGRUrun                     ! number of GRUs in the run domain
-  real(rkind),save,public                        :: data_step                   ! length of the time_step
-  real(rkind),save,public                        :: dJulianStart                ! julian day of start time of simulation
-  real(rkind),save,public                        :: dJulianFinsh                ! julian day of end time of simulation
-  real(rkind),save,public                        :: refJulday                   ! reference time in fractional julian days
-  real(rkind),save,public                        :: refJulday_data              ! reference time in fractional julian days (data files)
-  integer(i4b),save,public                       :: nHRUfile                    ! number of HRUs in the file
-  integer(i4b),save,public                       :: urbanVegCategory            ! vegetation category for urban areas
-  logical(lgt),save,public                       :: doJacobian=.false.          ! flag to compute the Jacobian
-  logical(lgt),save,public                       :: globalPrintFlag=.false.     ! flag to compute the Jacobian
-  integer(i4b),save,public                       :: chunksize=1024              ! chunk size for the netcdf read/write
-  integer(i4b),save,public                       :: outputPrecision=nf90_double ! variable type
-  integer(i4b),save,public                    :: outputCompressionLevel=4             ! output netcdf file deflate level: 0-9. 0 is no compression.
-
-  ! define result from the time calls
-  integer(i4b),dimension(8),save,public          :: startInit,endInit       ! date/time for the start and end of the initialization
-  integer(i4b),dimension(8),save,public          :: startSetup,endSetup     ! date/time for the start and end of the parameter setup
-  integer(i4b),dimension(8),save,public          :: startRestart,endRestart ! date/time for the start and end to read restart data
-  integer(i4b),dimension(8),save,public          :: startRead,endRead       ! date/time for the start and end of the data read
-  integer(i4b),dimension(8),save,public          :: startWrite,endWrite     ! date/time for the start and end of the stats/write
-  integer(i4b),dimension(8),save,public          :: startPhysics,endPhysics ! date/time for the start and end of the physics
-
-
-
- ! define elapsed time
-  real(rkind),save,public                        :: elapsedInit             ! elapsed time for the initialization
-  real(rkind),save,public                        :: elapsedSetup            ! elapsed time for the parameter setup
-  real(rkind),save,public                        :: elapsedRestart          ! elapsed time to read restart data
-  real(rkind),save,public                        :: elapsedRead             ! elapsed time for the data read
-  real(rkind),save,public                        :: elapsedWrite            ! elapsed time for the stats/write
-  real(rkind),save,public                        :: elapsedPhysics          ! elapsed time for the physics
-
-  ! define ancillary data structures
-  type(var_i),save,public                        :: startTime               ! start time for the model simulation
-  type(var_i),save,public                        :: finshTime               ! end time for the model simulation
-  type(var_i),save,public                        :: refTime                 ! reference time for the model simulation
-  type(var_i),save,public                        :: oldTime                 ! time for the previous model time step
-
-
-  ! output file information
-  logical(lgt),dimension(maxvarFreq),save,public  :: outFreq              ! true if the output frequency is desired
-  integer(i4b),dimension(maxvarFreq),save,public  :: ncid                 ! netcdf output file id
-
- 
-  ! look-up values for the choice of the time zone information (formerly in modelDecisions module)
-  integer(i4b),parameter,public                  :: ncTime=1                ! time zone information from NetCDF file (timeOffset = longitude/15. - ncTimeOffset)
-  integer(i4b),parameter,public                  :: utcTime=2               ! all times in UTC (timeOffset = longitude/15. hours)
-  integer(i4b),parameter,public                  :: localTime=3             ! all times local (timeOffset = 0)
-
-
-  !!!!!!!!!!!!!!!!!!GLOBAL DATA STRUCTURES THAT ARE MANAGED BY FILEACCESSACTOR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  type(var_forc),allocatable,save,public          :: forcingDataStruct(:)      ! forcingDataStruct(:)%var(:)%dataFromFile(:,:)
-  type(dlength),allocatable,save,public           :: vecTime(:)
-  logical(lgt),allocatable,save,public            :: failedHRUs(:)             ! list of true and false values to indicate if an HRU has failed           
-  type(ilength),allocatable,save,public           :: outputTimeStep(:)  ! timestep in output files
-  ! inital conditions
-  type(init_cond),allocatable,save,public         :: init_cond_prog(:)   ! variable data for initial conditions
-  type(init_cond),allocatable,save,public         :: init_cond_bvar(:)   ! variable data for initial conditions
-  !!!!!!!!!!!!!!!!!!GLOBAL DATA STRUCTURES THAT ARE MANAGED BY FILEACCESSACTOR !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-  ! define fixed dimensions
-  integer(i4b),parameter,public                   :: nBand=2          ! number of spectral bands
-  integer(i4b),parameter,public                   :: nTimeDelay=2000  ! number of hours in the time delay histogram (default: ~1 season = 24*365/4)
-
-
-  character(len=1024),public,save                 :: fname                         ! temporary filename
-
-END MODULE globalData
diff --git a/build/source/dshare/var_lookup.f90 b/build/source/dshare/var_lookup.f90
deleted file mode 100755
index 4b430ca5691e5483fe369c99c25884bf6004f3f2..0000000000000000000000000000000000000000
--- a/build/source/dshare/var_lookup.f90
+++ /dev/null
@@ -1,898 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-MODULE var_lookup
- ! defines named variables used to index array elements
- USE, intrinsic :: iso_c_binding
- USE nrtype, integerMissing=>nr_integerMissing
- implicit none
- private
- ! local variables
- integer(i4b),parameter            :: ixVal =1                      ! an example 4 byte integer
- integer(8),parameter              :: ix8Val=2                      ! an example 8 byte integer
- integer(i4b),parameter            :: iLength =storage_size(ixVal)   ! size of the example 4 byte integer
- integer(i4b),parameter            :: i8Length=storage_size(ix8Val)  ! size of the example 8 byte integer
-
- ! ***************************************************************************************
- ! (0) define model decisions
- ! ***************************************************************************************
- type, public  ::  iLook_decision
-  integer(i4b)    :: soilCatTbl = integerMissing     ! soil-category dateset
-  integer(i4b)    :: vegeParTbl = integerMissing     ! vegetation category dataset
-  integer(i4b)    :: soilStress = integerMissing     ! choice of function for the soil moisture control on stomatal resistance
-  integer(i4b)    :: stomResist = integerMissing     ! choice of function for stomatal resistance
-  integer(i4b)    :: bbTempFunc = integerMissing     ! Ball-Berry: leaf temperature controls on photosynthesis + stomatal resistance
-  integer(i4b)    :: bbHumdFunc = integerMissing     ! Ball-Berry: humidity controls on stomatal resistance
-  integer(i4b)    :: bbElecFunc = integerMissing     ! Ball-Berry: dependence of photosynthesis on PAR
-  integer(i4b)    :: bbCO2point = integerMissing     ! Ball-Berry: use of CO2 compensation point to calculate stomatal resistance
-  integer(i4b)    :: bbNumerics = integerMissing     ! Ball-Berry: iterative numerical solution method
-  integer(i4b)    :: bbAssimFnc = integerMissing     ! Ball-Berry: controls on carbon assimilation
-  integer(i4b)    :: bbCanIntg8 = integerMissing     ! Ball-Berry: scaling of photosynthesis from the leaf to the canopy
-  integer(i4b)    :: num_method = integerMissing     ! choice of numerical method
-  integer(i4b)    :: fDerivMeth = integerMissing     ! method used to calculate flux derivatives
-  integer(i4b)    :: LAI_method = integerMissing     ! method used to determine LAI and SAI
-  integer(i4b)    :: cIntercept = integerMissing     ! choice of parameterization for canopy interception
-  integer(i4b)    :: f_Richards = integerMissing     ! form of richards' equation
-  integer(i4b)    :: groundwatr = integerMissing     ! choice of groundwater parameterization
-  integer(i4b)    :: hc_profile = integerMissing     ! choice of hydraulic conductivity profile
-  integer(i4b)    :: bcUpprTdyn = integerMissing     ! type of upper boundary condition for thermodynamics
-  integer(i4b)    :: bcLowrTdyn = integerMissing     ! type of lower boundary condition for thermodynamics
-  integer(i4b)    :: bcUpprSoiH = integerMissing     ! type of upper boundary condition for soil hydrology
-  integer(i4b)    :: bcLowrSoiH = integerMissing     ! type of lower boundary condition for soil hydrology
-  integer(i4b)    :: veg_traits = integerMissing     ! choice of parameterization for vegetation roughness length and displacement height
-  integer(i4b)    :: rootProfil = integerMissing     ! choice of parameterization for the rooting profile
-  integer(i4b)    :: canopyEmis = integerMissing     ! choice of parameterization for canopy emissivity
-  integer(i4b)    :: snowIncept = integerMissing     ! choice of parameterization for snow interception
-  integer(i4b)    :: snowUnload = integerMissing     ! choice of parameterization for snow unloading
-  integer(i4b)    :: windPrfile = integerMissing     ! choice of canopy wind profile
-  integer(i4b)    :: astability = integerMissing     ! choice of stability function
-  integer(i4b)    :: canopySrad = integerMissing     ! choice of method for canopy shortwave radiation
-  integer(i4b)    :: alb_method = integerMissing     ! choice of albedo representation
-  integer(i4b)    :: snowLayers = integerMissing     ! choice of method to combine and sub-divide snow layers
-  integer(i4b)    :: compaction = integerMissing     ! choice of compaction routine
-  integer(i4b)    :: thCondSnow = integerMissing     ! choice of thermal conductivity representation for snow
-  integer(i4b)    :: thCondSoil = integerMissing     ! choice of thermal conductivity representation for soil
-  integer(i4b)    :: spatial_gw = integerMissing     ! choice of method for spatial representation of groundwater
-  integer(i4b)    :: subRouting = integerMissing     ! choice of method for sub-grid routing
-  integer(i4b)    :: snowDenNew = integerMissing     ! choice of method for new snow density
- endtype iLook_decision
-
- ! ***********************************************************************************************************
- ! (1) define model time
- ! ***********************************************************************************************************
- type, public  ::  iLook_time
-  integer(i4b)    :: iyyy       = integerMissing     ! year
-  integer(i4b)    :: im         = integerMissing     ! month
-  integer(i4b)    :: id         = integerMissing     ! day
-  integer(i4b)    :: ih         = integerMissing     ! hour
-  integer(i4b)    :: imin       = integerMissing     ! minute
-  integer(i4b)    :: ih_tz      = integerMissing     ! hour for time zone offset
-  integer(i4b)    :: imin_tz    = integerMissing     ! minute for time zone offset
- endtype iLook_time
-
- ! ***********************************************************************************************************
- ! (2) define model forcing data
- ! ***********************************************************************************************************
- type, public  ::  iLook_force
-  integer(i4b)    :: time       = integerMissing     ! time since time reference       (s)
-  integer(i4b)    :: pptrate    = integerMissing     ! precipitation rate              (kg m-2 s-1)
-  integer(i4b)    :: airtemp    = integerMissing     ! air temperature                 (K)
-  integer(i4b)    :: spechum    = integerMissing     ! specific humidity               (g/g)
-  integer(i4b)    :: windspd    = integerMissing     ! windspeed                       (m/s)
-  integer(i4b)    :: SWRadAtm   = integerMissing     ! downwelling shortwave radiaiton (W m-2)
-  integer(i4b)    :: LWRadAtm   = integerMissing     ! downwelling longwave radiation  (W m-2)
-  integer(i4b)    :: airpres    = integerMissing     ! pressure                        (Pa)
- endtype iLook_force
-
- ! ***********************************************************************************************************
- ! (3) define local attributes
- ! ***********************************************************************************************************
- type, public  ::  iLook_attr
-  integer(i4b)    :: latitude      = integerMissing  ! latitude (degrees north)
-  integer(i4b)    :: longitude     = integerMissing  ! longitude (degrees east)
-  integer(i4b)    :: elevation     = integerMissing  ! elevation (m)
-  integer(i4b)    :: tan_slope     = integerMissing  ! tan water table slope, taken as tan local ground surface slope (-)
-  integer(i4b)    :: contourLength = integerMissing  ! length of contour at downslope edge of HRU (m)
-  integer(i4b)    :: HRUarea       = integerMissing  ! area of each HRU  (m2)
-  integer(i4b)    :: mHeight       = integerMissing  ! measurement height above bare ground (m)
-  integer(i4b)    :: aspect        = integerMissing  ! mean azimuth of HRU (degrees E of N, range 0-360)
- end type iLook_attr
-
- ! ***********************************************************************************************************
- ! (4) define local classification of veg, soil, etc.; and gru and hru IDs and associated information
- ! ***********************************************************************************************************
- type, public  ::  iLook_type
-  integer(i4b)    :: vegTypeIndex  = integerMissing  ! index defining vegetation type (-)
-  integer(i4b)    :: soilTypeIndex = integerMissing  ! index defining soil type (-)
-  integer(i4b)    :: slopeTypeIndex= integerMissing  ! index defining slope (-)
-  integer(i4b)    :: downHRUindex  = integerMissing  ! index of downslope HRU (0 = basin outlet)
- end type iLook_type
-
- type, public  ::  iLook_id
-  integer(8)    :: hruId         = integerMissing  ! ID label defining hydrologic response unit (-)
- end type iLook_id
-
- ! ***********************************************************************************************************
- ! (5) define model parameters
- ! ***********************************************************************************************************
- type, public  ::  iLook_param
-  ! boundary conditions
-  integer(i4b)    :: upperBoundHead        = integerMissing    ! matric head of the upper boundary (m)
-  integer(i4b)    :: lowerBoundHead        = integerMissing    ! matric head of the lower boundary (m)
-  integer(i4b)    :: upperBoundTheta       = integerMissing    ! volumetric liquid water content of the upper boundary (-)
-  integer(i4b)    :: lowerBoundTheta       = integerMissing    ! volumetric liquid water content of the lower boundary (-)
-  integer(i4b)    :: upperBoundTemp        = integerMissing    ! temperature of the upper boundary (K)
-  integer(i4b)    :: lowerBoundTemp        = integerMissing    ! temperature of the lower boundary (K)
-  ! precipitation partitioning
-  integer(i4b)    :: tempCritRain          = integerMissing    ! critical temperature where precipitation is rain (K)
-  integer(i4b)    :: tempRangeTimestep     = integerMissing    ! temperature range over the time step (K)
-  integer(i4b)    :: frozenPrecipMultip    = integerMissing    ! frozen precipitation multiplier (-)
-  ! snow properties
-  integer(i4b)    :: snowfrz_scale         = integerMissing    ! scaling parameter for the freezing curve for snow (K-1)
-  integer(i4b)    :: fixedThermalCond_snow = integerMissing    ! fixed thermal conductivity for snow (W m-1 K-1)
-  ! snow albedo
-  integer(i4b)    :: albedoMax             = integerMissing    ! maximum snow albedo for a single spectral band (-)
-  integer(i4b)    :: albedoMinWinter       = integerMissing    ! minimum snow albedo during winter for a single spectral band (-)
-  integer(i4b)    :: albedoMinSpring       = integerMissing    ! minimum snow albedo during spring for a single spectral band (-)
-  integer(i4b)    :: albedoMaxVisible      = integerMissing    ! maximum snow albedo in the visible part of the spectrum (-)
-  integer(i4b)    :: albedoMinVisible      = integerMissing    ! minimum snow albedo in the visible part of the spectrum (-)
-  integer(i4b)    :: albedoMaxNearIR       = integerMissing    ! maximum snow albedo in the near infra-red part of the spectrum (-)
-  integer(i4b)    :: albedoMinNearIR       = integerMissing    ! minimum snow albedo in the near infra-red part of the spectrum (-)
-  integer(i4b)    :: albedoDecayRate       = integerMissing    ! albedo decay rate (s)
-  integer(i4b)    :: albedoSootLoad        = integerMissing    ! soot load factor (-)
-  integer(i4b)    :: albedoRefresh         = integerMissing    ! critical mass necessary for albedo refreshment (kg m-2)
-  ! radiation transfer within snow
-  integer(i4b)    :: radExt_snow           = integerMissing    ! extinction coefficient for radiation penetration into the snowpack (m-1)
-  integer(i4b)    :: directScale           = integerMissing    ! scaling factor for fractional driect radiaion parameterization (-)
-  integer(i4b)    :: Frad_direct           = integerMissing    ! maximum fraction of direct solar radiation (-)
-  integer(i4b)    :: Frad_vis              = integerMissing    ! fraction of radiation in the visible part of the spectrum (-)
-  ! new snow density
-  integer(i4b)    :: newSnowDenMin         = integerMissing    ! minimum new snow density (kg m-3)
-  integer(i4b)    :: newSnowDenMult        = integerMissing    ! multiplier for new snow density (kg m-3)
-  integer(i4b)    :: newSnowDenScal        = integerMissing    ! scaling factor for new snow density (K)
-  integer(i4b)    :: constSnowDen          = integerMissing    ! constDens, Constant new snow density (kg m-3)
-  integer(i4b)    :: newSnowDenAdd         = integerMissing    ! Pahaut 1976, additive factor for new snow density (kg m-3)
-  integer(i4b)    :: newSnowDenMultTemp    = integerMissing    ! Pahaut 1976, multiplier for new snow density applied to air temperature (kg m-3 K-1)
-  integer(i4b)    :: newSnowDenMultWind    = integerMissing    ! Pahaut 1976, multiplier for new snow density applied to wind speed (kg m-7/2 s-1/2)
-  integer(i4b)    :: newSnowDenMultAnd     = integerMissing    ! Anderson 1976, multiplier for new snow density for Anderson function (K-1)
-  integer(i4b)    :: newSnowDenBase        = integerMissing    ! Anderson 1976, base value that is rasied to the (3/2) power (K)
-  ! snow compaction
-  integer(i4b)    :: densScalGrowth        = integerMissing    ! density scaling factor for grain growth (kg-1 m3)
-  integer(i4b)    :: tempScalGrowth        = integerMissing    ! temperature scaling factor for grain growth (K-1)
-  integer(i4b)    :: grainGrowthRate       = integerMissing    ! rate of grain growth (s-1)
-  integer(i4b)    :: densScalOvrbdn        = integerMissing    ! density scaling factor for overburden pressure (kg-1 m3)
-  integer(i4b)    :: tempScalOvrbdn        = integerMissing    ! temperature scaling factor for overburden pressure (K-1)
-  integer(i4b)    :: baseViscosity         = integerMissing    ! viscosity coefficient at T=T_frz and snow density=0  (kg s m-2)
-  ! water flow within snow
-  integer(i4b)    :: Fcapil                = integerMissing    ! capillary retention as a fraction of the total pore volume (-)
-  integer(i4b)    :: k_snow                = integerMissing    ! hydraulic conductivity of snow (m s-1), 0.0055 = approx. 20 m/hr, from UEB
-  integer(i4b)    :: mw_exp                = integerMissing    ! exponent for meltwater flow (-)
-  ! turbulent heat fluxes
-  integer(i4b)    :: z0Snow                = integerMissing    ! roughness length of snow (m)
-  integer(i4b)    :: z0Soil                = integerMissing    ! roughness length of bare soil below the canopy (m)
-  integer(i4b)    :: z0Canopy              = integerMissing    ! roughness length of the canopy (m)
-  integer(i4b)    :: zpdFraction           = integerMissing    ! zero plane displacement / canopy height (-)
-  integer(i4b)    :: critRichNumber        = integerMissing    ! critical value for the bulk Richardson number (-)
-  integer(i4b)    :: Louis79_bparam        = integerMissing    ! parameter in Louis (1979) stability function (-)
-  integer(i4b)    :: Louis79_cStar         = integerMissing    ! parameter in Louis (1979) stability function (-)
-  integer(i4b)    :: Mahrt87_eScale        = integerMissing    ! exponential scaling factor in the Mahrt (1987) stability function (-)
-  integer(i4b)    :: leafExchangeCoeff     = integerMissing    ! turbulent exchange coeff between canopy surface and canopy air ( m s-(1/2) )
-  integer(i4b)    :: windReductionParam    = integerMissing    ! canopy wind reduction parameter (-)
-  ! stomatal conductance
-  integer(i4b)    :: Kc25                  = integerMissing    ! Michaelis-Menten constant for CO2 at 25 degrees C (umol mol-1)
-  integer(i4b)    :: Ko25                  = integerMissing    ! Michaelis-Menten constant for O2 at 25 degrees C (mol mol-1)
-  integer(i4b)    :: Kc_qFac               = integerMissing    ! factor in the q10 function defining temperature controls on Kc (-)
-  integer(i4b)    :: Ko_qFac               = integerMissing    ! factor in the q10 function defining temperature controls on Ko (-)
-  integer(i4b)    :: kc_Ha                 = integerMissing    ! activation energy for the Michaelis-Menten constant for CO2 (J mol-1)
-  integer(i4b)    :: ko_Ha                 = integerMissing    ! activation energy for the Michaelis-Menten constant for O2 (J mol-1)
-  integer(i4b)    :: vcmax25_canopyTop     = integerMissing    ! potential carboxylation rate at 25 degrees C at the canopy top (umol co2 m-2 s-1)
-  integer(i4b)    :: vcmax_qFac            = integerMissing    ! factor in the q10 function defining temperature controls on vcmax (-)
-  integer(i4b)    :: vcmax_Ha              = integerMissing    ! activation energy in the vcmax function (J mol-1)
-  integer(i4b)    :: vcmax_Hd              = integerMissing    ! deactivation energy in the vcmax function (J mol-1)
-  integer(i4b)    :: vcmax_Sv              = integerMissing    ! entropy term in the vcmax function (J mol-1 K-1)
-  integer(i4b)    :: vcmax_Kn              = integerMissing    ! foliage nitrogen decay coefficient (-)
-  integer(i4b)    :: jmax25_scale          = integerMissing    ! scaling factor to relate jmax25 to vcmax25 (-)
-  integer(i4b)    :: jmax_Ha               = integerMissing    ! activation energy in the jmax function (J mol-1)
-  integer(i4b)    :: jmax_Hd               = integerMissing    ! deactivation energy in the jmax function (J mol-1)
-  integer(i4b)    :: jmax_Sv               = integerMissing    ! entropy term in the jmax function (J mol-1 K-1)
-  integer(i4b)    :: fractionJ             = integerMissing    ! fraction of light lost by other than the chloroplast lamellae (-)
-  integer(i4b)    :: quantamYield          = integerMissing    ! quantam yield (mol e mol-1 q)
-  integer(i4b)    :: vpScaleFactor         = integerMissing    ! vapor pressure scaling factor in stomatal conductance function (Pa)
-  integer(i4b)    :: cond2photo_slope      = integerMissing    ! slope of conductance-photosynthesis relationship (-)
-  integer(i4b)    :: minStomatalConductance= integerMissing    ! minimum stomatal conductance (umol H2O m-2 s-1)
-  ! vegetation properties
-  integer(i4b)    :: winterSAI             = integerMissing    ! stem area index prior to the start of the growing season (m2 m-2)
-  integer(i4b)    :: summerLAI             = integerMissing    ! maximum leaf area index at the peak of the growing season (m2 m-2)
-  integer(i4b)    :: rootScaleFactor1      = integerMissing    ! 1st scaling factor (a) in Y = 1 - 0.5*( exp(-aZ) + exp(-bZ) )  (m-1)
-  integer(i4b)    :: rootScaleFactor2      = integerMissing    ! 2nd scaling factor (b) in Y = 1 - 0.5*( exp(-aZ) + exp(-bZ) )  (m-1)
-  integer(i4b)    :: rootingDepth          = integerMissing    ! rooting depth (m)
-  integer(i4b)    :: rootDistExp           = integerMissing    ! exponent controlling the vertical distribution of root density (-)
-  integer(i4b)    :: plantWiltPsi          = integerMissing    ! matric head at wilting point (m)
-  integer(i4b)    :: soilStressParam       = integerMissing    ! parameter in the exponential soil stress function
-  integer(i4b)    :: critSoilWilting       = integerMissing    ! critical vol. liq. water content when plants are wilting (-)
-  integer(i4b)    :: critSoilTranspire     = integerMissing    ! critical vol. liq. water content when transpiration is limited (-)
-  integer(i4b)    :: critAquiferTranspire  = integerMissing    ! critical aquifer storage value when transpiration is limited (m)
-  integer(i4b)    :: minStomatalResistance = integerMissing    ! minimum canopy resistance (s m-1)
-  integer(i4b)    :: leafDimension         = integerMissing    ! characteristic leaf dimension (m)
-  integer(i4b)    :: heightCanopyTop       = integerMissing    ! height of top of the vegetation canopy above ground surface (m)
-  integer(i4b)    :: heightCanopyBottom    = integerMissing    ! height of bottom of the vegetation canopy above ground surface (m)
-  integer(i4b)    :: specificHeatVeg       = integerMissing    ! specific heat of vegetation (J kg-1 K-1)
-  integer(i4b)    :: maxMassVegetation     = integerMissing    ! maximum mass of vegetation (full foliage) (kg m-2)
-  integer(i4b)    :: throughfallScaleSnow  = integerMissing    ! scaling factor for throughfall (snow) (-)
-  integer(i4b)    :: throughfallScaleRain  = integerMissing    ! scaling factor for throughfall (rain) (-)
-  integer(i4b)    :: refInterceptCapSnow   = integerMissing    ! reference canopy interception capacity per unit leaf area (snow) (kg m-2)
-  integer(i4b)    :: refInterceptCapRain   = integerMissing    ! canopy interception capacity per unit leaf area (rain) (kg m-2)
-  integer(i4b)    :: snowUnloadingCoeff    = integerMissing    ! time constant for unloading of snow from the forest canopy (s-1)
-  integer(i4b)    :: canopyDrainageCoeff   = integerMissing    ! time constant for drainage of liquid water from the forest canopy (s-1)
-  integer(i4b)    :: ratioDrip2Unloading   = integerMissing    ! ratio of canopy drip to unloading of snow from the forest canopy (-)
-  integer(i4b)    :: canopyWettingFactor   = integerMissing    ! maximum wetted fraction of the canopy (-)
-  integer(i4b)    :: canopyWettingExp      = integerMissing    ! exponent in canopy wetting function (-)
-  integer(i4b)    :: minTempUnloading      = integerMissing    ! constant describing the minimum temperature for snow unloading in windySnow parameterization (K)
-  integer(i4b)    :: rateTempUnloading     = integerMissing    ! constant describing how quickly snow will unload due to temperature in windySnow parameterization (K s)
-  integer(i4b)    :: minWindUnloading      = integerMissing    ! constant describing the minimum windspeed for snow unloading in windySnow parameterization (m  s-1)
-  integer(i4b)    :: rateWindUnloading     = integerMissing    ! constant describing how quickly snow will unload due to wind in windySnow parameterization (m)
-  ! soil properties
-  integer(i4b)    :: soil_dens_intr        = integerMissing    ! intrinsic soil density (kg m-3)
-  integer(i4b)    :: thCond_soil           = integerMissing    ! thermal conductivity of soil (W m-1 K-1)
-  integer(i4b)    :: frac_sand             = integerMissing    ! fraction of sand (-)
-  integer(i4b)    :: frac_silt             = integerMissing    ! fraction of silt (-)
-  integer(i4b)    :: frac_clay             = integerMissing    ! fraction of clay (-)
-  integer(i4b)    :: fieldCapacity         = integerMissing    ! field capacity (-)
-  integer(i4b)    :: wettingFrontSuction   = integerMissing    ! Green-Ampt wetting front suction (m)
-  integer(i4b)    :: theta_mp              = integerMissing    ! volumetric liquid water content when macropore flow begins (-)
-  integer(i4b)    :: theta_sat             = integerMissing    ! porosity (-)
-  integer(i4b)    :: theta_res             = integerMissing    ! volumetric residual water content (-)
-  integer(i4b)    :: vGn_alpha             = integerMissing    ! van Genuchten "alpha" parameter (m-1)
-  integer(i4b)    :: vGn_n                 = integerMissing    ! van Genuchten "n" parameter (-)
-  integer(i4b)    :: mpExp                 = integerMissing    ! empirical exponent in macropore flow equation (-)
-  integer(i4b)    :: k_soil                = integerMissing    ! hydraulic conductivity of soil (m s-1)
-  integer(i4b)    :: k_macropore           = integerMissing    ! saturated hydraulic conductivity for macropores (m s-1)
-  integer(i4b)    :: kAnisotropic          = integerMissing    ! anisotropy factor for lateral hydraulic conductivity (-)
-  integer(i4b)    :: zScale_TOPMODEL       = integerMissing    ! TOPMODEL scaling factor used in lower boundary condition for soil (m)
-  integer(i4b)    :: compactedDepth        = integerMissing    ! depth where k_soil reaches the compacted value given by CH78 (m)
-  integer(i4b)    :: aquiferBaseflowRate   = integerMissing    ! baseflow rate when aquifer storage = aquiferScaleFactor (m s-1)
-  integer(i4b)    :: aquiferScaleFactor    = integerMissing    ! scaling factor for aquifer storage in the big bucket (m)
-  integer(i4b)    :: aquiferBaseflowExp    = integerMissing    ! baseflow exponent (-)
-  integer(i4b)    :: qSurfScale            = integerMissing    ! scaling factor in the surface runoff parameterization (-)
-  integer(i4b)    :: specificYield         = integerMissing    ! specific yield (-)
-  integer(i4b)    :: specificStorage       = integerMissing    ! specific storage coefficient (m-1)
-  integer(i4b)    :: f_impede              = integerMissing    ! ice impedence factor (-)
-  integer(i4b)    :: soilIceScale          = integerMissing    ! scaling factor for depth of soil ice, used to get frozen fraction (m)
-  integer(i4b)    :: soilIceCV             = integerMissing    ! CV of depth of soil ice, used to get frozen fraction (-)
-  ! algorithmic control parameters
-  integer(i4b)    :: minwind               = integerMissing    ! minimum wind speed (m s-1)
-  integer(i4b)    :: minstep               = integerMissing    ! minimum length of the time step
-  integer(i4b)    :: maxstep               = integerMissing    ! maximum length of the time step
-  integer(i4b)    :: wimplicit             = integerMissing    ! weight assigned to the start-of-step fluxes
-  integer(i4b)    :: maxiter               = integerMissing    ! maximum number of iteration
-  integer(i4b)    :: relConvTol_liquid     = integerMissing    ! relative convergence tolerance for vol frac liq water (-)
-  integer(i4b)    :: absConvTol_liquid     = integerMissing    ! absolute convergence tolerance for vol frac liq water (-)
-  integer(i4b)    :: relConvTol_matric     = integerMissing    ! relative convergence tolerance for matric head (-)
-  integer(i4b)    :: absConvTol_matric     = integerMissing    ! absolute convergence tolerance for matric head (m)
-  integer(i4b)    :: relConvTol_energy     = integerMissing    ! relative convergence tolerance for energy (-)
-  integer(i4b)    :: absConvTol_energy     = integerMissing    ! absolute convergence tolerance for energy (J m-3)
-  integer(i4b)    :: relConvTol_aquifr     = integerMissing    ! relative convergence tolerance for aquifer storage (-)
-  integer(i4b)    :: absConvTol_aquifr     = integerMissing    ! absolute convergence tolerance for aquifer storage (J m-3)
-  integer(i4b)    :: zmin                  = integerMissing    ! minimum layer depth (m)
-  integer(i4b)    :: zmax                  = integerMissing    ! maximum layer depth (m)
-  integer(i4b)    :: zminLayer1            = integerMissing    ! minimum layer depth for the 1st (top) layer (m)
-  integer(i4b)    :: zminLayer2            = integerMissing    ! minimum layer depth for the 2nd layer (m)
-  integer(i4b)    :: zminLayer3            = integerMissing    ! minimum layer depth for the 3rd layer (m)
-  integer(i4b)    :: zminLayer4            = integerMissing    ! minimum layer depth for the 4th layer (m)
-  integer(i4b)    :: zminLayer5            = integerMissing    ! minimum layer depth for the 5th (bottom) layer (m)
-  integer(i4b)    :: zmaxLayer1_lower      = integerMissing    ! maximum layer depth for the 1st (top) layer when only 1 layer (m)
-  integer(i4b)    :: zmaxLayer2_lower      = integerMissing    ! maximum layer depth for the 2nd layer when only 2 layers (m)
-  integer(i4b)    :: zmaxLayer3_lower      = integerMissing    ! maximum layer depth for the 3rd layer when only 3 layers (m)
-  integer(i4b)    :: zmaxLayer4_lower      = integerMissing    ! maximum layer depth for the 4th layer when only 4 layers (m)
-  integer(i4b)    :: zmaxLayer1_upper      = integerMissing    ! maximum layer depth for the 1st (top) layer when > 1 layer (m)
-  integer(i4b)    :: zmaxLayer2_upper      = integerMissing    ! maximum layer depth for the 2nd layer when > 2 layers (m)
-  integer(i4b)    :: zmaxLayer3_upper      = integerMissing    ! maximum layer depth for the 3rd layer when > 3 layers (m)
-  integer(i4b)    :: zmaxLayer4_upper      = integerMissing    ! maximum layer depth for the 4th layer when > 4 layers (m)
- endtype ilook_param
-
- ! ***********************************************************************************************************
- ! (6) define model prognostic (state) variables
- ! ***********************************************************************************************************
- type, public :: iLook_prog
-  ! variables for time stepping
-  integer(i4b)    :: dt_init                     = integerMissing    ! length of initial time step at start of next data interval (s)
-  ! state variables for vegetation
-  integer(i4b)    :: scalarCanopyIce             = integerMissing    ! mass of ice on the vegetation canopy (kg m-2)
-  integer(i4b)    :: scalarCanopyLiq             = integerMissing    ! mass of liquid water on the vegetation canopy (kg m-2)
-  integer(i4b)    :: scalarCanopyWat             = integerMissing    ! mass of total water on the vegetation canopy (kg m-2)
-  integer(i4b)    :: scalarCanairTemp            = integerMissing    ! temperature of the canopy air space (Pa)
-  integer(i4b)    :: scalarCanopyTemp            = integerMissing    ! temperature of the vegetation canopy (K)
-  ! state variables for snow
-  integer(i4b)    :: spectralSnowAlbedoDiffuse   = integerMissing    ! diffuse snow albedo for individual spectral bands (-)
-  integer(i4b)    :: scalarSnowAlbedo            = integerMissing    ! snow albedo for the entire spectral band (-)
-  integer(i4b)    :: scalarSnowDepth             = integerMissing    ! total snow depth (m)
-  integer(i4b)    :: scalarSWE                   = integerMissing    ! snow water equivalent (kg m-2)
-  integer(i4b)    :: scalarSfcMeltPond           = integerMissing    ! ponded water caused by melt of the "snow without a layer" (kg m-2)
-  ! state variables for the snow+soil domain
-  integer(i4b)    :: mLayerTemp                  = integerMissing    ! temperature of each layer (K)
-  integer(i4b)    :: mLayerVolFracIce            = integerMissing    ! volumetric fraction of ice in each layer (-)
-  integer(i4b)    :: mLayerVolFracLiq            = integerMissing    ! volumetric fraction of liquid water in each layer (-)
-  integer(i4b)    :: mLayerVolFracWat            = integerMissing    ! volumetric fraction of total water in each layer (-)
-  integer(i4b)    :: mLayerMatricHead            = integerMissing    ! matric head of water in the soil (m)
-  ! other state variables
-  integer(i4b)    :: scalarAquiferStorage        = integerMissing    ! relative aquifer storage -- above bottom of the soil profile (m)
-  integer(i4b)    :: scalarSurfaceTemp           = integerMissing    ! surface temperature (K)
-  ! coordinate variables
-  integer(i4b)    :: mLayerDepth                 = integerMissing    ! depth of each layer (m)
-  integer(i4b)    :: mLayerHeight                = integerMissing    ! height at the mid-point of each layer (m)
-  integer(i4b)    :: iLayerHeight                = integerMissing    ! height of the layer interface; top of soil = 0 (m)
- endtype iLook_prog
-
- ! ***********************************************************************************************************
- ! (7) define diagnostic variables
- ! ***********************************************************************************************************
- type, public :: iLook_diag
-  ! local properties
-  integer(i4b)    :: scalarCanopyDepth               = integerMissing ! canopy depth (m)
-  integer(i4b)    :: scalarGreenVegFraction          = integerMissing ! green vegetation fraction used to compute LAI (-)
-  integer(i4b)    :: scalarBulkVolHeatCapVeg         = integerMissing ! bulk volumetric heat capacity of vegetation (J m-3 K-1)
-  integer(i4b)    :: scalarCanopyEmissivity          = integerMissing ! effective canopy emissivity (-)
-  integer(i4b)    :: scalarRootZoneTemp              = integerMissing ! average temperature of the root zone (K)
-  integer(i4b)    :: scalarLAI                       = integerMissing ! one-sided leaf area index (m2 m-2)
-  integer(i4b)    :: scalarSAI                       = integerMissing ! one-sided stem area index (m2 m-2)
-  integer(i4b)    :: scalarExposedLAI                = integerMissing ! exposed leaf area index after burial by snow (m2 m-2)
-  integer(i4b)    :: scalarExposedSAI                = integerMissing ! exposed stem area index after burial by snow (m2 m-2)
-  integer(i4b)    :: scalarAdjMeasHeight             = integerMissing ! adjusted measurement height for cases snowDepth>mHeight (m)
-  integer(i4b)    :: scalarCanopyIceMax              = integerMissing ! maximum interception storage capacity for ice (kg m-2)
-  integer(i4b)    :: scalarCanopyLiqMax              = integerMissing ! maximum interception storage capacity for liquid water (kg m-2)
-  integer(i4b)    :: scalarGrowingSeasonIndex        = integerMissing ! growing season index (0=off, 1=on)
-  integer(i4b)    :: scalarVolHtCap_air              = integerMissing ! volumetric heat capacity air (J m-3 K-1)
-  integer(i4b)    :: scalarVolHtCap_ice              = integerMissing ! volumetric heat capacity ice (J m-3 K-1)
-  integer(i4b)    :: scalarVolHtCap_soil             = integerMissing ! volumetric heat capacity dry soil (J m-3 K-1)
-  integer(i4b)    :: scalarVolHtCap_water            = integerMissing ! volumetric heat capacity liquid wat (J m-3 K-1)
-  integer(i4b)    :: mLayerVolHtCapBulk              = integerMissing ! volumetric heat capacity in each layer (J m-3 K-1)
-  integer(i4b)    :: scalarLambda_drysoil            = integerMissing ! thermal conductivity of dry soil     (W m-1 K-1)
-  integer(i4b)    :: scalarLambda_wetsoil            = integerMissing ! thermal conductivity of wet soil     (W m-1 K-1)
-  integer(i4b)    :: mLayerThermalC                  = integerMissing ! thermal conductivity at the mid-point of each layer (W m-1 K-1)
-  integer(i4b)    :: iLayerThermalC                  = integerMissing ! thermal conductivity at the interface of each layer (W m-1 K-1)
-  ! forcing
-  integer(i4b)    :: scalarVPair                     = integerMissing ! vapor pressure of the air above the vegetation canopy (Pa)
-  integer(i4b)    :: scalarVP_CanopyAir              = integerMissing ! vapor pressure of the canopy air space (Pa)
-  integer(i4b)    :: scalarTwetbulb                  = integerMissing ! wet bulb temperature (K)
-  integer(i4b)    :: scalarSnowfallTemp              = integerMissing ! temperature of fresh snow (K)
-  integer(i4b)    :: scalarNewSnowDensity            = integerMissing ! density of fresh snow (kg m-3)
-  integer(i4b)    :: scalarO2air                     = integerMissing ! atmospheric o2 concentration (Pa)
-  integer(i4b)    :: scalarCO2air                    = integerMissing ! atmospheric co2 concentration (Pa)
-  ! shortwave radiation
-  integer(i4b)    :: scalarCosZenith                 = integerMissing ! cosine of the solar zenith angle (0-1)
-  integer(i4b)    :: scalarFractionDirect            = integerMissing ! fraction of direct radiation (0-1)
-  integer(i4b)    :: scalarCanopySunlitFraction      = integerMissing ! sunlit fraction of canopy (-)
-  integer(i4b)    :: scalarCanopySunlitLAI           = integerMissing ! sunlit leaf area (-)
-  integer(i4b)    :: scalarCanopyShadedLAI           = integerMissing ! shaded leaf area (-)
-  integer(i4b)    :: spectralAlbGndDirect            = integerMissing ! direct  albedo of underlying surface for each spectral band (-)
-  integer(i4b)    :: spectralAlbGndDiffuse           = integerMissing ! diffuse albedo of underlying surface for each spectral band (-)
-  integer(i4b)    :: scalarGroundAlbedo              = integerMissing ! albedo of the ground surface (-)
-  ! turbulent heat transfer
-  integer(i4b)    :: scalarLatHeatSubVapCanopy       = integerMissing ! latent heat of sublimation/vaporization used for veg canopy (J kg-1)
-  integer(i4b)    :: scalarLatHeatSubVapGround       = integerMissing ! latent heat of sublimation/vaporization used for ground surface (J kg-1)
-  integer(i4b)    :: scalarSatVP_CanopyTemp          = integerMissing ! saturation vapor pressure at the temperature of vegetation canopy (Pa)
-  integer(i4b)    :: scalarSatVP_GroundTemp          = integerMissing ! saturation vapor pressure at the temperature of the ground (Pa)
-  integer(i4b)    :: scalarZ0Canopy                  = integerMissing ! roughness length of the canopy (m)
-  integer(i4b)    :: scalarWindReductionFactor       = integerMissing ! canopy wind reduction factor (-)
-  integer(i4b)    :: scalarZeroPlaneDisplacement     = integerMissing ! zero plane displacement (m)
-  integer(i4b)    :: scalarRiBulkCanopy              = integerMissing ! bulk Richardson number for the canopy (-)
-  integer(i4b)    :: scalarRiBulkGround              = integerMissing ! bulk Richardson number for the ground surface (-)
-  integer(i4b)    :: scalarCanopyStabilityCorrection = integerMissing ! stability correction for the canopy (-)
-  integer(i4b)    :: scalarGroundStabilityCorrection = integerMissing ! stability correction for the ground surface (-)
-  ! evapotranspiration
-  integer(i4b)    :: scalarIntercellularCO2Sunlit    = integerMissing ! carbon dioxide partial pressure of leaf interior (sunlit leaves) (Pa)
-  integer(i4b)    :: scalarIntercellularCO2Shaded    = integerMissing ! carbon dioxide partial pressure of leaf interior (shaded leaves) (Pa)
-  integer(i4b)    :: scalarTranspireLim              = integerMissing ! aggregate soil moisture + aquifer storage limit on transpiration (-)
-  integer(i4b)    :: scalarTranspireLimAqfr          = integerMissing ! aquifer storage limit on transpiration (-)
-  integer(i4b)    :: scalarFoliageNitrogenFactor     = integerMissing ! foliage nitrogen concentration, 1=saturated (-)
-  integer(i4b)    :: scalarSoilRelHumidity           = integerMissing ! relative humidity in the soil pores in the upper-most soil layer (-)
-  integer(i4b)    :: mLayerTranspireLim              = integerMissing ! soil moist & veg limit on transpiration for each layer (-)
-  integer(i4b)    :: mLayerRootDensity               = integerMissing ! fraction of roots in each soil layer (-)
-  integer(i4b)    :: scalarAquiferRootFrac           = integerMissing ! fraction of roots below the soil profile (-)
-  ! canopy hydrology
-  integer(i4b)    :: scalarFracLiqVeg                = integerMissing ! fraction of liquid water on vegetation (-)
-  integer(i4b)    :: scalarCanopyWetFraction         = integerMissing ! fraction of canopy that is wet
-  ! snow hydrology
-  integer(i4b)    :: scalarSnowAge                   = integerMissing ! non-dimensional snow age (-)
-  integer(i4b)    :: scalarGroundSnowFraction        = integerMissing ! fraction of ground that is covered with snow (-)
-  integer(i4b)    :: spectralSnowAlbedoDirect        = integerMissing ! direct snow albedo for individual spectral bands (-)
-  integer(i4b)    :: mLayerFracLiqSnow               = integerMissing ! fraction of liquid water in each snow layer (-)
-  integer(i4b)    :: mLayerThetaResid                = integerMissing ! residual volumetric water content in each snow layer (-)
-  integer(i4b)    :: mLayerPoreSpace                 = integerMissing ! total pore space in each snow layer (-)
-  integer(i4b)    :: mLayerMeltFreeze                = integerMissing ! change in ice content due to melt/freeze in each layer (kg m-3)
-  ! soil hydrology
-  integer(i4b)    :: scalarInfilArea                 = integerMissing ! fraction of unfrozen area where water can infiltrate (-)
-  integer(i4b)    :: scalarFrozenArea                = integerMissing ! fraction of area that is considered impermeable due to soil ice (-)
-  integer(i4b)    :: scalarSoilControl               = integerMissing ! soil control on infiltration: 1=controlling; 0=not (-)
-  integer(i4b)    :: mLayerVolFracAir                = integerMissing ! volumetric fraction of air in each layer (-)
-  integer(i4b)    :: mLayerTcrit                     = integerMissing ! critical soil temperature above which all water is unfrozen (K)
-  integer(i4b)    :: mLayerCompress                  = integerMissing ! change in volumetric water content due to compression of soil (-)
-  integer(i4b)    :: scalarSoilCompress              = integerMissing ! change in total soil storage due to compression of the soil matrix (kg m-2)
-  integer(i4b)    :: mLayerMatricHeadLiq             = integerMissing ! matric potential of liquid water (m)
-  ! mass balance check
-  integer(i4b)    :: scalarSoilWatBalError           = integerMissing ! error in the total soil water balance (kg m-2)
-  integer(i4b)    :: scalarAquiferBalError           = integerMissing ! error in the aquifer water balance (kg m-2)
-  integer(i4b)    :: scalarTotalSoilLiq              = integerMissing ! total mass of liquid water in the soil (kg m-2)
-  integer(i4b)    :: scalarTotalSoilIce              = integerMissing ! total mass of ice in the soil (kg m-2)
-  integer(i4b)    :: scalarTotalSoilWat              = integerMissing ! total mass of water in the soil (kg m-2)
-  ! variable shortcuts
-  integer(i4b)    :: scalarVGn_m                     = integerMissing ! van Genuchten "m" parameter (-)
-  integer(i4b)    :: scalarKappa                     = integerMissing ! constant in the freezing curve function (m K-1)
-  integer(i4b)    :: scalarVolLatHt_fus              = integerMissing ! volumetric latent heat of fusion     (J m-3)
-  ! number of function evaluations
-  integer(i4b)    :: numFluxCalls                    = integerMissing ! number of flux calls (-)
-  integer(i4b)    :: wallClockTime                   = integerMissing ! wall clock time (s)
- endtype iLook_diag
-
- ! ***********************************************************************************************************
- ! (8) define model fluxes
- ! ***********************************************************************************************************
- type, public :: iLook_flux
-  ! net energy and mass fluxes for the vegetation domain
-  integer(i4b)    :: scalarCanairNetNrgFlux          = integerMissing ! net energy flux for the canopy air space (W m-2)
-  integer(i4b)    :: scalarCanopyNetNrgFlux          = integerMissing ! net energy flux for the vegetation canopy (W m-2)
-  integer(i4b)    :: scalarGroundNetNrgFlux          = integerMissing ! net energy flux for the ground surface (W m-2)
-  integer(i4b)    :: scalarCanopyNetLiqFlux          = integerMissing ! net liquid water flux for the vegetation canopy (kg m-2 s-1)
-  ! forcing
-  integer(i4b)    :: scalarRainfall                  = integerMissing ! computed rainfall rate (kg m-2 s-1)
-  integer(i4b)    :: scalarSnowfall                  = integerMissing ! computed snowfall rate (kg m-2 s-1)
-  ! shortwave radiation
-  integer(i4b)    :: spectralIncomingDirect          = integerMissing ! incoming direct solar radiation in each wave band (W m-2)
-  integer(i4b)    :: spectralIncomingDiffuse         = integerMissing ! incoming diffuse solar radiation in each wave band (W m-2)
-  integer(i4b)    :: scalarCanopySunlitPAR           = integerMissing ! average absorbed par for sunlit leaves (W m-2)
-  integer(i4b)    :: scalarCanopyShadedPAR           = integerMissing ! average absorbed par for shaded leaves (W m-2)
-  integer(i4b)    :: spectralBelowCanopyDirect       = integerMissing ! downward direct flux below veg layer for each spectral band  (W m-2)
-  integer(i4b)    :: spectralBelowCanopyDiffuse      = integerMissing ! downward diffuse flux below veg layer for each spectral band (W m-2)
-  integer(i4b)    :: scalarBelowCanopySolar          = integerMissing ! solar radiation transmitted below the canopy (W m-2)
-  integer(i4b)    :: scalarCanopyAbsorbedSolar       = integerMissing ! solar radiation absorbed by canopy (W m-2)
-  integer(i4b)    :: scalarGroundAbsorbedSolar       = integerMissing ! solar radiation absorbed by ground (W m-2)
-  ! longwave radiation
-  integer(i4b)    :: scalarLWRadCanopy               = integerMissing ! longwave radiation emitted from the canopy (W m-2)
-  integer(i4b)    :: scalarLWRadGround               = integerMissing ! longwave radiation emitted at the ground surface  (W m-2)
-  integer(i4b)    :: scalarLWRadUbound2Canopy        = integerMissing ! downward atmospheric longwave radiation absorbed by the canopy (W m-2)
-  integer(i4b)    :: scalarLWRadUbound2Ground        = integerMissing ! downward atmospheric longwave radiation absorbed by the ground (W m-2)
-  integer(i4b)    :: scalarLWRadUbound2Ubound        = integerMissing ! atmospheric radiation refl by ground + lost thru upper boundary (W m-2)
-  integer(i4b)    :: scalarLWRadCanopy2Ubound        = integerMissing ! longwave radiation emitted from canopy lost thru upper boundary (W m-2)
-  integer(i4b)    :: scalarLWRadCanopy2Ground        = integerMissing ! longwave radiation emitted from canopy absorbed by the ground (W m-2)
-  integer(i4b)    :: scalarLWRadCanopy2Canopy        = integerMissing ! canopy longwave reflected from ground and absorbed by the canopy (W m-2)
-  integer(i4b)    :: scalarLWRadGround2Ubound        = integerMissing ! longwave radiation emitted from ground lost thru upper boundary (W m-2)
-  integer(i4b)    :: scalarLWRadGround2Canopy        = integerMissing ! longwave radiation emitted from ground and absorbed by the canopy (W m-2)
-  integer(i4b)    :: scalarLWNetCanopy               = integerMissing ! net longwave radiation at the canopy (W m-2)
-  integer(i4b)    :: scalarLWNetGround               = integerMissing ! net longwave radiation at the ground surface (W m-2)
-  integer(i4b)    :: scalarLWNetUbound               = integerMissing ! net longwave radiation at the upper atmospheric boundary (W m-2)
-  ! turbulent heat transfer
-  integer(i4b)    :: scalarEddyDiffusCanopyTop       = integerMissing ! eddy diffusivity for heat at the top of the canopy (m2 s-1)
-  integer(i4b)    :: scalarFrictionVelocity          = integerMissing ! friction velocity - canopy momentum sink (m s-1)
-  integer(i4b)    :: scalarWindspdCanopyTop          = integerMissing ! windspeed at the top of the canopy (m s-1)
-  integer(i4b)    :: scalarWindspdCanopyBottom       = integerMissing ! windspeed at the height of the bottom of the canopy (m s-1)
-  integer(i4b)    :: scalarGroundResistance          = integerMissing ! below canopy aerodynamic resistance (s m-1)
-  integer(i4b)    :: scalarCanopyResistance          = integerMissing ! above canopy aerodynamic resistance (s m-1)
-  integer(i4b)    :: scalarLeafResistance            = integerMissing ! mean leaf boundary layer resistance per unit leaf area (s m-1)
-  integer(i4b)    :: scalarSoilResistance            = integerMissing ! soil surface resistance (s m-1)
-  integer(i4b)    :: scalarSenHeatTotal              = integerMissing ! sensible heat from the canopy air space to the atmosphere (W m-2)
-  integer(i4b)    :: scalarSenHeatCanopy             = integerMissing ! sensible heat from the canopy to the canopy air space (W m-2)
-  integer(i4b)    :: scalarSenHeatGround             = integerMissing ! sensible heat from the ground (below canopy or non-vegetated) (W m-2)
-  integer(i4b)    :: scalarLatHeatTotal              = integerMissing ! latent heat from the canopy air space to the atmosphere (W m-2)
-  integer(i4b)    :: scalarLatHeatCanopyEvap         = integerMissing ! evaporation latent heat from the canopy to the canopy air space (W m-2)
-  integer(i4b)    :: scalarLatHeatCanopyTrans        = integerMissing ! transpiration latent heat from the canopy to the canopy air space (W m-2)
-  integer(i4b)    :: scalarLatHeatGround             = integerMissing ! latent heat from the ground (below canopy or non-vegetated) (W m-2)
-  integer(i4b)    :: scalarCanopyAdvectiveHeatFlux   = integerMissing ! heat advected to the canopy surface with rain + snow (W m-2)
-  integer(i4b)    :: scalarGroundAdvectiveHeatFlux   = integerMissing ! heat advected to the ground surface with throughfall and unloading/drainage (W m-2)
-  integer(i4b)    :: scalarCanopySublimation         = integerMissing ! canopy sublimation/frost (kg m-2 s-1)
-  integer(i4b)    :: scalarSnowSublimation           = integerMissing ! snow sublimation/frost (below canopy or non-vegetated) (kg m-2 s-1)
-  ! liquid water fluxes associated with evapotranspiration
-  integer(i4b)    :: scalarStomResistSunlit          = integerMissing ! stomatal resistance for sunlit leaves (s m-1)
-  integer(i4b)    :: scalarStomResistShaded          = integerMissing ! stomatal resistance for shaded leaves (s m-1)
-  integer(i4b)    :: scalarPhotosynthesisSunlit      = integerMissing ! sunlit photosynthesis (umolco2 m-2 s-1)
-  integer(i4b)    :: scalarPhotosynthesisShaded      = integerMissing ! shaded photosynthesis (umolco2 m-2 s-1)
-  integer(i4b)    :: scalarCanopyTranspiration       = integerMissing ! canopy transpiration (kg m-2 s-1)
-  integer(i4b)    :: scalarCanopyEvaporation         = integerMissing ! canopy evaporation/condensation (kg m-2 s-1)
-  integer(i4b)    :: scalarGroundEvaporation         = integerMissing ! ground evaporation/condensation -- below canopy or non-vegetated (kg m-2 s-1)
-  integer(i4b)    :: mLayerTranspire                 = integerMissing ! transpiration loss from each soil layer (kg m-2 s-1)
-  ! liquid and solid water fluxes through the canopy
-  integer(i4b)    :: scalarThroughfallSnow           = integerMissing ! snow that reaches the ground without ever touching the canopy (kg m-2 s-1)
-  integer(i4b)    :: scalarThroughfallRain           = integerMissing ! rain that reaches the ground without ever touching the canopy (kg m-2 s-1)
-  integer(i4b)    :: scalarCanopySnowUnloading       = integerMissing ! unloading of snow from the vegetion canopy (kg m-2 s-1)
-  integer(i4b)    :: scalarCanopyLiqDrainage         = integerMissing ! drainage of liquid water from the vegetation canopy (kg m-2 s-1)
-  integer(i4b)    :: scalarCanopyMeltFreeze          = integerMissing ! melt/freeze of water stored in the canopy (kg m-2 s-1)
-  ! energy fluxes and for the snow and soil domains
-  integer(i4b)    :: iLayerConductiveFlux            = integerMissing ! conductive energy flux at layer interfaces (W m-2)
-  integer(i4b)    :: iLayerAdvectiveFlux             = integerMissing ! advective energy flux at layer interfaces (W m-2)
-  integer(i4b)    :: iLayerNrgFlux                   = integerMissing ! energy flux at layer interfaces (W m-2)
-  integer(i4b)    :: mLayerNrgFlux                   = integerMissing ! net energy flux for each layer in the snow+soil domain (J m-3 s-1)
-  ! liquid water fluxes for the snow domain
-  integer(i4b)    :: scalarSnowDrainage              = integerMissing ! drainage from the bottom of the snow profile (m s-1)
-  integer(i4b)    :: iLayerLiqFluxSnow               = integerMissing ! liquid flux at snow layer interfaces (m s-1)
-  integer(i4b)    :: mLayerLiqFluxSnow               = integerMissing ! net liquid water flux for each snow layer (s-1)
-  ! liquid water fluxes for the soil domain
-  integer(i4b)    :: scalarRainPlusMelt              = integerMissing ! rain plus melt, as input to soil before calculating surface runoff (m s-1)
-  integer(i4b)    :: scalarMaxInfilRate              = integerMissing ! maximum infiltration rate (m s-1)
-  integer(i4b)    :: scalarInfiltration              = integerMissing ! infiltration of water into the soil profile (m s-1)
-  integer(i4b)    :: scalarExfiltration              = integerMissing ! exfiltration of water from the top of the soil profile (m s-1)
-  integer(i4b)    :: scalarSurfaceRunoff             = integerMissing ! surface runoff (m s-1)
-  integer(i4b)    :: mLayerSatHydCondMP              = integerMissing ! saturated hydraulic conductivity of macropores in each layer (m s-1)
-  integer(i4b)    :: mLayerSatHydCond                = integerMissing ! saturated hydraulic conductivity in each layer (m s-1)
-  integer(i4b)    :: iLayerSatHydCond                = integerMissing ! saturated hydraulic conductivity at each layer interface (m s-1)
-  integer(i4b)    :: mLayerHydCond                   = integerMissing ! hydraulic conductivity in each soil layer (m s-1)
-  integer(i4b)    :: iLayerLiqFluxSoil               = integerMissing ! liquid flux at soil layer interfaces (m s-1)
-  integer(i4b)    :: mLayerLiqFluxSoil               = integerMissing ! net liquid water flux for each soil layer (s-1)
-  integer(i4b)    :: mLayerBaseflow                  = integerMissing ! baseflow from each soil layer (m s-1)
-  integer(i4b)    :: mLayerColumnInflow              = integerMissing ! total inflow to each layer in a given soil column (m3 s-1)
-  integer(i4b)    :: mLayerColumnOutflow             = integerMissing ! total outflow from each layer in a given soil column (m3 s-1)
-  integer(i4b)    :: scalarSoilBaseflow              = integerMissing ! total baseflow from throughout the soil profile (m s-1)
-  integer(i4b)    :: scalarSoilDrainage              = integerMissing ! drainage from the bottom of the soil profile (m s-1)
-  integer(i4b)    :: scalarAquiferRecharge           = integerMissing ! recharge to the aquifer (m s-1)
-  integer(i4b)    :: scalarAquiferTranspire          = integerMissing ! transpiration from the aquifer (m s-1)
-  integer(i4b)    :: scalarAquiferBaseflow           = integerMissing ! baseflow from the aquifer (m s-1)
-  ! derived variables
-  integer(i4b)    :: scalarTotalET                   = integerMissing ! total ET (kg m-2 s-1)
-  integer(i4b)    :: scalarTotalRunoff               = integerMissing ! total runoff (m s-1)
-  integer(i4b)    :: scalarNetRadiation              = integerMissing ! net radiation (W m-2)
- endtype iLook_flux
-
- ! ***********************************************************************************************************
- ! (9) define derivatives
- ! ***********************************************************************************************************
- type, public :: iLook_deriv
-  ! derivatives in net vegetation energy fluxes w.r.t. relevant state variables
-  integer(i4b)    :: dCanairNetFlux_dCanairTemp      = integerMissing ! derivative in net canopy air space flux w.r.t. canopy air temperature (W m-2 K-1)
-  integer(i4b)    :: dCanairNetFlux_dCanopyTemp      = integerMissing ! derivative in net canopy air space flux w.r.t. canopy temperature (W m-2 K-1)
-  integer(i4b)    :: dCanairNetFlux_dGroundTemp      = integerMissing ! derivative in net canopy air space flux w.r.t. ground temperature (W m-2 K-1)
-  integer(i4b)    :: dCanopyNetFlux_dCanairTemp      = integerMissing ! derivative in net canopy flux w.r.t. canopy air temperature (W m-2 K-1)
-  integer(i4b)    :: dCanopyNetFlux_dCanopyTemp      = integerMissing ! derivative in net canopy flux w.r.t. canopy temperature (W m-2 K-1)
-  integer(i4b)    :: dCanopyNetFlux_dGroundTemp      = integerMissing ! derivative in net canopy flux w.r.t. ground temperature (W m-2 K-1)
-  integer(i4b)    :: dCanopyNetFlux_dCanLiq          = integerMissing ! derivative in net canopy fluxes w.r.t. canopy liquid water content (J kg-1 s-1)
-  integer(i4b)    :: dGroundNetFlux_dCanairTemp      = integerMissing ! derivative in net ground flux w.r.t. canopy air temperature (W m-2 K-1)
-  integer(i4b)    :: dGroundNetFlux_dCanopyTemp      = integerMissing ! derivative in net ground flux w.r.t. canopy temperature (W m-2 K-1)
-  integer(i4b)    :: dGroundNetFlux_dGroundTemp      = integerMissing ! derivative in net ground flux w.r.t. ground temperature (W m-2 K-1)
-  integer(i4b)    :: dGroundNetFlux_dCanLiq          = integerMissing ! derivative in net ground fluxes w.r.t. canopy liquid water content (J kg-1 s-1)
-  ! derivatives in evaporative fluxes w.r.t. relevant state variables
-  integer(i4b)    :: dCanopyEvaporation_dTCanair     = integerMissing ! derivative in canopy evaporation w.r.t. canopy air temperature (kg m-2 s-1 K-1)
-  integer(i4b)    :: dCanopyEvaporation_dTCanopy     = integerMissing ! derivative in canopy evaporation w.r.t. canopy temperature (kg m-2 s-1 K-1)
-  integer(i4b)    :: dCanopyEvaporation_dTGround     = integerMissing ! derivative in canopy evaporation w.r.t. ground temperature (kg m-2 s-1 K-1)
-  integer(i4b)    :: dCanopyEvaporation_dCanLiq      = integerMissing ! derivative in canopy evaporation w.r.t. canopy liquid water content (s-1)
-  integer(i4b)    :: dGroundEvaporation_dTCanair     = integerMissing ! derivative in ground evaporation w.r.t. canopy air temperature (kg m-2 s-1 K-1)
-  integer(i4b)    :: dGroundEvaporation_dTCanopy     = integerMissing ! derivative in ground evaporation w.r.t. canopy temperature (kg m-2 s-1 K-1)
-  integer(i4b)    :: dGroundEvaporation_dTGround     = integerMissing ! derivative in ground evaporation w.r.t. ground temperature (kg m-2 s-1 K-1)
-  integer(i4b)    :: dGroundEvaporation_dCanLiq      = integerMissing ! derivative in ground evaporation w.r.t. canopy liquid water content (s-1)
-  ! derivatives in canopy water w.r.t canopy temperature
-  integer(i4b)    :: dTheta_dTkCanopy                = integerMissing ! derivative of volumetric liquid water content w.r.t. temperature (K-1)
-  integer(i4b)    :: dCanLiq_dTcanopy                = integerMissing ! derivative of canopy liquid storage w.r.t. temperature (kg m-2 K-1)
-  ! derivatives in canopy liquid fluxes w.r.t. canopy water
-  integer(i4b)    :: scalarCanopyLiqDeriv            = integerMissing ! derivative in (throughfall + canopy drainage) w.r.t. canopy liquid water (s-1)
-  integer(i4b)    :: scalarThroughfallRainDeriv      = integerMissing ! derivative in throughfall w.r.t. canopy liquid water (s-1)
-  integer(i4b)    :: scalarCanopyLiqDrainageDeriv    = integerMissing ! derivative in canopy drainage w.r.t. canopy liquid water (s-1)
-  ! derivatives in energy fluxes at the interface of snow+soil layers w.r.t. temperature in layers above and below
-  integer(i4b)    :: dNrgFlux_dTempAbove             = integerMissing ! derivatives in the flux w.r.t. temperature in the layer above (J m-2 s-1 K-1)
-  integer(i4b)    :: dNrgFlux_dTempBelow             = integerMissing ! derivatives in the flux w.r.t. temperature in the layer below (J m-2 s-1 K-1)
-  ! derivative in liquid water fluxes at the interface of snow layers w.r.t. volumetric liquid water content in the layer above
-  integer(i4b)    :: iLayerLiqFluxSnowDeriv          = integerMissing ! derivative in vertical liquid water flux at layer interfaces (m s-1)
-  ! derivative in liquid water fluxes for the soil domain w.r.t hydrology state variables
-  integer(i4b)    :: dVolTot_dPsi0                   = integerMissing ! derivative in total water content w.r.t. total water matric potential (m-1)
-  integer(i4b)    :: dq_dHydStateAbove               = integerMissing ! change in the flux in layer interfaces w.r.t. state variables in the layer above
-  integer(i4b)    :: dq_dHydStateBelow               = integerMissing ! change in the flux in layer interfaces w.r.t. state variables in the layer below
-  integer(i4b)    :: mLayerdTheta_dPsi               = integerMissing ! derivative in the soil water characteristic w.r.t. psi (m-1)
-  integer(i4b)    :: mLayerdPsi_dTheta               = integerMissing ! derivative in the soil water characteristic w.r.t. theta (m)
-  integer(i4b)    :: dCompress_dPsi                  = integerMissing ! derivative in compressibility w.r.t matric head (m-1)
-  ! derivative in baseflow flux w.r.t. aquifer storage
-  integer(i4b)    :: dBaseflow_dAquifer              = integerMissing ! derivative in baseflow flux w.r.t. aquifer storage (s-1)
-  ! derivative in liquid water fluxes for the soil domain w.r.t energy state variables
-  integer(i4b)    :: dq_dNrgStateAbove               = integerMissing ! change in the flux in layer interfaces w.r.t. state variables in the layer above
-  integer(i4b)    :: dq_dNrgStateBelow               = integerMissing ! change in the flux in layer interfaces w.r.t. state variables in the layer below
-  integer(i4b)    :: mLayerdTheta_dTk                = integerMissing ! derivative of volumetric liquid water content w.r.t. temperature (K-1)
-  integer(i4b)    :: dPsiLiq_dTemp                   = integerMissing ! derivative in the liquid water matric potential w.r.t. temperature (m K-1)
-  integer(i4b)    :: dPsiLiq_dPsi0                   = integerMissing ! derivative in liquid water matric potential w.r.t. the total water matric potential (-)
- endtype iLook_deriv
-
- ! ***********************************************************************************************************
- ! (10) define model indices
- ! ***********************************************************************************************************
- type, public :: iLook_index
- ! number of model layers, and layer indices
- integer(i4b)     :: nSnow                 = integerMissing  ! number of snow layers                                                    (-)
- integer(i4b)     :: nSoil                 = integerMissing  ! number of soil layers                                                    (-)
- integer(i4b)     :: nLayers               = integerMissing  ! total number of layers                                                   (-)
- integer(i4b)     :: layerType             = integerMissing  ! index defining type of layer (snow or soil)                              (-)
- ! number of state variables of different type
- integer(i4b)     :: nCasNrg               = integerMissing  ! number of energy state variables for the canopy air space                (-)
- integer(i4b)     :: nVegNrg               = integerMissing  ! number of energy state variables for the vegetation canopy               (-)
- integer(i4b)     :: nVegMass              = integerMissing  ! number of hydrology states for vegetation (mass of water)                (-)
- integer(i4b)     :: nVegState             = integerMissing  ! number of vegetation state variables                                     (-)
- integer(i4b)     :: nNrgState             = integerMissing  ! number of energy state variables                                         (-)
- integer(i4b)     :: nWatState             = integerMissing  ! number of "total water" states (vol. total water content)                (-)
- integer(i4b)     :: nMatState             = integerMissing  ! number of matric head state variables                                    (-)
- integer(i4b)     :: nMassState            = integerMissing  ! number of hydrology state variables (mass of water)                      (-)
- integer(i4b)     :: nState                = integerMissing  ! total number of model state variables                                    (-)
- ! number of state variables within different domains in the snow+soil system
- integer(i4b)     :: nSnowSoilNrg          = integerMissing  ! number of energy states in the snow+soil domain                          (-)
- integer(i4b)     :: nSnowOnlyNrg          = integerMissing  ! number of energy states in the snow domain                               (-)
- integer(i4b)     :: nSoilOnlyNrg          = integerMissing  ! number of energy states in the soil domain                               (-)
- integer(i4b)     :: nSnowSoilHyd          = integerMissing  ! number of hydrology states in the snow+soil domain                       (-)
- integer(i4b)     :: nSnowOnlyHyd          = integerMissing  ! number of hydrology states in the snow domain                            (-)
- integer(i4b)     :: nSoilOnlyHyd          = integerMissing  ! number of hydrology states in the soil domain                            (-)
- ! type of model state variables
- integer(i4b)     :: ixControlVolume       = integerMissing  ! index of the control volume for different domains (veg, snow, soil)      (-)
- integer(i4b)     :: ixDomainType          = integerMissing  ! index of the type of domain (iname_veg, iname_snow, iname_soil)          (-)
- integer(i4b)     :: ixStateType           = integerMissing  ! index of the type of every state variable (iname_nrgCanair, ...)         (-)
- integer(i4b)     :: ixHydType             = integerMissing  ! index of the type of hydrology states in snow+soil domain                (-)
- ! type of model state variables (state subset)
- integer(i4b)     :: ixDomainType_subset   = integerMissing  ! [state subset] id of domain for desired model state variables            (-)
- integer(i4b)     :: ixStateType_subset    = integerMissing  ! [state subset] type of desired model state variables                     (-)
- ! mapping between state subset and the full state vector
- integer(i4b)     :: ixMapFull2Subset      = integerMissing  ! list of indices of the state subset in the full state vector             (-)
- integer(i4b)     :: ixMapSubset2Full      = integerMissing  ! list of indices of the full state vector in the state subset             (-)
- ! indices of model specific state variables
- integer(i4b)     :: ixCasNrg              = integerMissing  ! index IN THE STATE SUBSET of canopy air space energy state variable      (-)
- integer(i4b)     :: ixVegNrg              = integerMissing  ! index IN THE STATE SUBSET of canopy energy state variable                (-)
- integer(i4b)     :: ixVegHyd              = integerMissing  ! index IN THE STATE SUBSET of canopy hydrology state variable (mass)      (-)
- integer(i4b)     :: ixTopNrg              = integerMissing  ! index IN THE STATE SUBSET of upper-most energy state in snow+soil domain (-)
- integer(i4b)     :: ixTopHyd              = integerMissing  ! index IN THE STATE SUBSET of upper-most hydrol state in snow+soil domain (-)
- integer(i4b)     :: ixAqWat               = integerMissing  ! index IN THE STATE SUBSET of water storage in the aquifer                (-)
- ! vectors of indices for specific state types
- integer(i4b)     :: ixNrgOnly             = integerMissing  ! indices IN THE STATE SUBSET for all energy states                        (-)
- integer(i4b)     :: ixHydOnly             = integerMissing  ! indices IN THE STATE SUBSET for hydrology states in the snow+soil domain (-)
- integer(i4b)     :: ixMatOnly             = integerMissing  ! indices IN THE STATE SUBSET for matric head state variables              (-)
- integer(i4b)     :: ixMassOnly            = integerMissing  ! indices IN THE STATE SUBSET for hydrology states (mass of water)         (-)
- ! vectors of indices for specific state types within specific sub-domains
- integer(i4b)     :: ixSnowSoilNrg         = integerMissing  ! indices of model layers for energy states in the snow+soil domain        (-)
- integer(i4b)     :: ixSnowOnlyNrg         = integerMissing  ! indices of model layers for energy states in the snow domain             (-)
- integer(i4b)     :: ixSoilOnlyNrg         = integerMissing  ! indices of model layers for energy states in the soil domain             (-)
- integer(i4b)     :: ixSnowSoilHyd         = integerMissing  ! indices of model layers for hydrology states in the snow+soil domain     (-)
- integer(i4b)     :: ixSnowOnlyHyd         = integerMissing  ! indices of model layers for hydrology states in the snow domain          (-)
- integer(i4b)     :: ixSoilOnlyHyd         = integerMissing  ! indices of model layers for hydrology states in the soil domain          (-)
- ! vectors of indices for specfic state types within specific sub-domains
- integer(i4b)     :: ixNrgCanair           = integerMissing  ! indices IN THE FULL VECTOR for energy states in canopy air space domain  (-)
- integer(i4b)     :: ixNrgCanopy           = integerMissing  ! indices IN THE FULL VECTOR for energy states in the canopy domain        (-)
- integer(i4b)     :: ixHydCanopy           = integerMissing  ! indices IN THE FULL VECTOR for hydrology states in the canopy domain     (-)
- integer(i4b)     :: ixNrgLayer            = integerMissing  ! indices IN THE FULL VECTOR for energy states in the snow+soil domain     (-)
- integer(i4b)     :: ixHydLayer            = integerMissing  ! indices IN THE FULL VECTOR for hydrology states in the snow+soil domain  (-)
- integer(i4b)     :: ixWatAquifer          = integerMissing  ! indices IN THE FULL VECTOR for the storage of water in the aquifer       (-)
- ! vectors of indices for specific state types IN SPECIFIC SUB-DOMAINS
- integer(i4b)     :: ixVolFracWat          = integerMissing  ! indices IN THE SNOW+SOIL VECTOR for hyd states                           (-)
- integer(i4b)     :: ixMatricHead          = integerMissing  ! indices IN THE SOIL VECTOR for hyd states                                (-)
- ! indices within state vectors
- integer(i4b)     :: ixAllState            = integerMissing  ! list of indices for all model state variables                            (-)
- integer(i4b)     :: ixSoilState           = integerMissing  ! list of indices for all soil layers                                      (-)
- integer(i4b)     :: ixLayerState          = integerMissing  ! list of indices for all model layers                                     (-)
- integer(i4b)     :: ixLayerActive         = integerMissing  ! list of indices for active model layers (inactive=integerMissing)        (-)
- ! number of trials
- integer(i4b)     :: numberFluxCalc        = integerMissing  ! number of flux calculations                                              (-)
- integer(i4b)     :: numberStateSplit      = integerMissing  ! number of state splitting solutions                                      (-)
- integer(i4b)     :: numberDomainSplitNrg  = integerMissing  ! number of domain splitting solutions for energy                          (-)
- integer(i4b)     :: numberDomainSplitMass = integerMissing  ! number of domain splitting solutions for mass                            (-)
- integer(i4b)     :: numberScalarSolutions = integerMissing  ! number of scalar solutions                                               (-)
- endtype iLook_index
-
- ! ***********************************************************************************************************
- ! (11) define basin-average model parameters
- ! ***********************************************************************************************************
- type, public :: iLook_bpar
-  ! baseflow
-  integer(i4b)    :: basin__aquiferHydCond      = integerMissing ! hydraulic conductivity for the aquifer (m s-1)
-  integer(i4b)    :: basin__aquiferScaleFactor  = integerMissing ! scaling factor for aquifer storage in the big bucket (m)
-  integer(i4b)    :: basin__aquiferBaseflowExp  = integerMissing ! baseflow exponent for the big bucket (-)
-  ! within-grid routing
-  integer(i4b)    :: routingGammaShape          = integerMissing ! shape parameter in Gamma distribution used for sub-grid routing (-)
-  integer(i4b)    :: routingGammaScale          = integerMissing ! scale parameter in Gamma distribution used for sub-grid routing (s)
- endtype iLook_bpar
-
- ! ***********************************************************************************************************
- ! (12) define basin-average model variables
- ! ***********************************************************************************************************
- type, public :: iLook_bvar
-  ! define derived variables
-  integer(i4b)    :: basin__totalArea           = integerMissing ! total basin area (m2)
-  ! define fluxes
-  integer(i4b)    :: basin__SurfaceRunoff       = integerMissing ! surface runoff (m s-1)
-  integer(i4b)    :: basin__ColumnOutflow       = integerMissing ! outflow from all "outlet" HRUs (those with no downstream HRU)
-  integer(i4b)    :: basin__AquiferStorage      = integerMissing ! aquifer storage (m s-1)
-  integer(i4b)    :: basin__AquiferRecharge     = integerMissing ! recharge to the aquifer (m s-1)
-  integer(i4b)    :: basin__AquiferBaseflow     = integerMissing ! baseflow from the aquifer (m s-1)
-  integer(i4b)    :: basin__AquiferTranspire    = integerMissing ! transpiration from the aquifer (m s-1)
-  integer(i4b)    :: basin__TotalRunoff         = integerMissing ! total runoff to channel from all active components (m s-1)
-  integer(i4b)    :: basin__SoilDrainage        = integerMissing ! soil drainage (m s-1)
-  ! define variables for runoff
-  integer(i4b)    :: routingRunoffFuture        = integerMissing ! runoff in future time steps (m s-1)
-  integer(i4b)    :: routingFractionFuture      = integerMissing ! fraction of runoff in future time steps (-)
-  integer(i4b)    :: averageInstantRunoff       = integerMissing ! instantaneous runoff (m s-1)
-  integer(i4b)    :: averageRoutedRunoff        = integerMissing ! routed runoff (m s-1)
- endtype iLook_bvar
-
- ! ***********************************************************************************************************
- ! (13) structure for looking up the type of a model variable (this is only needed for backward
- ! compatability, and should be removed eventually)
- ! ***********************************************************************************************************
- type, public, bind(C) :: iLook_varType
-  integer(i4b)    :: scalarv   = integerMissing ! scalar variables
-  integer(i4b)    :: wLength   = integerMissing ! # spectral bands
-  integer(i4b)    :: midSnow   = integerMissing ! mid-layer snow variables
-  integer(i4b)    :: midSoil   = integerMissing ! mid-layer soil variables
-  integer(i4b)    :: midToto   = integerMissing ! mid-layer, both snow and soil
-  integer(i4b)    :: ifcSnow   = integerMissing ! interface snow variables
-  integer(i4b)    :: ifcSoil   = integerMissing ! interface soil variables
-  integer(i4b)    :: ifcToto   = integerMissing ! interface, snow and soil
-  integer(i4b)    :: parSoil   = integerMissing ! soil depth
-  integer(i4b)    :: routing   = integerMissing ! routing variables
-  integer(i4b)    :: outstat   = integerMissing ! output statistic
-  integer(i4b)    :: unknown   = integerMissing ! cath-cal alternative type
- endtype iLook_varType
-
- ! ***********************************************************************************************************
- ! (14) structure for looking up statistics
- ! ***********************************************************************************************************
- type, public :: iLook_stat
-  integer(i4b)    :: totl = integerMissing ! summation
-  integer(i4b)    :: inst = integerMissing ! instantaneous
-  integer(i4b)    :: mean = integerMissing ! mean over period
-  integer(i4b)    :: vari = integerMissing ! variance over period
-  integer(i4b)    :: mini = integerMissing ! minimum over period
-  integer(i4b)    :: maxi = integerMissing ! maximum over period
-  integer(i4b)    :: mode = integerMissing ! mode over period
- endtype iLook_stat
-
- ! ***********************************************************************************************************
- ! (15) structure for looking up output frequencies
- ! ***********************************************************************************************************
- type, public :: iLook_freq
-  integer(i4b)    :: day      = integerMissing ! daily aggregation
-  integer(i4b)    :: month    = integerMissing ! monthly aggregation
-  integer(i4b)    :: annual   = integerMissing ! yearly (annual) aggregation
-  integer(i4b)    :: timestep = integerMissing ! timestep-level output (no temporal aggregation)
- endtype iLook_freq
-
- ! ***********************************************************************************************************
- ! (16) structure for looking up lookup tables
- ! ***********************************************************************************************************
- type, public :: iLook_vLookup
-  integer(i4b)    :: temperature = integerMissing ! temperature (K)
-  integer(i4b)    :: enthalpy    = integerMissing ! enthalpy (J m-3)
-  integer(i4b)    :: deriv2      = integerMissing ! second derivatives of the interpolating function
- endtype iLook_vLookup
-
-
- ! ***********************************************************************************************************
- ! (X) define data structures and maximum number of variables of each type
- ! ***********************************************************************************************************
-
- ! named variables: model decisions
- type(iLook_decision),public,parameter :: iLookDECISIONS=iLook_decision(  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30,&
-                                                                         31, 32, 33, 34, 35, 36, 37, 38)
- ! named variables: model time
- type(iLook_time),    public,parameter :: iLookTIME     =iLook_time    (  1,  2,  3,  4,  5,  6,  7)
-
- ! named variables: model forcing data
- type(iLook_force),   public,parameter :: iLookFORCE    =iLook_force   (  1,  2,  3,  4,  5,  6,  7,  8)
-
- ! named variables: model attributes
- type(iLook_attr),    public,parameter :: iLookATTR     =iLook_attr    (  1,  2,  3,  4,  5,  6,  7,  8)
-
- ! named variables: soil and vegetation types
- type(iLook_type),    public,parameter :: iLookTYPE     =iLook_type    (  1,  2,  3,  4)
-
- ! named variables: hru and gru IDs and associated information
- type(iLook_id),      public,parameter :: iLookID       =iLook_id      (  1)
-
- ! named variables: model parameters
- type(iLook_param),   public,parameter :: iLookPARAM    =iLook_param   (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30,&
-                                                                         31, 32, 33, 34, 35, 36, 37, 38, 39, 40,&
-                                                                         41, 42, 43, 44, 45, 46, 47, 48, 49, 50,&
-                                                                         51, 52, 53, 54, 55, 56, 57, 58, 59, 60,&
-                                                                         61, 62, 63, 64, 65, 66, 67, 68, 69, 70,&
-                                                                         71, 72, 73, 74, 75, 76, 77, 78, 79, 80,&
-                                                                         81, 82, 83, 84, 85, 86, 87, 88, 89, 90,&
-                                                                         91, 92, 93, 94, 95, 96, 97, 98, 99,100,&
-                                                                        101,102,103,104,105,106,107,108,109,110,&
-                                                                        111,112,113,114,115,116,117,118,119,120,&
-                                                                        121,122,123,124,125,126,127,128,129,130,&
-                                                                        131,132,133,134,135,136,137,138,139,140,&
-                                                                        141,142,143,144,145,146,147,148,149,150,&
-                                                                        151,152,153,154,155,156,157,158,159)
-
- ! named variables: model prognostic (state) variables
- type(iLook_prog),   public,parameter  :: iLookPROG     =iLook_prog    (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21)
-
- ! named variables: model diagnostic variables
- type(iLook_diag),    public,parameter :: iLookDIAG     =iLook_diag    (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30,&
-                                                                         31, 32, 33, 34, 35, 36, 37, 38, 39, 40,&
-                                                                         41, 42, 43, 44, 45, 46, 47, 48, 49, 50,&
-                                                                         51, 52, 53, 54, 55, 56, 57, 58, 59, 60,&
-                                                                         61, 62, 63, 64, 65, 66, 67, 68, 69, 70,&
-                                                                         71, 72, 73, 74, 75, 76, 77, 78, 79, 80,&
-                                                                         81, 82, 83, 84)
- ! named variables: model fluxes
- type(iLook_flux),    public,parameter :: iLookFLUX     =iLook_flux    (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30,&
-                                                                         31, 32, 33, 34, 35, 36, 37, 38, 39, 40,&
-                                                                         41, 42, 43, 44, 45, 46, 47, 48, 49, 50,&
-                                                                         51, 52, 53, 54, 55, 56, 57, 58, 59, 60,&
-                                                                         61, 62, 63, 64, 65, 66, 67, 68, 69, 70,&
-                                                                         71, 72, 73, 74, 75, 76, 77, 78, 79, 80,&
-                                                                         81, 82, 83, 84, 85, 86, 87, 88, 89)
-
- ! named variables: derivatives in model fluxes w.r.t. relevant state variables
- type(iLook_deriv),   public,parameter :: iLookDERIV    =iLook_deriv   (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30,&
-                                                                         31, 32, 33, 34, 35, 36, 37, 38, 39)
-
- ! named variables: model indices
- type(iLook_index),   public,parameter :: iLookINDEX    =ilook_index   (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13, 14, 15, 16, 17, 18, 19, 20,&
-                                                                         21, 22, 23, 24, 25, 26, 27, 28, 29, 30,&
-                                                                         31, 32, 33, 34, 35, 36, 37, 38, 39, 40,&
-                                                                         41, 42, 43, 44, 45, 46, 47, 48, 49, 50,&
-                                                                         51, 52, 53, 54, 55, 56, 57, 58, 59, 60)
-
- ! named variables: basin-average parameters
- type(iLook_bpar),    public,parameter :: iLookBPAR     =ilook_bpar    (  1,  2,  3,  4,  5)
-
- ! named variables: basin-average variables
- type(iLook_bvar),    public,parameter :: iLookBVAR     =ilook_bvar    (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12, 13)
-
- ! named variables in varibale type structure
- type(iLook_varType), public,parameter :: iLookVarType  =ilook_varType (  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,&
-                                                                         11, 12)
-
- ! number of possible output statistics
- type(iLook_stat),    public,parameter :: iLookStat     =ilook_stat    (  1,  2,  3,  4,  5,  6,  7)
-
- ! number of possible output frequencies
- type(iLook_freq),    public,parameter :: iLookFreq     =ilook_freq    (  1,  2,  3,  4)
-
- type(iLook_vLookup), public,parameter :: iLookLOOKUP   =ilook_vLookup ( 1, 2, 3)
-
- ! define maximum number of variables of each type
- integer(i4b),parameter,public :: maxvarDecisions = storage_size(iLookDECISIONS)/iLength
- integer(i4b),parameter,public :: maxvarTime      = storage_size(iLookTIME)/iLength
- integer(i4b),parameter,public :: maxvarForc      = storage_size(iLookFORCE)/iLength
- integer(i4b),parameter,public :: maxvarAttr      = storage_size(iLookATTR)/iLength
- integer(i4b),parameter,public :: maxvarType      = storage_size(iLookTYPE)/iLength
- integer(i4b),parameter,public :: maxvarId        = storage_size(iLookID)/i8Length
- integer(i4b),parameter,public :: maxvarMpar      = storage_size(iLookPARAM)/iLength
- integer(i4b),parameter,public :: maxvarProg      = storage_size(iLookPROG)/iLength
- integer(i4b),parameter,public :: maxvarDiag      = storage_size(iLookDIAG)/iLength
- integer(i4b),parameter,public :: maxvarFlux      = storage_size(iLookFLUX)/iLength
- integer(i4b),parameter,public :: maxvarDeriv     = storage_size(iLookDERIV)/iLength
- integer(i4b),parameter,public :: maxvarIndx      = storage_size(iLookINDEX)/iLength
- integer(i4b),parameter,public :: maxvarBpar      = storage_size(iLookBPAR)/iLength
- integer(i4b),parameter,public :: maxvarBvar      = storage_size(iLookBVAR)/iLength
- integer(i4b),parameter,public :: maxvarVarType   = storage_size(iLookVarType)/iLength
- integer(i4b),parameter,public :: maxvarStat      = storage_size(iLookStat)/iLength
- integer(i4b),parameter,public :: maxvarFreq      = storage_size(iLookFreq)/iLength
- integer(i4b),parameter,public :: maxvarLookup    = storage_size(iLookLOOKUP)/iLength
-
- ! ***********************************************************************************************************
- ! (Y) define ancillary look-up structures
- ! ***********************************************************************************************************
-
- integer(i4b),allocatable,save,public   :: childFLUX_MEAN(:)  ! index of the child data structure: mean flux
-
-
-END MODULE var_lookup
diff --git a/build/source/engine/alloc_fileAccess.f90 b/build/source/engine/alloc_fileAccess.f90
deleted file mode 100644
index 238f447c09e6bcf62aff901cbe60099280649001..0000000000000000000000000000000000000000
--- a/build/source/engine/alloc_fileAccess.f90
+++ /dev/null
@@ -1,331 +0,0 @@
-module alloc_outputStructure
-USE nrtype
-USE data_types,only:var_time_dlength
-USE data_types,only:var_time_ilength
-USE data_types,only:var_time_i
-USE data_types,only:var_time_d
-USE data_types,only:var_time_i8
-USE data_types,only:var_i8
-USE data_types,only:var_d
-USE data_types,only:var_i
-USE data_types,only:var_dlength
-USE data_types,only:var_info
-USE globalData,only:integerMissing
-USE globalData,only:nBand                 ! number of spectral bands
-USE globalData,only:nTimeDelay            ! number of timesteps in the time delay histogram
-USE var_lookup,only:maxvarFreq             ! allocation dimension (output frequency)
-USE var_lookup,only:iLookVarType           ! look up structure for variable typed
-USE var_lookup,only:iLookINDEX
-
-
-implicit none
-private
-public::alloc_outputStruc
-public::allocateDat_rkind
-public::allocateDat_int
-private::is_var_desired
-contains
-
-logical function is_var_desired(metaStruct, iVar)
-  implicit none
-  type(var_info),intent(in) :: metaStruct(:)
-  integer(i4b),intent(in)   :: iVar
-  ! local
-  integer(i4b)              :: iFreq
-  ! initalize error control
-  is_var_desired=.false.
-  do iFreq=1,maxvarFreq
-    if(metaStruct(iVar)%statIndex(iFreq) /= integerMissing)then
-      is_var_desired=.true.
-      exit
-    end if
-  end do
-
-end function is_var_desired
-
-subroutine alloc_outputStruc(metaStruct,dataStruct,nSteps,nSnow,nSoil,str_name,err,message)
-  implicit none
-  type(var_info),intent(in)            :: metaStruct(:)
-  class(*),intent(inout)               :: dataStruct
-  ! optional input
-  integer(i4b),intent(in),optional     :: nSteps
-  integer(i4b),intent(in),optional     :: nSnow          ! number of snow layers
-  integer(i4b),intent(in),optional     :: nSoil          ! number of soil layers
-  character(len=*),intent(in),optional :: str_name    ! name of the structure to allocate
-  ! output
-  integer(i4b),intent(inout)           :: err            ! error code
-  character(*),intent(out)             :: message        ! error message
-  ! local
-  logical(lgt)                         :: check          ! .true. if the variables are allocated
-  integer(i4b)                         :: nVars          ! number of variables in the metadata structure
-  integer(i4b)                         :: nLayers        ! total number of layers
-  integer(i4b)                         :: iVar
-  integer(i4b)                         :: iStat          ! checks if we want this variable
-  character(len=256)                   :: cmessage       ! error message of the downwind routine
-  ! initalize error control
-  message='alloc_outputStruc'
-
-  nVars = size(metaStruct)
-  if(present(nSnow) .or. present(nSoil))then
-    ! check both are present
-    if(.not.present(nSoil))then; err=20; message=trim(message)//'expect nSoil to be present when nSnow is present'; print*,message; return; end if
-    if(.not.present(nSnow))then; err=20; message=trim(message)//'expect nSnow to be present when nSoil is present'; print*,message; return; end if
-    nLayers = nSnow+nSoil
-    ! It is possible that nSnow and nSoil are actually needed here, so we return an error if the optional arguments are missing when needed
-  else
-    select type(dataStruct)
-      class is (var_time_ilength); err=20
-      class is (var_time_dlength); err=20
-    end select
-    if(err/=0)then; message=trim(message)//'expect nSnow and nSoil to be present for variable-length data structures'; print*,message; return; end if
-  end if
-
-  check=.false.
-  ! allocate the space for the variables and thier time steps in the output structure
-  select type(dataStruct)
-    ! ****************************************************
-    class is (var_time_i)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else 
-        allocate(dataStruct%var(nVars),stat=err)
-      end if
-      do iVar=1, nVars
-        ! Check if this variable is desired within any timeframe
-        if(is_var_desired(metaStruct,iVar))then
-          allocate(dataStruct%var(iVar)%tim(nSteps))
-        end if
-      end do
-      return
-    ! ****************************************************
-    class is (var_time_i8)
-      if(allocated(dataStruct%var))then 
-        check=.true.
-      else 
-        allocate(dataStruct%var(nVars),stat=err) 
-      end if 
-      do iVar=1, nVars
-        ! Check if this variable is desired within any timeframe
-        if(is_var_desired(metaStruct,iVar))then
-          allocate(dataStruct%var(iVar)%tim(nSteps))
-        end if
-      end do
-      return
-    ! ****************************************************
-    class is (var_time_d)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else
-        allocate(dataStruct%var(nVars),stat=err)
-      end if
-      do iVar=1, nVars
-        ! Check if this variable is desired within any timeframe
-        if(is_var_desired(metaStruct,iVar))then
-          allocate(dataStruct%var(iVar)%tim(nSteps))
-        end if
-      end do
-      return
-    ! ****************************************************   
-    class is (var_d)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else
-        allocate(dataStruct%var(nVars),stat=err)
-      end if
-      return
-    ! ****************************************************
-    class is (var_i)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else
-        allocate(dataStruct%var(nVars),stat=err)
-      end if
-      return
-    ! ****************************************************    
-    class is (var_i8)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else
-        allocate(dataStruct%var(nVars), stat=err)
-      end if
-      return
-    ! ****************************************************    
-    class is (var_dlength)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else
-        allocate(dataStruct%var(nVars),stat=err)
-        call allocateDat_rkind(metaStruct,dataStruct,nSnow,nSoil,err,cmessage)
-      end if
-    ! ****************************************************
-    class is (var_time_ilength)
-      if(allocated(dataStruct%var))then
-        check=.true. 
-      else 
-        allocate(dataStruct%var(nVars),stat=err) 
-      end if
-      do iVar=1, nVars
-        ! Check if this variable is desired within any timeframe
-        if(is_var_desired(metaStruct,iVar) .or. (present(str_name) .and. &
-         ((iVar == iLookINDEX%nLayers) .or. (iVar == iLookINDEX%nSnow) .or. (iVar == iLookINDEX%nSoil)) ))then
-        allocate(dataStruct%var(iVar)%tim(nSteps))
-          call allocateDat_int(metaStruct,dataStruct,nSnow,nSoil,nSteps,iVar,err,cmessage)
-        end if
-      end do
-    ! ****************************************************
-    class is (var_time_dlength)
-      if(allocated(dataStruct%var))then
-        check=.true.
-      else 
-        allocate(dataStruct%var(nVars),stat=err)
-      end if
-      do iVar=1, nVars
-        ! Check if this variable is desired within any timeframe
-        if(is_var_desired(metaStruct,iVar))then
-          allocate(dataStruct%var(iVar)%tim(nSteps))
-          call allocateDat_rkind_nSteps(metaStruct,dataStruct,nSnow,nSoil,nSteps,iVar,err,cmessage)
-        end if
-      end do
-    ! ****************************************************
-    class default; err=20; message=trim(message)//'unable to identify derived data type for the variable dimension'; print*,message;return
-  end select
-  ! check errors
-  if(check) then; err=20; message=trim(message)//'structure was unexpectedly allocated already'; print*,message; return; end if
-  if(err/=0)then; err=20; message=trim(message)//'problem allocating'; print*,message; return; end if
-
-  ! check errors
-  if(err/=0)then; message=trim(message)//trim(cmessage); print*, message; return; end if
-end subroutine
-
-
-subroutine allocateDat_rkind_nSteps(metadata,varData,nSnow, nSoil, &
-                                  nSteps,iVar,err,message)
-              
-  USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
-  
-  implicit none
-  type(var_info),intent(in)            :: metadata(:)
-  ! output variables
-  type(var_time_dlength),intent(inout) :: varData     ! model variables for a local HRU
-  integer(i4b),intent(in)              :: nSnow
-  integer(i4b),intent(in)              :: nSoil
-  integer(i4b),intent(in)              :: nSteps
-  integer(i4b),intent(in)              :: iVar
-  integer(i4b),intent(inout)           :: err         ! error code
-  character(*),intent(inout)           :: message     ! error message
-  
-  ! local variables
-  integer(i4b)                         :: iStep 
-  integer(i4b)                         :: nLayers
-  message='allocateDat_rkindAccessActor'
-
-  nLayers = nSnow+nSoil
-  do iStep=1, nSteps
-    select case(metadata(iVar)%vartype)
-      case(iLookVarType%scalarv); allocate(varData%var(iVar)%tim(iStep)%dat(1),stat=err)
-      case(iLookVarType%wLength); allocate(varData%var(iVar)%tim(iStep)%dat(nBand),stat=err)
-      case(iLookVarType%midSnow); allocate(varData%var(iVar)%tim(iStep)%dat(nSnow),stat=err)
-      case(iLookVarType%midSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
-      case(iLookVarType%midToto); allocate(varData%var(iVar)%tim(iStep)%dat(nLayers),stat=err)
-      case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%tim(iStep)%dat(0:nSnow),stat=err)
-      case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%tim(iStep)%dat(0:nSoil),stat=err)
-      case(iLookVarType%ifcToto); allocate(varData%var(iVar)%tim(iStep)%dat(0:nLayers),stat=err)
-      case(iLookVarType%parSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
-      case(iLookVarType%routing); allocate(varData%var(iVar)%tim(iStep)%dat(nTimeDelay),stat=err)
-      case(iLookVarType%outstat); allocate(varData%var(iVar)%tim(iStep)%dat(maxvarfreq*2),stat=err)
-      case(iLookVarType%unknown); allocate(varData%var(iVar)%tim(iStep)%dat(0),stat=err)
-      case default
-        err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
-        return
-    end select
-  end do ! (iStep)
-
-end subroutine allocateDat_rkind_nSteps
-
-subroutine allocateDat_rkind(metadata,varData,nSnow,nSoil,err,message)
-  USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
-  implicit none
-  type(var_info),intent(in)         :: metadata(:)
-  ! output variables
-  type(var_dlength),intent(inout)   :: varData     ! model variables for a local HRU
-  integer(i4b),intent(in)           :: nSnow
-  integer(i4b),intent(in)           :: nSoil
-  
-  integer(i4b),intent(inout)        :: err         ! error code
-  character(*),intent(inout)        :: message     ! error message
-  
-  ! local variables
-  integer(i4b)                      :: nVars
-  integer(i4b)                      :: iVar
-  integer(i4b)                      :: nLayers
-  message='allocateDat_rkindAccessActor'
-
-  nVars = size(metaData)
-  nLayers = nSnow+nSoil
-  do iVar=1, nVars
-    select case(metadata(iVar)%vartype)
-    case(iLookVarType%scalarv); allocate(varData%var(iVar)%dat(1),stat=err)
-    case(iLookVarType%wLength); allocate(varData%var(iVar)%dat(nBand),stat=err)
-    case(iLookVarType%midSnow); allocate(varData%var(iVar)%dat(nSnow),stat=err)
-    case(iLookVarType%midSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
-    case(iLookVarType%midToto); allocate(varData%var(iVar)%dat(nLayers),stat=err)
-    case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%dat(0:nSnow),stat=err)
-    case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%dat(0:nSoil),stat=err)
-    case(iLookVarType%ifcToto); allocate(varData%var(iVar)%dat(0:nLayers),stat=err)
-    case(iLookVarType%parSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
-    case(iLookVarType%routing); allocate(varData%var(iVar)%dat(nTimeDelay),stat=err)
-    case(iLookVarType%outstat); allocate(varData%var(iVar)%dat(maxvarfreq*2),stat=err)
-    case(iLookVarType%unknown); allocate(varData%var(iVar)%dat(0),stat=err)
-    case default
-        err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
-        return
-    end select
-  end do
-
-end subroutine allocateDat_rkind
-
-subroutine allocateDat_int(metadata,varData,nSnow, nSoil, &
-                          nSteps,iVar,err,message)
-  USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
-
-  implicit none
-  type(var_info),intent(in)            :: metadata(:)
-  ! output variables
-  type(var_time_ilength),intent(inout) :: varData     ! model variables for a local HRU
-  integer(i4b),intent(in)              :: nSnow
-  integer(i4b),intent(in)              :: nSoil
-  integer(i4b),intent(in)              :: nSteps
-  integer(i4b),intent(in)              :: iVar  
-  integer(i4b),intent(inout)           :: err         ! error code
-  character(*),intent(inout)           :: message     ! error message
-  ! local variables
-  integer(i4b)                         :: iStep 
-  integer(i4b)                         :: nLayers
-  message='allocateDat_rkindAccessActor'
-  
-  nLayers = nSnow+nSoil
-  do iStep=1, nSteps
-    select case(metadata(iVar)%vartype)
-    case(iLookVarType%scalarv); allocate(varData%var(iVar)%tim(iStep)%dat(1),stat=err)
-    case(iLookVarType%wLength); allocate(varData%var(iVar)%tim(iStep)%dat(nBand),stat=err)
-    case(iLookVarType%midSnow); allocate(varData%var(iVar)%tim(iStep)%dat(nSnow),stat=err)
-    case(iLookVarType%midSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
-    case(iLookVarType%midToto); allocate(varData%var(iVar)%tim(iStep)%dat(nLayers),stat=err)
-    case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%tim(iStep)%dat(0:nSnow),stat=err)
-    case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%tim(iStep)%dat(0:nSoil),stat=err)
-    case(iLookVarType%ifcToto); allocate(varData%var(iVar)%tim(iStep)%dat(0:nLayers),stat=err)
-    case(iLookVarType%parSoil); allocate(varData%var(iVar)%tim(iStep)%dat(nSoil),stat=err)
-    case(iLookVarType%routing); allocate(varData%var(iVar)%tim(iStep)%dat(nTimeDelay),stat=err)
-    case(iLookVarType%outstat); allocate(varData%var(iVar)%tim(iStep)%dat(maxvarfreq*2),stat=err)
-    case(iLookVarType%unknown); allocate(varData%var(iVar)%tim(iStep)%dat(0),stat=err)
-    case default
-        err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
-        return
-    end select
-  end do ! loop through time steps
-end subroutine
-
-
-
-
-end module alloc_outputStructure
\ No newline at end of file
diff --git a/build/source/engine/allocspaceActors.f90 b/build/source/engine/allocspaceActors.f90
deleted file mode 100755
index 63dfe0327d28043edf88412198d7d37c8ccdc63a..0000000000000000000000000000000000000000
--- a/build/source/engine/allocspaceActors.f90
+++ /dev/null
@@ -1,596 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module allocspace_module
-
-! data types
-USE nrtype
-
-! provide access to the derived types to define the data structures
-USE data_types,only:&
-                    zLookup,             &
-                    ! final data vectors
-                    dlength,             & ! var%dat
-                    ilength,             & ! var%dat
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            integer(8)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_flagVec,         & ! x%var(:)%dat        (logical)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    ! gru dimension
-                    gru_int,             & ! x%gru(:)%var(:)     (i4b)
-                    gru_int8,            & ! x%gru(:)%var(:)     integer(8)
-                    gru_double,          & ! x%gru(:)%var(:)     (dp)
-                    gru_intVec,          & ! x%gru(:)%var(:)%dat (i4b)
-                    gru_doubleVec,       & ! x%gru(:)%var(:)%dat (dp)
-                    ! gru+hru dimension
-                    gru_hru_int,         & ! x%gru(:)%hru(:)%var(:)     (i4b)
-                    gru_hru_int8,        & ! x%gru(:)%hru(:)%var(:)     integer(8)
-                    gru_hru_double,      & ! x%gru(:)%hru(:)%var(:)     (dp)
-                    gru_hru_intVec,      & ! x%gru(:)%hru(:)%var(:)%dat (i4b)
-                    gru_hru_doubleVec      ! x%gru(:)%hru(:)%var(:)%dat (dp)
-
-! metadata structure
-USE data_types,only:var_info               ! data type for metadata
-
-! access missing values
-USE globalData,only:integerMissing         ! missing integer
-USE globalData,only:realMissing            ! missing double precision number
-
-USE globalData,only: nTimeDelay            ! number of timesteps in the time delay histogram
-USE globalData,only: nBand                 ! number of spectral bands
-
-! access variable types
-USE var_lookup,only:iLookVarType           ! look up structure for variable typed
-USE var_lookup,only:maxvarFreq             ! allocation dimension (output frequency)
-
-! privacy
-implicit none
-private
-public::allocLocal
-public::resizeData
-
-! -----------------------------------------------------------------------------------------------------------------------------------
-contains
-
- ! ************************************************************************************************
- ! public subroutine allocLocal: allocate space for local data structures
- ! ************************************************************************************************
- subroutine allocLocal(metaStruct,dataStruct,nSnow,nSoil,err,message)
- implicit none
- ! input-output
- type(var_info),intent(in)        :: metaStruct(:)  ! metadata structure
- class(*),intent(inout)           :: dataStruct     ! data structure
- ! optional input
- integer(i4b),intent(in),optional :: nSnow          ! number of snow layers
- integer(i4b),intent(in),optional :: nSoil          ! number of soil layers
- ! output
- integer(i4b),intent(out)         :: err            ! error code
- character(*),intent(out)         :: message        ! error message
- ! local
- logical(lgt)                     :: check          ! .true. if the variables are allocated
- integer(i4b)                     :: nVars          ! number of variables in the metadata structure
- integer(i4b)                     :: nLayers        ! total number of layers
- logical(lgt)                     :: spatial
- character(len=256)               :: cmessage       ! error message of the downwind routine
- ! initialize error control
- err=0; message='allocLocal/'
-
- ! get the number of variables in the metadata structure
- nVars = size(metaStruct)
-
- ! check if nSnow and nSoil are present
- if(present(nSnow) .or. present(nSoil))then
-  ! check both are present
-  if(.not.present(nSoil))then; err=20; message=trim(message)//'expect nSoil to be present when nSnow is present'; return; end if
-  if(.not.present(nSnow))then; err=20; message=trim(message)//'expect nSnow to be present when nSoil is present'; return; end if
-  nLayers = nSnow+nSoil
-
- ! It is possible that nSnow and nSoil are actually needed here, so we return an error if the optional arguments are missing when needed
- else
-  select type(dataStruct)
-   class is (var_flagVec); err=20
-   class is (var_ilength); err=20
-   class is (var_dlength); err=20
-  end select
-  if(err/=0)then; message=trim(message)//'expect nSnow and nSoil to be present for variable-length data structures'; return; end if
- end if
-
- ! initialize allocation check
- check=.false.
-
- ! allocate the dimension for model variables
- select type(dataStruct)
-  class is (var_i);       if(allocated(dataStruct%var))then; check=.true.; else; allocate(dataStruct%var(nVars),stat=err); end if; return
-  class is (var_i8);      if(allocated(dataStruct%var))then; check=.true.; else; allocate(dataStruct%var(nVars),stat=err); end if; return
-  class is (var_d);       if(allocated(dataStruct%var))then; check=.true.; else; allocate(dataStruct%var(nVars),stat=err); end if; return
-  class is (var_flagVec); if(allocated(dataStruct%var))then; check=.true.; else; allocate(dataStruct%var(nVars),stat=err); end if
-  class is (var_ilength); if(allocated(dataStruct%var))then; check=.true.; else; allocate(dataStruct%var(nVars),stat=err); end if
-  class is (var_dlength); if(allocated(dataStruct%var))then; check=.true.; else; allocate(dataStruct%var(nVars),stat=err); end if
-  class is (zLookup);    spatial=.true.
-  class default; err=20; message=trim(message)//'unable to identify derived data type for the variable dimension'; return
- end select
- ! check errors
- if(check) then; err=20; message=trim(message)//'structure was unexpectedly allocated already'; return; end if
- if(err/=0)then; err=20; message=trim(message)//'problem allocating'; return; end if
-
- ! allocate the dimension for model data
- select type(dataStruct)
-  class is (var_flagVec); call allocateDat_flag(metaStruct,nSnow,nSoil,nLayers,dataStruct,err,cmessage)
-  class is (var_ilength); call allocateDat_int( metaStruct,nSnow,nSoil,nLayers,dataStruct,err,cmessage)
-  class is (var_dlength); call allocateDat_dp(  metaStruct,nSnow,nSoil,nLayers,dataStruct,err,cmessage)
-  class is (zLookup);     spatial=.true.
-  class default; err=20; message=trim(message)//'unable to identify derived data type for the data dimension'; return
- end select
-
- ! check errors
- if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-
- end subroutine allocLocal
-
- ! ************************************************************************************************
- ! public subroutine resizeData: resize data structure
- ! ************************************************************************************************
- subroutine resizeData(metaStruct,dataStructOrig,dataStructNew,copy,err,message)
- implicit none
- ! input
- type(var_info),intent(in)             :: metaStruct(:)  ! metadata structure
- class(*)      ,intent(in)             :: dataStructOrig ! original data structure
- ! output
- class(*)      ,intent(inout)          :: dataStructNew  ! new data structure
- ! control
- logical(lgt)  ,intent(in)   ,optional :: copy           ! flag to copy data
- integer(i4b)  ,intent(out)            :: err            ! error code
- character(*)  ,intent(out)            :: message        ! error message
- ! local
- integer(i4b)                          :: iVar           ! number of variables in the structure
- integer(i4b)                          :: nVars          ! number of variables in the structure
- logical(lgt)                          :: isCopy         ! flag to copy data (handles absence of optional argument)
- character(len=256)                    :: cmessage       ! error message of the downwind routine
- ! initialize error control
- err=0; message='resizeData/'
-
- ! get the copy flag
- if(present(copy))then
-  isCopy = copy
- else
-  isCopy = .false.
- endif
-
- ! get the number of variables in the data structure
- nVars = size(metaStruct)
-
- ! check that the input data structure is allocated
- select type(dataStructOrig)
-  class is (var_ilength); err=merge(0, 20, allocated(dataStructOrig%var))
-  class is (var_dlength); err=merge(0, 20, allocated(dataStructOrig%var))
-  class default; err=20; message=trim(message)//'unable to identify type of data structure'; return
- end select
- if(err/=0)then; message=trim(message)//'input data structure dataStructOrig%var'; return; end if
-
- ! allocate the dimension for model variables
- select type(dataStructNew)
-  class is (var_ilength); if(.not.allocated(dataStructNew%var)) allocate(dataStructNew%var(nVars),stat=err)
-  class is (var_dlength); if(.not.allocated(dataStructNew%var)) allocate(dataStructNew%var(nVars),stat=err)
-  class default; err=20; message=trim(message)//'unable to identify derived data type for the variable dimension'; return
- end select
- if(err/=0)then; message=trim(message)//'problem allocating space for dataStructNew%var'; return; end if
-
- ! loop through variables
- do iVar=1,nVars
-
-  ! resize and copy data structures
-  select type(dataStructOrig)
-
-   ! double precision
-   class is (var_dlength)
-    select type(dataStructNew)
-     class is (var_dlength); call copyStruct_dp( dataStructOrig%var(iVar),dataStructNew%var(iVar),isCopy,err,cmessage)
-     class default; err=20; message=trim(message)//'mismatch data structure for variable'//trim(metaStruct(iVar)%varname); return
-    end select
-
-   ! integer
-   class is (var_ilength)
-    select type(dataStructNew)
-     class is (var_ilength); call copyStruct_i4b(dataStructOrig%var(iVar),dataStructNew%var(iVar),isCopy,err,cmessage)
-     class default; err=20; message=trim(message)//'mismatch data structure for variable'//trim(metaStruct(iVar)%varname); return
-    end select
-
-   ! check
-   class default; err=20; message=trim(message)//'unable to identify type of data structure'; return
-  end select
-  if(err/=0)then; message=trim(message)//trim(cmessage)//' ('//trim(metaStruct(iVar)%varname)//')'; return; end if
-
- end do  ! looping through variables in the data structure
-
- end subroutine resizeData
-
- ! ************************************************************************************************
- ! private subroutine copyStruct_dp: copy a given data structure
- ! ************************************************************************************************
- subroutine copyStruct_dp(varOrig,varNew,copy,err,message)
- ! dummy variables
- type(dlength),intent(in)    :: varOrig        ! original data structure
- type(dlength),intent(inout) :: varNew         ! new data structure
- logical(lgt) ,intent(in)    :: copy           ! flag to copy data
- integer(i4b) ,intent(out)   :: err            ! error code
- character(*) ,intent(out)   :: message        ! error message
- ! local
- logical(lgt)                :: allocatedOrig  ! flag to denote if a given variable in the original data structure is allocated
- logical(lgt)                :: allocatedNew   ! flag to denote if a given variable in the new data structure is allocated
- integer(i4b)                :: lowerBoundOrig ! lower bound of a given variable in the original data structure
- integer(i4b)                :: upperBoundOrig ! upper bound of a given variable in the original data structure
- integer(i4b)                :: lowerBoundNew  ! lower bound of a given variable in the new data structure
- integer(i4b)                :: upperBoundNew  ! upper bound of a given variable in the new data structure
- ! initialize error control
- err=0; message='copyStruct_dp/'
-
- ! get the information from the data structures
- call getVarInfo(varOrig,allocatedOrig,lowerBoundOrig,upperBoundOrig)
- call getVarInfo(varNew, allocatedNew, lowerBoundNew, upperBoundNew)
-
- ! check that the variable of the original data structure is allocated
- if(.not.allocatedOrig)then
-  message=trim(message)//'variable in the original data structure is not allocated'
-  err=20; return
- endif
-
- ! re-size data structure if necessary
- if(lowerBoundOrig/=lowerBoundNew .or. upperBoundOrig/=upperBoundNew .or. .not.allocatedNew)then
-
-  ! deallocate space (if necessary)
-  if(allocatedNew) deallocate(varNew%dat)
-
-  ! allocate space
-  allocate(varNew%dat(lowerBoundOrig:upperBoundOrig), stat=err)
-  if(err/=0)then; message=trim(message)//'problem allocating'; return; endif
-
- endif  ! if need to resize
-
- ! copy the data structure
- if(copy)then
-  varNew%dat(:) = varOrig%dat(:)
-
- ! initialize the data structure to missing values
- else
-  varNew%dat(:) = realMissing
- endif
-
- ! internal routines
- contains
-
-  ! internal subroutine getVarInfo: get information from a given data structure
-  subroutine getVarInfo(var,isAllocated,lowerBound,upperBound)
-  ! input
-  type(dlength),intent(in)         :: var            ! data vector for a given variable
-  ! output
-  logical(lgt),intent(out)         :: isAllocated    ! flag to denote if the data vector is allocated
-  integer(i4b),intent(out)         :: lowerBound     ! lower bound
-  integer(i4b),intent(out)         :: upperBound     ! upper bound
-  ! local
-  integer(i4b),dimension(1)        :: lowerBoundVec  ! lower bound vector
-  integer(i4b),dimension(1)        :: upperBoundVec  ! upper bound vector
-  ! initialize error control
-  err=0; message='getVarInfo/'
-
-  ! check that the input data structure is allocated
-  isAllocated = allocated(var%dat)
-
-  ! if allocated then get the bounds
-  ! NOTE: also convert vector to scalar
-  if(isAllocated)then
-   lowerBoundVec=lbound(var%dat); lowerBound=lowerBoundVec(1)
-   upperBoundVec=ubound(var%dat); upperBound=upperBoundVec(1)
-
-  ! if not allocated then return zero bounds
-  else
-   lowerBound=0
-   upperBound=0
-  endif ! (check allocation)
-
-  end subroutine getVarInfo
-
- end subroutine copyStruct_dp
-
- ! ************************************************************************************************
- ! private subroutine copyStruct_i4b: copy a given data structure
- ! ************************************************************************************************
- subroutine copyStruct_i4b(varOrig,varNew,copy,err,message)
- ! dummy variables
- type(ilength),intent(in)    :: varOrig        ! original data structure
- type(ilength),intent(inout) :: varNew         ! new data structure
- logical(lgt) ,intent(in)    :: copy           ! flag to copy data
- integer(i4b) ,intent(out)   :: err            ! error code
- character(*) ,intent(out)   :: message        ! error message
- ! local
- logical(lgt)                :: allocatedOrig  ! flag to denote if a given variable in the original data structure is allocated
- logical(lgt)                :: allocatedNew   ! flag to denote if a given variable in the new data structure is allocated
- integer(i4b)                :: lowerBoundOrig ! lower bound of a given variable in the original data structure
- integer(i4b)                :: upperBoundOrig ! upper bound of a given variable in the original data structure
- integer(i4b)                :: lowerBoundNew  ! lower bound of a given variable in the new data structure
- integer(i4b)                :: upperBoundNew  ! upper bound of a given variable in the new data structure
- ! initialize error control
- err=0; message='copyStruct_i4b/'
-
- ! get the information from the data structures
- call getVarInfo(varOrig,allocatedOrig,lowerBoundOrig,upperBoundOrig)
- call getVarInfo(varNew, allocatedNew, lowerBoundNew, upperBoundNew)
-
- ! check that the variable of the original data structure is allocated
- if(.not.allocatedOrig)then
-  message=trim(message)//'variable in the original data structure is not allocated'
-  err=20; return
- endif
-
- ! re-size data structure if necessary
- if(lowerBoundOrig/=lowerBoundNew .or. upperBoundOrig/=upperBoundNew .or. .not.allocatedNew)then
-
-  ! deallocate space (if necessary)
-  if(allocatedNew) deallocate(varNew%dat)
-
-  ! allocate space
-  allocate(varNew%dat(lowerBoundOrig:upperBoundOrig), stat=err)
-  if(err/=0)then; message=trim(message)//'problem allocating'; return; endif
-
- endif  ! if need to resize
-
- ! copy the data structure
- if(copy)then
-  varNew%dat(:) = varOrig%dat(:)
-
- ! initialize the data structure to missing values
- else
-  varNew%dat(:) = integerMissing
- endif
-
- ! internal routines
- contains
-
-  ! internal subroutine getVarInfo: get information from a given data structure
-  subroutine getVarInfo(var,isAllocated,lowerBound,upperBound)
-  ! input
-  type(ilength),intent(in)         :: var            ! data vector for a given variable
-  ! output
-  logical(lgt),intent(out)         :: isAllocated    ! flag to denote if the data vector is allocated
-  integer(i4b),intent(out)         :: lowerBound     ! lower bound
-  integer(i4b),intent(out)         :: upperBound     ! upper bound
-  ! local
-  integer(i4b),dimension(1)        :: lowerBoundVec  ! lower bound vector
-  integer(i4b),dimension(1)        :: upperBoundVec  ! upper bound vector
-  ! initialize error control
-  err=0; message='getVarInfo/'
-
-  ! check that the input data structure is allocated
-  isAllocated = allocated(var%dat)
-
-  ! if allocated then get the bounds
-  ! NOTE: also convert vector to scalar
-  if(isAllocated)then
-   lowerBoundVec=lbound(var%dat); lowerBound=lowerBoundVec(1)
-   upperBoundVec=ubound(var%dat); upperBound=upperBoundVec(1)
-
-  ! if not allocated then return zero bounds
-  else
-   lowerBound=0
-   upperBound=0
-  endif ! (check allocation)
-
-  end subroutine getVarInfo
-
- end subroutine copyStruct_i4b
-
-
- ! ************************************************************************************************
- ! private subroutine allocateDat_dp: initialize data dimension of the data structures
- ! ************************************************************************************************
- subroutine allocateDat_dp(metadata,nSnow,nSoil,nLayers, & ! input
-                           varData,err,message)            ! output
- ! access subroutines
- USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
-
- implicit none
- ! input variables
- type(var_info),intent(in)         :: metadata(:) ! metadata structure
- integer(i4b),intent(in)           :: nSnow       ! number of snow layers
- integer(i4b),intent(in)           :: nSoil       ! number of soil layers
- integer(i4b),intent(in)           :: nLayers     ! total number of soil layers in the snow+soil domian (nSnow+nSoil)
- ! output variables
- type(var_dlength),intent(inout)   :: varData     ! model variables for a local HRU
- integer(i4b),intent(out)          :: err         ! error code
- character(*),intent(out)          :: message     ! error message
- ! local variables
- integer(i4b)                      :: iVar        ! variable index
- integer(i4b)                      :: nVars       ! number of variables in the metadata structure
-
-! initialize error control
- err=0; message='allocateDat_dp/'
-
- ! get the number of variables in the metadata structure
- nVars = size(metadata)
-
- ! loop through variables in the data structure
- do iVar=1,nVars
-
-  ! check allocated
-  if(allocated(varData%var(iVar)%dat))then
-   message=trim(message)//'variable '//trim(metadata(iVar)%varname)//' is unexpectedly allocated'
-   err=20; return
-
-  ! allocate structures
-  ! NOTE: maxvarFreq is the number of possible output frequencies
-  !        -- however, this vector must store two values for the variance calculation, thus the *2 in this allocate
-  !            (need enough space in the event that variance is the desired statistic for all output frequencies)
-  else
-   select case(metadata(iVar)%vartype)
-    case(iLookVarType%scalarv); allocate(varData%var(iVar)%dat(1),stat=err)
-    case(iLookVarType%wLength); allocate(varData%var(iVar)%dat(nBand),stat=err)
-    case(iLookVarType%midSnow); allocate(varData%var(iVar)%dat(nSnow),stat=err)
-    case(iLookVarType%midSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
-    case(iLookVarType%midToto); allocate(varData%var(iVar)%dat(nLayers),stat=err)
-    case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%dat(0:nSnow),stat=err)
-    case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%dat(0:nSoil),stat=err)
-    case(iLookVarType%ifcToto); allocate(varData%var(iVar)%dat(0:nLayers),stat=err)
-    case(iLookVarType%parSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
-    case(iLookVarType%routing); allocate(varData%var(iVar)%dat(nTimeDelay),stat=err)
-    case(iLookVarType%outstat); allocate(varData%var(iVar)%dat(maxvarfreq*2),stat=err)
-    case(iLookVarType%unknown); allocate(varData%var(iVar)%dat(0),stat=err)  ! unknown = special (and valid) case that is allocated later (initialize with zero-length vector)
-    case default
-     err=40; message=trim(message)//"1. unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"
-     return
-   end select
-   ! check error
-   if(err/=0)then; err=20; message=trim(message)//'problem allocating variable '//trim(metadata(iVar)%varname); return; end if
-   ! set to missing
-   varData%var(iVar)%dat(:) = realMissing
-  end if  ! if not allocated
-
- end do  ! looping through variables
-
- end subroutine allocateDat_dp
-
- ! ************************************************************************************************
- ! private subroutine allocateDat_int: initialize data dimension of the data structures
- ! ************************************************************************************************
- subroutine allocateDat_int(metadata,nSnow,nSoil,nLayers, & ! input
-                            varData,err,message)            ! output
- USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
- implicit none
- ! input variables
- type(var_info),intent(in)         :: metadata(:) ! metadata structure
- integer(i4b),intent(in)           :: nSnow       ! number of snow layers
- integer(i4b),intent(in)           :: nSoil       ! number of soil layers
- integer(i4b),intent(in)           :: nLayers     ! total number of soil layers in the snow+soil domian (nSnow+nSoil)
- ! output variables
- type(var_ilength),intent(inout)   :: varData     ! model variables for a local HRU
- integer(i4b),intent(out)          :: err         ! error code
- character(*),intent(out)          :: message     ! error message
- ! local variables
- integer(i4b)                      :: iVar        ! variable index
- integer(i4b)                      :: nVars       ! number of variables in the metadata structure
-
-! initialize error control
- err=0; message='allocateDat_int/'
-
- ! get the number of variables in the metadata structure
- nVars = size(metadata)
-
-! loop through variables in the data structure
- do iVar=1,nVars
-
-  ! check allocated
-  if(allocated(varData%var(iVar)%dat))then
-   message=trim(message)//'variable '//trim(metadata(iVar)%varname)//' is unexpectedly allocated'
-   err=20; return
-
-  ! allocate structures
-  ! NOTE: maxvarFreq is the number of possible output frequencies
-  !        -- however, this vector must store two values for the variance calculation, thus the *2 in this allocate
-  !            (need enough space in the event that variance is the desired statistic for all output frequencies)
-  else
-   select case(metadata(iVar)%vartype)
-    case(iLookVarType%scalarv); allocate(varData%var(iVar)%dat(1),stat=err)
-    case(iLookVarType%wLength); allocate(varData%var(iVar)%dat(nBand),stat=err)
-    case(iLookVarType%midSnow); allocate(varData%var(iVar)%dat(nSnow),stat=err)
-    case(iLookVarType%midSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
-    case(iLookVarType%midToto); allocate(varData%var(iVar)%dat(nLayers),stat=err)
-    case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%dat(0:nSnow),stat=err)
-    case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%dat(0:nSoil),stat=err)
-    case(iLookVarType%ifcToto); allocate(varData%var(iVar)%dat(0:nLayers),stat=err)
-    case(iLookVarType%routing); allocate(varData%var(iVar)%dat(nTimeDelay),stat=err)
-    case(iLookVarType%outstat); allocate(varData%var(iVar)%dat(maxvarFreq*2),stat=err)
-    case(iLookVarType%unknown); allocate(varData%var(iVar)%dat(0),stat=err)  ! unknown=special (and valid) case that is allocated later (initialize with zero-length vector)
-    case default; err=40; message=trim(message)//"unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"; return
-   end select
-   ! check error
-   if(err/=0)then; err=20; message=trim(message)//'problem allocating variable '//trim(metadata(iVar)%varname); return; end if
-   ! set to missing
-   varData%var(iVar)%dat(:) = integerMissing
-  end if  ! if not allocated
-
- end do  ! looping through variables
-
- end subroutine allocateDat_int
-
- ! ************************************************************************************************
- ! private subroutine allocateDat_flag: initialize data dimension of the data structures
- ! ************************************************************************************************
- subroutine allocateDat_flag(metadata,nSnow,nSoil,nLayers, & ! input
-                             varData,err,message)            ! output
- USE get_ixName_module,only:get_varTypeName       ! to access type strings for error messages
- implicit none
- ! input variables
- type(var_info),intent(in)         :: metadata(:) ! metadata structure
- integer(i4b),intent(in)           :: nSnow       ! number of snow layers
- integer(i4b),intent(in)           :: nSoil       ! number of soil layers
- integer(i4b),intent(in)           :: nLayers     ! total number of soil layers in the snow+soil domian (nSnow+nSoil)
- ! output variables
- type(var_flagVec),intent(inout)   :: varData     ! model variables for a local HRU
- integer(i4b),intent(out)          :: err         ! error code
- character(*),intent(out)          :: message     ! error message
- ! local variables
- integer(i4b)                      :: iVar        ! variable index
- integer(i4b)                      :: nVars       ! number of variables in the metadata structure
-
-! initialize error control
- err=0; message='allocateDat_flag/'
-
- ! get the number of variables in the metadata structure
- nVars = size(metadata)
-
-! loop through variables in the data structure
- do iVar=1,nVars
-
-  ! check allocated
-  if(allocated(varData%var(iVar)%dat))then
-   message=trim(message)//'variable '//trim(metadata(iVar)%varname)//' is unexpectedly allocated'
-   err=20; return
-
-  ! allocate structures
-  ! NOTE: maxvarFreq is the number of possible output frequencies
-  !        -- however, this vector must store two values for the variance calculation, thus the *2 in this allocate
-  !            (need enough space in the event that variance is the desired statistic for all output frequencies)
-  else
-   select case(metadata(iVar)%vartype)
-    case(iLookVarType%scalarv); allocate(varData%var(iVar)%dat(1),stat=err)
-    case(iLookVarType%wLength); allocate(varData%var(iVar)%dat(nBand),stat=err)
-    case(iLookVarType%midSnow); allocate(varData%var(iVar)%dat(nSnow),stat=err)
-    case(iLookVarType%midSoil); allocate(varData%var(iVar)%dat(nSoil),stat=err)
-    case(iLookVarType%midToto); allocate(varData%var(iVar)%dat(nLayers),stat=err)
-    case(iLookVarType%ifcSnow); allocate(varData%var(iVar)%dat(0:nSnow),stat=err)
-    case(iLookVarType%ifcSoil); allocate(varData%var(iVar)%dat(0:nSoil),stat=err)
-    case(iLookVarType%ifcToto); allocate(varData%var(iVar)%dat(0:nLayers),stat=err)
-    case(iLookVarType%routing); allocate(varData%var(iVar)%dat(nTimeDelay),stat=err)
-    case(iLookVarType%outstat); allocate(varData%var(iVar)%dat(maxvarFreq*2),stat=err)
-    case(iLookVarType%unknown); allocate(varData%var(iVar)%dat(0),stat=err)  ! unknown=special (and valid) case that is allocated later (initialize with zero-length vector)
-    case default; err=40; message=trim(message)//"unknownVariableType[name='"//trim(metadata(iVar)%varname)//"'; type='"//trim(get_varTypeName(metadata(iVar)%vartype))//"']"; return
-   end select
-   ! check error
-   if(err/=0)then; err=20; message=trim(message)//'problem allocating variable '//trim(metadata(iVar)%varname); return; end if
-   ! set to false
-   varData%var(iVar)%dat(:) = .false.
-  end if  ! if not allocated
-
- end do  ! looping through variables
-
- end subroutine allocateDat_flag
-
-end module allocspace_module
diff --git a/build/source/engine/checkStruc.f90 b/build/source/engine/checkStruc.f90
deleted file mode 100755
index d048e2dd5d85fc8d75e54f3a43545caa863c30b5..0000000000000000000000000000000000000000
--- a/build/source/engine/checkStruc.f90
+++ /dev/null
@@ -1,196 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module checkStruc_module
-USE nrtype
-USE globalData,only:integerMissing
-implicit none
-private
-public::checkStruc
-contains
-
-
- ! ************************************************************************************************
- ! public subroutine checkStruc: check data structures
- ! ************************************************************************************************
- subroutine checkStruc(err,message)
- ! ascii utilities
- USE ascii_util_module,only:split_line
- ! summary of data structures
- USE globalData,only:structInfo
- ! metadata structures
- USE globalData,only:time_meta,forc_meta,attr_meta,type_meta,id_meta  ! metadata structures
- USE globalData,only:prog_meta,diag_meta,flux_meta,deriv_meta         ! metadata structures
- USE globalData,only:mpar_meta,indx_meta                              ! metadata structures
- USE globalData,only:bpar_meta,bvar_meta                              ! metadata structures
- ! named variables defining strructure elements
- USE var_lookup,only:iLookTIME,iLookFORCE,iLookATTR,iLookTYPE,iLookID ! named variables showing the elements of each data structure
- USE var_lookup,only:iLookPROG,iLookDIAG,iLookFLUX,iLookDERIV         ! named variables showing the elements of each data structure
- USE var_lookup,only:iLookPARAM,iLookINDEX                            ! named variables showing the elements of each data structure
- USE var_lookup,only:iLookBPAR,iLookBVAR                              ! named variables showing the elements of each data structure
- implicit none
- ! dummy variables
- integer(i4b),intent(out)             :: err         ! error code
- character(*),intent(out)             :: message     ! error message
- ! local variables
- integer(i4b)                         :: iStruct     ! index of data structure
- integer(i4b),parameter               :: nStruct=size(structInfo)  ! number of data structures
- character(len=8192)                  :: longString  ! string containing the indices defined in the structure constructor
- character(len=32),allocatable        :: words(:)    ! vector of words extracted from the long string
- integer(i4b)                         :: ix          ! index of the variable in the data structure
- integer(i4b)                         :: ixTest      ! test the structure constructor = (1,2,3,...,nVar)
- character(len=256)                   :: cmessage    ! error message of downwind routine
- ! -----------------------------------------------------------------------------------------------------------------------------------
- ! initialize errors
- err=0; message="checkStruc/"
-
- ! -----
- ! * check that the structure constructors are correct...
- ! ------------------------------------------------------
-
- ! loop through data structures
- do iStruct=1,nStruct
-  ! convert the lookup structures to a character string
-  ! expect the lookup structures to be a vector (1,2,3,...,n)
-  select case(trim(structInfo(iStruct)%structName))
-   case('time');  write(longString,*) iLookTIME
-   case('forc');  write(longString,*) iLookFORCE
-   case('attr');  write(longString,*) iLookATTR
-   case('type');  write(longString,*) iLookTYPE
-   case('id');    write(longString,*) iLookID
-   case('mpar');  write(longString,*) iLookPARAM
-   case('bpar');  write(longString,*) iLookBPAR
-   case('bvar');  write(longString,*) iLookBVAR
-   case('indx');  write(longString,*) iLookINDEX
-   case('prog');  write(longString,*) iLookPROG
-   case('diag');  write(longString,*) iLookDIAG
-   case('flux');  write(longString,*) iLookFLUX
-   case('deriv'); write(longString,*) iLookDERIV
-   case('lookup'); cycle
-   case default; err=20; message=trim(message)//'unable to identify lookup structure'; return
-  end select
-  ! check that the length of the lookup structure matches the number of variables in the data structure
-  call split_line(longString,words,err,cmessage) ! convert the long character string to a vector of "words"
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-  if(size(words)/=structInfo(iStruct)%nVar)then; err=20; message=trim(message)//'unexpected number of elements'; 
-    print*, 'size(words) = ', size(words)
-    print*, 'structInfo(iStruct)%nVar = ', structInfo(iStruct)%nVar
-  return; end if
-  ! check that the elements in the lookup structure are sequential integers (1,2,3,...,n)
-  do ix=1,structInfo(iStruct)%nVar
-   read(words(ix),*) ixTest  ! convert character to integer; store in ixTest
-   if(ixTest/=ix)then ! expect that the ix-th word is equal to ix
-    write(message,'(a,i0,a)')trim(message)//'problem with structure constructor iLook'//trim(structInfo(iStruct)%lookName)//' [element=',ix,']'
-    err=20; return
-   end if
-  end do
- end do  ! looping through data structures
-
- ! -----
- ! * check that the metadata is fully populated...
- ! -----------------------------------------------
-
- ! loop through data structures
- do iStruct=1,nStruct
-  ! check that the metadata is fully populated
-  select case(trim(structInfo(iStruct)%structName))
-   case('time');  call checkPopulated(iStruct,time_meta,err,cmessage)
-   case('forc');  call checkPopulated(iStruct,forc_meta,err,cmessage)
-   case('attr');  call checkPopulated(iStruct,attr_meta,err,cmessage)
-   case('type');  call checkPopulated(iStruct,type_meta,err,cmessage)
-   case('id');    call checkPopulated(iStruct,id_meta,  err,cmessage)
-   case('mpar');  call checkPopulated(iStruct,mpar_meta,err,cmessage)
-   case('bpar');  call checkPopulated(iStruct,bpar_meta,err,cmessage)
-   case('bvar');  call checkPopulated(iStruct,bvar_meta,err,cmessage)
-   case('indx');  call checkPopulated(iStruct,indx_meta,err,cmessage)
-   case('prog');  call checkPopulated(iStruct,prog_meta,err,cmessage)
-   case('diag');  call checkPopulated(iStruct,diag_meta,err,cmessage)
-   case('flux');  call checkPopulated(iStruct,flux_meta,err,cmessage)
-   case('deriv'); call checkPopulated(iStruct,deriv_meta,err,cmessage)
-   case('lookup'); cycle
-   case default; err=20; message=trim(message)//'unable to identify lookup structure'; return
-  end select
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if  ! (check for errors)
- end do  ! looping through data structures
-
-
- contains
-
-  ! ************************************************************************************************
-  ! internal subroutine checkPopulated: check that the metadata is fully populated...
-  ! ************************************************************************************************
-  subroutine checkPopulated(iStruct,metadata,err,message)
-  ! access the data type for the metadata structures
-  USE data_types,only:var_info
-  ! get index from character string
-  USE get_ixname_module,only: get_ixUnknown! variable lookup structure
-  implicit none
-  ! dummy variables
-  integer(i4b),intent(in)   :: iStruct     ! index of data structure
-  type(var_info)            :: metadata(:) ! metadata structure
-  integer(i4b),intent(out)  :: err         ! error code
-  character(*),intent(out)  :: message     ! error message
-  ! local variables
-  integer(i4b)              :: iVar        ! index of variable within a data structure
-  integer(i4b)              :: jVar        ! index of variable within a data structure (returned from the variable name)
-  character(LEN=100)        :: typeName    ! name of variable type to be returned by get_ixUnknown
-  character(len=256)        :: cmessage    ! error message of downwind routine
-  ! initialize error control
-  err=0; message='checkPopulated/'
-
-  ! loop through variables
-  do iVar=1,size(metadata)
-
-   ! check that this variable is populated
-   if (trim(metadata(iVar)%varname)=='empty') then
-    write(message,'(a,i0,a)') trim(message)//trim(structInfo(iStruct)%structName)//'_meta structure is not populated for named variable # ',iVar,' in structure iLook'//trim(structInfo(iStruct)%lookName)
-    err=20; return
-   end if
-
-   ! look for the populated variable
-   call get_ixUnknown(trim(metadata(iVar)%varname),typeName,jVar,err,cmessage)
-   if(err/=0)then; message=trim(message)//trim(cmessage); return; end if  ! (check for errors)
-
-   ! check that the variable was found at all
-   if (jVar==integerMissing) then
-    message = trim(message)//'cannot find variable '//trim(metadata(iVar)%varname)//' in structure '//trim(structInfo(iStruct)%structName)//'_meta; you need to add variable to get_ix'//trim(structInfo(iStruct)%structName)
-    err=20; return
-   end if
-
-   ! check that the variable was found in the correct structure
-   if (trim(structInfo(iStruct)%structName)/=typeName) then
-    message=trim(message)//'variable '//trim(metadata(iVar)%varname)//' from structure '//trim(structInfo(iStruct)%structName)//'_meta is in structure '//trim(typeName)//'_meta'
-    err=20; return
-   end if
-
-   ! check that the variable index is correct
-   ! This can occur because (1) the code in popMetadat is corrupt (e.g., mis-match in look-up variable); or (2) var_lookup is corrupt.
-   if (jVar/=iVar) then
-    write(message,'(a,i0,a,i0,a)') trim(message)//'variable '//trim(metadata(iVar)%varname)//' has index ', iVar, ' (expect index ', jVar, '); problem possible in popMetadat, get_ix'//trim(structInfo(iStruct)%structName)//', or var_lookup'
-    err=20; return
-   end if
-
-  end do  ! looping through variables in structure iStruct
-
-  end subroutine checkPopulated
-
- end subroutine checkStruc
-
-end module checkStruc_module
diff --git a/build/source/engine/check_icondActors.f90 b/build/source/engine/check_icondActors.f90
deleted file mode 100755
index 2bcc25e89d99b0738ab31525f00364346c2a68f8..0000000000000000000000000000000000000000
--- a/build/source/engine/check_icondActors.f90
+++ /dev/null
@@ -1,278 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module check_icond4chm_module
-USE nrtype
-
-! access missing values
-USE globalData,only:integerMissing  ! missing integer
-USE globalData,only:realMissing     ! missing double precision number
-
-! define modeling decisions
-USE mDecisions_module,only:  &
- moisture,                   & ! moisture-based form of Richards' equation
- mixdform                      ! mixed form of Richards' equation
-
-implicit none
-private
-public::check_icond4chm
-contains
-
- ! ************************************************************************************************
- ! public subroutine check_icond4chm: read model initial conditions
- ! ************************************************************************************************
- subroutine check_icond4chm(&
-                        indxGRU,                           & ! index of GRU in gru_struc
-                        indxHRU,                           & ! index of HRU in gru_struc
-                        progData,                          & ! model prognostic (state) variables
-                        mparData,                          & ! model parameters
-                        indxData,                          & ! layer index data
-                        err,message)                         ! error control
- ! --------------------------------------------------------------------------------------------------------
- ! modules
- USE nrtype
- USE var_lookup,only:iLookParam                          ! variable lookup structure
- USE var_lookup,only:iLookProg                           ! variable lookup structure
- USE var_lookup,only:iLookIndex                          ! variable lookup structure
- USE globalData,only:gru_struc                           ! gru-hru mapping structures
- USE data_types,only:var_dlength                         ! actual data
- USE data_types,only:var_ilength                         ! actual data
- USE globaldata,only:iname_soil,iname_snow               ! named variables to describe the type of layer
- USE multiconst,only:&
-                       LH_fus,    &                      ! latent heat of fusion                (J kg-1)
-                       iden_ice,  &                      ! intrinsic density of ice             (kg m-3)
-                       iden_water,&                      ! intrinsic density of liquid water    (kg m-3)
-                       gravity,   &                      ! gravitational acceleration           (m s-2)
-                       Tfreeze                           ! freezing point of pure water         (K)
- USE snow_utils_module,only:fracliquid                   ! compute volumetric fraction of liquid water in snow based on temperature
- USE updatState_module,only:updateSnow                   ! update snow states
- USE updatState_module,only:updateSoil                   ! update soil states
- implicit none
-
- ! --------------------------------------------------------------------------------------------------------
- ! variable declarations
- ! dummies
- integer(i4b),intent(in)            :: indxGRU        ! index of GRU in gru_struc
- integer(i4b),intent(in)            :: indxHRU        ! index of HRU in gru_struc
- type(var_dlength),intent(inout)    :: progData       ! prognostic vars
- type(var_dlength),intent(in)       :: mparData       ! parameters
- type(var_ilength),intent(in)       :: indxData       ! layer indexes
- integer(i4b),intent(out)           :: err            ! error code
- character(*),intent(out)           :: message        ! returned error message
-
- ! locals
- character(len=256)                :: cmessage       ! downstream error message
-
- ! temporary variables for realism checks
- integer(i4b)                      :: iLayer         ! index of model layer
- integer(i4b)                      :: iSoil          ! index of soil layer
- real(dp)                          :: fLiq           ! fraction of liquid water on the vegetation canopy (-)
- real(dp)                          :: vGn_m          ! van Genutchen "m" parameter (-)
- real(dp)                          :: tWat           ! total water on the vegetation canopy (kg m-2)
- real(dp)                          :: scalarTheta    ! liquid water equivalent of total water [liquid water + ice] (-)
- real(dp)                          :: h1,h2          ! used to check depth and height are consistent
- integer(i4b)                      :: nLayers        ! total number of layers
- real(dp)                          :: kappa          ! constant in the freezing curve function (m K-1)
- integer(i4b)                      :: nSnow          ! number of snow layers
- real(dp),parameter                :: xTol=1.e-10_dp ! small tolerance to address precision issues
- ! --------------------------------------------------------------------------------------------------------
-
- ! Start procedure here
- err=0; message="check_icond4chm/"
-
- ! --------------------------------------------------------------------------------------------------------
- ! Check that the initial conditions do not conflict with parameters, structure, etc.
- ! --------------------------------------------------------------------------------------------------------
- ! ensure the spectral average albedo is realistic
- if(progData%var(iLookPROG%scalarSnowAlbedo)%dat(1) > mparData%var(iLookPARAM%albedoMax)%dat(1)) &
-    progData%var(iLookPROG%scalarSnowAlbedo)%dat(1) = mparData%var(iLookPARAM%albedoMax)%dat(1)
- if(progData%var(iLookPROG%scalarSnowAlbedo)%dat(1) < mparData%var(iLookPARAM%albedoMinWinter)%dat(1)) &
-    progData%var(iLookPROG%scalarSnowAlbedo)%dat(1) = mparData%var(iLookPARAM%albedoMinWinter)%dat(1)
- ! ensure the visible albedo is realistic
- if(progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(1) > mparData%var(iLookPARAM%albedoMaxVisible)%dat(1)) &
-    progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(1) = mparData%var(iLookPARAM%albedoMaxVisible)%dat(1)
- if(progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(1) < mparData%var(iLookPARAM%albedoMinVisible)%dat(1)) &
-    progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(1) = mparData%var(iLookPARAM%albedoMinVisible)%dat(1)
- ! ensure the nearIR albedo is realistic
- if(progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(2) > mparData%var(iLookPARAM%albedoMaxNearIR)%dat(1)) &
-    progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(2) = mparData%var(iLookPARAM%albedoMaxNearIR)%dat(1)
- if(progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(2) < mparData%var(iLookPARAM%albedoMinNearIR)%dat(1)) &
-    progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(2) = mparData%var(iLookPARAM%albedoMinNearIR)%dat(1)
-
- ! ensure the initial conditions are consistent with the constitutive functions
- ! associate local variables with variables in the data structures
- associate(&
- ! state variables in the vegetation canopy
- scalarCanopyTemp  => progData%var(iLookPROG%scalarCanopyTemp)%dat(1)   , & ! canopy temperature
- scalarCanopyIce   => progData%var(iLookPROG%scalarCanopyIce)%dat(1)    , & ! mass of ice on the vegetation canopy (kg m-2)
- scalarCanopyLiq   => progData%var(iLookPROG%scalarCanopyLiq)%dat(1)    , & ! mass of liquid water on the vegetation canopy (kg m-2)
- ! state variables in the snow+soil domain
- mLayerTemp        => progData%var(iLookPROG%mLayerTemp)%dat            , & ! temperature (K)
- mLayerVolFracLiq  => progData%var(iLookPROG%mLayerVolFracLiq)%dat      , & ! volumetric fraction of liquid water in each snow layer (-)
- mLayerVolFracIce  => progData%var(iLookPROG%mLayerVolFracIce)%dat      , & ! volumetric fraction of ice in each snow layer (-)
- mLayerMatricHead  => progData%var(iLookPROG%mLayerMatricHead)%dat      , & ! matric head (m)
- mLayerLayerType   => indxData%var(iLookINDEX%layerType)%dat            , & ! type of layer (ix_soil or ix_snow)
- ! depth varying soil properties
- vGn_alpha         => mparData%var(iLookPARAM%vGn_alpha)%dat            , & ! van Genutchen "alpha" parameter (m-1)
- vGn_n             => mparData%var(iLookPARAM%vGn_n)%dat                , & ! van Genutchen "n" parameter (-)
- theta_sat         => mparData%var(iLookPARAM%theta_sat)%dat            , & ! soil porosity (-)
- theta_res         => mparData%var(iLookPARAM%theta_res)%dat            , & ! soil residual volumetric water content (-)
- ! snow parameters
- snowfrz_scale     => mparData%var(iLookPARAM%snowfrz_scale)%dat(1)     , & ! scaling parameter for the snow freezing curve (K-1)
- FCapil            => mparData%var(iLookPARAM%FCapil)%dat(1)              & ! fraction of pore space in tension storage (-)
- )  ! (associate local variables with model parameters)
-
- ! compute the constant in the freezing curve function (m K-1)
- kappa  = (iden_ice/iden_water)*(LH_fus/(gravity*Tfreeze))  ! NOTE: J = kg m2 s-2
-
- ! modify the liquid water and ice in the canopy
- if(scalarCanopyIce > 0._dp .and. scalarCanopyTemp > Tfreeze)then
-  message=trim(message)//'canopy ice > 0 when canopy temperature > Tfreeze'
-  err=20; return
- end if
- fLiq = fracliquid(scalarCanopyTemp,snowfrz_scale)  ! fraction of liquid water (-)
- tWat = scalarCanopyLiq + scalarCanopyIce           ! total water (kg m-2)
- scalarCanopyLiq = fLiq*tWat                        ! mass of liquid water on the canopy (kg m-2)
- scalarCanopyIce = (1._dp - fLiq)*tWat              ! mass of ice on the canopy (kg m-2)
-
- ! number of layers
- nLayers = gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow + gru_struc(indxGRU)%hruInfo(indxHRU)%nSoil
- nSnow   = gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow
-
- ! loop through all layers
- do iLayer=1,nLayers
-
-  ! compute liquid water equivalent of total water (liquid plus ice)
-  if (iLayer>nSnow) then ! soil layer = no volume expansion
-   iSoil       = iLayer - nSnow
-   vGn_m       = 1._dp - 1._dp/vGn_n(iSoil)
-   scalarTheta = mLayerVolFracIce(iLayer) + mLayerVolFracLiq(iLayer)
-  else ! snow layer = volume expansion allowed
-   iSoil       = integerMissing
-   vGn_m       = realMissing
-   scalarTheta = mLayerVolFracIce(iLayer)*(iden_ice/iden_water) + mLayerVolFracLiq(iLayer)
-  end if
-
-  ! *****
-  ! * check that the initial volumetric fraction of liquid water and ice is reasonable...
-  ! *************************************************************************************
-  
-  select case(mlayerLayerType(iLayer))
-
-   ! ***** snow
-   case(iname_snow)
-    ! (check liquid water)
-    if(mLayerVolFracLiq(iLayer) < 0._dp)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of liquid water < 0: layer = ',iLayer; err=20; return; end if
-    if(mLayerVolFracLiq(iLayer) > 1._dp)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of liquid water > 1: layer = ',iLayer; err=20; return; end if
-    ! (check ice)
-    if(mLayerVolFracIce(iLayer) > 0.80_dp)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of ice > 0.80: layer = ',iLayer; err=20; return; end if
-    if(mLayerVolFracIce(iLayer) < 0.05_dp)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of ice < 0.05: layer = ',iLayer; err=20; return; end if
-    ! check total water
-    if(scalarTheta > 0.80_dp)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with total water fraction [liquid + ice] > 0.80: layer = ',iLayer; err=20; return; end if
-    if(scalarTheta < 0.05_dp)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with total water fraction [liquid + ice] < 0.05: layer = ',iLayer; err=20; return; end if
-
-   ! ***** soil
-   case(iname_soil)
-
-    ! (check liquid water)
-    if(mLayerVolFracLiq(iLayer) < theta_res(iSoil)-xTol)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of liquid water < theta_res: layer = ',iLayer; err=20; return; end if
-    if(mLayerVolFracLiq(iLayer) > theta_sat(iSoil)+xTol)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of liquid water > theta_sat: layer = ',iLayer; err=20; return; end if
-    ! (check ice)
-    if(mLayerVolFracIce(iLayer) < 0._dp                )then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of ice < 0: layer = '        ,iLayer; err=20; return; end if
-    if(mLayerVolFracIce(iLayer) > theta_sat(iSoil)+xTol)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with volumetric fraction of ice > theta_sat: layer = ',iLayer; err=20; return; end if
-    ! check total water
-    if(scalarTheta < theta_res(iSoil)-xTol)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with total water fraction [liquid + ice] < theta_res: layer = ',iLayer; err=20; return; end if
-    if(scalarTheta > theta_sat(iSoil)+xTol)then; write(message,'(a,1x,i0)') trim(message)//'cannot initialize the model with total water fraction [liquid + ice] > theta_sat: layer = ',iLayer; err=20; return; end if
-
-   case default
-    write(*,*) 'Cannot recognize case in initial vol water/ice check: type=', mlayerLayerType(iLayer)
-    err=20; message=trim(message)//'cannot identify layer type'; return
-  end select
-
-  ! *****
-  ! * check that the initial conditions are consistent with the constitutive functions...
-  ! *************************************************************************************
-  select case(mLayerLayerType(iLayer))
-
-   ! ** snow
-   case(iname_snow)
-
-    ! check that snow temperature is less than freezing
-    if(mLayerTemp(iLayer) > Tfreeze)then
-     message=trim(message)//'initial snow temperature is greater than freezing'
-     err=20; return
-    end if
-
-    ! ensure consistency among state variables
-    call updateSnow(&
-                    ! input
-                    mLayerTemp(iLayer),                        & ! intent(in): temperature (K)
-                    scalarTheta,                               & ! intent(in): mass fraction of total water (-)
-                    snowfrz_scale,                             & ! intent(in): scaling parameter for the snow freezing curve (K-1)
-                    ! output
-                    mLayerVolFracLiq(iLayer),                  & ! intent(out): volumetric fraction of liquid water (-)
-                    mLayerVolFracIce(iLayer),                  & ! intent(out): volumetric fraction of ice (-)
-                    fLiq,                                      & ! intent(out): fraction of liquid water (-)
-                    err,cmessage)                                ! intent(out): error control
-    if(err/=0)then; message=trim(message)//trim(cmessage); return; end if  ! (check for errors)
-
-   ! ** soil
-   case(iname_soil)
-
-    ! ensure consistency among state variables
-    call updateSoil(&
-                    ! input
-                    mLayerTemp(iLayer),                                                    & ! intent(in): layer temperature (K)
-                    mLayerMatricHead(iLayer-nSnow),                                        & ! intent(in): matric head (m)
-                    vGn_alpha(iSoil),vGn_n(iSoil),theta_sat(iSoil),theta_res(iSoil),vGn_m, & ! intent(in): van Genutchen soil parameters
-                    ! output
-                    scalarTheta,                                                           & ! intent(out): volumetric fraction of total water (-)
-                    mLayerVolFracLiq(iLayer),                                              & ! intent(out): volumetric fraction of liquid water (-)
-                    mLayerVolFracIce(iLayer),                                              & ! intent(out): volumetric fraction of ice (-)
-                    err,cmessage)                                                            ! intent(out): error control
-    if(err/=0)then; message=trim(message)//trim(cmessage); return; end if  ! (check for errors)
-
-   case default; err=10; message=trim(message)//'unknown case for model layer'; return
-  end select
-
- end do  ! (looping through layers)
-
-   ! end association to variables in the data structures
- end associate
-
- ! if snow layers exist, compute snow depth and SWE
- if(nSnow > 0)then
-  progData%var(iLookPROG%scalarSWE)%dat(1)       = sum( (progData%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                                             progData%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice)        * &
-                                                                             progData%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
- end if  ! if snow layers exist
-
- ! check that the layering is consistent
- do iLayer=1,nLayers
-  h1 = sum(progData%var(iLookPROG%mLayerDepth)%dat(1:iLayer)) ! sum of the depths up to the current layer
-  h2 = progData%var(iLookPROG%iLayerHeight)%dat(iLayer) - progData%var(iLookPROG%iLayerHeight)%dat(0)  ! difference between snow-atm interface and bottom of layer
-  if(abs(h1 - h2) > 1.e-6_dp)then
-   write(message,'(a,1x,i0)') trim(message)//'mis-match between layer depth and layer height; layer = ', iLayer, '; sum depths = ',h1,'; height = ',h2
-   err=20; return
-  end if
- end do
- end subroutine check_icond4chm
-
-end module check_icond4chm_module
diff --git a/build/source/engine/coupled_em.f90 b/build/source/engine/coupled_em.f90
deleted file mode 100644
index 85c21fe60399d90e01ea02ab3c8f9f144aa7b8a3..0000000000000000000000000000000000000000
--- a/build/source/engine/coupled_em.f90
+++ /dev/null
@@ -1,1421 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module coupled_em_module
-
-! numerical recipes data types
-USE nrtype
-
-! physical constants
-USE multiconst,only:&
-                    Tfreeze,      & ! temperature at freezing              (K)
-                    LH_fus,       & ! latent heat of fusion                (J kg-1)
-                    LH_sub,       & ! latent heat of sublimation           (J kg-1)
-                    iden_ice,     & ! intrinsic density of ice             (kg m-3)
-                    iden_water      ! intrinsic density of liquid water    (kg m-3)
-
-! data types
-USE data_types,only:&
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    zLookup
-
-! named variables for parent structures
-USE var_lookup,only:iLookDECISIONS         ! named variables for elements of the decision structure
-USE var_lookup,only:iLookPROG              ! named variables for structure elements
-USE var_lookup,only:iLookDIAG              ! named variables for structure elements
-USE var_lookup,only:iLookFLUX              ! named variables for structure elements
-USE var_lookup,only:iLookPARAM             ! named variables for structure elements
-USE var_lookup,only:iLookINDEX             ! named variables for structure elements
-USE globalData,only:iname_snow             ! named variables for snow
-USE globalData,only:iname_soil             ! named variables for soil
-
-! named variables for child structures
-USE var_lookup,only:childFLUX_MEAN
-
-! metadata
-USE globalData,only:indx_meta              ! metadata on the model index variables
-USE globalData,only:diag_meta              ! metadata on the model diagnostic variables
-USE globalData,only:prog_meta              ! metadata on the model prognostic variables
-USE globalData,only:averageFlux_meta       ! metadata on the timestep-average model flux structure
-
-! global data
-USE globalData,only:data_step              ! time step of forcing data (s)
-USE globalData,only:model_decisions        ! model decision structure
-USE globalData,only:globalPrintFlag        ! the global print flag
-
-! look-up values for the maximum interception capacity
-USE mDecisions_module,only:         &
-                      stickySnow,   &      ! maximum interception capacity an increasing function of temerature
-                      lightSnow            ! maximum interception capacity an inverse function of new snow density
-
-! look-up values for the groundwater parameterization
-USE mDecisions_module,only:         &
-                      qbaseTopmodel,&      ! TOPMODEL-ish baseflow parameterization
-                      bigBucket    ,&      ! a big bucket (lumped aquifer model)
-                      noExplicit           ! no explicit groundwater parameterization
-
-! look-up values for the spatial representation of groundwater
-USE mDecisions_module,only:         &
-                      localColumn  ,&      ! separate groundwater representation in each local soil column
-                      singleBasin          ! single groundwater store over the entire basin
-
-! privacy
-implicit none
-private
-public::coupled_em
-! algorithmic parameters
-real(dp),parameter     :: valueMissing=-9999._dp  ! missing value, used when diagnostic or state variables are undefined
-real(dp),parameter     :: verySmall=1.e-6_dp   ! used as an additive constant to check if substantial difference among real numbers
-real(dp),parameter     :: mpe=1.e-6_dp         ! prevents overflow error if division by zero
-real(dp),parameter     :: dx=1.e-6_dp          ! finite difference increment
-contains
-
-
-  ! ************************************************************************************************
-  ! public subroutine coupled_em: run the coupled energy-mass model for one timestep
-  ! ************************************************************************************************
-subroutine coupled_em(&
-                        ! model control
-                        indxHRU,           & ! intent(in):    hruId
-                        dt_init,           & ! intent(inout): used to initialize the size of the sub-step
-                        dt_init_factor,    & ! Used to adjust the length of the timestep in the event of a failure
-                        computeVegFlux,    & ! intent(inout): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-                        ! data structures (input)
-                        type_data,         & ! intent(in):    local classification of soil veg etc. for each HRU
-                        attr_data,         & ! intent(in):    local attributes for each HRU
-                        forc_data,         & ! intent(in):    model forcing data
-                        mpar_data,         & ! intent(in):    model parameters
-                        bvar_data,         & ! intent(in):    basin-average variables
-                        lookup_data,       & ! intent(in):    lookup tables
-                        ! data structures (input-output)
-                        indx_data,         & ! intent(inout): model indices
-                        prog_data,         & ! intent(inout): prognostic variables for a local HRU
-                        diag_data,         & ! intent(inout): diagnostic variables for a local HRU
-                        flux_data,         & ! intent(inout): model fluxes for a local HRU
-                        fracJulDay,        &
-                        yearLength,        &
-                        ! error control
-                        err,message)         ! intent(out):   error control
-  ! structure allocations
-  USE allocspace_module,only:allocLocal      ! allocate local data structures
-  USE allocspace_module,only:resizeData      ! clone a data structure
-  ! preliminary subroutines
-  USE vegPhenlgy_module,only:vegPhenlgy      ! compute vegetation phenology
-  USE vegNrgFlux_module,only:wettedFrac      ! compute wetted fraction of the canopy (used in sw radiation fluxes)
-  USE snowAlbedo_module,only:snowAlbedo      ! compute snow albedo
-  USE vegSWavRad_module,only:vegSWavRad      ! compute canopy sw radiation fluxes
-  USE canopySnow_module,only:canopySnow      ! compute interception and unloading of snow from the vegetation canopy
-  USE volicePack_module,only:newsnwfall      ! compute change in the top snow layer due to throughfall and unloading
-  USE volicePack_module,only:volicePack      ! merge and sub-divide snow layers, if necessary
-  USE diagn_evar_module,only:diagn_evar      ! compute diagnostic energy variables -- thermal conductivity and heat capacity
-  ! the model solver
-  USE indexState_module,only:indexState      ! define indices for all model state variables and layers
-  USE opSplittin_module,only:opSplittin      ! solve the system of thermodynamic and hydrology equations for a given substep
-  ! additional subroutines
-  USE tempAdjust_module,only:tempAdjust      ! adjust snow temperature associated with new snowfall
-  USE snwDensify_module,only:snwDensify      ! snow densification (compaction and cavitation)
-  USE var_derive_module,only:calcHeight      ! module to calculate height at layer interfaces and layer mid-point
-  ! look-up values for the numerical method
-  implicit none
-  ! model control
-  integer(4),intent(in)                :: indxHRU                ! hruId
-  real(dp),intent(inout)               :: dt_init                ! used to initialize the size of the sub-step
-  integer(i4b),intent(in)              :: dt_init_factor         ! Used to adjust the length of the timestep in the event of a failure
-  logical(lgt),intent(inout)           :: computeVegFlux         ! flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-  ! data structures (input)
-  type(var_i),intent(in)               :: type_data              ! type of vegetation and soil
-  type(var_d),intent(in)               :: attr_data              ! spatial attributes
-  type(var_d),intent(in)               :: forc_data              ! model forcing data
-  type(var_dlength),intent(in)         :: mpar_data              ! model parameters
-  type(var_dlength),intent(in)         :: bvar_data              ! basin-average model variables
-  type(zLookup),intent(in)             :: lookup_data            ! lookup tables
-  ! data structures (input-output)
-  type(var_ilength),intent(inout)      :: indx_data              ! state vector geometry
-  type(var_dlength),intent(inout)      :: prog_data              ! prognostic variables for a local HRU
-  type(var_dlength),intent(inout)      :: diag_data              ! diagnostic variables for a local HRU
-  type(var_dlength),intent(inout)      :: flux_data              ! model fluxes for a local HRU
-  real(dp),intent(inout)               :: fracJulDay
-  integer(i4b),intent(inout)           :: yearLength 
-  ! error control
-  integer(i4b),intent(out)             :: err                    ! error code
-  character(*),intent(out)             :: message                ! error message
-  ! =====================================================================================================================================================
-  ! =====================================================================================================================================================
-  ! local variables
-  character(len=256)                   :: cmessage               ! error message
-  integer(i4b)                         :: nSnow                  ! number of snow layers
-  integer(i4b)                         :: nSoil                  ! number of soil layers
-  integer(i4b)                         :: nLayers                ! total number of layers
-  integer(i4b)                         :: nState                 ! total number of state variables
-  real(dp)                             :: dtSave                 ! length of last input model sub-step (seconds)
-  real(dp)                             :: dt_sub                 ! length of model sub-step (seconds)
-  real(dp)                             :: dt_wght                ! weight applied to model sub-step (dt_sub/data_step)
-  real(dp)                             :: dt_solv                ! seconds in the data step that have been completed
-  real(dp)                             :: dtMultiplier           ! time step multiplier (-) based on what happenned in "opSplittin"
-  real(dp)                             :: minstep,maxstep        ! minimum and maximum time step length (seconds)
-  integer(i4b)                         :: nsub                   ! number of substeps
-  logical(lgt)                         :: computeVegFluxOld      ! flag to indicate if we are computing fluxes over vegetation on the previous sub step
-  logical(lgt)                         :: includeAquifer         ! flag to denote that an aquifer is included
-  logical(lgt)                         :: modifiedLayers         ! flag to denote that snow layers were modified
-  logical(lgt)                         :: modifiedVegState       ! flag to denote that vegetation states were modified
-  type(var_dlength)                    :: flux_mean              ! timestep-average model fluxes for a local HRU
-  integer(i4b)                         :: nLayersRoots           ! number of soil layers that contain roots
-  real(dp)                             :: exposedVAI             ! exposed vegetation area index
-  real(dp)                             :: dCanopyWetFraction_dWat ! derivative in wetted fraction w.r.t. canopy total water (kg-1 m2)
-  real(dp)                             :: dCanopyWetFraction_dT   ! derivative in wetted fraction w.r.t. canopy temperature (K-1)
-  real(dp),parameter                   :: varNotUsed1=-9999._dp  ! variables used to calculate derivatives (not needed here)
-  real(dp),parameter                   :: varNotUsed2=-9999._dp  ! variables used to calculate derivatives (not needed here)
-  integer(i4b)                         :: iSnow                  ! index of snow layers
-  integer(i4b)                         :: iLayer                 ! index of model layers
-  real(dp)                             :: massLiquid             ! mass liquid water (kg m-2)
-  real(dp)                             :: superflousSub          ! superflous sublimation (kg m-2 s-1)
-  real(dp)                             :: superflousNrg          ! superflous energy that cannot be used for sublimation (W m-2 [J m-2 s-1])
-  integer(i4b)                         :: ixSolution             ! solution method used by opSplitting
-  logical(lgt)                         :: firstSubStep           ! flag to denote if the first time step
-  logical(lgt)                         :: stepFailure            ! flag to denote the need to reduce length of the coupled step and try again
-  logical(lgt)                         :: tooMuchMelt            ! flag to denote that there was too much melt in a given time step
-  logical(lgt)                         :: doLayerMerge           ! flag to denote the need to merge snow layers
-  logical(lgt)                         :: pauseFlag              ! flag to pause execution
-  logical(lgt),parameter               :: backwardsCompatibility=.true.  ! flag to denote a desire to ensure backwards compatibility with previous branches.
-  type(var_ilength)                    :: indx_temp              ! temporary model index variables
-  type(var_dlength)                    :: prog_temp              ! temporary model prognostic variables
-  type(var_dlength)                    :: diag_temp              ! temporary model diagnostic variables
-  ! check SWE
-  real(dp)                             :: oldSWE                 ! SWE at the start of the substep
-  real(dp)                             :: newSWE                 ! SWE at the end of the substep
-  real(dp)                             :: delSWE                 ! change in SWE over the subtep
-  real(dp)                             :: effRainfall            ! effective rainfall (kg m-2 s-1)
-  real(dp)                             :: effSnowfall            ! effective snowfall (kg m-2 s-1)
-  real(dp)                             :: sfcMeltPond            ! surface melt pond (kg m-2)
-  real(dp)                             :: massBalance            ! mass balance error (kg m-2)
-  ! balance checks
-  integer(i4b)                         :: iVar                   ! loop through model variables
-  real(dp)                             :: totalSoilCompress      ! total soil compression (kg m-2)
-  real(dp)                             :: scalarCanopyWatBalError ! water balance error for the vegetation canopy (kg m-2)
-  real(dp)                             :: scalarSoilWatBalError  ! water balance error (kg m-2)
-  real(dp)                             :: scalarInitCanopyLiq    ! initial liquid water on the vegetation canopy (kg m-2)
-  real(dp)                             :: scalarInitCanopyIce    ! initial ice          on the vegetation canopy (kg m-2)
-  real(dp)                             :: balanceCanopyWater0    ! total water stored in the vegetation canopy at the start of the step (kg m-2)
-  real(dp)                             :: balanceCanopyWater1    ! total water stored in the vegetation canopy at the end of the step (kg m-2)
-  real(dp)                             :: balanceSoilWater0      ! total soil storage at the start of the step (kg m-2)
-  real(dp)                             :: balanceSoilWater1      ! total soil storage at the end of the step (kg m-2)
-  real(dp)                             :: balanceSoilInflux      ! input to the soil zone
-  real(dp)                             :: balanceSoilBaseflow    ! output from the soil zone
-  real(dp)                             :: balanceSoilDrainage    ! output from the soil zone
-  real(dp)                             :: balanceSoilET          ! output from the soil zone
-  real(dp)                             :: balanceAquifer0        ! total aquifer storage at the start of the step (kg m-2)
-  real(dp)                             :: balanceAquifer1        ! total aquifer storage at the end of the step (kg m-2)
-  ! test balance checks
-  logical(lgt), parameter              :: printBalance=.false.   ! flag to print the balance checks
-  real(dp), allocatable                :: liqSnowInit(:)         ! volumetric liquid water conetnt of snow at the start of the time step
-  real(dp), allocatable                :: liqSoilInit(:)         ! soil moisture at the start of the time step
-
-  
-  ! ----------------------------------------------------------------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message="coupled_em/"
-
-  ! check that the decision is supported
-  if(model_decisions(iLookDECISIONS%groundwatr)%iDecision==bigBucket .and. &
-      model_decisions(iLookDECISIONS%spatial_gw)%iDecision/=localColumn)then
-    message=trim(message)//'expect "spatial_gw" decision to equal localColumn when "groundwatr" decision is bigBucket'
-    err=20; return
-  endif
-  
-  ! check if the aquifer is included
-  includeAquifer = (model_decisions(iLookDECISIONS%groundwatr)%iDecision==bigBucket)
-
-  ! initialize the numerix tracking variables
-  indx_data%var(iLookINDEX%numberFluxCalc       )%dat(1) = 0  ! number of flux calculations                     (-)
-  indx_data%var(iLookINDEX%numberStateSplit     )%dat(1) = 0  ! number of state splitting solutions             (-)
-  indx_data%var(iLookINDEX%numberDomainSplitNrg )%dat(1) = 0  ! number of domain splitting solutions for energy (-)
-  indx_data%var(iLookINDEX%numberDomainSplitMass)%dat(1) = 0  ! number of domain splitting solutions for mass   (-)
-  indx_data%var(iLookINDEX%numberScalarSolutions)%dat(1) = 0  ! number of scalar solutions                      (-)
-
-  ! link canopy depth to the information in the data structure
-  canopy: associate(canopyDepth => diag_data%var(iLookDIAG%scalarCanopyDepth)%dat(1) )  ! intent(out): [dp] canopy depth (m)
-  
-
-  ! start by NOT pausing
-  pauseFlag=.false.
-
-  ! start by assuming that the step is successful
-  stepFailure  = .false.
-  doLayerMerge = .false.
-
-  ! initialize flags to modify the veg layers or modify snow layers
-  modifiedLayers    = .false.    ! flag to denote that snow layers were modified
-  modifiedVegState  = .false.    ! flag to denote that vegetation states were modified
-
-  ! define the first step
-  firstSubStep = .true.
-
-  ! count the number of snow and soil layers
-  ! NOTE: need to re-compute the number of snow and soil layers at the start of each sub-step because the number of layers may change
-  !         (nSnow and nSoil are shared in the data structure)
-  nSnow = count(indx_data%var(iLookINDEX%layerType)%dat==iname_snow)
-  nSoil = count(indx_data%var(iLookINDEX%layerType)%dat==iname_soil)
-
-  ! compute the total number of snow and soil layers
-  nLayers = nSnow + nSoil
-  
-
-  ! create temporary data structures for prognostic variables
-  call resizeData(prog_meta(:),prog_data,prog_temp,err=err,message=cmessage)
-    if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! create temporary data structures for diagnostic variables
-  call resizeData(diag_meta(:),diag_data,diag_temp,err=err,message=cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! create temporary data structures for index variables
-  call resizeData(indx_meta(:),indx_data,indx_temp,err=err,message=cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! allocate space for the local fluxes
-  call allocLocal(averageFlux_meta(:)%var_info,flux_mean,nSnow,nSoil,err,cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! initialize compression and surface melt pond
-  sfcMeltPond       = 0._dp  ! change in storage associated with the surface melt pond (kg m-2)
-  totalSoilCompress = 0._dp  ! change in soil storage associated with compression of the matrix (kg m-2)
-
-  ! initialize mean fluxes
-  do iVar=1,size(averageFlux_meta)
-    flux_mean%var(iVar)%dat(:) = 0._dp
-  end do
-  
-
-  ! associate local variables with information in the data structures
-  associate(&
-  ! state variables in the vegetation canopy
-  scalarCanopyLiq      => prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1)                 ,&  ! canopy liquid water (kg m-2)
-  scalarCanopyIce      => prog_data%var(iLookPROG%scalarCanopyIce)%dat(1)                 ,&  ! canopy ice content (kg m-2)
-  ! state variables in the soil domain
-  mLayerDepth          => prog_data%var(iLookPROG%mLayerDepth)%dat(nSnow+1:nLayers)       ,&  ! depth of each soil layer (m)
-  mLayerVolFracIce     => prog_data%var(iLookPROG%mLayerVolFracIce)%dat(nSnow+1:nLayers)  ,&  ! volumetric ice content in each soil layer (-)
-  mLayerVolFracLiq     => prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(nSnow+1:nLayers)  ,&  ! volumetric liquid water content in each soil layer (-)
-  scalarAquiferStorage => prog_data%var(iLookPROG%scalarAquiferStorage)%dat(1)            ,&  ! aquifer storage (m)
-  scalarTotalSoilIce   => diag_data%var(iLookDIAG%scalarTotalSoilIce)%dat(1)              ,&  ! total ice in the soil column (kg m-2)
-  scalarTotalSoilLiq   => diag_data%var(iLookDIAG%scalarTotalSoilLiq)%dat(1)              ,&  ! total liquid water in the soil column (kg m-2)
-  scalarTotalSoilWat   => diag_data%var(iLookDIAG%scalarTotalSoilWat)%dat(1)               &  ! total water in the soil column (kg m-2)
-  ) ! (association of local variables with information in the data structures
-
-  ! save the liquid water and ice on the vegetation canopy
-  scalarInitCanopyLiq = scalarCanopyLiq    ! initial liquid water on the vegetation canopy (kg m-2)
-  scalarInitCanopyIce = scalarCanopyIce    ! initial ice          on the vegetation canopy (kg m-2)
-
-  ! compute total soil moisture and ice at the *START* of the step (kg m-2)
-  scalarTotalSoilLiq = sum(iden_water*mLayerVolFracLiq(1:nSoil)*mLayerDepth(1:nSoil))
-  scalarTotalSoilIce = sum(iden_water*mLayerVolFracIce(1:nSoil)*mLayerDepth(1:nSoil))  ! NOTE: no expansion and hence use iden_water
-
-  ! compute storage of water in the canopy and the soil
-  balanceCanopyWater0 = scalarCanopyLiq + scalarCanopyIce
-  balanceSoilWater0   = scalarTotalSoilLiq + scalarTotalSoilIce
-
-  ! get the total aquifer storage at the start of the time step (kg m-2)
-  balanceAquifer0 = scalarAquiferStorage*iden_water
-
-  ! save liquid water content
-  if(printBalance)then
-    allocate(liqSnowInit(nSnow), liqSoilInit(nSoil), stat=err)
-    if(err/=0)then
-      message=trim(message)//'unable to allocate space for the initial vectors'
-      print*,message
-      err=20; 
-      return
-    endif
-    if(nSnow>0) liqSnowInit = prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)
-    liqSoilInit = mLayerVolFracLiq
-  endif
-
-  ! end association of local variables with information in the data structures
-  end associate
-  
-
-  ! short-cut to the algorithmic control parameters
-  ! NOTE - temporary assignment of minstep to foce something reasonable
-  minstep = 10._dp  ! mpar_data%var(iLookPARAM%minstep)%dat(1)  ! minimum time step (s)
-  maxstep = mpar_data%var(iLookPARAM%maxstep)%dat(1)  ! maximum time step (s)
-  !print*, 'minstep, maxstep = ', minstep, maxstep
-
-  ! compute the number of layers with roots
-  nLayersRoots = count(prog_data%var(iLookPROG%iLayerHeight)%dat(nSnow:nLayers-1) < mpar_data%var(iLookPARAM%rootingDepth)%dat(1)-verySmall)
-  if(nLayersRoots == 0)then
-    message=trim(message)//'no roots within the soil profile'
-    print*, message
-    err=20; return
-  end if
-
-  ! define the foliage nitrogen factor
-  diag_data%var(iLookDIAG%scalarFoliageNitrogenFactor)%dat(1) = 1._dp  ! foliage nitrogen concentration (1.0 = saturated)
-
-  ! save SWE
-  oldSWE = prog_data%var(iLookPROG%scalarSWE)%dat(1)
-  !print*, 'nSnow = ', nSnow
-  !print*, 'oldSWE = ', oldSWE
-
-  ! *** compute phenology...
-  ! ------------------------
-  
-
-  ! compute the temperature of the root zone: used in vegetation phenology
-  diag_data%var(iLookDIAG%scalarRootZoneTemp)%dat(1) = sum(prog_data%var(iLookPROG%mLayerTemp)%dat(nSnow+1:nSnow+nLayersRoots)) / real(nLayersRoots, kind(dp))
-
-  ! remember if we compute the vegetation flux on the previous sub-step
-  computeVegFluxOld = computeVegFlux
-
-  ! compute the exposed LAI and SAI and whether veg is buried by snow
-  call vegPhenlgy(&
-                  ! input/output: data structures
-                  model_decisions,             & ! intent(in):    model decisions
-                  type_data,                   & ! intent(in):    type of vegetation and soil
-                  attr_data,                   & ! intent(in):    spatial attributes
-                  mpar_data,                   & ! intent(in):    model parameters
-                  prog_data,                   & ! intent(in):    model prognostic variables for a local HRU
-                  diag_data,                   & ! intent(inout): model diagnostic variables for a local HRU
-                  ! output
-                  computeVegFlux,              & ! intent(out): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-                  canopyDepth,                 & ! intent(out): canopy depth (m)
-                  exposedVAI,                  & ! intent(out): exposed vegetation area index (m2 m-2)
-                  fracJulDay,                  & ! fractional julian days since the start of year
-                  yearLength,                  & ! number of days in the current year
-                  err,cmessage)                  ! intent(out): error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-  
-
-  ! check
-  if(computeVegFlux)then
-    if(canopyDepth < epsilon(canopyDepth))then
-      message=trim(message)//'canopy depth is zero when computeVegFlux flag is .true.'
-      print*, message
-      err=20; return
-    endif
-  endif
-
-  ! flag the case where number of vegetation states has changed
-  modifiedVegState = (computeVegFlux.neqv.computeVegFluxOld)
-
-  ! *** compute wetted canopy area...
-  ! ---------------------------------
-
-  ! compute maximum canopy liquid water (kg m-2)
-  diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1) = mpar_data%var(iLookPARAM%refInterceptCapRain)%dat(1)*exposedVAI
-
-  ! compute maximum canopy ice content (kg m-2)
-  ! NOTE 1: this is used to compute the snow fraction on the canopy, as used in *BOTH* the radiation AND canopy sublimation routines
-  ! NOTE 2: this is a different variable than the max ice used in the throughfall (snow interception) calculations
-  ! NOTE 3: use maximum per unit leaf area storage capacity for snow (kg m-2)
-  select case(model_decisions(iLookDECISIONS%snowIncept)%iDecision)
-    case(lightSnow);  diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1) = exposedVAI*mpar_data%var(iLookPARAM%refInterceptCapSnow)%dat(1)
-    case(stickySnow); diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1) = exposedVAI*mpar_data%var(iLookPARAM%refInterceptCapSnow)%dat(1)*4._dp
-    case default
-      message=trim(message)//'unable to identify option for maximum branch interception capacity'
-      print*, message
-      err=20
-      return
-  end select ! identifying option for maximum branch interception capacity
-  !print*, 'diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1) = ', diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1)
-  !print*, 'diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1) = ', diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1)
-
-  ! compute wetted fraction of the canopy
-  ! NOTE: assume that the wetted fraction is constant over the substep for the radiation calculations
-  if(computeVegFlux)then
-
-    ! compute wetted fraction of the canopy
-    call wettedFrac(&
-                  ! input
-                  .false.,                                                      & ! flag to denote if derivatives are required
-                  .false.,                                                      & ! flag to denote if derivatives are calculated numerically
-                  (prog_data%var(iLookPROG%scalarCanopyTemp)%dat(1) < Tfreeze), & ! flag to denote if the canopy is frozen
-                  varNotUsed1,                                                  & ! derivative in canopy liquid w.r.t. canopy temperature (kg m-2 K-1)
-                  varNotUsed2,                                                  & ! fraction of liquid water on the canopy
-                  prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1),              & ! canopy liquid water (kg m-2)
-                  prog_data%var(iLookPROG%scalarCanopyIce)%dat(1),              & ! canopy ice (kg m-2)
-                  diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1),           & ! maximum canopy liquid water (kg m-2)
-                  diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1),           & ! maximum canopy ice content (kg m-2)
-                  mpar_data%var(iLookPARAM%canopyWettingFactor)%dat(1),         & ! maximum wetted fraction of the canopy (-)
-                  mpar_data%var(iLookPARAM%canopyWettingExp)%dat(1),            & ! exponent in canopy wetting function (-)
-                  ! output
-                  diag_data%var(iLookDIAG%scalarCanopyWetFraction)%dat(1),      & ! canopy wetted fraction (-)
-                  dCanopyWetFraction_dWat,                                      & ! derivative in wetted fraction w.r.t. canopy liquid water content (kg-1 m2)
-                  dCanopyWetFraction_dT,                                        & ! derivative in wetted fraction w.r.t. canopy liquid water content (kg-1 m2)
-                  err,cmessage)
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-
-    ! vegetation is completely buried by snow (or no veg exists at all)
-  else
-    diag_data%var(iLookDIAG%scalarCanopyWetFraction)%dat(1) = 0._dp
-    dCanopyWetFraction_dWat                                 = 0._dp
-    dCanopyWetFraction_dT                                   = 0._dp
-  end if
-  
-
-  ! *** compute snow albedo...
-  ! --------------------------
-  ! NOTE: this should be done before the radiation calculations
-  ! NOTE: uses snowfall; should really use canopy throughfall + canopy unloading
-  call snowAlbedo(&
-                  ! input: model control
-                  data_step,                   & ! intent(in): model time step (s)
-                  (nSnow > 0),                 & ! intent(in): logical flag to denote if snow is present
-                  ! input/output: data structures
-                  model_decisions,             & ! intent(in):    model decisions
-                  mpar_data,                   & ! intent(in):    model parameters
-                  flux_data,                   & ! intent(in):    model flux variables
-                  diag_data,                   & ! intent(inout): model diagnostic variables for a local HRU
-                  prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                  ! output: error control
-                  err,cmessage)                  ! intent(out): error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-
-  ! *** compute canopy sw radiation fluxes...
-  ! -----------------------------------------
-  call vegSWavRad(&
-                  data_step,                    & ! intent(in):    time step (s) -- only used in Noah-MP radiation, to compute albedo
-                  nSnow,                        & ! intent(in):    number of snow layers
-                  nSoil,                        & ! intent(in):    number of soil layers
-                  nLayers,                      & ! intent(in):    total number of layers
-                  computeVegFlux,               & ! intent(in):    logical flag to compute vegetation fluxes (.false. if veg buried by snow)
-                  type_data,                    & ! intent(in):    type of vegetation and soil
-                  prog_data,                    & ! intent(inout): model prognostic variables for a local HRU
-                  diag_data,                    & ! intent(inout): model diagnostic variables for a local HRU
-                  flux_data,                    & ! intent(inout): model flux variables
-                  err,cmessage)                   ! intent(out):   error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! *** compute canopy throughfall and unloading...
-  ! -----------------------------------------------
-  ! NOTE 1: this needs to be done before solving the energy and liquid water equations, to account for the heat advected with precipitation (and throughfall/unloading)
-  ! NOTE 2: the unloading flux is computed using canopy drip (scalarCanopyLiqDrainage) from the previous time step
-  call canopySnow(&
-                  ! input: model control
-                  data_step,                   & ! intent(in): time step (seconds)
-                  exposedVAI,                  & ! intent(in): exposed vegetation area index (m2 m-2)
-                  computeVegFlux,              & ! intent(in): flag to denote if computing energy flux over vegetation
-                  ! input/output: data structures
-                  model_decisions,             & ! intent(in):    model decisions
-                  forc_data,                   & ! intent(in):    model forcing data
-                  mpar_data,                   & ! intent(in):    model parameters
-                  diag_data,                   & ! intent(in):    model diagnostic variables for a local HRU
-                  prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                  flux_data,                   & ! intent(inout): model flux variables
-                  ! output: error control
-                  err,cmessage)                  ! intent(out): error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! adjust canopy temperature to account for new snow
-  if(computeVegFlux)then ! logical flag to compute vegetation fluxes (.false. if veg buried by snow)
-    call tempAdjust(&
-                  ! input: derived parameters
-                  canopyDepth,                 & ! intent(in): canopy depth (m)
-                  ! input/output: data structures
-                  mpar_data,                   & ! intent(in):    model parameters
-                  prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                  diag_data,                   & ! intent(out):   model diagnostic variables for a local HRU
-                  ! output: error control
-                  err,cmessage)                  ! intent(out): error control
-    if(err/=0)then
-      err=20
-      message=trim(message)//trim(cmessage)
-      return
-    end if
-  endif ! if computing fluxes over vegetation
-  
-
-  ! initialize drainage and throughfall
-  ! NOTE 1: this needs to be done before solving the energy and liquid water equations, to account for the heat advected with precipitation
-  ! NOTE 2: this initialization needs to be done AFTER the call to canopySnow, since canopySnow uses canopy drip drom the previous time step
-  if(.not.computeVegFlux)then
-    flux_data%var(iLookFLUX%scalarThroughfallRain)%dat(1)   = flux_data%var(iLookFLUX%scalarRainfall)%dat(1)
-    flux_data%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp
-  else
-    flux_data%var(iLookFLUX%scalarThroughfallRain)%dat(1)   = 0._dp
-    flux_data%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp
-  end if
-
-  ! ****************************************************************************************************
-  ! *** MAIN SOLVER ************************************************************************************
-  ! ****************************************************************************************************
-
-  ! initialize the length of the sub-step
-  dt_solv = 0._dp   ! length of time step that has been completed (s)
-  dt_init = min(data_step,maxstep) / dt_init_factor  ! initial substep length (s)
-  dt_sub  = dt_init                 ! length of substep
-  dtSave  = dt_init                 ! length of substep
-
-  ! initialize the number of sub-steps
-  nsub=0
-
-  ! loop through sub-steps
-  substeps: do  ! continuous do statement with exit clause (alternative to "while")
-
-    ! print progress
-    !print*, '*** new substep'
-    !write(*,'(a,3(f11.4,1x))') 'dt_sub, dt_init = ', dt_sub, dt_init
-
-    ! print progress
-    if(globalPrintFlag)then
-      write(*,'(a,1x,4(f13.5,1x))') ' start of step: dt_init, dt_sub, dt_solv, data_step: ', dt_init, dt_sub, dt_solv, data_step
-      print*, 'stepFailure = ', stepFailure
-      print*, 'before resizeData: nSnow, nSoil = ', nSnow, nSoil
-    endif
-
-    ! increment the number of sub-steps
-    nsub = nsub+1
-
-    ! resize the "indx_data" structure
-    ! NOTE: this is necessary because the length of index variables depends on a given split
-    !        --> the resize here is overwritten later (in indexSplit)
-    !        --> admittedly ugly, and retained for now
-    if(stepFailure)then
-      call resizeData(indx_meta(:),indx_temp,indx_data,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-    else
-      call resizeData(indx_meta(:),indx_data,indx_temp,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-    endif
-
-    ! save/recover copies of index variables
-    do iVar=1,size(indx_data%var)
-      !print*, 'indx_meta(iVar)%varname = ', trim(indx_meta(iVar)%varname)
-      select case(stepFailure)
-        case(.false.); indx_temp%var(iVar)%dat(:) = indx_data%var(iVar)%dat(:)
-        case(.true.);  indx_data%var(iVar)%dat(:) = indx_temp%var(iVar)%dat(:)
-      end select
-    end do  ! looping through variables
-
-    ! save/recover copies of prognostic variables
-    do iVar=1,size(prog_data%var)
-      !print*, 'prog_meta(iVar)%varname = ', trim(prog_meta(iVar)%varname)
-      select case(stepFailure)
-        case(.false.); prog_temp%var(iVar)%dat(:) = prog_data%var(iVar)%dat(:)
-        case(.true.);  prog_data%var(iVar)%dat(:) = prog_temp%var(iVar)%dat(:)
-      end select
-    end do  ! looping through variables
-
-    ! save/recover copies of diagnostic variables
-    do iVar=1,size(diag_data%var)
-      select case(stepFailure)
-        case(.false.); diag_temp%var(iVar)%dat(:) = diag_data%var(iVar)%dat(:)
-        case(.true.);  diag_data%var(iVar)%dat(:) = diag_temp%var(iVar)%dat(:)
-      end select
-    end do  ! looping through variables
-
-    ! re-assign dimension lengths
-    nSnow   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_snow)
-    nSoil   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_soil)
-    nLayers = nSnow+nSoil
-  
-
-    ! *** merge/sub-divide snow layers...
-    ! -----------------------------------
-    call volicePack(&
-                    ! input/output: model data structures
-                    doLayerMerge,                & ! intent(in):    flag to force merge of snow layers
-                    model_decisions,             & ! intent(in):    model decisions
-                    mpar_data,                   & ! intent(in):    model parameters
-                    indx_data,                   & ! intent(inout): type of each layer
-                    prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                    diag_data,                   & ! intent(inout): model diagnostic variables for a local HRU
-                    flux_data,                   & ! intent(inout): model fluxes for a local HRU
-                    ! output
-                    modifiedLayers,              & ! intent(out): flag to denote that layers were modified
-                    err,cmessage)                  ! intent(out): error control
-    if(err/=0)then
-      err=55
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-
-    ! save the number of snow and soil layers
-    nSnow   = indx_data%var(iLookINDEX%nSnow)%dat(1)
-    nSoil   = indx_data%var(iLookINDEX%nSoil)%dat(1)
-    nLayers = indx_data%var(iLookINDEX%nLayers)%dat(1)
-
-
-    ! compute the indices for the model state variables
-    if(firstSubStep .or. modifiedVegState .or. modifiedLayers)then
-      call indexState(computeVegFlux,          & ! intent(in):    flag to denote if computing the vegetation flux
-                      includeAquifer,          & ! intent(in):    flag to denote if included the aquifer
-                      nSnow,nSoil,nLayers,     & ! intent(in):    number of snow and soil layers, and total number of layers
-                      indx_data,               & ! intent(inout): indices defining model states and layers
-                      err,cmessage)              ! intent(out):   error control
-      if(err/=0)then
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      end if
-    end if
-
-    ! recreate the temporary data structures
-    ! NOTE: resizeData(meta, old, new, ..)
-    if(modifiedVegState .or. modifiedLayers)then
-
-      ! create temporary data structures for prognostic variables
-      call resizeData(prog_meta(:),prog_data,prog_temp,copy=.true.,err=err,message=cmessage)
-      if(err/=0)then; 
-        err=20 
-        message=trim(message)//trim(cmessage);
-        print*, message
-        return
-      endif
-
-      ! create temporary data structures for diagnostic variables
-      call resizeData(diag_meta(:),diag_data,diag_temp,copy=.true.,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-
-      ! create temporary data structures for index variables
-      call resizeData(indx_meta(:),indx_data,indx_temp,copy=.true.,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-
-      do iVar=1,size(indx_data%var)
-        !print*, 'indx_meta(iVar)%varname = ', trim(indx_meta(iVar)%varname)
-        select case(stepFailure)
-          case(.false.); indx_temp%var(iVar)%dat(:) = indx_data%var(iVar)%dat(:)
-          case(.true.);  indx_data%var(iVar)%dat(:) = indx_temp%var(iVar)%dat(:)
-        end select
-      end do  ! looping through variables
-
-    endif  ! if modified the states
-
-    ! define the number of state variables
-    nState = indx_data%var(iLookINDEX%nState)%dat(1)
-  
-
-    ! *** compute diagnostic variables for each layer...
-    ! --------------------------------------------------
-    ! NOTE: this needs to be done AFTER volicePack, since layers may have been sub-divided and/or merged
-    call diagn_evar(&
-                  ! input: control variables
-                  computeVegFlux,          & ! intent(in): flag to denote if computing the vegetation flux
-                  canopyDepth,             & ! intent(in): canopy depth (m)
-                  ! input/output: data structures
-                  mpar_data,               & ! intent(in):    model parameters
-                  indx_data,               & ! intent(in):    model layer indices
-                  prog_data,               & ! intent(in):    model prognostic variables for a local HRU
-                  diag_data,               & ! intent(inout): model diagnostic variables for a local HRU
-                  ! output: error control
-                  err,cmessage)              ! intent(out): error control
-    if(err/=0)then
-      err=55;
-      message=trim(message)//trim(cmessage)
-      return
-    end if
-
-
-    ! *** compute melt of the "snow without a layer"...
-    ! -------------------------------------------------
-    ! NOTE: forms a surface melt pond, which drains into the upper-most soil layer through the time step
-    ! (check for the special case of "snow without a layer")
-    if(nSnow==0)then
-      call implctMelt(&
-                    ! input/output: integrated snowpack properties
-                    prog_data%var(iLookPROG%scalarSWE)%dat(1),               & ! intent(inout): snow water equivalent (kg m-2)
-                    prog_data%var(iLookPROG%scalarSnowDepth)%dat(1),         & ! intent(inout): snow depth (m)
-                    prog_data%var(iLookPROG%scalarSfcMeltPond)%dat(1),       & ! intent(inout): surface melt pond (kg m-2)
-                    ! input/output: properties of the upper-most soil layer
-                    prog_data%var(iLookPROG%mLayerTemp)%dat(nSnow+1),        & ! intent(inout): surface layer temperature (K)
-                    prog_data%var(iLookPROG%mLayerDepth)%dat(nSnow+1),       & ! intent(inout): surface layer depth (m)
-                    diag_data%var(iLookDIAG%mLayerVolHtCapBulk)%dat(nSnow+1),& ! intent(inout): surface layer volumetric heat capacity (J m-3 K-1)
-                    ! output: error control
-                    err,cmessage                                             ) ! intent(out): error control
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      end if
-    end if ! nsnow == 0
-
-    ! *** solve model equations...
-    ! ----------------------------
-
-    ! save input step
-    dtSave = dt_sub
-    !write(*,'(a,1x,3(f12.5,1x))') trim(message)//'before opSplittin: dt_init, dt_sub, dt_solv = ', dt_init, dt_sub, dt_solv
-  
-    ! get the new solution
-    call opSplittin(&
-                  ! input: model control
-                  nSnow,                                  & ! intent(in):    number of snow layers
-                  nSoil,                                  & ! intent(in):    number of soil layers
-                  nLayers,                                & ! intent(in):    total number of layers
-                  nState,                                 & ! intent(in):    total number of layers
-                  dt_sub,                                 & ! intent(in):    length of the model sub-step
-                  (nsub==1),                              & ! intent(in):    logical flag to denote the first substep
-                  computeVegFlux,                         & ! intent(in):    logical flag to compute fluxes within the vegetation canopy
-                  ! input/output: data structures
-                  type_data,                              & ! intent(in):    type of vegetation and soil
-                  attr_data,                              & ! intent(in):    spatial attributes
-                  forc_data,                              & ! intent(in):    model forcing data
-                  mpar_data,                              & ! intent(in):    model parameters
-                  indx_data,                              & ! intent(inout): index data
-                  prog_data,                              & ! intent(inout): model prognostic variables for a local HRU
-                  diag_data,                              & ! intent(inout): model diagnostic variables for a local HRU
-                  flux_data,                              & ! intent(inout): model fluxes for a local HRU
-                  bvar_data,                              & ! intent(in):    model variables for the local basin
-                  model_decisions,                        & ! intent(in):    model decisions
-                  ! output: model control
-                  dtMultiplier,                           & ! intent(out):   substep multiplier (-)
-                  tooMuchMelt,                            & ! intent(out):   flag to denote that ice is insufficient to support melt
-                  stepFailure,                            & ! intent(out):   flag to denote that the coupled step failed
-                  ixSolution,                             & ! intent(out):   solution method used in this iteration
-                  err,cmessage)                             ! intent(out):   error code and error message
-
-    ! check for all errors (error recovery within opSplittin)
-    if(err/=0)then
-      err=20
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-  
-
-    ! process the flag for too much melt
-    if(tooMuchMelt)then
-      stepFailure  = .true.
-      doLayerMerge = .true.
-    else
-      doLayerMerge = .false.
-    endif
-
-    ! handle special case of the step failure
-    ! NOTE: need to revert back to the previous state vector that we were happy with and reduce the time step
-    ! TODO: ask isn't this what the actors program does without the code block below
-    if(stepFailure)then
-
-      ! halve step
-      dt_sub = dtSave/2._dp
-
-      ! check that the step is not tiny
-      if(dt_sub < minstep)then
-        print*,ixSolution
-        print*, 'dtSave, dt_sub', dtSave, dt_sub
-        message=trim(message)//'length of the coupled step is below the minimum step length'
-        print*, message
-        err=20; return
-      endif
-
-      ! try again
-      cycle substeps
-
-    endif
-
-    ! update first step
-    firstSubStep=.false.
-
-    ! ***  remove ice due to sublimation...
-    ! --------------------------------------------------------------
-    sublime: associate(&
-      scalarCanopySublimation => flux_data%var(iLookFLUX%scalarCanopySublimation)%dat(1), & ! sublimation from the vegetation canopy (kg m-2 s-1)
-      scalarSnowSublimation   => flux_data%var(iLookFLUX%scalarSnowSublimation)%dat(1),   & ! sublimation from the snow surface (kg m-2 s-1)
-      scalarLatHeatCanopyEvap => flux_data%var(iLookFLUX%scalarLatHeatCanopyEvap)%dat(1), & ! latent heat flux for evaporation from the canopy to the canopy air space (W m-2)
-      scalarSenHeatCanopy     => flux_data%var(iLookFLUX%scalarSenHeatCanopy)%dat(1),     & ! sensible heat flux from the canopy to the canopy air space (W m-2)
-      scalarLatHeatGround     => flux_data%var(iLookFLUX%scalarLatHeatGround)%dat(1),     & ! latent heat flux from ground surface below vegetation (W m-2)
-      scalarSenHeatGround     => flux_data%var(iLookFLUX%scalarSenHeatGround)%dat(1),     & ! sensible heat flux from ground surface below vegetation (W m-2)
-      scalarCanopyLiq         => prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1),         & ! liquid water stored on the vegetation canopy (kg m-2)
-      scalarCanopyIce         => prog_data%var(iLookPROG%scalarCanopyIce)%dat(1),         & ! ice          stored on the vegetation canopy (kg m-2)
-      mLayerVolFracIce        => prog_data%var(iLookPROG%mLayerVolFracIce)%dat,           & ! volumetric fraction of ice in the snow+soil domain (-)
-      mLayerVolFracLiq        => prog_data%var(iLookPROG%mLayerVolFracLiq)%dat,           & ! volumetric fraction of liquid water in the snow+soil domain (-)
-      mLayerDepth             => prog_data%var(iLookPROG%mLayerDepth)%dat                 & ! depth of each snow+soil layer (m)
-    ) ! associations to variables in data structures
-
-    ! * compute change in canopy ice content due to sublimation...
-    ! ------------------------------------------------------------
-    if(computeVegFlux)then
-
-      ! remove mass of ice on the canopy
-      scalarCanopyIce = scalarCanopyIce + scalarCanopySublimation*dt_sub
-
-      ! if removed all ice, take the remaining sublimation from water
-      if(scalarCanopyIce < 0._dp)then
-        scalarCanopyLiq = scalarCanopyLiq + scalarCanopyIce
-        scalarCanopyIce = 0._dp
-      endif
-
-      ! modify fluxes if there is insufficient canopy water to support the converged sublimation rate over the time step dt_sub
-      if(scalarCanopyLiq < 0._dp)then
-        ! --> superfluous sublimation flux
-        superflousSub = -scalarCanopyLiq/dt_sub  ! kg m-2 s-1
-        superflousNrg = superflousSub*LH_sub     ! W m-2 (J m-2 s-1)
-        ! --> update fluxes and states
-        scalarCanopySublimation = scalarCanopySublimation + superflousSub
-        scalarLatHeatCanopyEvap = scalarLatHeatCanopyEvap + superflousNrg
-        scalarSenHeatCanopy     = scalarSenHeatCanopy - superflousNrg
-        scalarCanopyLiq         = 0._dp
-      endif
-
-    end if  ! (if computing the vegetation flux)
-
-    ! * compute change in ice content of the top snow layer due to sublimation...
-    ! ---------------------------------------------------------------------------
-    ! NOTE: this is done BEFORE densification
-    if(nSnow > 0)then ! snow layers exist
-
-      ! try to remove ice from the top layer
-      iSnow=1
-
-      ! save the mass of liquid water (kg m-2)
-      massLiquid = mLayerDepth(iSnow)*mLayerVolFracLiq(iSnow)*iden_water
-
-      ! add/remove the depth of snow gained/lost by frost/sublimation (m)
-      ! NOTE: assume constant density
-      mLayerDepth(iSnow) = mLayerDepth(iSnow) + dt_sub*scalarSnowSublimation/(mLayerVolFracIce(iSnow)*iden_ice)
-
-      ! check that we did not remove the entire layer
-      if(mLayerDepth(iSnow) < verySmall)then
-        stepFailure  = .true.
-        doLayerMerge = .true.
-        dt_sub      = max(dtSave/2._dp, minstep)
-        cycle substeps
-      else
-        stepFailure  = .false.
-        doLayerMerge = .false.
-      endif
-
-      ! update the volumetric fraction of liquid water
-      mLayerVolFracLiq(iSnow) = massLiquid / (mLayerDepth(iSnow)*iden_water)
-
-    ! no snow
-    else
-
-      ! no snow: check that sublimation is zero
-      if(abs(scalarSnowSublimation) > verySmall)then
-        message=trim(message)//'sublimation of snow has been computed when no snow exists'
-        print*, message
-        err=20; return
-      end if
-
-    end if  ! (if snow layers exist)
-
-    ! end associate sublime
-
-    ! *** account for compaction and cavitation in the snowpack...
-    ! ------------------------------------------------------------
-    if(nSnow>0)then
-      call snwDensify(&
-                    ! intent(in): variables
-                    dt_sub,                                                 & ! intent(in): time step (s)
-                    indx_data%var(iLookINDEX%nSnow)%dat(1),                 & ! intent(in): number of snow layers
-                    prog_data%var(iLookPROG%mLayerTemp)%dat(1:nSnow),       & ! intent(in): temperature of each layer (K)
-                    diag_data%var(iLookDIAG%mLayerMeltFreeze)%dat(1:nSnow), & ! intent(in): volumetric melt in each layer (kg m-3)
-                    ! intent(in): parameters
-                    mpar_data%var(iLookPARAM%densScalGrowth)%dat(1),        & ! intent(in): density scaling factor for grain growth (kg-1 m3)
-                    mpar_data%var(iLookPARAM%tempScalGrowth)%dat(1),        & ! intent(in): temperature scaling factor for grain growth (K-1)
-                    mpar_data%var(iLookPARAM%grainGrowthRate)%dat(1),       & ! intent(in): rate of grain growth (s-1)
-                    mpar_data%var(iLookPARAM%densScalOvrbdn)%dat(1),        & ! intent(in): density scaling factor for overburden pressure (kg-1 m3)
-                    mpar_data%var(iLookPARAM%tempScalOvrbdn)%dat(1),        & ! intent(in): temperature scaling factor for overburden pressure (K-1)
-                    mpar_data%var(iLookPARAM%baseViscosity)%dat(1),         & ! intent(in): viscosity coefficient at T=T_frz and snow density=0 (kg m-2 s)
-                    ! intent(inout): state variables
-                    prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow),      & ! intent(inout): depth of each layer (m)
-                    prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow), & ! intent(inout):  volumetric fraction of liquid water after itertations (-)
-                    prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow), & ! intent(inout):  volumetric fraction of ice after itertations (-)
-                    ! output: error control
-                    err,cmessage)                     ! intent(out): error control
-      if(err/=0)then
-        err=55
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      end if
-
-    end if  ! if snow layers exist
-
-    ! update coordinate variables
-    call calcHeight(&
-                  ! input/output: data structures
-                  indx_data,   & ! intent(in): layer type
-                  prog_data,   & ! intent(inout): model variables for a local HRU
-                  ! output: error control
-                  err,cmessage)
-    if(err/=0)then
-      err=20
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-
-    ! recompute snow depth and SWE
-    if(nSnow > 0)then
-      prog_data%var(iLookPROG%scalarSnowDepth)%dat(1) = sum(  prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow))
-      prog_data%var(iLookPROG%scalarSWE)%dat(1)       = sum( (prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                            prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice) &
-                                                          * prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
-    end if
-
-    ! increment fluxes
-    dt_wght = dt_sub/data_step ! define weight applied to each sub-step
-    do iVar=1,size(averageFlux_meta)
-      flux_mean%var(iVar)%dat(:) = flux_mean%var(iVar)%dat(:) + flux_data%var(averageFlux_meta(iVar)%ixParent)%dat(:)*dt_wght
-    end do
-
-    ! increment change in storage associated with the surface melt pond (kg m-2)
-    if(nSnow==0) sfcMeltPond = sfcMeltPond + prog_data%var(iLookPROG%scalarSfcMeltPond)%dat(1)
-
-    ! increment soil compression (kg m-2)
-    totalSoilCompress = totalSoilCompress + diag_data%var(iLookDIAG%scalarSoilCompress)%dat(1) ! total soil compression over whole layer (kg m-2)
-
-    end associate sublime
-
-
-    ! ****************************************************************************************************
-    ! *** END MAIN SOLVER ********************************************************************************
-    ! ****************************************************************************************************
-
-    ! increment sub-step
-    dt_solv = dt_solv + dt_sub
-    ! save the time step to initialize the subsequent step
-    if(dt_solv<data_step .or. nsub==1) dt_init = dt_sub
-
-    ! check
-    if(globalPrintFlag)&
-    write(*,'(a,1x,3(f18.5,1x))') 'dt_sub, dt_solv, data_step: ', dt_sub, dt_solv, data_step
-
-    ! check that we have completed the sub-step
-    if(dt_solv >= data_step-verySmall) then
-      exit substeps
-    endif
-
-    ! adjust length of the sub-step (make sure that we don't exceed the step)
-    dt_sub = min(data_step - dt_solv, dt_sub)
-
-  end do  substeps ! (sub-step loop)
-
-  ! *** add snowfall to the snowpack...
-  ! -----------------------------------
-
-  ! add new snowfall to the snowpack
-  ! NOTE: This needs to be done AFTER the call to canopySnow, since throughfall and unloading are computed in canopySnow
-  call newsnwfall(&
-                ! input: model control
-                data_step,                                                 & ! time step (seconds)
-                (nSnow > 0),                                               & ! logical flag if snow layers exist
-                mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1),            & ! freeezing curve parameter for snow (K-1)
-                ! input: diagnostic scalar variables
-                diag_data%var(iLookDIAG%scalarSnowfallTemp)%dat(1),        & ! computed temperature of fresh snow (K)
-                diag_data%var(iLookDIAG%scalarNewSnowDensity)%dat(1),      & ! computed density of new snow (kg m-3)
-                flux_data%var(iLookFLUX%scalarThroughfallSnow)%dat(1),     & ! throughfall of snow through the canopy (kg m-2 s-1)
-                flux_data%var(iLookFLUX%scalarCanopySnowUnloading)%dat(1), & ! unloading of snow from the canopy (kg m-2 s-1)
-                ! input/output: state variables
-                prog_data%var(iLookPROG%scalarSWE)%dat(1),                 & ! SWE (kg m-2)
-                prog_data%var(iLookPROG%scalarSnowDepth)%dat(1),           & ! total snow depth (m)
-                prog_data%var(iLookPROG%mLayerTemp)%dat(1),                & ! temperature of the top layer (K)
-                prog_data%var(iLookPROG%mLayerDepth)%dat(1),               & ! depth of the top layer (m)
-                prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1),          & ! volumetric fraction of ice of the top layer (-)
-                prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1),          & ! volumetric fraction of liquid water of the top layer (-)
-                ! output: error control
-                err,cmessage)                                                ! error control
-  if(err/=0)then
-    err=30
-    message=trim(message)//trim(cmessage)
-    print*,message
-    return
-  end if
-
-  ! re-compute snow depth and SWE
-  if(nSnow > 0)then
-    prog_data%var(iLookPROG%scalarSnowDepth)%dat(1) = sum(  prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow))
-    prog_data%var(iLookPROG%scalarSWE)%dat(1)       = sum( (prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                          prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice) &
-                                                        * prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
-  end if
-  !print*, 'SWE after snowfall = ',  prog_data%var(iLookPROG%scalarSWE)%dat(1)
-
-  ! re-assign dimension lengths
-  nSnow   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_snow)
-  nSoil   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_soil)
-  nLayers = nSnow+nSoil
-
-  ! update coordinate variables
-  call calcHeight(&
-                  ! input/output: data structures
-                  indx_data,   & ! intent(in): layer type
-                  prog_data,   & ! intent(inout): model variables for a local HRU
-                  ! output: error control
-                  err,cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! overwrite flux_data with flux_mean (returns timestep-average fluxes for scalar variables)
-  do iVar=1,size(averageFlux_meta)
-    flux_data%var(averageFlux_meta(iVar)%ixParent)%dat(:) = flux_mean%var(iVar)%dat(:)
-  end do
-
-  ! ***********************************************************************************************************************************
-  ! ***********************************************************************************************************************************
-  ! ***********************************************************************************************************************************
-  ! ***********************************************************************************************************************************
-
-  ! ---
-  ! *** balance checks...
-  ! ---------------------
-
-  ! save the average compression and melt pond storage in the data structures
-  prog_data%var(iLookPROG%scalarSfcMeltPond)%dat(1)  = sfcMeltPond
-
-  ! associate local variables with information in the data structures
-  associate(&
-    ! model forcing
-    scalarSnowfall             => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSnowfall)           )%dat(1)     ,&  ! computed snowfall rate (kg m-2 s-1)
-    scalarRainfall             => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarRainfall)           )%dat(1)     ,&  ! computed rainfall rate (kg m-2 s-1)
-    ! canopy fluxes
-    averageThroughfallSnow     => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarThroughfallSnow)    )%dat(1)     ,&  ! snow that reaches the ground without ever touching the canopy (kg m-2 s-1)
-    averageThroughfallRain     => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarThroughfallRain)    )%dat(1)     ,&  ! rain that reaches the ground without ever touching the canopy (kg m-2 s-1)
-    averageCanopySnowUnloading => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopySnowUnloading))%dat(1)     ,&  ! unloading of snow from the vegetion canopy (kg m-2 s-1)
-    averageCanopyLiqDrainage   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopyLiqDrainage)  )%dat(1)     ,&  ! drainage of liquid water from the vegetation canopy (kg m-2 s-1)
-    averageCanopySublimation   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopySublimation)  )%dat(1)     ,&  ! canopy sublimation/frost (kg m-2 s-1)
-    averageCanopyEvaporation   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopyEvaporation)  )%dat(1)     ,&  ! canopy evaporation/condensation (kg m-2 s-1)
-    ! snow fluxes
-    averageSnowSublimation     => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSnowSublimation)    )%dat(1)     ,&  ! sublimation from the snow surface (kg m-2 s-1)
-    averageSnowDrainage        => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSnowDrainage)       )%dat(1)     ,&  ! drainage from the bottom of the snowpack (m s-1)
-    ! soil fluxes
-    averageSoilInflux          => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarInfiltration)       )%dat(1)     ,&  ! influx of water at the top of the soil profile (m s-1)
-    averageSoilDrainage        => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSoilDrainage)       )%dat(1)     ,&  ! drainage from the bottom of the soil profile (m s-1)
-    averageSoilBaseflow        => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSoilBaseflow)       )%dat(1)     ,&  ! total baseflow from throughout the soil profile (m s-1)
-    averageGroundEvaporation   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarGroundEvaporation)  )%dat(1)     ,&  ! soil evaporation (kg m-2 s-1)
-    averageCanopyTranspiration => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopyTranspiration))%dat(1)     ,&  ! canopy transpiration (kg m-2 s-1)
-    ! state variables in the vegetation canopy
-    scalarCanopyLiq            => prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1)                               ,&  ! canopy liquid water (kg m-2)
-    scalarCanopyIce            => prog_data%var(iLookPROG%scalarCanopyIce)%dat(1)                               ,&  ! canopy ice content (kg m-2)
-    ! state variables in the soil domain
-    mLayerDepth                => prog_data%var(iLookPROG%mLayerDepth)%dat(nSnow+1:nLayers)                     ,&  ! depth of each soil layer (m)
-    mLayerVolFracIce           => prog_data%var(iLookPROG%mLayerVolFracIce)%dat(nSnow+1:nLayers)                ,&  ! volumetric ice content in each soil layer (-)
-    mLayerVolFracLiq           => prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(nSnow+1:nLayers)                ,&  ! volumetric liquid water content in each soil layer (-)
-    scalarAquiferStorage       => prog_data%var(iLookPROG%scalarAquiferStorage)%dat(1)                          ,&  ! aquifer storage (m)
-    ! error tolerance
-    absConvTol_liquid          => mpar_data%var(iLookPARAM%absConvTol_liquid)%dat(1)                            ,&  ! absolute convergence tolerance for vol frac liq water (-)
-    scalarTotalSoilIce         => diag_data%var(iLookDIAG%scalarTotalSoilIce)%dat(1)                            ,&  ! total ice in the soil column (kg m-2)
-    scalarTotalSoilLiq         => diag_data%var(iLookDIAG%scalarTotalSoilLiq)%dat(1)                             &  ! total liquid water in the soil column (kg m-2)
-  ) ! (association of local variables with information in the data structures
-
-  ! -----
-  ! * balance checks for the canopy...
-  ! ----------------------------------
-
-  ! if computing the vegetation flux
-  if(computeVegFlux)then
-
-    ! canopy water balance
-    balanceCanopyWater1 = scalarCanopyLiq + scalarCanopyIce
-
-    ! balance checks for the canopy
-    ! NOTE: need to put the balance checks in the sub-step loop so that we can re-compute if necessary
-    scalarCanopyWatBalError = balanceCanopyWater1 - (balanceCanopyWater0 + (scalarSnowfall - averageThroughfallSnow)*data_step + (scalarRainfall - averageThroughfallRain)*data_step &
-                              - averageCanopySnowUnloading*data_step - averageCanopyLiqDrainage*data_step + averageCanopySublimation*data_step + averageCanopyEvaporation*data_step)
-    if(abs(scalarCanopyWatBalError) > absConvTol_liquid*iden_water*10._dp)then
-      print*, '** canopy water balance error:'
-      write(*,'(a,1x,f20.10)') 'data_step                                    = ', data_step
-      write(*,'(a,1x,f20.10)') 'balanceCanopyWater0                          = ', balanceCanopyWater0
-      write(*,'(a,1x,f20.10)') 'balanceCanopyWater1                          = ', balanceCanopyWater1
-      write(*,'(a,1x,f20.10)') 'scalarSnowfall                               = ', scalarSnowfall
-      write(*,'(a,1x,f20.10)') 'scalarRainfall                               = ', scalarRainfall
-      write(*,'(a,1x,f20.10)') '(scalarSnowfall - averageThroughfallSnow)    = ', (scalarSnowfall - averageThroughfallSnow)!*data_step
-      write(*,'(a,1x,f20.10)') '(scalarRainfall - averageThroughfallRain)    = ', (scalarRainfall - averageThroughfallRain)!*data_step
-      write(*,'(a,1x,f20.10)') 'averageCanopySnowUnloading                   = ', averageCanopySnowUnloading!*data_step
-      write(*,'(a,1x,f20.10)') 'averageCanopyLiqDrainage                     = ', averageCanopyLiqDrainage!*data_step
-      write(*,'(a,1x,f20.10)') 'averageCanopySublimation                     = ', averageCanopySublimation!*data_step
-      write(*,'(a,1x,f20.10)') 'averageCanopyEvaporation                     = ', averageCanopyEvaporation!*data_step
-      write(*,'(a,1x,f20.10)') 'scalarCanopyWatBalError                      = ', scalarCanopyWatBalError
-      message=trim(message)//'canopy hydrology does not balance'
-      print*, message
-      err=20; return
-    end if
-
-  endif  ! if computing the vegetation flux
-
-  ! -----
-  ! * balance checks for SWE...
-  ! ---------------------------
-
-  ! recompute snow depth (m) and SWE (kg m-2)
-  if(nSnow > 0)then
-    prog_data%var(iLookPROG%scalarSnowDepth)%dat(1) = sum(  prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow))
-    prog_data%var(iLookPROG%scalarSWE)%dat(1)       = sum( (prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                            prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice) &
-                                                          * prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
-  end if
-
-  ! check the individual layers
-  if(printBalance .and. nSnow>0)then
-    write(*,'(a,1x,10(f12.8,1x))') 'liqSnowInit       = ', liqSnowInit
-    write(*,'(a,1x,10(f12.8,1x))') 'volFracLiq        = ', prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)
-    write(*,'(a,1x,10(f12.8,1x))') 'iLayerLiqFluxSnow = ', flux_data%var(iLookFLUX%iLayerLiqFluxSnow)%dat*iden_water*data_step
-    write(*,'(a,1x,10(f12.8,1x))') 'mLayerLiqFluxSnow = ', flux_data%var(iLookFLUX%mLayerLiqFluxSnow)%dat*data_step
-    write(*,'(a,1x,10(f12.8,1x))') 'change volFracLiq = ', prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow) - liqSnowInit
-    deallocate(liqSnowInit, stat=err)
-    if(err/=0)then
-    message=trim(message)//'unable to deallocate space for the initial volumetric liquid water content of snow'
-    print*, message
-    err=20; return
-    endif
-  endif
-
-  ! check SWE
-  if(nSnow>0)then
-    effSnowfall = averageThroughfallSnow + averageCanopySnowUnloading
-    effRainfall = averageThroughfallRain + averageCanopyLiqDrainage
-    newSWE      = prog_data%var(iLookPROG%scalarSWE)%dat(1)
-    delSWE      = newSWE - (oldSWE - sfcMeltPond)
-    massBalance = delSWE - (effSnowfall + effRainfall + averageSnowSublimation - averageSnowDrainage*iden_water)*data_step
-
-    if(abs(massBalance) > absConvTol_liquid*iden_water*10._dp)then
-      print*,                  'nSnow       = ', nSnow
-      print*,                  'nSub        = ', nSub
-      write(*,'(a,1x,f20.10)') 'data_step   = ', data_step
-      write(*,'(a,1x,f20.10)') 'oldSWE      = ', oldSWE
-      write(*,'(a,1x,f20.10)') 'newSWE      = ', newSWE
-      write(*,'(a,1x,f20.10)') 'delSWE      = ', delSWE
-      write(*,'(a,1x,f20.10)') 'effRainfall = ', effRainfall*data_step
-      write(*,'(a,1x,f20.10)') 'effSnowfall = ', effSnowfall*data_step
-      write(*,'(a,1x,f20.10)') 'sublimation = ', averageSnowSublimation*data_step
-      write(*,'(a,1x,f20.10)') 'snwDrainage = ', averageSnowDrainage*iden_water*data_step
-      write(*,'(a,1x,f20.10)') 'sfcMeltPond = ', sfcMeltPond
-      write(*,'(a,1x,f20.10)') 'massBalance = ', massBalance
-      message=trim(message)//'SWE does not balance'
-      print*,message
-      err=20; return
-    endif  ! if failed mass balance check
-  endif  ! if snow layers exist
-
-  ! -----
-  ! * balance checks for soil...
-  ! ----------------------------
-
-  ! compute the liquid water and ice content at the end of the time step
-  scalarTotalSoilLiq = sum(iden_water*mLayerVolFracLiq(1:nSoil)*mLayerDepth(1:nSoil))
-  scalarTotalSoilIce = sum(iden_water*mLayerVolFracIce(1:nSoil)*mLayerDepth(1:nSoil))   ! NOTE: no expansion of soil, hence use iden_water
-
-  ! get the total water in the soil (liquid plus ice) at the end of the time step (kg m-2)
-  balanceSoilWater1 = scalarTotalSoilLiq + scalarTotalSoilIce
-
-  ! get the total aquifer storage at the start of the time step (kg m-2)
-  balanceAquifer1 = scalarAquiferStorage*iden_water
-
-  ! get the input and output to/from the soil zone (kg m-2)
-  balanceSoilInflux        = averageSoilInflux*iden_water*data_step
-  balanceSoilBaseflow      = averageSoilBaseflow*iden_water*data_step
-  balanceSoilDrainage      = averageSoilDrainage*iden_water*data_step
-  balanceSoilET            = (averageCanopyTranspiration + averageGroundEvaporation)*data_step
-
-  ! check the individual layers
-  if(printBalance)then
-    write(*,'(a,1x,10(f12.8,1x))') 'liqSoilInit       = ', liqSoilInit
-    write(*,'(a,1x,10(f12.8,1x))') 'volFracLiq        = ', mLayerVolFracLiq
-    write(*,'(a,1x,10(f12.8,1x))') 'iLayerLiqFluxSoil = ', flux_data%var(iLookFLUX%iLayerLiqFluxSoil)%dat*iden_water*data_step
-    write(*,'(a,1x,10(f12.8,1x))') 'mLayerLiqFluxSoil = ', flux_data%var(iLookFLUX%mLayerLiqFluxSoil)%dat*data_step
-    write(*,'(a,1x,10(f12.8,1x))') 'change volFracLiq = ', mLayerVolFracLiq - liqSoilInit
-    deallocate(liqSoilInit, stat=err)
-    if(err/=0)then
-    message=trim(message)//'unable to deallocate space for the initial soil moisture'
-    err=20; return
-    print*, message
-    endif
-  endif
-
-  ! check the soil water balance
-  scalarSoilWatBalError  = balanceSoilWater1 - (balanceSoilWater0 + (balanceSoilInflux + balanceSoilET - balanceSoilBaseflow - balanceSoilDrainage - totalSoilCompress) )
-  if(abs(scalarSoilWatBalError) > absConvTol_liquid*iden_water*10._dp)then  ! NOTE: kg m-2, so need coarse tolerance to account for precision issues
-    write(*,*)               'solution method           = ', ixSolution
-    write(*,'(a,1x,f20.10)') 'data_step                 = ', data_step
-    write(*,'(a,1x,f20.10)') 'totalSoilCompress         = ', totalSoilCompress
-    write(*,'(a,1x,f20.10)') 'scalarTotalSoilLiq        = ', scalarTotalSoilLiq
-    write(*,'(a,1x,f20.10)') 'scalarTotalSoilIce        = ', scalarTotalSoilIce
-    write(*,'(a,1x,f20.10)') 'balanceSoilWater0         = ', balanceSoilWater0
-    write(*,'(a,1x,f20.10)') 'balanceSoilWater1         = ', balanceSoilWater1
-    write(*,'(a,1x,f20.10)') 'balanceSoilInflux         = ', balanceSoilInflux
-    write(*,'(a,1x,f20.10)') 'balanceSoilBaseflow       = ', balanceSoilBaseflow
-    write(*,'(a,1x,f20.10)') 'balanceSoilDrainage       = ', balanceSoilDrainage
-    write(*,'(a,1x,f20.10)') 'balanceSoilET             = ', balanceSoilET
-    write(*,'(a,1x,f20.10)') 'scalarSoilWatBalError     = ', scalarSoilWatBalError
-    write(*,'(a,1x,f20.10)') 'scalarSoilWatBalError     = ', scalarSoilWatBalError/iden_water
-    write(*,'(a,1x,f20.10)') 'absConvTol_liquid         = ', absConvTol_liquid
-    ! error control
-    message=trim(message)//'soil hydrology does not balance'
-    print*, message
-    err=20; return
-  end if
-
-  ! end association of local variables with information in the data structures
-  end associate
-
-  ! end association to canopy depth
-  end associate canopy
-
-  ! Save the total soil water (Liquid+Ice)
-  diag_data%var(iLookDIAG%scalarTotalSoilWat)%dat(1) = balanceSoilWater1
-  ! save the surface temperature (just to make things easier to visualize)
-  prog_data%var(iLookPROG%scalarSurfaceTemp)%dat(1) = prog_data%var(iLookPROG%mLayerTemp)%dat(1)
-
-  ! overwrite flux data with the timestep-average value
-  if(.not.backwardsCompatibility)then
-    do iVar=1,size(flux_mean%var)
-    flux_data%var(averageFlux_meta(iVar)%ixParent)%dat = flux_mean%var(iVar)%dat
-    end do
-  end if
-
-  iLayer = nSnow+1
-  !print*, 'nsub, mLayerTemp(iLayer), mLayerVolFracIce(iLayer) = ', nsub, mLayerTemp(iLayer), mLayerVolFracIce(iLayer)
-  !print*, 'nsub = ', nsub
-  if(nsub>50000)then
-    write(message,'(a,i0)') trim(cmessage)//'number of sub-steps > 50000 for HRU ', indxHRU
-    err=20; return
-  end if
-
-end subroutine coupled_em
-
-
-  ! *********************************************************************************************************
-  ! private subroutine implctMelt: compute melt of the "snow without a layer"
-  ! *********************************************************************************************************
-  subroutine implctMelt(&
-                        ! input/output: integrated snowpack properties
-                        scalarSWE,         & ! intent(inout): snow water equivalent (kg m-2)
-                        scalarSnowDepth,   & ! intent(inout): snow depth (m)
-                        scalarSfcMeltPond, & ! intent(inout): surface melt pond (kg m-2)
-                        ! input/output: properties of the upper-most soil layer
-                        soilTemp,          & ! intent(inout): surface layer temperature (K)
-                        soilDepth,         & ! intent(inout): surface layer depth (m)
-                        soilHeatcap,       & ! intent(inout): surface layer volumetric heat capacity (J m-3 K-1)
-                        ! output: error control
-                        err,message        ) ! intent(out): error control
-  implicit none
-  ! input/output: integrated snowpack properties
-  real(dp),intent(inout)    :: scalarSWE          ! snow water equivalent (kg m-2)
-  real(dp),intent(inout)    :: scalarSnowDepth    ! snow depth (m)
-  real(dp),intent(inout)    :: scalarSfcMeltPond  ! surface melt pond (kg m-2)
-  ! input/output: properties of the upper-most soil layer
-  real(dp),intent(inout)    :: soilTemp           ! surface layer temperature (K)
-  real(dp),intent(inout)    :: soilDepth          ! surface layer depth (m)
-  real(dp),intent(inout)    :: soilHeatcap        ! surface layer volumetric heat capacity (J m-3 K-1)
-  ! output: error control
-  integer(i4b),intent(out)  :: err                ! error code
-  character(*),intent(out)  :: message            ! error message
-  ! local variables
-  real(dp)                  :: nrgRequired        ! energy required to melt all the snow (J m-2)
-  real(dp)                  :: nrgAvailable       ! energy available to melt the snow (J m-2)
-  real(dp)                  :: snwDensity         ! snow density (kg m-3)
-  ! initialize error control
-  err=0; message='implctMelt/'
-
-  if(scalarSWE > 0._dp)then
-  ! only melt if temperature of the top soil layer is greater than Tfreeze
-  if(soilTemp > Tfreeze)then
-    ! compute the energy required to melt all the snow (J m-2)
-    nrgRequired     = scalarSWE*LH_fus
-    ! compute the energy available to melt the snow (J m-2)
-    nrgAvailable    = soilHeatcap*(soilTemp - Tfreeze)*soilDepth
-    ! compute the snow density (not saved)
-    snwDensity      = scalarSWE/scalarSnowDepth
-    ! compute the amount of melt, and update SWE (kg m-2)
-    if(nrgAvailable > nrgRequired)then
-    scalarSfcMeltPond  = scalarSWE
-    scalarSWE          = 0._dp
-    else
-    scalarSfcMeltPond  = nrgAvailable/LH_fus
-    scalarSWE          = scalarSWE - scalarSfcMeltPond
-    end if
-    ! update depth
-    scalarSnowDepth = scalarSWE/snwDensity
-    ! update temperature of the top soil layer (K)
-    soilTemp =  soilTemp - (LH_fus*scalarSfcMeltPond/soilDepth)/soilHeatcap
-  else  ! melt is zero if the temperature of the top soil layer is less than Tfreeze
-    scalarSfcMeltPond = 0._dp  ! kg m-2
-  end if ! (if the temperature of the top soil layer is greater than Tfreeze)
-  else  ! melt is zero if the "snow without a layer" does not exist
-  scalarSfcMeltPond = 0._dp  ! kg m-2
-  end if ! (if the "snow without a layer" exists)
-
-  end subroutine implctMelt
-
-end module coupled_em_module
diff --git a/build/source/engine/derivforce.f90 b/build/source/engine/derivforce.f90
deleted file mode 100755
index 47296716f540fe898f7b2f1557587f9fe3ca8e22..0000000000000000000000000000000000000000
--- a/build/source/engine/derivforce.f90
+++ /dev/null
@@ -1,347 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module derivforce_module
-
-! data types
-USE nrtype
-USE data_types,only:var_dlength                             ! data structure: x%var(:)%dat (dp)
-
-! model constants
-USE multiconst,only:Tfreeze                                 ! freezing point of pure water (K)
-USE multiconst,only:secprday                                ! number of seconds in a day
-USE multiconst,only:secprhour                               ! number of seconds in an hour
-USE multiconst,only:minprhour                               ! number of minutes in an hour
-
-! global time information
-USE globalData,only:refJulday                               ! reference time (fractional julian days)
-USE globalData,only:data_step                               ! length of the data step (s)
-
-! model decisions
-USE globalData,only:model_decisions                         ! model decision structure
-USE var_lookup,only:iLookDECISIONS                          ! named variables for elements of the decision structure
-
-! named variables for structure elements
-USE var_lookup,only:iLookTIME,iLookATTR                     ! named variables for structure elements
-USE var_lookup,only:iLookPARAM,iLookFORCE                   ! named variables for structure elements
-USE var_lookup,only:iLookPROG,iLookDIAG,iLookFLUX           ! named variables for structure elements
-
-! look-up values for the choice of the time zone information
-USE globalData,only:ncTime,utcTime,localTime                ! time zone info: as in NetCDF file, UTC, or local
-
-! look-up values for the choice of snow albedo options
-USE mDecisions_module,only:  &
- constDens,              &    ! Constant new snow density
- anderson,               &    ! Anderson 1976
- hedAndPom,              &    ! Hedstrom and Pomeroy (1998), expoential increase
- pahaut_76                    ! Pahaut 1976, wind speed dependent (derived from Col de Porte, French Alps)
-
-! privacy
-implicit none
-private
-public::derivforce
-contains
-
- ! ************************************************************************************************
- ! public subroutine derivforce: compute derived forcing data
- ! ************************************************************************************************
- subroutine derivforce(time_data,forc_data,attr_data,mpar_data,prog_data,diag_data,flux_data,tmZoneOffsetFracDay,err,message)
- USE sunGeomtry_module,only:clrsky_rad                         ! compute cosine of the solar zenith angle
- USE conv_funcs_module,only:vapPress                           ! compute vapor pressure of air (Pa)
- USE conv_funcs_module,only:SPHM2RELHM,RELHM2SPHM,WETBULBTMP   ! conversion functions
- USE snow_utils_module,only:fracliquid,templiquid              ! functions to compute temperature/liquid water
- USE time_utils_module,only:compcalday                         ! convert julian day to calendar date
- USE summaFileManager,only: NC_TIME_ZONE                       ! time zone option from control file
- ! compute derived forcing data variables
- implicit none
- ! input variables
- integer(i4b),     intent(in)    :: time_data(:)               ! vector of time data for a given time step
- real(dp),         intent(inout) :: forc_data(:)               ! vector of forcing data for a given time step
- real(dp),         intent(in)    :: attr_data(:)               ! vector of model attributes
- type(var_dlength),intent(in)    :: mpar_data                  ! vector of model parameters
- type(var_dlength),intent(in)    :: prog_data                  ! data structure of model prognostic variables for a local HRU
- ! output variables
- type(var_dlength),intent(inout) :: diag_data                  ! data structure of model diagnostic variables for a local HRU
- type(var_dlength),intent(inout) :: flux_data                  ! data structure of model fluxes for a local HRU
- real(dp),intent(inout)          :: tmZoneOffsetFracDay 
- integer(i4b),intent(out)        :: err                        ! error code
- character(*),intent(out)        :: message                    ! error message
- ! local time
- integer(i4b)                    :: jyyy,jm,jd                 ! year, month, day
- integer(i4b)                    :: jh,jmin                    ! hour, minute
- real(dp)                        :: dsec                       ! double precision seconds (not used)
- real(dp)                        :: timeOffset                 ! time offset from Grenwich (days)
- real(dp)                        :: julianTime                 ! local julian time
- ! cosine of the solar zenith angle
- real(dp)                        :: ahour                      ! hour at start of time step
- real(dp)                        :: dataStep                   ! data step (hours)
- real(dp),parameter              :: slope=0._dp                ! terrain slope (assume flat)
- real(dp),parameter              :: azimuth=0._dp              ! terrain azimuth (assume zero)
- real(dp)                        :: hri                        ! average radiation index over time step DT
- ! general local variables
- character(len=256)              :: cmessage                   ! error message for downwind routine
- integer(i4b),parameter          :: nBands=2                   ! number of spectral bands
- real(dp),parameter              :: valueMissing=-9999._dp     ! missing value
- real(dp),parameter              :: co2Factor=355.e-6_dp       ! empirical factor to obtain partial pressure of co2
- real(dp),parameter              :: o2Factor=0.209_dp          ! empirical factor to obtain partial pressure of o2
- real(dp),parameter              :: minMeasHeight=1._dp        ! minimum measurement height (m)
- real(dp)                        :: relhum                     ! relative humidity (-)
- real(dp)                        :: fracrain                   ! fraction of precipitation that falls as rain
- real(dp)                        :: maxFrozenSnowTemp          ! maximum temperature of snow when the snow is predominantely frozen (K)
- real(dp),parameter              :: unfrozenLiq=0.01_dp        ! unfrozen liquid water used to compute maxFrozenSnowTemp (-)
- real(dp),parameter              :: eps=epsilon(fracrain)      ! a number that is almost negligible
- real(dp)                        :: Tmin,Tmax                  ! minimum and maximum wet bulb temperature in the time step (K)
- real(dp),parameter              :: pomNewSnowDenMax=150._dp   ! Upper limit for new snow density limit in Hedstrom and Pomeroy 1998. 150 was used because at was the highest observed density at air temperatures used in this study. See Figure 4 of Hedstrom and Pomeroy (1998).
- real(dp),parameter              :: andersonWarmDenLimit=2._dp ! Upper air temperature limit in Anderson (1976) new snow density (C)
- real(dp),parameter              :: andersonColdDenLimit=15._dp! Lower air temperature limit in Anderson (1976) new snow density (C)
- real(dp),parameter              :: andersonDenScal=1.5_dp     ! Scalar parameter in Anderson (1976) new snow density function (-)
- real(dp),parameter              :: pahautDenWindScal=0.5_dp   ! Scalar parameter for wind impacts on density using Pahaut (1976) function (-)
- ! ************************************************************************************************
- ! associate local variables with the information in the data structures
- associate(&
- ! model parameters
- Frad_vis                => mpar_data%var(iLookPARAM%Frad_vis)%dat(1)             , & ! fraction radiation absorbed in visible part of spectrum (-)
- directScale             => mpar_data%var(iLookPARAM%directScale)%dat(1)          , & ! scaling factor for fractional driect radiaion parameterization (-)
- Frad_direct             => mpar_data%var(iLookPARAM%Frad_direct)%dat(1)          , & ! maximum fraction direct radiation (-)
- minwind                 => mpar_data%var(iLookPARAM%minwind)%dat(1)              , & ! minimum windspeed (m s-1)
- fc_param                => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)        , & ! freezing curve parameter for snow (K-1)
- tempCritRain            => mpar_data%var(iLookPARAM%tempCritRain)%dat(1)         , & ! critical temperature where precipitation is rain (K)
- tempRangeTimestep       => mpar_data%var(iLookPARAM%tempRangeTimestep)%dat(1)    , & ! temperature range over the time step (K)
- frozenPrecipMultip      => mpar_data%var(iLookPARAM%frozenPrecipMultip)%dat(1)   , & ! frozen precipitation multiplier (-)
- newSnowDenMin           => mpar_data%var(iLookPARAM%newSnowDenMin)%dat(1)        , & ! minimum new snow density (kg m-3)
- newSnowDenMult          => mpar_data%var(iLookPARAM%newSnowDenMult)%dat(1)       , & ! multiplier for new snow density (kg m-3)
- newSnowDenScal          => mpar_data%var(iLookPARAM%newSnowDenScal)%dat(1)       , & ! scaling factor for new snow density (K)
- constSnowDen            => mpar_data%var(iLookPARAM%constSnowDen)%dat(1)         , & ! Constant new snow density (kg m-3)
- newSnowDenAdd           => mpar_data%var(iLookPARAM%newSnowDenAdd)%dat(1)        , & ! Pahaut 1976, additive factor for new snow density (kg m-3)
- newSnowDenMultTemp      => mpar_data%var(iLookPARAM%newSnowDenMultTemp)%dat(1)   , & ! Pahaut 1976, multiplier for new snow density applied to air temperature (kg m-3 K-1)
- newSnowDenMultWind      => mpar_data%var(iLookPARAM%newSnowDenMultWind)%dat(1)   , & ! Pahaut 1976, multiplier for new snow density applied to wind speed (kg m-7/2 s-1/2)
- newSnowDenMultAnd       => mpar_data%var(iLookPARAM%newSnowDenMultAnd)%dat(1)    , & ! Anderson 1976, multiplier for new snow density for Anderson function (K-1)
- newSnowDenBase          => mpar_data%var(iLookPARAM%newSnowDenBase)%dat(1)       , & ! Anderson 1976, base value that is rasied to the (3/2) power (K)
- ! radiation geometry variables
- iyyy                    => time_data(iLookTIME%iyyy)                             , & ! year
- im                      => time_data(iLookTIME%im)                               , & ! month
- id                      => time_data(iLookTIME%id)                               , & ! day
- ih                      => time_data(iLookTIME%ih)                               , & ! hour
- imin                    => time_data(iLookTIME%imin)                             , & ! minute
- latitude                => attr_data(iLookATTR%latitude)                         , & ! latitude (degrees north)
- longitude               => attr_data(iLookATTR%longitude)                        , & ! longitude (degrees east)
- cosZenith               => diag_data%var(iLookDIAG%scalarCosZenith)%dat(1)       , & ! average cosine of the zenith angle over time step DT
- ! measurement height
- mHeight                 => attr_data(iLookATTR%mHeight)                          , & ! latitude (degrees north)
- adjMeasHeight           => diag_data%var(iLookDIAG%scalarAdjMeasHeight)%dat(1)   , & ! adjusted measurement height (m)
- scalarSnowDepth         => prog_data%var(iLookPROG%scalarSnowDepth)%dat(1)       , & ! snow depth on the ground surface (m)
- heightCanopyTop         => mpar_data%var(iLookPARAM%heightCanopyTop)%dat(1)      , & ! height of the top of the canopy layer (m)
- ! model time
- secondsSinceRefTime     => forc_data(iLookFORCE%time)                            , & ! time = seconds since reference time
- ! model forcing data
- SWRadAtm                => forc_data(iLookFORCE%SWRadAtm)                        , & ! downward shortwave radiation (W m-2)
- airtemp                 => forc_data(iLookFORCE%airtemp)                         , & ! air temperature at 2 meter height (K)
- windspd                 => forc_data(iLookFORCE%windspd)                         , & ! wind speed at 10 meter height (m s-1)
- airpres                 => forc_data(iLookFORCE%airpres)                         , & ! air pressure at 2 meter height (Pa)
- spechum                 => forc_data(iLookFORCE%spechum)                         , & ! specific humidity at 2 meter height (g g-1)
- pptrate                 => forc_data(iLookFORCE%pptrate)                         , & ! precipitation rate (kg m-2 s-1)
- ! derived model forcing data
- scalarO2air             => diag_data%var(iLookDIAG%scalarO2air)%dat(1)           , & ! atmospheric o2 concentration (Pa)
- scalarCO2air            => diag_data%var(iLookDIAG%scalarCO2air)%dat(1)          , & ! atmospheric co2 concentration (Pa)
- ! radiation variables
- scalarFractionDirect    => diag_data%var(iLookDIAG%scalarFractionDirect)%dat(1)  , & ! fraction of direct radiation (0-1)
- spectralIncomingDirect  => flux_data%var(iLookFLUX%spectralIncomingDirect)%dat   , & ! downwelling direct shortwave radiation for each waveband (W m-2)
- spectralIncomingDiffuse => flux_data%var(iLookFLUX%spectralIncomingDiffuse)%dat  , & ! downwelling diffuse shortwave radiation for each waveband (W m-2)
- ! snow accumulation variables
- rainfall                => flux_data%var(iLookFLUX%scalarRainfall)%dat(1)        , & ! computed rainfall rate (kg m-2 s-1)
- snowfall                => flux_data%var(iLookFLUX%scalarSnowfall)%dat(1)        , & ! computed snowfall rate (kg m-2 s-1)
- VPair                   => diag_data%var(iLookDIAG%scalarVPair)%dat(1)           , & ! vapor pressure of the air above the vegetation canopy (Pa)
- twetbulb                => diag_data%var(iLookDIAG%scalarTwetbulb)%dat(1)        , & ! wet bulb temperature (K)
- snowfallTemp            => diag_data%var(iLookDIAG%scalarSnowfallTemp)%dat(1)    , & ! computed temperature of fresh snow (K)
- newSnowDensity          => diag_data%var(iLookDIAG%scalarNewSnowDensity)%dat(1)    & ! computed density of new snow (kg m-3)
- ) ! (associating local variables with the information in the data structures)
-
- ! initialize error control
- err=0; message="derivforce/"
-
- ! check spectral dimension
- if(size(spectralIncomingDirect) /= nBands .or. size(spectralIncomingDiffuse) /= nBands)then
-  write(message,'(a,i0,a)') trim(message)//'expect ', nBands, 'spectral classes for radiation'
-  err=20; return
- end if
-
- ! adjust the measurement height for the vegetation canopy
- ! NOTE: could return an error or a warning
- ! NOTE: this does not need to be done every time step -- doing here for consistency with the snow adjustment
- if(mHeight < heightCanopyTop)then
-  adjMeasHeight = heightCanopyTop+minMeasHeight  ! measurement height at least minMeasHeight above the canopy
- else
-  adjMeasHeight = mHeight
- endif
-
- ! adjust the measurement height for snow depth
- if(adjMeasHeight < scalarSnowDepth+minMeasHeight)then
-  adjMeasHeight = scalarSnowDepth+minMeasHeight  ! measurement height at least minMeasHeight above the snow surface
- endif
-
- ! compute the partial pressure of o2 and co2
- scalarCO2air = co2Factor * airpres  ! atmospheric co2 concentration (Pa)
- scalarO2air  = o2Factor * airpres   ! atmospheric o2 concentration (Pa)
-
- ! determine timeOffset based on tmZoneInfo option number`
- select case(trim(NC_TIME_ZONE))
-  ! Time zone information from NetCDF file
-  case('ncTime')
-   timeOffset = longitude/360._dp - tmZoneOffsetFracDay ! time offset in days
-  ! All times in UTC
-  case('utcTime')
-   timeOffset = longitude/360._dp  ! time offset in days
-  ! All times local
-  case('localTime')
-   timeOffset = 0._dp  ! time offset in days
-  case default; message=trim(message)//'unable to identify option for tmZoneInfo'; err=20; return
- end select ! identifying option tmZoneInfo
-
- ! constrain timeOffset so that it is in the [-0.5, 0.5] range
- if(timeOffset<-0.5)then
-  timeOffset = timeOffset+1
- else if(timeOffset>0.5)then
-  timeOffset = timeOffset-1
- endif
-
- ! compute the local time
- julianTime = secondsSinceRefTime/secprday + refJulDay ! julian time (days)
-
- ! convert julian day to year/month/day/hour/minute
- call compcalday(julianTime+timeOffset,          & ! input  = julian day
-                 jyyy,jm,jd,jh,jmin,dsec,        & ! output = year, month, day, hour, minute, second
-                 err,cmessage)                     ! output = error control
- if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-
- ! compute the decimal hour at the start of the time step
- dataStep = data_step/secprhour  ! time step (hours)
- ahour    = real(jh,kind(dp)) + real(jmin,kind(dp))/minprhour - data_step/secprhour  ! decimal hour (start of the step)
-
- ! compute the cosine of the solar zenith angle
- call clrsky_rad(jm,jd,ahour,dataStep,   &  ! intent(in): time variables
-                 slope,azimuth,latitude, &  ! intent(in): location variables
-                 hri,cosZenith)             ! intent(out): cosine of the solar zenith angle
- !write(*,'(a,1x,4(i2,1x),3(f9.3,1x))') 'im,id,ih,imin,ahour,dataStep,cosZenith = ', &
-
- ! ensure solar radiation is non-negative
- if(SWRadAtm < 0._dp) SWRadAtm = 0._dp
- ! compute the fraction of direct radiation using the parameterization of Nijssen and Lettenmaier (1999)
- if(cosZenith > 0._dp)then
-  scalarFractionDirect = Frad_direct*cosZenith/(cosZenith + directScale)
- else
-  scalarFractionDirect = 0._dp
- end if
- ! compute direct shortwave radiation, in the visible and near-infra-red part of the spectrum
- spectralIncomingDirect(1) = SWRadAtm*scalarFractionDirect*Frad_vis                         ! (direct vis)
- spectralIncomingDirect(2) = SWRadAtm*scalarFractionDirect*(1._dp - Frad_vis)               ! (direct nir)
- ! compute diffuse shortwave radiation, in the visible and near-infra-red part of the spectrum
- spectralIncomingDiffuse(1) = SWRadAtm*(1._dp - scalarFractionDirect)*Frad_vis              ! (diffuse vis)
- spectralIncomingDiffuse(2) = SWRadAtm*(1._dp - scalarFractionDirect)*(1._dp - Frad_vis)    ! (diffuse nir)
-
- ! ensure wind speed is above a prescribed minimum value
- if(windspd < minwind) windspd=minwind
- ! compute relative humidity (-)
- relhum   = SPHM2RELHM(spechum, airpres, airtemp)
- ! if relative humidity exceeds saturation, then set relative and specific humidity to saturation
- if(relhum > 1._dp)then
-  relhum  = 1._dp
-  spechum = RELHM2SPHM(relhum, airpres, airtemp)
- end if
-
- ! compute vapor pressure of the air above the vegetation canopy (Pa)
- VPair = vapPress(spechum,airpres)
- !print*, 'VPair = ', VPair
-
- ! compute wet bulb temperature (K)
- twetbulb = WETBULBTMP(airtemp, relhum, airpres)
-
- ! compute the maximum temperature of snow when the snow is predominantely frozen (K)
- maxFrozenSnowTemp = templiquid(unfrozenLiq,fc_param)
-
- ! compute fraction of rain and temperature of fresh snow
- Tmin = twetbulb - tempRangeTimestep/2._dp
- Tmax = twetbulb + tempRangeTimestep/2._dp
- if(Tmax < tempCritRain)then
-  fracrain     = 0._dp
-  snowfallTemp = twetbulb
- elseif(Tmin > tempCritRain)then
-  fracrain     = 1._dp
-  snowfallTemp = maxFrozenSnowTemp
- else
-  fracrain     = (Tmax - tempCritRain)/(Tmax - Tmin)
-  snowfallTemp = 0.5_dp*(Tmin + maxFrozenSnowTemp)
- end if
- !write(*,'(a,1x,10(f20.10,1x))') 'Tmin, twetbulb, tempRangeTimestep, tempCritRain = ', &
- !                                 Tmin, twetbulb, tempRangeTimestep, tempCritRain
-
- ! ensure that snowfall temperature creates predominantely solid precipitation
- snowfallTemp      = min(maxFrozenSnowTemp,snowfallTemp) ! snowfall temperature
-
- ! ensure precipitation rate can be resolved by the data model
- if(pptrate<eps)then
-  ! set rainfall and snowfall to zero
-  rainfall     = 0._dp
-  snowfall     = 0._dp
- else
-  ! compute rainfall and snowfall
-  rainfall = fracrain*pptrate
-  snowfall = (1._dp - fracrain)*pptrate*frozenPrecipMultip
- end if
-
- !print*, 'tempCritRain, tempRangeTimestep, pptrate, airtemp, rainfall, snowfall, twetbulb, relhum, snowfallTemp = '
- !print*, tempCritRain, tempRangeTimestep, pptrate, airtemp, rainfall, snowfall, twetbulb, relhum, snowfallTemp
-
- ! compute density of new snow
- if(snowfall > tiny(fracrain))then
-  ! Determine which method to use
-  select case(model_decisions(iLookDECISIONS%snowDenNew)%iDecision)
-   ! Hedstrom and Pomeroy 1998
-   case(hedAndPom)
-    newSnowDensity = min(pomNewSnowDenMax,newSnowDenMin + newSnowDenMult*exp((airtemp-Tfreeze)/newSnowDenScal))  ! new snow density (kg m-3)
-   ! Pahaut 1976 (Boone et al. 2002)
-   case(pahaut_76)
-    newSnowDensity = max(newSnowDenMin,newSnowDenAdd + (newSnowDenMultTemp * (airtemp-Tfreeze))+(newSnowDenMultWind*((windspd)**pahautDenWindScal))); ! new snow density (kg m-3)
-   ! Anderson 1976
-   case(anderson)
-    if(airtemp>(Tfreeze+andersonWarmDenLimit))then
-     newSnowDensity = newSnowDenMin + newSnowDenMultAnd*(newSnowDenBase)**(andersonDenScal) ! new snow density (kg m-3)
-    elseif(airtemp<=(Tfreeze-andersonColdDenLimit))then
-     newSnowDensity = newSnowDenMin ! new snow density (kg m-3)
-    else
-     newSnowDensity = newSnowDenMin + newSnowDenMultAnd*(airtemp-Tfreeze+newSnowDenBase)**(andersonDenScal) ! new snow density (kg m-3)
-    end if
-   ! Constant new snow density
-   case(constDens)
-    newSnowDensity = constSnowDen ! new snow density (kg m-3)
-   case default; message=trim(message)//'unable to identify option for new snow density'; err=20; return
-  end select ! identifying option for new snow density
- else
-  newSnowDensity = valueMissing
-  rainfall = rainfall + snowfall ! in most cases snowfall will be zero here
-  snowfall = 0._dp
- end if
-
- ! end association of local variables with the information in the data structures
- end associate
-
- end subroutine derivforce
-
-
-end module derivforce_module
diff --git a/build/source/engine/mDecisions.f90 b/build/source/engine/mDecisions.f90
deleted file mode 100755
index db481e044b51200545505537f83887cb882717ff..0000000000000000000000000000000000000000
--- a/build/source/engine/mDecisions.f90
+++ /dev/null
@@ -1,753 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module mDecisions_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-USE var_lookup, only: maxvarDecisions  ! maximum number of decisions
-implicit none
-private
-public::mDecisions
-! look-up values for the choice of function for the soil moisture control on stomatal resistance
-integer(i4b),parameter,public :: NoahType             =   1    ! thresholded linear function of volumetric liquid water content
-integer(i4b),parameter,public :: CLM_Type             =   2    ! thresholded linear function of matric head
-integer(i4b),parameter,public :: SiB_Type             =   3    ! exponential of the log of matric head
-! look-up values for the choice of stomatal resistance formulation
-integer(i4b),parameter,public :: BallBerry            =   1    ! Ball-Berry
-integer(i4b),parameter,public :: Jarvis               =   2    ! Jarvis
-integer(i4b),parameter,public :: simpleResistance     =   3    ! simple resistance formulation
-integer(i4b),parameter,public :: BallBerryFlex        =   4    ! flexible Ball-Berry scheme
-integer(i4b),parameter,public :: BallBerryTest        =   5    ! flexible Ball-Berry scheme (testing)
-! look-up values to define leaf temperature controls on photosynthesis + stomatal resistance
-integer(i4b),parameter,public :: q10Func              =  11    ! the q10 function used in CLM4 and Noah-MP
-integer(i4b),parameter,public :: Arrhenius            =  12    ! the Arrhenious functions used in CLM5 and Cable
-! look-up values to define humidity controls on stomatal resistance
-integer(i4b),parameter,public :: humidLeafSurface     =  21    ! humidity at the leaf surface [Bonan et al., 2011]
-integer(i4b),parameter,public :: scaledHyperbolic     =  22    ! scaled hyperbolic function [Leuning et al., 1995]
-! look-up values to define the electron transport function (dependence of photosynthesis on PAR)
-integer(i4b),parameter,public :: linear               =  31    ! linear function used in CLM4 and Noah-MP
-integer(i4b),parameter,public :: linearJmax           =  32    ! linear jmax function used in Cable [Wang et al., Ag Forest Met 1998, eq D5]
-integer(i4b),parameter,public :: quadraticJmax        =  33    ! the quadratic Jmax function, used in SSiB and CLM5
-! look up values to define the use of CO2 compensation point to calculate stomatal resistance
-integer(i4b),parameter,public :: origBWB              =  41    ! the original BWB approach
-integer(i4b),parameter,public :: Leuning              =  42    ! the Leuning approach
-! look up values to define the iterative numerical solution method used in the Ball-Berry stomatal resistance parameterization
-integer(i4b),parameter,public :: NoahMPsolution       =  51    ! the NoahMP solution (and CLM4): fixed point iteration; max 3 iterations
-integer(i4b),parameter,public :: newtonRaphson        =  52    ! full Newton-Raphson iterative solution to convergence
-! look up values to define the controls on carbon assimilation
-integer(i4b),parameter,public :: colimitation         =  61    ! enable colimitation, as described by Collatz et al. (1991) and Sellers et al. (1996)
-integer(i4b),parameter,public :: minFunc              =  62    ! do not enable colimitation: use minimum of the three controls on carbon assimilation
-! look up values to define the scaling of photosynthesis from the leaves to the canopy
-integer(i4b),parameter,public :: constantScaling      =  71    ! constant scaling factor
-integer(i4b),parameter,public :: laiScaling           =  72    ! exponential function of LAI (Leuning, Plant Cell Env 1995: "Scaling from..." [eq 9])
-! look-up values for the choice of numerical method
-integer(i4b),parameter,public :: iterative            =  81    ! iterative
-integer(i4b),parameter,public :: nonIterative         =  82    ! non-iterative
-integer(i4b),parameter,public :: iterSurfEnergyBal    =  83    ! iterate only on the surface energy balance
-! look-up values for method used to compute derivative
-integer(i4b),parameter,public :: numerical            =  91    ! numerical solution
-integer(i4b),parameter,public :: analytical           =  92    ! analytical solution
-! look-up values for method used to determine LAI and SAI
-integer(i4b),parameter,public :: monthlyTable         = 101    ! LAI/SAI taken directly from a monthly table for different vegetation classes
-integer(i4b),parameter,public :: specified            = 102    ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
-! look-up values for the choice of the canopy interception parameterization
-integer(i4b),parameter,public :: sparseCanopy         = 111    ! fraction of rainfall that never hits the canopy (throughfall); drainage above threshold
-integer(i4b),parameter,public :: storageFunc          = 112    ! throughfall a function of canopy storage; 100% throughfall when canopy is at capacity
-integer(i4b),parameter,public :: unDefined            = 113    ! option is undefined (backwards compatibility)
-! look-up values for the form of Richards' equation
-integer(i4b),parameter,public :: moisture             = 121    ! moisture-based form of Richards' equation
-integer(i4b),parameter,public :: mixdform             = 122    ! mixed form of Richards' equation
-! look-up values for the choice of groundwater parameterization
-integer(i4b),parameter,public :: qbaseTopmodel        = 131    ! TOPMODEL-ish baseflow parameterization
-integer(i4b),parameter,public :: bigBucket            = 132    ! a big bucket (lumped aquifer model)
-integer(i4b),parameter,public :: noExplicit           = 133    ! no explicit groundwater parameterization
-! look-up values for the choice of hydraulic conductivity profile
-integer(i4b),parameter,public :: constant             = 141    ! constant hydraulic conductivity with depth
-integer(i4b),parameter,public :: powerLaw_profile     = 142    ! power-law profile
-! look-up values for the choice of boundary conditions for thermodynamics
-integer(i4b),parameter,public :: prescribedTemp       = 151    ! prescribed temperature
-integer(i4b),parameter,public :: energyFlux           = 152    ! energy flux
-integer(i4b),parameter,public :: zeroFlux             = 153    ! zero flux
-! look-up values for the choice of boundary conditions for hydrology
-integer(i4b),parameter,public :: liquidFlux           = 161    ! liquid water flux
-integer(i4b),parameter,public :: prescribedHead       = 162    ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
-integer(i4b),parameter,public :: funcBottomHead       = 163    ! function of matric head in the lower-most layer
-integer(i4b),parameter,public :: freeDrainage         = 164    ! free drainage
-! look-up values for the choice of parameterization for vegetation roughness length and displacement height
-integer(i4b),parameter,public :: Raupach_BLM1994      = 171    ! Raupach (BLM 1994) "Simplified expressions..."
-integer(i4b),parameter,public :: CM_QJRMS1988         = 172    ! Choudhury and Monteith (QJRMS 1988) "A four layer model for the heat budget..."
-integer(i4b),parameter,public :: vegTypeTable         = 173    ! constant parameters dependent on the vegetation type
-! look-up values for the choice of parameterization for the rooting profile
-integer(i4b),parameter,public :: powerLaw             = 181    ! simple power-law rooting profile
-integer(i4b),parameter,public :: doubleExp            = 182    ! the double exponential function of Xeng et al. (JHM 2001)
-! look-up values for the choice of parameterization for canopy emissivity
-integer(i4b),parameter,public :: simplExp             = 191    ! simple exponential function
-integer(i4b),parameter,public :: difTrans             = 192    ! parameterized as a function of diffuse transmissivity
-! look-up values for the choice of parameterization for snow interception
-integer(i4b),parameter,public :: stickySnow           = 201    ! maximum interception capacity an increasing function of temerature
-integer(i4b),parameter,public :: lightSnow            = 202    ! maximum interception capacity an inverse function of new snow density
-! look-up values for the choice of wind profile
-integer(i4b),parameter,public :: exponential          = 211    ! exponential wind profile extends to the surface
-integer(i4b),parameter,public :: logBelowCanopy       = 212    ! logarithmic profile below the vegetation canopy
-! look-up values for the choice of stability function
-integer(i4b),parameter,public :: standard             = 221    ! standard MO similarity, a la Anderson (1976)
-integer(i4b),parameter,public :: louisInversePower    = 222    ! Louis (1979) inverse power function
-integer(i4b),parameter,public :: mahrtExponential     = 223    ! Mahrt (1987) exponential
-! look-up values for the choice of canopy shortwave radiation method
-integer(i4b),parameter,public :: noah_mp              = 231    ! full Noah-MP implementation (including albedo)
-integer(i4b),parameter,public :: CLM_2stream          = 232    ! CLM 2-stream model (see CLM documentation)
-integer(i4b),parameter,public :: UEB_2stream          = 233    ! UEB 2-stream model (Mahat and Tarboton, WRR 2011)
-integer(i4b),parameter,public :: NL_scatter           = 234    ! Simplified method Nijssen and Lettenmaier (JGR 1999)
-integer(i4b),parameter,public :: BeersLaw             = 235    ! Beer's Law (as implemented in VIC)
-! look-up values for the choice of albedo representation
-integer(i4b),parameter,public :: constantDecay        = 241    ! constant decay (e.g., VIC, CLASS)
-integer(i4b),parameter,public :: variableDecay        = 242    ! variable decay (e.g., BATS approach, with destructive metamorphism + soot content)
-! look-up values for the choice of compaction routine
-integer(i4b),parameter,public :: constantSettlement   = 251    ! constant settlement rate
-integer(i4b),parameter,public :: andersonEmpirical    = 252    ! semi-empirical method of Anderson (1976)
-! look-up values for the choice of method to combine and sub-divide snow layers
-integer(i4b),parameter,public :: sameRulesAllLayers   = 261    ! same combination/sub-division rules applied to all layers
-integer(i4b),parameter,public :: rulesDependLayerIndex= 262    ! combination/sub-dividion rules depend on layer index
-! look-up values for the choice of thermal conductivity representation for snow
-integer(i4b),parameter,public :: Yen1965              = 271    ! Yen (1965)
-integer(i4b),parameter,public :: Mellor1977           = 272    ! Mellor (1977)
-integer(i4b),parameter,public :: Jordan1991           = 273    ! Jordan (1991)
-integer(i4b),parameter,public :: Smirnova2000         = 274    ! Smirnova et al. (2000)
-! look-up values for the choice of thermal conductivityi representation for soil
-integer(i4b),parameter,public :: funcSoilWet          = 281    ! function of soil wetness
-integer(i4b),parameter,public :: mixConstit           = 282    ! mixture of constituents
-integer(i4b),parameter,public :: hanssonVZJ           = 283    ! test case for the mizoguchi lab experiment, Hansson et al. VZJ 2004
-! look-up values for the choice of method for the spatial representation of groundwater
-integer(i4b),parameter,public :: localColumn          = 291    ! separate groundwater representation in each local soil column
-integer(i4b),parameter,public :: singleBasin          = 292    ! single groundwater store over the entire basin
-! look-up values for the choice of sub-grid routing method
-integer(i4b),parameter,public :: timeDelay            = 301    ! time-delay histogram
-integer(i4b),parameter,public :: qInstant             = 302    ! instantaneous routing
-! look-up values for the choice of new snow density method
-integer(i4b),parameter,public :: constDens            = 311    ! Constant new snow density
-integer(i4b),parameter,public :: anderson             = 312    ! Anderson 1976
-integer(i4b),parameter,public :: hedAndPom            = 313    ! Hedstrom and Pomeroy (1998), expoential increase
-integer(i4b),parameter,public :: pahaut_76            = 314    ! Pahaut 1976, wind speed dependent (derived from Col de Porte, French Alps)
-! look-up values for the choice of snow unloading from the canopy
-integer(i4b),parameter,public :: meltDripUnload       = 321    ! Hedstrom and Pomeroy (1998), Storck et al 2002 (snowUnloadingCoeff & ratioDrip2Unloading)
-integer(i4b),parameter,public :: windUnload           = 322    ! Roesch et al 2001, formulate unloading based on wind and temperature
-! -----------------------------------------------------------------------------------------------------------
-
-contains
-
- ! ************************************************************************************************
- ! public subroutine mDecisions: save model decisions as named integers
- ! ************************************************************************************************
- subroutine mDecisions(num_steps, err) bind(C, name='mDecisions')
- ! model time structures
- USE multiconst,only:secprday               ! number of seconds in a day
- USE var_lookup,only:iLookTIME              ! named variables that identify indices in the time structures
- USE globalData,only:refTime,refJulday      ! reference time
- USE globalData,only:oldTime                ! time from the previous time step
- USE globalData,only:startTime,finshTime    ! start/end time of simulation
- USE globalData,only:dJulianStart           ! julian day of start time of simulation
- USE globalData,only:dJulianFinsh           ! julian day of end time of simulation
- USE globalData,only:data_step              ! length of data step (s)
- USE globalData,only:numtim                 ! number of time steps in the simulation
- ! model decision structures
- USE globaldata,only:model_decisions        ! model decision structure
- USE var_lookup,only:iLookDECISIONS         ! named variables for elements of the decision structure
- ! forcing metadata
- USE globalData,only:forc_meta              ! metadata structures
- USE var_lookup,only:iLookFORCE             ! named variables to define structure elements
- ! Noah-MP decision structures
- USE noahmp_globals,only:DVEG               ! decision for dynamic vegetation
- USE noahmp_globals,only:OPT_RAD            ! decision for canopy radiation
- USE noahmp_globals,only:OPT_ALB            ! decision for snow albedo
- ! time utility programs
- USE time_utils_module,only:extractTime     ! extract time info from units string
- USE time_utils_module,only:compjulday      ! compute the julian day
- USE time_utils_module,only:fracDay         ! compute fractional day
- USE summaFileManager,only: SIM_START_TM, SIM_END_TM   ! time info from control file module
-
- implicit none
-  ! define output
- integer(c_int),intent(out)           :: num_steps
- integer(c_int),intent(out)           :: err            ! error code
-  ! define local variables
- character(len=256)                   :: message        ! error message
- character(len=256)                   :: cmessage       ! error message for downwind routine
- real(rkind)                          :: dsec,dsec_tz   ! second
- ! initialize error control
- err=0; message='mDecisions/'
-
- ! -------------------------------------------------------------------------------------------------
- ! -------------------------------------------------------------------------------------------------
-
- ! read information from model decisions file, and populate model decisions structure
- call readoption(err,cmessage)
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! -------------------------------------------------------------------------------------------------
-
- ! put reference time information into the time structures
- call extractTime(forc_meta(iLookFORCE%time)%varunit,                    & ! date-time string
-                  refTime%var(iLookTIME%iyyy),                           & ! year
-                  refTime%var(iLookTIME%im),                             & ! month
-                  refTime%var(iLookTIME%id),                             & ! day
-                  refTime%var(iLookTIME%ih),                             & ! hour
-                  refTime%var(iLookTIME%imin),                           & ! minute
-                  dsec,                                                  & ! second
-                  refTime%var(iLookTIME%ih_tz),                          & ! time zone hour
-                  refTime%var(iLookTIME%imin_tz),                        & ! time zone minute
-                  dsec_tz,                                               & ! time zone seconds
-                  err,cmessage)                                            ! error control
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! compute the julian date (fraction of day) for the reference time
- call compjulday(&
-                 refTime%var(iLookTIME%iyyy),                           & ! year
-                 refTime%var(iLookTIME%im),                             & ! month
-                 refTime%var(iLookTIME%id),                             & ! day
-                 refTime%var(iLookTIME%ih),                             & ! hour
-                 refTime%var(iLookTIME%imin),                           & ! minute
-                 0._rkind,                                                 & ! second
-                 refJulday,                                             & ! julian date for the start of the simulation
-                 err, cmessage)                                           ! error control
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! put simulation start time information into the time structures
- call extractTime(trim(SIM_START_TM),                                    & ! date-time string
-                  startTime%var(iLookTIME%iyyy),                         & ! year
-                  startTime%var(iLookTIME%im),                           & ! month
-                  startTime%var(iLookTIME%id),                           & ! day
-                  startTime%var(iLookTIME%ih),                           & ! hour
-                  startTime%var(iLookTIME%imin),                         & ! minute
-                  dsec,                                                  & ! second
-                  startTime%var(iLookTIME%ih_tz),                        & ! time zone hour
-                  startTime%var(iLookTIME%imin_tz),                      & ! time zone minnute
-                  dsec_tz,                                               & ! time zone seconds
-                  err,cmessage)                                            ! error control
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! compute the julian date (fraction of day) for the start of the simulation
- call compjulday(&
-                 startTime%var(iLookTIME%iyyy),                         & ! year
-                 startTime%var(iLookTIME%im),                           & ! month
-                 startTime%var(iLookTIME%id),                           & ! day
-                 startTime%var(iLookTIME%ih),                           & ! hour
-                 startTime%var(iLookTIME%imin),                         & ! minute
-                 0._rkind,                                                 & ! second
-                 dJulianStart,                                          & ! julian date for the start of the simulation
-                 err, cmessage)                                           ! error control
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! put simulation end time information into the time structures
- call extractTime(trim(SIM_END_TM),                                      & ! date-time string
-                  finshTime%var(iLookTIME%iyyy),                         & ! year
-                  finshTime%var(iLookTIME%im),                           & ! month
-                  finshTime%var(iLookTIME%id),                           & ! day
-                  finshTime%var(iLookTIME%ih),                           & ! hour
-                  finshTime%var(iLookTIME%imin),                         & ! minute
-                  dsec,                                                  & ! second
-                  finshTime%var(iLookTIME%ih_tz),                        & ! time zone hour
-                  finshTime%var(iLookTIME%imin_tz),                      & ! time zone minnute
-                  dsec_tz,                                               & ! time zone seconds
-                  err,cmessage)                                            ! error control
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! compute the julian date (fraction of day) for the end of the simulation
- call compjulday(&
-                 finshTime%var(iLookTIME%iyyy),                         & ! year
-                 finshTime%var(iLookTIME%im),                           & ! month
-                 finshTime%var(iLookTIME%id),                           & ! day
-                 finshTime%var(iLookTIME%ih),                           & ! hour
-                 finshTime%var(iLookTIME%imin),                         & ! minute
-                 0._rkind,                                                 & ! second
-                 dJulianFinsh,                                          & ! julian date for the end of the simulation
-                 err, cmessage)                                           ! error control
- if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
- ! check start and finish time
- write(*,'(a,i4,1x,4(i2,1x))') 'startTime: iyyy, im, id, ih, imin = ', startTime%var(1:5)
- write(*,'(a,i4,1x,4(i2,1x))') 'finshTime: iyyy, im, id, ih, imin = ', finshTime%var(1:5)
-
- ! check that simulation end time is > start time
- if(dJulianFinsh < dJulianStart)then; err=20; message=trim(message)//'end time of simulation occurs before start time'; return; end if
-
- ! initialize the old time vector (time from the previous time step)
- oldTime%var(:) = startTime%var(:)
-
- ! compute the number of time steps
- numtim = nint( (dJulianFinsh - dJulianStart)*secprday/data_step ) + 1
- num_steps = numtim
-
- ! -------------------------------------------------------------------------------------------------
-
- ! set Noah-MP options
- DVEG=3      ! option for dynamic vegetation
- OPT_RAD=3   ! option for canopy radiation
- OPT_ALB=2   ! option for snow albedo
-
- ! set zero option for thee category tables
- ! NOTE: we want to keep track of these decisions, but not used in the physics routines
- model_decisions(iLookDECISIONS%soilCatTbl)%iDecision = 0
- model_decisions(iLookDECISIONS%vegeParTbl)%iDecision = 0
-
- ! identify the choice of function for the soil moisture control on stomatal resistance
- select case(trim(model_decisions(iLookDECISIONS%soilStress)%cDecision))
-  case('NoahType'); model_decisions(iLookDECISIONS%soilStress)%iDecision = NoahType             ! thresholded linear function of volumetric liquid water content
-  case('CLM_Type'); model_decisions(iLookDECISIONS%soilStress)%iDecision = CLM_Type             ! thresholded linear function of matric head
-  case('SiB_Type'); model_decisions(iLookDECISIONS%soilStress)%iDecision = SiB_Type             ! exponential of the log of matric head
-  case default
-   err=10; message=trim(message)//"unknown soil moisture function [option="//trim(model_decisions(iLookDECISIONS%soilStress)%cDecision)//"]"; return
- end select
-
- ! identify the choice of function for stomatal resistance
- select case(trim(model_decisions(iLookDECISIONS%stomResist)%cDecision))
-  case('BallBerry'          ); model_decisions(iLookDECISIONS%stomResist)%iDecision = BallBerry           ! Ball-Berry
-  case('Jarvis'             ); model_decisions(iLookDECISIONS%stomResist)%iDecision = Jarvis              ! Jarvis
-  case('simpleResistance'   ); model_decisions(iLookDECISIONS%stomResist)%iDecision = simpleResistance    ! simple resistance formulation
-  case('BallBerryFlex'      ); model_decisions(iLookDECISIONS%stomResist)%iDecision = BallBerryFlex       ! flexible Ball-Berry scheme
-  case('BallBerryTest'      ); model_decisions(iLookDECISIONS%stomResist)%iDecision = BallBerryTest       ! flexible Ball-Berry scheme (testing)
-  case default
-   err=10; message=trim(message)//"unknown stomatal resistance function [option="//trim(model_decisions(iLookDECISIONS%stomResist)%cDecision)//"]"; return
- end select
-
- ! identify the leaf temperature controls on photosynthesis + stomatal resistance
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbTempFunc)%cDecision))
-   case('q10Func'            ); model_decisions(iLookDECISIONS%bbTempFunc)%iDecision = q10Func
-   case('Arrhenius'          ); model_decisions(iLookDECISIONS%bbTempFunc)%iDecision = Arrhenius
-   case default
-    err=10; message=trim(message)//"unknown leaf temperature function [option="//trim(model_decisions(iLookDECISIONS%bbTempFunc)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify the humidity controls on stomatal resistance
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbHumdFunc)%cDecision))
-   case('humidLeafSurface'   ); model_decisions(iLookDECISIONS%bbHumdFunc)%iDecision = humidLeafSurface
-   case('scaledHyperbolic'   ); model_decisions(iLookDECISIONS%bbHumdFunc)%iDecision = scaledHyperbolic
-   case default
-    err=10; message=trim(message)//"unknown humidity function [option="//trim(model_decisions(iLookDECISIONS%bbHumdFunc)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify functions for electron transport function (dependence of photosynthesis on PAR)
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbElecFunc)%cDecision))
-   case('linear'             ); model_decisions(iLookDECISIONS%bbElecFunc)%iDecision = linear
-   case('linearJmax'         ); model_decisions(iLookDECISIONS%bbElecFunc)%iDecision = linearJmax
-   case('quadraticJmax'      ); model_decisions(iLookDECISIONS%bbElecFunc)%iDecision = quadraticJmax
-   case default
-    err=10; message=trim(message)//"unknown electron transport function [option="//trim(model_decisions(iLookDECISIONS%bbElecFunc)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify the use of the co2 compensation point in the stomatal conductance calaculations
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbCO2point)%cDecision))
-   case('origBWB'            ); model_decisions(iLookDECISIONS%bbCO2point)%iDecision = origBWB
-   case('Leuning'            ); model_decisions(iLookDECISIONS%bbCO2point)%iDecision = Leuning
-   case default
-    err=10; message=trim(message)//"unknown option for the co2 compensation point [option="//trim(model_decisions(iLookDECISIONS%bbCO2point)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify the iterative numerical solution method used in the Ball-Berry stomatal resistance parameterization
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbNumerics)%cDecision))
-   case('NoahMPsolution'     ); model_decisions(iLookDECISIONS%bbNumerics)%iDecision = NoahMPsolution  ! the NoahMP solution (and CLM4): fixed point iteration; max 3 iterations
-   case('newtonRaphson'      ); model_decisions(iLookDECISIONS%bbNumerics)%iDecision = newtonRaphson   ! full Newton-Raphson iterative solution to convergence
-   case default
-    err=10; message=trim(message)//"unknown option for the Ball-Berry numerical solution [option="//trim(model_decisions(iLookDECISIONS%bbNumerics)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify the controls on carbon assimilation
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbAssimFnc)%cDecision))
-   case('colimitation'       ); model_decisions(iLookDECISIONS%bbAssimFnc)%iDecision = colimitation    ! enable colimitation, as described by Collatz et al. (1991) and Sellers et al. (1996)
-   case('minFunc'            ); model_decisions(iLookDECISIONS%bbAssimFnc)%iDecision = minFunc         ! do not enable colimitation: use minimum of the three controls on carbon assimilation
-   case default
-    err=10; message=trim(message)//"unknown option for the controls on carbon assimilation [option="//trim(model_decisions(iLookDECISIONS%bbAssimFnc)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify the scaling of photosynthesis from the leaf to the canopy
- if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-  select case(trim(model_decisions(iLookDECISIONS%bbCanIntg8)%cDecision))
-   case('constantScaling'    ); model_decisions(iLookDECISIONS%bbCanIntg8)%iDecision = constantScaling ! constant scaling factor
-   case('laiScaling'         ); model_decisions(iLookDECISIONS%bbCanIntg8)%iDecision = laiScaling      ! exponential function of LAI (Leuning, Plant Cell Env 1995: "Scaling from..." [eq 9])
-   case default
-    err=10; message=trim(message)//"unknown option for scaling of photosynthesis from the leaf to the canopy [option="//trim(model_decisions(iLookDECISIONS%bbCanIntg8)%cDecision)//"]"; return
-  end select
- end if
-
- ! identify the numerical method
- select case(trim(model_decisions(iLookDECISIONS%num_method)%cDecision))
-  case('itertive'); model_decisions(iLookDECISIONS%num_method)%iDecision = iterative           ! iterative
-  case('non_iter'); model_decisions(iLookDECISIONS%num_method)%iDecision = nonIterative        ! non-iterative
-  case('itersurf'); model_decisions(iLookDECISIONS%num_method)%iDecision = iterSurfEnergyBal   ! iterate only on the surface energy balance
-  case default
-   err=10; message=trim(message)//"unknown numerical method [option="//trim(model_decisions(iLookDECISIONS%num_method)%cDecision)//"]"; return
- end select
-
- ! identify the method used to calculate flux derivatives
- select case(trim(model_decisions(iLookDECISIONS%fDerivMeth)%cDecision))
-  case('numericl'); model_decisions(iLookDECISIONS%fDerivMeth)%iDecision = numerical           ! numerical
-  case('analytic'); model_decisions(iLookDECISIONS%fDerivMeth)%iDecision = analytical          ! analytical
-  case default
-   err=10; message=trim(message)//"unknown method used to calculate flux derivatives [option="//trim(model_decisions(iLookDECISIONS%fDerivMeth)%cDecision)//"]"; return
- end select
-
- ! identify the method used to determine LAI and SAI
- select case(trim(model_decisions(iLookDECISIONS%LAI_method)%cDecision))
-  case('monTable');  model_decisions(iLookDECISIONS%LAI_method)%iDecision = monthlyTable       ! LAI/SAI taken directly from a monthly table for different vegetation classes
-  case('specified'); model_decisions(iLookDECISIONS%LAI_method)%iDecision = specified          ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
-  case default
-   err=10; message=trim(message)//"unknown method to determine LAI and SAI [option="//trim(model_decisions(iLookDECISIONS%LAI_method)%cDecision)//"]"; return
- end select
-
- ! identify the canopy interception parameterization
- select case(trim(model_decisions(iLookDECISIONS%cIntercept)%cDecision))
-  case('notPopulatedYet'); model_decisions(iLookDECISIONS%cIntercept)%iDecision = unDefined
-  case('sparseCanopy');    model_decisions(iLookDECISIONS%cIntercept)%iDecision = sparseCanopy
-  case('storageFunc');     model_decisions(iLookDECISIONS%cIntercept)%iDecision = storageFunc
-  case default
-   err=10; message=trim(message)//"unknown canopy interception parameterization [option="//trim(model_decisions(iLookDECISIONS%cIntercept)%cDecision)//"]"; return
- end select
-
- ! identify the form of Richards' equation
- select case(trim(model_decisions(iLookDECISIONS%f_Richards)%cDecision))
-  case('moisture'); model_decisions(iLookDECISIONS%f_Richards)%iDecision = moisture            ! moisture-based form
-  case('mixdform'); model_decisions(iLookDECISIONS%f_Richards)%iDecision = mixdform            ! mixed form
-  case default
-   err=10; message=trim(message)//"unknown form of Richards' equation [option="//trim(model_decisions(iLookDECISIONS%f_Richards)%cDecision)//"]"; return
- end select
-
- ! identify the groundwater parameterization
- select case(trim(model_decisions(iLookDECISIONS%groundwatr)%cDecision))
-  case('qTopmodl'); model_decisions(iLookDECISIONS%groundwatr)%iDecision = qbaseTopmodel       ! TOPMODEL-ish baseflow parameterization
-  case('bigBuckt'); model_decisions(iLookDECISIONS%groundwatr)%iDecision = bigBucket           ! a big bucket (lumped aquifer model)
-  case('noXplict'); model_decisions(iLookDECISIONS%groundwatr)%iDecision = noExplicit          ! no explicit groundwater parameterization
-  case default
-   err=10; message=trim(message)//"unknown groundwater parameterization [option="//trim(model_decisions(iLookDECISIONS%groundwatr)%cDecision)//"]"; return
- end select
-
- ! identify the hydraulic conductivity profile
- select case(trim(model_decisions(iLookDECISIONS%hc_profile)%cDecision))
-  case('constant'); model_decisions(iLookDECISIONS%hc_profile)%iDecision = constant            ! constant hydraulic conductivity with depth
-  case('pow_prof'); model_decisions(iLookDECISIONS%hc_profile)%iDecision = powerLaw_profile    ! power-law profile
-  case default
-   err=10; message=trim(message)//"unknown hydraulic conductivity profile [option="//trim(model_decisions(iLookDECISIONS%hc_profile)%cDecision)//"]"; return
- end select
-
- ! identify the upper boundary conditions for thermodynamics
- select case(trim(model_decisions(iLookDECISIONS%bcUpprTdyn)%cDecision))
-  case('presTemp'); model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision = prescribedTemp      ! prescribed temperature
-  case('nrg_flux'); model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision = energyFlux          ! energy flux
-  case('zeroFlux'); model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision = zeroFlux            ! zero flux
-  case default
-   err=10; message=trim(message)//"unknown upper boundary conditions for thermodynamics [option="//trim(model_decisions(iLookDECISIONS%bcUpprTdyn)%cDecision)//"]"; return
- end select
-
- ! identify the lower boundary conditions for thermodynamics
- select case(trim(model_decisions(iLookDECISIONS%bcLowrTdyn)%cDecision))
-  case('presTemp'); model_decisions(iLookDECISIONS%bcLowrTdyn)%iDecision = prescribedTemp      ! prescribed temperature
-  case('zeroFlux'); model_decisions(iLookDECISIONS%bcLowrTdyn)%iDecision = zeroFlux            ! zero flux
-  case default
-   err=10; message=trim(message)//"unknown lower boundary conditions for thermodynamics [option="//trim(model_decisions(iLookDECISIONS%bcLowrTdyn)%cDecision)//"]"; return
- end select
-
- ! identify the upper boundary conditions for soil hydrology
- select case(trim(model_decisions(iLookDECISIONS%bcUpprSoiH)%cDecision))
-  case('presHead'); model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision = prescribedHead      ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
-  case('liq_flux'); model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision = liquidFlux          ! liquid water flux
-  case default
-   err=10; message=trim(message)//"unknown upper boundary conditions for soil hydrology [option="//trim(model_decisions(iLookDECISIONS%bcUpprSoiH)%cDecision)//"]"; return
- end select
-
- ! identify the lower boundary conditions for soil hydrology
- select case(trim(model_decisions(iLookDECISIONS%bcLowrSoiH)%cDecision))
-  case('presHead'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = prescribedHead      ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
-  case('bottmPsi'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = funcBottomHead      ! function of matric head in the lower-most layer
-  case('drainage'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = freeDrainage        ! free drainage
-  case('zeroFlux'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = zeroFlux            ! zero flux
-  case default
-   err=10; message=trim(message)//"unknown lower boundary conditions for soil hydrology [option="//trim(model_decisions(iLookDECISIONS%bcLowrSoiH)%cDecision)//"]"; return
- end select
-
- ! identify the choice of parameterization for vegetation roughness length and displacement height
- select case(trim(model_decisions(iLookDECISIONS%veg_traits)%cDecision))
-  case('Raupach_BLM1994'); model_decisions(iLookDECISIONS%veg_traits)%iDecision = Raupach_BLM1994  ! Raupach (BLM 1994) "Simplified expressions..."
-  case('CM_QJRMS1988'   ); model_decisions(iLookDECISIONS%veg_traits)%iDecision = CM_QJRMS1988     ! Choudhury and Monteith (QJRMS 1998) "A four layer model for the heat budget..."
-  case('vegTypeTable'   ); model_decisions(iLookDECISIONS%veg_traits)%iDecision = vegTypeTable     ! constant parameters dependent on the vegetation type
-  case default
-   err=10; message=trim(message)//"unknown parameterization for vegetation roughness length and displacement height [option="//trim(model_decisions(iLookDECISIONS%veg_traits)%cDecision)//"]"; return
- end select
-
- ! identify the choice of parameterization for the rooting profile
- ! NOTE: for backwards compatibility select powerLaw if rooting profile is undefined
- select case(trim(model_decisions(iLookDECISIONS%rootProfil)%cDecision))
-  case('powerLaw','notPopulatedYet');  model_decisions(iLookDECISIONS%rootProfil)%iDecision = powerLaw      ! simple power-law rooting profile
-  case('doubleExp');                   model_decisions(iLookDECISIONS%rootProfil)%iDecision = doubleExp     ! the double exponential function of Xeng et al. (JHM 2001)
-  case default
-   err=10; message=trim(message)//"unknown parameterization for rooting profile [option="//trim(model_decisions(iLookDECISIONS%rootProfil)%cDecision)//"]"; return
- end select
-
- ! identify the choice of parameterization for canopy emissivity
- select case(trim(model_decisions(iLookDECISIONS%canopyEmis)%cDecision))
-  case('simplExp'); model_decisions(iLookDECISIONS%canopyEmis)%iDecision = simplExp            ! simple exponential function
-  case('difTrans'); model_decisions(iLookDECISIONS%canopyEmis)%iDecision = difTrans            ! parameterized as a function of diffuse transmissivity
-  case default
-   err=10; message=trim(message)//"unknown parameterization for canopy emissivity [option="//trim(model_decisions(iLookDECISIONS%canopyEmis)%cDecision)//"]"; return
- end select
-
- ! choice of parameterization for snow interception
- select case(trim(model_decisions(iLookDECISIONS%snowIncept)%cDecision))
-  case('stickySnow'); model_decisions(iLookDECISIONS%snowIncept)%iDecision = stickySnow        ! maximum interception capacity an increasing function of temerature
-  case('lightSnow' ); model_decisions(iLookDECISIONS%snowIncept)%iDecision = lightSnow         ! maximum interception capacity an inverse function of new snow density
-  case default
-  err=10; message=trim(message)//"unknown option for snow interception capacity[option="//trim(model_decisions(iLookDECISIONS%snowIncept)%cDecision)//"]"; return
- end select
-
- ! identify the choice of wind profile
- select case(trim(model_decisions(iLookDECISIONS%windPrfile)%cDecision))
-  case('exponential'   ); model_decisions(iLookDECISIONS%windPrfile)%iDecision = exponential      ! exponential wind profile extends to the surface
-  case('logBelowCanopy'); model_decisions(iLookDECISIONS%windPrfile)%iDecision = logBelowCanopy   ! logarithmic profile below the vegetation canopy
-  case default
-   err=10; message=trim(message)//"unknown option for choice of wind profile[option="//trim(model_decisions(iLookDECISIONS%windPrfile)%cDecision)//"]"; return
- end select
-
- ! identify the choice of atmospheric stability function
- select case(trim(model_decisions(iLookDECISIONS%astability)%cDecision))
-  case('standard'); model_decisions(iLookDECISIONS%astability)%iDecision = standard            ! standard MO similarity, a la Anderson (1976)
-  case('louisinv'); model_decisions(iLookDECISIONS%astability)%iDecision = louisInversePower   ! Louis (1979) inverse power function
-  case('mahrtexp'); model_decisions(iLookDECISIONS%astability)%iDecision = mahrtExponential    ! Mahrt (1987) exponential
-  case default
-   err=10; message=trim(message)//"unknown stability function [option="//trim(model_decisions(iLookDECISIONS%astability)%cDecision)//"]"; return
- end select
-
- ! choice of canopy shortwave radiation method
- select case(trim(model_decisions(iLookDECISIONS%canopySrad)%cDecision))
-  case('noah_mp'    ); model_decisions(iLookDECISIONS%canopySrad)%iDecision = noah_mp          ! full Noah-MP implementation (including albedo)
-  case('CLM_2stream'); model_decisions(iLookDECISIONS%canopySrad)%iDecision = CLM_2stream      ! CLM 2-stream model (see CLM documentation)
-  case('UEB_2stream'); model_decisions(iLookDECISIONS%canopySrad)%iDecision = UEB_2stream      ! UEB 2-stream model (Mahat and Tarboton, WRR 2011)
-  case('NL_scatter' ); model_decisions(iLookDECISIONS%canopySrad)%iDecision = NL_scatter       ! Simplified method Nijssen and Lettenmaier (JGR 1999)
-  case('BeersLaw'   ); model_decisions(iLookDECISIONS%canopySrad)%iDecision = BeersLaw         ! Beer's Law (as implemented in VIC)
-  case default
-   err=10; message=trim(message)//"unknown canopy radiation method [option="//trim(model_decisions(iLookDECISIONS%canopySrad)%cDecision)//"]"; return
- end select
-
- ! choice of albedo representation
- select case(trim(model_decisions(iLookDECISIONS%alb_method)%cDecision))
-  case('conDecay'); model_decisions(iLookDECISIONS%alb_method)%iDecision = constantDecay       ! constant decay (e.g., VIC, CLASS)
-  case('varDecay'); model_decisions(iLookDECISIONS%alb_method)%iDecision = variableDecay       ! variable decay (e.g., BATS approach, with destructive metamorphism + soot content)
-  case default
-   err=10; message=trim(message)//"unknown option for snow albedo [option="//trim(model_decisions(iLookDECISIONS%alb_method)%cDecision)//"]"; return
- end select
-
- ! choice of snow compaction routine
- select case(trim(model_decisions(iLookDECISIONS%compaction)%cDecision))
-  case('consettl'); model_decisions(iLookDECISIONS%compaction)%iDecision = constantSettlement  ! constant settlement rate
-  case('anderson'); model_decisions(iLookDECISIONS%compaction)%iDecision = andersonEmpirical   ! semi-empirical method of Anderson (1976)
-  case default
-   err=10; message=trim(message)//"unknown option for snow compaction [option="//trim(model_decisions(iLookDECISIONS%compaction)%cDecision)//"]"; return
- end select
-
- ! choice of method to combine and sub-divide snow layers
- select case(trim(model_decisions(iLookDECISIONS%snowLayers)%cDecision))
-  case('jrdn1991'); model_decisions(iLookDECISIONS%snowLayers)%iDecision = sameRulesAllLayers    ! SNTHERM option: same combination/sub-dividion rules applied to all layers
-  case('CLM_2010'); model_decisions(iLookDECISIONS%snowLayers)%iDecision = rulesDependLayerIndex ! CLM option: combination/sub-dividion rules depend on layer index
-  case default
-   err=10; message=trim(message)//"unknown option for combination/sub-division of snow layers [option="//trim(model_decisions(iLookDECISIONS%snowLayers)%cDecision)//"]"; return
- end select
-
- ! choice of thermal conductivity representation for snow
- select case(trim(model_decisions(iLookDECISIONS%thCondSnow)%cDecision))
-  case('tyen1965'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Yen1965             ! Yen (1965)
-  case('melr1977'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Mellor1977          ! Mellor (1977)
-  case('jrdn1991'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Jordan1991          ! Jordan (1991)
-  case('smnv2000'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Smirnova2000        ! Smirnova et al. (2000)
-  case default
-   err=10; message=trim(message)//"unknown option for thermal conductivity of snow [option="//trim(model_decisions(iLookDECISIONS%thCondSnow)%cDecision)//"]"; return
- end select
-
- ! choice of thermal conductivity representation for soil
- select case(trim(model_decisions(iLookDECISIONS%thCondSoil)%cDecision))
-  case('funcSoilWet'); model_decisions(iLookDECISIONS%thCondSoil)%iDecision = funcSoilWet      ! function of soil wetness
-  case('mixConstit' ); model_decisions(iLookDECISIONS%thCondSoil)%iDecision = mixConstit       ! mixture of constituents
-  case('hanssonVZJ' ); model_decisions(iLookDECISIONS%thCondSoil)%iDecision = hanssonVZJ       ! test case for the mizoguchi lab experiment, Hansson et al. VZJ 2004
-  case default
-   err=10; message=trim(message)//"unknown option for thermal conductivity of soil [option="//trim(model_decisions(iLookDECISIONS%thCondSoil)%cDecision)//"]"; return
- end select
-
- ! choice of method for the spatial representation of groundwater
- select case(trim(model_decisions(iLookDECISIONS%spatial_gw)%cDecision))
-  case('localColumn'); model_decisions(iLookDECISIONS%spatial_gw)%iDecision = localColumn       ! separate groundwater in each local soil column
-  case('singleBasin'); model_decisions(iLookDECISIONS%spatial_gw)%iDecision = singleBasin       ! single groundwater store over the entire basin
-  case default
-   err=10; message=trim(message)//"unknown option for spatial representation of groundwater [option="//trim(model_decisions(iLookDECISIONS%spatial_gw)%cDecision)//"]"; return
- end select
-
- ! choice of routing method
- select case(trim(model_decisions(iLookDECISIONS%subRouting)%cDecision))
-  case('timeDlay'); model_decisions(iLookDECISIONS%subRouting)%iDecision = timeDelay           ! time-delay histogram
-  case('qInstant'); model_decisions(iLookDECISIONS%subRouting)%iDecision = qInstant            ! instantaneous routing
-  case default
-   err=10; message=trim(message)//"unknown option for sub-grid routing [option="//trim(model_decisions(iLookDECISIONS%subRouting)%cDecision)//"]"; return
- end select
-
- ! choice of new snow density
- ! NOTE: use hedAndPom as the default, where density method is undefined (not populated yet)
- select case(trim(model_decisions(iLookDECISIONS%snowDenNew)%cDecision))
-  case('hedAndPom','notPopulatedYet'); model_decisions(iLookDECISIONS%snowDenNew)%iDecision = hedAndPom           ! Hedstrom and Pomeroy (1998), expoential increase
-  case('anderson');                    model_decisions(iLookDECISIONS%snowDenNew)%iDecision = anderson            ! Anderson 1976
-  case('pahaut_76');                   model_decisions(iLookDECISIONS%snowDenNew)%iDecision = pahaut_76           ! Pahaut 1976, wind speed dependent (derived from Col de Porte, French Alps)
-  case('constDens');                   model_decisions(iLookDECISIONS%snowDenNew)%iDecision = constDens           ! Constant new snow density
-  case default
-   err=10; message=trim(message)//"unknown option for new snow density [option="//trim(model_decisions(iLookDECISIONS%snowDenNew)%cDecision)//"]"; return
- end select
-
- ! choice of snow unloading from canopy
- select case(trim(model_decisions(iLookDECISIONS%snowUnload)%cDecision))
-  case('meltDripUnload','notPopulatedYet'); model_decisions(iLookDECISIONS%snowUnload)%iDecision = meltDripUnload  ! Hedstrom and Pomeroy (1998), Storck et al 2002 (snowUnloadingCoeff & ratioDrip2Unloading)
-  case('windUnload');                       model_decisions(iLookDECISIONS%snowUnload)%iDecision = windUnload          ! Roesch et al 2001, formulate unloading based on wind and temperature
-  case default
-   err=10; message=trim(message)//"unknown option for snow unloading [option="//trim(model_decisions(iLookDECISIONS%snowUnload)%cDecision)//"]"; return
- end select
-
-
- ! -----------------------------------------------------------------------------------------------------------------------------------------------
- ! check for consistency among options
- ! -----------------------------------------------------------------------------------------------------------------------------------------------
-
- ! check there is prescribedHead for soil hydrology when zeroFlux or prescribedTemp for thermodynamics
- !select case(model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision)
- ! case(prescribedTemp,zeroFlux)
- !  if(model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision /= prescribedHead)then
- !   message=trim(message)//'upper boundary condition for soil hydology must be presHead with presTemp and zeroFlux options for thermodynamics'
- !   err=20; return
- !  end if
- !end select
-
- ! check there is prescribedTemp or zeroFlux for thermodynamics when using prescribedHead for soil hydrology
- !select case(model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision)
- ! case(prescribedHead)
- !  ! check that upper boundary condition for thermodynamics is presTemp or zeroFlux
- !  select case(model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision)
- !   case(prescribedTemp,zeroFlux) ! do nothing: this is OK
- !   case default
- !    message=trim(message)//'upper boundary condition for thermodynamics must be presTemp or zeroFlux with presHead option for soil hydology'
- !    err=20; return
- !  end select
- !end select
-
- ! check zero flux lower boundary for topmodel baseflow option
- select case(model_decisions(iLookDECISIONS%groundwatr)%iDecision)
-  case(qbaseTopmodel)
-   if(model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision /= zeroFlux)then
-    message=trim(message)//'lower boundary condition for soil hydology must be zeroFlux with qbaseTopmodel option for groundwater'
-    err=20; return
-   end if
- end select
-
- ! check power-law profile is selected when using topmodel baseflow option
- select case(model_decisions(iLookDECISIONS%groundwatr)%iDecision)
-  case(qbaseTopmodel)
-   if(model_decisions(iLookDECISIONS%hc_profile)%iDecision /= powerLaw_profile)then
-    message=trim(message)//'power-law transmissivity profile must be selected when using topmodel baseflow option'
-    err=20; return
-   end if
- end select
-
- ! check bigBucket groundwater option is used when for spatial groundwater is singleBasin
- if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == singleBasin)then
-  if(model_decisions(iLookDECISIONS%groundwatr)%iDecision /= bigBucket)then
-   message=trim(message)//'groundwater parameterization must be bigBucket when using singleBasin for spatial_gw'
-   err=20; return
-  end if
- end if
-
- ! ensure that the LAI seaonality option is switched off (this was a silly idea, in retrospect)
- !if(model_decisions(iLookDECISIONS%LAI_method)%iDecision == specified)then
- ! message=trim(message)//'parameterization of LAI in terms of seasonal cycle of green veg fraction was a silly idea '&
- !                      //' -- the LAI_method option ["specified"] is no longer supported'
- ! err=20; return
- !end if
-
- end subroutine mDecisions
-
-
- ! ************************************************************************************************
- ! private subroutine readoption: read information from model decisions file
- ! ************************************************************************************************
- subroutine readoption(err,message)
- ! used to read information from model decisions file
- USE ascii_util_module,only:file_open       ! open file
- USE ascii_util_module,only:linewidth       ! max character number for one line
- USE ascii_util_module,only:get_vlines      ! get a vector of non-comment lines
- USE summaFileManager,only:SETTINGS_PATH    ! path for metadata files
- USE summaFileManager,only:M_DECISIONS      ! definition of modeling options
- USE get_ixname_module,only:get_ixdecisions ! identify index of named variable
- USE globalData,only:model_decisions        ! model decision structure
- implicit none
- ! define output
- integer(i4b),intent(out)             :: err            ! error code
- character(*),intent(out)             :: message        ! error message
- ! define local variables
- character(len=256)                   :: cmessage       ! error message for downwind routine
- character(LEN=256)                   :: infile         ! input filename
- integer(i4b)                         :: unt            ! file unit (free unit output from file_open)
- character(LEN=linewidth),allocatable :: charline(:)    ! vector of character strings
- integer(i4b)                         :: nDecisions     ! number of model decisions
- integer(i4b)                         :: iDecision      ! index of model decisions
- character(len=32)                    :: decision       ! name of model decision
- character(len=32)                    :: option         ! option for model decision
- integer(i4b)                         :: iVar           ! index of the decision in the data structure
- ! Start procedure here
- err=0; message='readoption/'
- ! build filename
- infile = trim(SETTINGS_PATH)//trim(M_DECISIONS)
- write(*,'(2(a,1x))') 'decisions file = ', trim(infile)
- ! open file
- call file_open(trim(infile),unt,err,cmessage)
- if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
- ! get a list of character strings from non-comment lines
- call get_vlines(unt,charline,err,cmessage)
- if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
- ! close the file unit
- close(unt)
- ! get the number of model decisions
- nDecisions = size(charline)
- ! populate the model decisions structure
- do iDecision=1,nDecisions
-  ! extract name of decision and the decision selected
-  read(charline(iDecision),*,iostat=err) option, decision
-  if (err/=0) then; err=30; message=trim(message)//"errorReadLine"; return; end if
-  ! get the index of the decision in the data structure
-  iVar = get_ixdecisions(trim(option))
-  write(*,'(i4,1x,a)') iDecision, trim(option)//': '//trim(decision)
-  if(iVar<=0)then; err=40; message=trim(message)//"cannotFindDecisionIndex[name='"//trim(option)//"']"; return; end if
-  ! populate the model decisions structure
-  model_decisions(iVar)%cOption   = trim(option)
-  model_decisions(iVar)%cDecision = trim(decision)
- end do
- end subroutine readoption
-
-
-end module mDecisions_module
diff --git a/build/source/engine/read_dimension.f90 b/build/source/engine/read_dimension.f90
deleted file mode 100644
index 404c1b1491db36d5db03141ea3e0a07e09a2d651..0000000000000000000000000000000000000000
--- a/build/source/engine/read_dimension.f90
+++ /dev/null
@@ -1,227 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module read_dimension_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-implicit none
-private
-public::read_dimension
-! public::read_attribute
-contains
-
-! ************************************************************************************************
-! public subroutine read_dimension: read HRU and GRU dimension information on local attributes
-! ************************************************************************************************
-subroutine read_dimension(numGRUs,numHRUs,startGRU,err) bind(C, name="readDimension")
-
-  USE netcdf
-  USE netcdf_util_module,only:nc_file_open                   ! open netcdf file
-  USE netcdf_util_module,only:nc_file_close                  ! close netcdf file
-  USE nr_utility_module ,only:arth
-  ! provide access to global data
-  USE globalData,only:gru_struc                              ! gru->hru mapping structure
-  USE globalData,only:index_map                              ! hru->gru mapping structure
-  ! file paths for attribute file
-  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
-  USE summaFileManager,only:LOCAL_ATTRIBUTES                  ! name of model initial attributes file
-
-
-  implicit none
-
-  ! Dummy Variables
-  
-  integer(c_int),intent(in)              :: numGRUs            ! number of GRUs for the run domain
-  integer(c_int),intent(out)             :: numHRUs            ! number of HRUs for the run domain (value filled in this subroutine)
-  integer(c_int),intent(in)              :: startGRU           ! Index of the starting GRU
-  integer(c_int),intent(out)             :: err                ! error code
-  
-  ! Local Variables
-  character(len=256)                     :: attrFile           ! name of attributed file
-  integer(i4b)                           :: fileGRU            ! number of GRUs in the input file
-  integer(i4b)                           :: fileHRU            ! number of HRUs in the input file
-  integer(i4b)                           :: iHRU               ! HRU couinting index
-  integer(i4b)                           :: iGRU               ! GRU loop index
-  integer(8),allocatable                 :: gru_id(:),hru_id(:)! read gru/hru IDs in from attributes file
-  integer(8),allocatable                 :: hru2gru_id(:)      ! read hru->gru mapping in from attributes file
-  integer(i4b),allocatable               :: hru_ix(:)          ! hru index for search
-  character(len=256)                     :: message            ! error message
-
-
-  ! define variables for NetCDF file operation
-  integer(i4b)                           :: ncID               ! NetCDF file ID
-  integer(i4b)                           :: varID              ! NetCDF variable ID
-  integer(i4b)                           :: gruDimId           ! variable id of GRU dimension from netcdf file
-  integer(i4b)                           :: hruDimId           ! variable id of HRU dimension from netcdf file
-  character(len=256)                     :: cmessage           ! error message for downwind routine
-
-  err=0; message="read_dimension/"
-  attrFile = trim(SETTINGS_PATH)//trim(LOCAL_ATTRIBUTES)
-
-  ! open nc file
-  call nc_file_open(trim(attrFile),nf90_noWrite,ncID,err,cmessage)
-  if(err/=0)then
-    message=trim(message)//trim(cmessage) 
-    print*, message
-    print*, attrFile
-    return
-  end if
-  
-  ! *********************************************************************************************
-  ! read and set GRU dimensions
-  ! **********************************************************************************************
-  ! get gru dimension of whole file
-  err = nf90_inq_dimid(ncID,"gru",gruDimId)
-  if(err/=nf90_noerr)then
-    message=trim(message)//'problem finding gru dimension/'//trim(nf90_strerror(err))
-    print*, message
-    return
-  end if
-
-  err = nf90_inquire_dimension(ncID, gruDimId, len = fileGRU)
-  if(err/=nf90_noerr)then; 
-    message=trim(message)//'problem reading gru dimension/'//trim(nf90_strerror(err))
-    print*, message
-    return
-  end if
-
-  ! get hru dimension of whole file
-  err = nf90_inq_dimid(ncID,"hru",hruDimId)
-  if(err/=nf90_noerr)then
-    message=trim(message)//'problem finding hru dimension/'//trim(nf90_strerror(err))
-    print*, message
-    return
-  end if
-
-  err = nf90_inquire_dimension(ncID, hruDimId, len = fileHRU)
-  if(err/=nf90_noerr)then
-    message=trim(message)//'problem reading hru dimension/'//trim(nf90_strerror(err))
-    print*, message
-    return
-  end if
-
-  ! check dimensions
-  if(numGRUs > fileGRU .or. numGRUs < 1) then; 
-    err=20
-    message=trim(message)//"numGRUs is out of range"
-    print*, message
-    return
-  end if
-
-  ! *********************************************************************************************
-  ! read mapping vectors and populate mapping structures
-  ! **********************************************************************************************
-  ! allocate space for GRU indices and HRU indices
-  allocate(gru_id(fileGRU))
-  allocate(hru_ix(fileHRU),hru_id(fileHRU),hru2gru_id(fileHRU))
-
-  ! read gru_id from netcdf file
-  err = nf90_inq_varid(ncID,"gruId",varID)
-  if (err/=0) then
-    message=trim(message)//'problem finding gruId'
-    print*, message
-    return
-  end if
-
-  err = nf90_get_var(ncID,varID,gru_id)
-  if (err/=0) then
-    message=trim(message)//'problem reading gruId'
-    print*, message
-    return
-  end if
-
-  ! read hru_id from netcdf file
-  err = nf90_inq_varid(ncID,"hruId",varID)
-  if (err/=0) then
-    message=trim(message)//'problem finding hruId'
-    print*, message
-    return
-  end if
-
-  err = nf90_get_var(ncID,varID,hru_id)
-  if (err/=0) then
-    message=trim(message)//'problem reading hruId'
-    print*, message
-    return
-  end if
-
-  ! read hru2gru_id from netcdf file
-  err = nf90_inq_varid(ncID,"hru2gruId",varID)
-  if (err/=0) then
-    message=trim(message)//'problem finding hru2gruId'
-    print*, message
-    return
-  end if
-
-  err = nf90_get_var(ncID,varID,hru2gru_id)
-  if (err/=0) then
-    message=trim(message)//'problem reading hru2gruId'
-    print*, message
-    return
-  end if
-  
-  ! array from 1 to total # of HRUs in attributes file
-  hru_ix=arth(1,1,fileHRU)
-
-  ! check that the mappings are not alreaday allocated
-  if (allocated(gru_struc)) then
-    deallocate(gru_struc)
-  endif
-
-  if (allocated(index_map)) then
-    deallocate(index_map)
-  endif
-
-  ! allocate first level of gru to hru mapping
-  allocate(gru_struc(numGRUs))
-
-  ! allocate space for the run
-  iHRU = 1
-  do iGRU = 1,numGRUs
-    if (count(hru2gru_Id == gru_id(iGRU+startGRU-1)) < 1) then; err=20; message=trim(message)//'problem finding HRUs belonging to GRU'; return; end if
-    gru_struc(iGRU)%hruCount          = count(hru2gru_Id == gru_id(iGRU+startGRU-1))                 ! number of HRUs in each GRU
-    gru_struc(iGRU)%gru_id            = gru_id(iGRU+startGRU-1)                                  ! set gru id
-    gru_struc(iGRU)%gru_nc            = iGRU+startGRU-1                                          ! set gru index in the netcdf file
-
-    allocate(gru_struc(iGRU)%hruInfo(gru_struc(iGRU)%hruCount))                                  ! allocate second level of gru to hru map
-    gru_struc(iGRU)%hruInfo(:)%hru_nc = pack(hru_ix,hru2gru_id == gru_struc(iGRU)%gru_id)        ! set hru id in attributes netcdf file
-    gru_struc(iGRU)%hruInfo(:)%hru_ix = arth(iHRU,1,gru_struc(iGRU)%hruCount)                    ! set index of hru in run domain
-    gru_struc(iGRU)%hruInfo(:)%hru_id = hru_id(gru_struc(iGRU)%hruInfo(:)%hru_nc)                ! set id of hru
-    iHRU = iHRU + gru_struc(iGRU)%hruCount
-  end do ! iGRU = 1,nGRU
-
-  ! set hru to gru mapping
-  numHRUs = sum(gru_struc%hruCount)   ! Total number of HRUs
-  allocate(index_map(numHRUs))        ! allocate first level of hru to gru mapping
-
-  do iGRU = 1, numGRUs
-    index_map(gru_struc(iGRU)%hruInfo(:)%hru_ix)%gru_ix   = iGRU                                 ! index of gru in run domain to which the hru belongs
-    index_map(gru_struc(iGRU)%hruInfo(:)%hru_ix)%localHRU_ix = hru_ix(1:gru_struc(iGRU)%hruCount)! index of hru within the gru
-  end do ! iGRU =1, numGRUs
-
-
-  deallocate(gru_id, hru_ix, hru_id, hru2gru_id)
-  ! close netcdf file
-  call nc_file_close(ncID,err,cmessage)
-  if (err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-end subroutine read_dimension
-
-end module read_dimension_module
diff --git a/build/source/engine/read_pinit.f90 b/build/source/engine/read_pinit.f90
deleted file mode 100755
index 2a0b350b171f0fe9816333a47f8b896447de5078..0000000000000000000000000000000000000000
--- a/build/source/engine/read_pinit.f90
+++ /dev/null
@@ -1,156 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module read_pinit_module
-USE nrtype
-! check for when model decisions are undefined
-USE mDecisions_module,only: unDefined
-USE globalData,only:model_decisions
-USE globalData,only:realMissing
-USE var_lookup,only:iLookDECISIONS,iLookPARAM
-implicit none
-private
-public::read_pinit
-contains
-
-
- ! ************************************************************************************************
- ! public subroutine read_pinit: read default model parameter values and constraints
- ! ************************************************************************************************
- subroutine read_pinit(filenm,isLocal,mpar_meta,parFallback,err,message)
- ! used to read metadata on the forcing data file
- USE summaFileManager,only:SETTINGS_PATH   ! path for input parameter and other configuration files
- USE ascii_util_module,only:file_open      ! open ascii file
- USE ascii_util_module,only:split_line     ! extract the list of variable names from the character string
- USE data_types,only:var_info              ! data type for metadata
- USE data_types,only:par_info              ! data type for parameter constraints
- USE get_ixname_module,only:get_ixParam    ! identify index of named variable for local column model parameters
- USE get_ixname_module,only:get_ixBpar     ! identify index of named variable for basin-average model parameters
- implicit none
- ! define input
- character(*),intent(in)                :: filenm         ! name of file containing default values and constraints of model parameters
- logical(lgt),intent(in)                :: isLocal        ! .true. if the file describes local column parameters
- type(var_info),intent(in)              :: mpar_meta(:)   ! metadata for model parameters
- ! define output
- type(par_info),intent(out)             :: parFallback(:) ! default values and constraints of model parameters
- integer(i4b),intent(out)               :: err            ! error code
- character(*),intent(out)               :: message        ! error message
- ! define general variables
- logical(lgt),parameter                 :: backwardsCompatible=.false. ! .true. if skip check that all parameters are populated
- character(len=256)                     :: cmessage       ! error message for downwind routine
- character(LEN=256)                     :: infile         ! input filename
- integer(i4b)                           :: unt            ! file unit (free unit output from file_open)
- integer(i4b)                           :: iline          ! loop through lines in the file
- integer(i4b),parameter                 :: maxLines=1000  ! maximum lines in the file
- character(LEN=256)                     :: temp           ! single line of information
- ! define local variables for the default model parameters
- integer(i4b)                           :: iend           ! check for the end of the file
- character(LEN=256)                     :: ffmt           ! file format
- character(LEN=32)                      :: varname        ! name of variable
- type(par_info)                         :: parTemp        ! temporary parameter structure
- character(LEN=2)                       :: dLim           ! column delimiter
- integer(i4b)                           :: ivar           ! index of model variable
- ! Start procedure here
- err=0; message="read_pinit/"
- ! **********************************************************************************************
- ! (1) open files, etc.
- ! **********************************************************************************************
- ! build filename and update error message
- infile = trim(SETTINGS_PATH)//trim(filenm)
- message=trim(message)//'file='//trim(infile)//' - '
- ! open file
- call file_open(trim(infile),unt,err,cmessage)
- if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-
- ! **********************************************************************************************
- ! (2) read default model parameter values and constraints
- ! **********************************************************************************************
- ! fill parameter vector with missing data
- parFallback(:)%default_val = realMissing
- parFallback(:)%lower_limit = realMissing
- parFallback(:)%upper_limit = realMissing
- ! ---------------------------------------------------------------------------------------------
- ! read format code
- ! ---------------------------------------------------------------------------------------------
- do iline=1,maxLines
-  ! (read through comment lines)
-  read(unt,'(a)',iostat=iend) temp  ! read a line of data
-  if(iend/=0)then; err=20; message=trim(message)//'got to end of file before found the format code'; return; end if
-  if (temp(1:1)=='!')cycle
-  ! (read in format string -- assume that the first non-comment line is the format code)
-  read(temp,*)ffmt  ! read in format string
-  exit
-  if(iLine==maxLines)then; err=20; message=trim(message)//'problem finding format code -- no non-comment line after start of parameter definitions'; return; end if
- end do ! looping through lines
- ! ---------------------------------------------------------------------------------------------
- ! read in default values of model parameters, and parameter constraints
- ! ---------------------------------------------------------------------------------------------
- do iline=1,maxLines
-  ! (read through comment lines)
-  read(unt,'(a)',iostat=iend) temp  ! read a line of data
-  if(iend/=0)exit !end of file
-  if (temp(1:1)=='!')cycle
-  ! (save data into a temporary variables)
-  read(temp,trim(ffmt),iostat=err) varname, dLim, parTemp%default_val, dLim, parTemp%lower_limit, dLim, parTemp%upper_limit
-  if (err/=0) then; err=30; message=trim(message)//"errorReadLine"; return; end if
-  ! (identify the index of the variable in the data structure)
-  if(isLocal)then
-   ivar = get_ixParam(trim(varname))
-  else
-   ivar = get_ixBpar(trim(varname))
-  end if
-  ! (check that we have successfully found the parameter)
-  if(ivar>0)then
-   if(ivar>size(parFallback))then
-    err=35; message=trim(message)//"indexOutOfRange[var="//trim(varname)//"]"; return
-   end if
-   ! (put data in the structure)
-   parFallback(ivar)=parTemp
-   !write(*,'(a,1x,i4,1x,a30,1x,f20.10,1x)') 'ivar, trim(varname), parFallback(ivar)%default_val = ', &
-   !                                          ivar, trim(varname), parFallback(ivar)%default_val
-  else
-   err=40; message=trim(message)//"variable in parameter file not present in data structure [var="//trim(varname)//"]"; return
-  end if
- end do  ! (looping through lines in the file)
- ! check we have populated all variables
- ! NOTE: ultimately need a need a parameter dictionary to ensure that the parameters used are populated
- if(.not.backwardsCompatible)then  ! if we add new variables in future versions of the code, then some may be missing in the input file
-  if(any(parFallback(:)%default_val < 0.99_dp*realMissing))then
-   do ivar=1,size(parFallback)
-    if(parFallback(ivar)%default_val < 0.99_dp*realMissing)then
-     err=40; message=trim(message)//"variableNonexistent[var="//trim(mpar_meta(ivar)%varname)//"]"; return
-    end if
-   end do
-  end if
- ! populate parameters that were not included in the original control files
- else ! (need backwards compatibility)
-  if(isLocal)then
-   if(model_decisions(iLookDECISIONS%cIntercept)%iDecision == unDefined)then
-    parFallback(iLookPARAM%canopyWettingFactor)%default_val = 1._dp             ! maximum wetted fraction of the canopy (-)
-    parFallback(iLookPARAM%canopyWettingExp)%default_val    = 0.666666667_dp    ! exponent in canopy wetting function (-)
-   end if
-  end if
- end if
- ! close file unit
- close(unt)
- end subroutine read_pinit
-
-
-end module read_pinit_module
diff --git a/build/source/engine/sundials/coupled_em.f90 b/build/source/engine/sundials/coupled_em.f90
deleted file mode 100755
index 2aa5fda2618a2dcfebe05988392d4bdf33a35e78..0000000000000000000000000000000000000000
--- a/build/source/engine/sundials/coupled_em.f90
+++ /dev/null
@@ -1,1388 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module coupled_em_module
-
-! numerical recipes data types
-USE nrtype
-
-! physical constants
-USE multiconst,only:&
-                    Tfreeze,      & ! temperature at freezing              (K)
-                    LH_fus,       & ! latent heat of fusion                (J kg-1)
-                    LH_sub,       & ! latent heat of sublimation           (J kg-1)
-                    iden_ice,     & ! intrinsic density of ice             (kg m-3)
-                    iden_water      ! intrinsic density of liquid water    (kg m-3)
-
-! data types
-USE data_types,only:&
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    zLookup
-
-! named variables for parent structures
-USE var_lookup,only:iLookDECISIONS         ! named variables for elements of the decision structure
-USE var_lookup,only:iLookPROG              ! named variables for structure elements
-USE var_lookup,only:iLookDIAG              ! named variables for structure elements
-USE var_lookup,only:iLookFLUX              ! named variables for structure elements
-USE var_lookup,only:iLookPARAM             ! named variables for structure elements
-USE var_lookup,only:iLookINDEX             ! named variables for structure elements
-USE globalData,only:iname_snow             ! named variables for snow
-USE globalData,only:iname_soil             ! named variables for soil
-
-! named variables for child structures
-USE var_lookup,only:childFLUX_MEAN
-
-! metadata
-USE globalData,only:indx_meta              ! metadata on the model index variables
-USE globalData,only:diag_meta              ! metadata on the model diagnostic variables
-USE globalData,only:prog_meta              ! metadata on the model prognostic variables
-USE globalData,only:averageFlux_meta       ! metadata on the timestep-average model flux structure
-
-! global data
-USE globalData,only:data_step              ! time step of forcing data (s)
-USE globalData,only:model_decisions        ! model decision structure
-USE globalData,only:globalPrintFlag        ! the global print flag
-
-! look-up values for the numerical method
-USE mDecisions_module,only:         &
- bEuler,                            &      ! home-grown backward Euler solution with long time steps
- sundials                                  ! SUNDIALS/IDA solution
-
-! look-up values for the maximum interception capacity
-USE mDecisions_module,only:         &
-                      stickySnow,   &      ! maximum interception capacity an increasing function of temerature
-                      lightSnow            ! maximum interception capacity an inverse function of new snow density
-
-! look-up values for the groundwater parameterization
-USE mDecisions_module,only:         &
-                      qbaseTopmodel,&      ! TOPMODEL-ish baseflow parameterization
-                      bigBucket    ,&      ! a big bucket (lumped aquifer model)
-                      noExplicit           ! no explicit groundwater parameterization
-
-! look-up values for the spatial representation of groundwater
-USE mDecisions_module,only:         &
-                      localColumn  ,&      ! separate groundwater representation in each local soil column
-                      singleBasin          ! single groundwater store over the entire basin
-
-! privacy
-implicit none
-private
-public::coupled_em
-! algorithmic parameters
-real(dp),parameter     :: valueMissing=-9999._dp  ! missing value, used when diagnostic or state variables are undefined
-real(dp),parameter     :: verySmall=1.e-6_dp   ! used as an additive constant to check if substantial difference among real numbers
-real(dp),parameter     :: mpe=1.e-6_dp         ! prevents overflow error if division by zero
-real(dp),parameter     :: dx=1.e-6_dp          ! finite difference increment
-contains
-
-
- ! ************************************************************************************************
- ! public subroutine coupled_em: run the coupled energy-mass model for one timestep
- ! ************************************************************************************************
-subroutine coupled_em(&
-                       ! model control
-                       indxHRU,           & ! intent(in):    hruId
-                       dt_init,           & ! intent(inout): used to initialize the size of the sub-step
-                       dt_init_factor,    & ! Used to adjust the length of the timestep in the event of a failure
-                       computeVegFlux,    & ! intent(inout): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-                       ! data structures (input)
-                       type_data,         & ! intent(in):    local classification of soil veg etc. for each HRU
-                       attr_data,         & ! intent(in):    local attributes for each HRU
-                       forc_data,         & ! intent(in):    model forcing data
-                       mpar_data,         & ! intent(in):    model parameters
-                       bvar_data,         & ! intent(in):    basin-average variables
-                       lookup_data,       & ! intent(in):    lookup tables
-                       ! data structures (input-output)
-                       indx_data,         & ! intent(inout): model indices
-                       prog_data,         & ! intent(inout): prognostic variables for a local HRU
-                       diag_data,         & ! intent(inout): diagnostic variables for a local HRU
-                       flux_data,         & ! intent(inout): model fluxes for a local HRU
-                       fracJulDay,        &
-                       yearLength,        &
-                       ! error control
-                       err,message)         ! intent(out):   error control
-  ! structure allocations
-  USE allocspace_module,only:allocLocal      ! allocate local data structures
-  USE allocspace_module,only:resizeData      ! clone a data structure
-  ! preliminary subroutines
-  USE vegPhenlgy_module,only:vegPhenlgy      ! compute vegetation phenology
-  USE vegNrgFlux_module,only:wettedFrac      ! compute wetted fraction of the canopy (used in sw radiation fluxes)
-  USE snowAlbedo_module,only:snowAlbedo      ! compute snow albedo
-  USE vegSWavRad_module,only:vegSWavRad      ! compute canopy sw radiation fluxes
-  USE canopySnow_module,only:canopySnow      ! compute interception and unloading of snow from the vegetation canopy
-  USE volicePack_module,only:newsnwfall      ! compute change in the top snow layer due to throughfall and unloading
-  USE volicePack_module,only:volicePack      ! merge and sub-divide snow layers, if necessary
-  USE diagn_evar_module,only:diagn_evar      ! compute diagnostic energy variables -- thermal conductivity and heat capacity
-  ! the model solver
-  USE indexState_module,only:indexState      ! define indices for all model state variables and layers
-  USE opSplittin_module,only:opSplittin      ! solve the system of thermodynamic and hydrology equations for a given substep
-  ! additional subroutines
-  USE tempAdjust_module,only:tempAdjust      ! adjust snow temperature associated with new snowfall
-  USE snwDensify_module,only:snwDensify      ! snow densification (compaction and cavitation)
-  USE var_derive_module,only:calcHeight      ! module to calculate height at layer interfaces and layer mid-point
-  USE computSnowDepth_module,only:computSnowDepth
-  ! look-up values for the numerical method
-  implicit none
-  ! model control
-  integer(4),intent(in)                :: indxHRU                ! hruId
-  real(dp),intent(inout)               :: dt_init                ! used to initialize the size of the sub-step
-  integer(i4b),intent(in)              :: dt_init_factor         ! Used to adjust the length of the timestep in the event of a failure
-  logical(lgt),intent(inout)           :: computeVegFlux         ! flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-  ! data structures (input)
-  type(var_i),intent(in)               :: type_data              ! type of vegetation and soil
-  type(var_d),intent(in)               :: attr_data              ! spatial attributes
-  type(var_d),intent(in)               :: forc_data              ! model forcing data
-  type(var_dlength),intent(in)         :: mpar_data              ! model parameters
-  type(var_dlength),intent(in)         :: bvar_data              ! basin-average model variables
-  type(zLookup),intent(in)             :: lookup_data            ! lookup tables
-  ! data structures (input-output)
-  type(var_ilength),intent(inout)      :: indx_data              ! state vector geometry
-  type(var_dlength),intent(inout)      :: prog_data              ! prognostic variables for a local HRU
-  type(var_dlength),intent(inout)      :: diag_data              ! diagnostic variables for a local HRU
-  type(var_dlength),intent(inout)      :: flux_data              ! model fluxes for a local HRU
-  real(dp),intent(inout)               :: fracJulDay
-  integer(i4b),intent(inout)           :: yearLength 
-  ! error control
-  integer(i4b),intent(out)             :: err                    ! error code
-  character(*),intent(out)             :: message                ! error message
-  ! =====================================================================================================================================================
-  ! =====================================================================================================================================================
-  ! local variables
-  character(len=256)                   :: cmessage               ! error message
-  integer(i4b)                         :: nSnow                  ! number of snow layers
-  integer(i4b)                         :: nSoil                  ! number of soil layers
-  integer(i4b)                         :: nLayers                ! total number of layers
-  integer(i4b)                         :: nState                 ! total number of state variables
-  real(dp)                             :: dtSave                 ! length of last input model sub-step (seconds)
-  real(dp)                             :: dt_sub                 ! length of model sub-step (seconds)
-  real(dp)                             :: dt_wght                ! weight applied to model sub-step (dt_sub/data_step)
-  real(dp)                             :: dt_solv                ! seconds in the data step that have been completed
-  real(dp)                             :: dtMultiplier           ! time step multiplier (-) based on what happenned in "opSplittin"
-  real(dp)                             :: minstep,maxstep        ! minimum and maximum time step length (seconds)
-  integer(i4b)                         :: nsub                   ! number of substeps
-  logical(lgt)                         :: computeVegFluxOld      ! flag to indicate if we are computing fluxes over vegetation on the previous sub step
-  logical(lgt)                         :: includeAquifer         ! flag to denote that an aquifer is included
-  logical(lgt)                         :: modifiedLayers         ! flag to denote that snow layers were modified
-  logical(lgt)                         :: modifiedVegState       ! flag to denote that vegetation states were modified
-  type(var_dlength)                    :: flux_mean              ! timestep-average model fluxes for a local HRU
-  integer(i4b)                         :: nLayersRoots           ! number of soil layers that contain roots
-  real(dp)                             :: exposedVAI             ! exposed vegetation area index
-  real(dp)                             :: dCanopyWetFraction_dWat ! derivative in wetted fraction w.r.t. canopy total water (kg-1 m2)
-  real(dp)                             :: dCanopyWetFraction_dT   ! derivative in wetted fraction w.r.t. canopy temperature (K-1)
-  real(dp),parameter                   :: varNotUsed1=-9999._dp  ! variables used to calculate derivatives (not needed here)
-  real(dp),parameter                   :: varNotUsed2=-9999._dp  ! variables used to calculate derivatives (not needed here)
-  integer(i4b)                         :: iSnow                  ! index of snow layers
-  integer(i4b)                         :: iLayer                 ! index of model layers
-  real(dp)                             :: massLiquid             ! mass liquid water (kg m-2)
-  real(dp)                             :: superflousSub          ! superflous sublimation (kg m-2 s-1)
-  real(dp)                             :: superflousNrg          ! superflous energy that cannot be used for sublimation (W m-2 [J m-2 s-1])
-  integer(i4b)                         :: ixSolution             ! solution method used by opSplitting
-  logical(lgt)                         :: firstSubStep           ! flag to denote if the first time step
-  logical(lgt)                         :: stepFailure            ! flag to denote the need to reduce length of the coupled step and try again
-  logical(lgt)                         :: tooMuchMelt            ! flag to denote that there was too much melt in a given time step
-  logical(lgt)                         :: doLayerMerge           ! flag to denote the need to merge snow layers
-  logical(lgt)                         :: pauseFlag              ! flag to pause execution
-  logical(lgt),parameter               :: backwardsCompatibility=.true.  ! flag to denote a desire to ensure backwards compatibility with previous branches.
-  logical(lgt)                         :: checkMassBalance       ! flag to check the mass balance
-  type(var_ilength)                    :: indx_temp              ! temporary model index variables
-  type(var_dlength)                    :: prog_temp              ! temporary model prognostic variables
-  type(var_dlength)                    :: diag_temp              ! temporary model diagnostic variables
-  ! check SWE
-  real(dp)                             :: oldSWE                 ! SWE at the start of the substep
-  real(dp)                             :: newSWE                 ! SWE at the end of the substep
-  real(dp)                             :: delSWE                 ! change in SWE over the subtep
-  real(dp)                             :: effRainfall            ! effective rainfall (kg m-2 s-1)
-  real(dp)                             :: effSnowfall            ! effective snowfall (kg m-2 s-1)
-  real(dp)                             :: sfcMeltPond            ! surface melt pond (kg m-2)
-  real(dp)                             :: massBalance            ! mass balance error (kg m-2)
-  ! balance checks
-  integer(i4b)                         :: iVar                   ! loop through model variables
-  real(dp)                             :: totalSoilCompress      ! total soil compression (kg m-2)
-  real(dp)                             :: scalarCanopyWatBalError ! water balance error for the vegetation canopy (kg m-2)
-  real(dp)                             :: scalarSoilWatBalError  ! water balance error (kg m-2)
-  real(dp)                             :: scalarInitCanopyLiq    ! initial liquid water on the vegetation canopy (kg m-2)
-  real(dp)                             :: scalarInitCanopyIce    ! initial ice          on the vegetation canopy (kg m-2)
-  real(dp)                             :: balanceCanopyWater0    ! total water stored in the vegetation canopy at the start of the step (kg m-2)
-  real(dp)                             :: balanceCanopyWater1    ! total water stored in the vegetation canopy at the end of the step (kg m-2)
-  real(dp)                             :: balanceSoilWater0      ! total soil storage at the start of the step (kg m-2)
-  real(dp)                             :: balanceSoilWater1      ! total soil storage at the end of the step (kg m-2)
-  real(dp)                             :: balanceSoilInflux      ! input to the soil zone
-  real(dp)                             :: balanceSoilBaseflow    ! output from the soil zone
-  real(dp)                             :: balanceSoilDrainage    ! output from the soil zone
-  real(dp)                             :: balanceSoilET          ! output from the soil zone
-  real(dp)                             :: balanceAquifer0        ! total aquifer storage at the start of the step (kg m-2)
-  real(dp)                             :: balanceAquifer1        ! total aquifer storage at the end of the step (kg m-2)
-  ! test balance checks
-  logical(lgt), parameter              :: printBalance=.false.   ! flag to print the balance checks
-  real(dp), allocatable                :: liqSnowInit(:)         ! volumetric liquid water conetnt of snow at the start of the time step
-  real(dp), allocatable                :: liqSoilInit(:)         ! soil moisture at the start of the time step
-  ! sundials addition
-  logical(lgt)                         :: tooMuchSublim          ! flag to denote that there was too much sublimation in a given time step
-
-  
-  ! ----------------------------------------------------------------------------------------------------------------------------------------------
-  ! initialize error control
-  err=0; message="coupled_em/"
-
-  ! check that the decision is supported
-  if(model_decisions(iLookDECISIONS%groundwatr)%iDecision==bigBucket .and. &
-      model_decisions(iLookDECISIONS%spatial_gw)%iDecision/=localColumn)then
-    message=trim(message)//'expect "spatial_gw" decision to equal localColumn when "groundwatr" decision is bigBucket'
-    err=20; return
-  endif
- 
-  ! check if the aquifer is included
-  includeAquifer = (model_decisions(iLookDECISIONS%groundwatr)%iDecision==bigBucket)
-
-  ! initialize the numerix tracking variables
-  indx_data%var(iLookINDEX%numberFluxCalc       )%dat(1) = 0  ! number of flux calculations                     (-)
-  indx_data%var(iLookINDEX%numberStateSplit     )%dat(1) = 0  ! number of state splitting solutions             (-)
-  indx_data%var(iLookINDEX%numberDomainSplitNrg )%dat(1) = 0  ! number of domain splitting solutions for energy (-)
-  indx_data%var(iLookINDEX%numberDomainSplitMass)%dat(1) = 0  ! number of domain splitting solutions for mass   (-)
-  indx_data%var(iLookINDEX%numberScalarSolutions)%dat(1) = 0  ! number of scalar solutions                      (-)
-
-  ! link canopy depth to the information in the data structure
-  canopy: associate(canopyDepth => diag_data%var(iLookDIAG%scalarCanopyDepth)%dat(1) )  ! intent(out): [dp] canopy depth (m)
-  
-
-  ! start by NOT pausing
-  pauseFlag=.false.
-
-  ! start by assuming that the step is successful
-  stepFailure  = .false.
-  doLayerMerge = .false.
-
-  ! initialize flags to modify the veg layers or modify snow layers
-  modifiedLayers    = .false.    ! flag to denote that snow layers were modified
-  modifiedVegState  = .false.    ! flag to denote that vegetation states were modified
-
-  ! define the first step
-  firstSubStep = .true.
-
-  ! count the number of snow and soil layers
-  ! NOTE: need to re-compute the number of snow and soil layers at the start of each sub-step because the number of layers may change
-  !         (nSnow and nSoil are shared in the data structure)
-  nSnow = count(indx_data%var(iLookINDEX%layerType)%dat==iname_snow)
-  nSoil = count(indx_data%var(iLookINDEX%layerType)%dat==iname_soil)
-
-  ! compute the total number of snow and soil layers
-  nLayers = nSnow + nSoil
-  
-
- ! create temporary data structures for prognostic variables
-  call resizeData(prog_meta(:),prog_data,prog_temp,err=err,message=cmessage)
-    if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! create temporary data structures for diagnostic variables
-  call resizeData(diag_meta(:),diag_data,diag_temp,err=err,message=cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! create temporary data structures for index variables
-  call resizeData(indx_meta(:),indx_data,indx_temp,err=err,message=cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  endif
-
-  ! allocate space for the local fluxes
-  call allocLocal(averageFlux_meta(:)%var_info,flux_mean,nSnow,nSoil,err,cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! initialize compression and surface melt pond
-  sfcMeltPond       = 0._dp  ! change in storage associated with the surface melt pond (kg m-2)
-  totalSoilCompress = 0._dp  ! change in soil storage associated with compression of the matrix (kg m-2)
-
-  ! initialize mean fluxes
-  do iVar=1,size(averageFlux_meta)
-    flux_mean%var(iVar)%dat(:) = 0._dp
-  end do
- 
-
-  ! associate local variables with information in the data structures
-  associate(&
-  ! state variables in the vegetation canopy
-  scalarCanopyLiq      => prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1)                 ,&  ! canopy liquid water (kg m-2)
-  scalarCanopyIce      => prog_data%var(iLookPROG%scalarCanopyIce)%dat(1)                 ,&  ! canopy ice content (kg m-2)
-  ! state variables in the soil domain
-  mLayerDepth          => prog_data%var(iLookPROG%mLayerDepth)%dat(nSnow+1:nLayers)       ,&  ! depth of each soil layer (m)
-  mLayerVolFracIce     => prog_data%var(iLookPROG%mLayerVolFracIce)%dat(nSnow+1:nLayers)  ,&  ! volumetric ice content in each soil layer (-)
-  mLayerVolFracLiq     => prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(nSnow+1:nLayers)  ,&  ! volumetric liquid water content in each soil layer (-)
-  scalarAquiferStorage => prog_data%var(iLookPROG%scalarAquiferStorage)%dat(1)            ,&  ! aquifer storage (m)
-  scalarTotalSoilIce   => diag_data%var(iLookDIAG%scalarTotalSoilIce)%dat(1)              ,&  ! total ice in the soil column (kg m-2)
-  scalarTotalSoilLiq   => diag_data%var(iLookDIAG%scalarTotalSoilLiq)%dat(1)              ,&  ! total liquid water in the soil column (kg m-2)
-  scalarTotalSoilWat   => diag_data%var(iLookDIAG%scalarTotalSoilWat)%dat(1)               &  ! total water in the soil column (kg m-2)
-  ) ! (association of local variables with information in the data structures
-
-  ! save the liquid water and ice on the vegetation canopy
-  scalarInitCanopyLiq = scalarCanopyLiq    ! initial liquid water on the vegetation canopy (kg m-2)
-  scalarInitCanopyIce = scalarCanopyIce    ! initial ice          on the vegetation canopy (kg m-2)
-
-  ! compute total soil moisture and ice at the *START* of the step (kg m-2)
-  scalarTotalSoilLiq = sum(iden_water*mLayerVolFracLiq(1:nSoil)*mLayerDepth(1:nSoil))
-  scalarTotalSoilIce = sum(iden_water*mLayerVolFracIce(1:nSoil)*mLayerDepth(1:nSoil))  ! NOTE: no expansion and hence use iden_water
-
-  ! compute storage of water in the canopy and the soil
-  balanceCanopyWater0 = scalarCanopyLiq + scalarCanopyIce
-  balanceSoilWater0   = scalarTotalSoilLiq + scalarTotalSoilIce
-
-  ! get the total aquifer storage at the start of the time step (kg m-2)
-  balanceAquifer0 = scalarAquiferStorage*iden_water
-
-  ! save liquid water content
-  if(printBalance)then
-    allocate(liqSnowInit(nSnow), liqSoilInit(nSoil), stat=err)
-    if(err/=0)then
-      message=trim(message)//'unable to allocate space for the initial vectors'
-      print*,message
-      err=20; 
-      return
-    endif
-    if(nSnow>0) liqSnowInit = prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)
-    liqSoilInit = mLayerVolFracLiq
-  endif
-
-  ! end association of local variables with information in the data structures
-  end associate
-  
-
-  ! short-cut to the algorithmic control parameters
-  ! NOTE - temporary assignment of minstep to foce something reasonable
-  minstep = 10._dp  ! mpar_data%var(iLookPARAM%minstep)%dat(1)  ! minimum time step (s)
-  maxstep = mpar_data%var(iLookPARAM%maxstep)%dat(1)  ! maximum time step (s)
-  !print*, 'minstep, maxstep = ', minstep, maxstep
-
-  ! compute the number of layers with roots
-  nLayersRoots = count(prog_data%var(iLookPROG%iLayerHeight)%dat(nSnow:nLayers-1) < mpar_data%var(iLookPARAM%rootingDepth)%dat(1)-verySmall)
-  if(nLayersRoots == 0)then
-    message=trim(message)//'no roots within the soil profile'
-    print*, message
-    err=20; return
-  end if
-
-  ! define the foliage nitrogen factor
-  diag_data%var(iLookDIAG%scalarFoliageNitrogenFactor)%dat(1) = 1._dp  ! foliage nitrogen concentration (1.0 = saturated)
-
-  ! save SWE
-  oldSWE = prog_data%var(iLookPROG%scalarSWE)%dat(1)
-  !print*, 'nSnow = ', nSnow
-  !print*, 'oldSWE = ', oldSWE
-
-  ! *** compute phenology...
-  ! ------------------------
-  
-
-  ! compute the temperature of the root zone: used in vegetation phenology
-  diag_data%var(iLookDIAG%scalarRootZoneTemp)%dat(1) = sum(prog_data%var(iLookPROG%mLayerTemp)%dat(nSnow+1:nSnow+nLayersRoots)) / real(nLayersRoots, kind(dp))
-
-  ! remember if we compute the vegetation flux on the previous sub-step
-  computeVegFluxOld = computeVegFlux
-
-  ! compute the exposed LAI and SAI and whether veg is buried by snow
-  call vegPhenlgy(&
-                  ! input/output: data structures
-                  model_decisions,             & ! intent(in):    model decisions
-                  type_data,                   & ! intent(in):    type of vegetation and soil
-                  attr_data,                   & ! intent(in):    spatial attributes
-                  mpar_data,                   & ! intent(in):    model parameters
-                  prog_data,                   & ! intent(in):    model prognostic variables for a local HRU
-                  diag_data,                   & ! intent(inout): model diagnostic variables for a local HRU
-                  ! output
-                  computeVegFlux,              & ! intent(out): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-                  canopyDepth,                 & ! intent(out): canopy depth (m)
-                  exposedVAI,                  & ! intent(out): exposed vegetation area index (m2 m-2)
-                  fracJulDay,                  & ! fractional julian days since the start of year
-                  yearLength,                  & ! number of days in the current year
-                  err,cmessage)                  ! intent(out): error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
- 
-
-  ! check
-  if(computeVegFlux)then
-    if(canopyDepth < epsilon(canopyDepth))then
-      message=trim(message)//'canopy depth is zero when computeVegFlux flag is .true.'
-      print*, message
-      err=20; return
-    endif
-  endif
-
-  ! flag the case where number of vegetation states has changed
-  modifiedVegState = (computeVegFlux.neqv.computeVegFluxOld)
-
-  ! *** compute wetted canopy area...
-  ! ---------------------------------
-
-  ! compute maximum canopy liquid water (kg m-2)
-  diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1) = mpar_data%var(iLookPARAM%refInterceptCapRain)%dat(1)*exposedVAI
-
-  ! compute maximum canopy ice content (kg m-2)
-  ! NOTE 1: this is used to compute the snow fraction on the canopy, as used in *BOTH* the radiation AND canopy sublimation routines
-  ! NOTE 2: this is a different variable than the max ice used in the throughfall (snow interception) calculations
-  ! NOTE 3: use maximum per unit leaf area storage capacity for snow (kg m-2)
-  select case(model_decisions(iLookDECISIONS%snowIncept)%iDecision)
-    case(lightSnow);  diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1) = exposedVAI*mpar_data%var(iLookPARAM%refInterceptCapSnow)%dat(1)
-    case(stickySnow); diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1) = exposedVAI*mpar_data%var(iLookPARAM%refInterceptCapSnow)%dat(1)*4._dp
-    case default
-      message=trim(message)//'unable to identify option for maximum branch interception capacity'
-      print*, message
-      err=20
-      return
-  end select ! identifying option for maximum branch interception capacity
-  !print*, 'diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1) = ', diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1)
-  !print*, 'diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1) = ', diag_data%var(iLookDIAG%scalarCanopyIceMax)%dat(1)
-
-  ! compute wetted fraction of the canopy
-  ! NOTE: assume that the wetted fraction is constant over the substep for the radiation calculations
-  if(computeVegFlux)then
-
-    ! compute wetted fraction of the canopy
-    call wettedFrac(&
-                  ! input
-                  .false.,                                                      & ! flag to denote if derivatives are required
-                  .false.,                                                      & ! flag to denote if derivatives are calculated numerically
-                  (prog_data%var(iLookPROG%scalarCanopyTemp)%dat(1) < Tfreeze), & ! flag to denote if the canopy is frozen
-                  varNotUsed1,                                                  & ! derivative in canopy liquid w.r.t. canopy temperature (kg m-2 K-1)
-                  varNotUsed2,                                                  & ! fraction of liquid water on the canopy
-                  prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1),              & ! canopy liquid water (kg m-2)
-                  prog_data%var(iLookPROG%scalarCanopyIce)%dat(1),              & ! canopy ice (kg m-2)
-                  diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1),           & ! maximum canopy liquid water (kg m-2)
-                  diag_data%var(iLookDIAG%scalarCanopyLiqMax)%dat(1),           & ! maximum canopy ice content (kg m-2)
-                  mpar_data%var(iLookPARAM%canopyWettingFactor)%dat(1),         & ! maximum wetted fraction of the canopy (-)
-                  mpar_data%var(iLookPARAM%canopyWettingExp)%dat(1),            & ! exponent in canopy wetting function (-)
-                  ! output
-                  diag_data%var(iLookDIAG%scalarCanopyWetFraction)%dat(1),      & ! canopy wetted fraction (-)
-                  dCanopyWetFraction_dWat,                                      & ! derivative in wetted fraction w.r.t. canopy liquid water content (kg-1 m2)
-                  dCanopyWetFraction_dT,                                        & ! derivative in wetted fraction w.r.t. canopy liquid water content (kg-1 m2)
-                  err,cmessage)
-    if(err/=0)then
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-
-    ! vegetation is completely buried by snow (or no veg exists at all)
-  else
-    diag_data%var(iLookDIAG%scalarCanopyWetFraction)%dat(1) = 0._dp
-    dCanopyWetFraction_dWat                                 = 0._dp
-    dCanopyWetFraction_dT                                   = 0._dp
-  end if
-  
-
-  ! *** compute snow albedo...
-  ! --------------------------
-  ! NOTE: this should be done before the radiation calculations
-  ! NOTE: uses snowfall; should really use canopy throughfall + canopy unloading
-  call snowAlbedo(&
-                  ! input: model control
-                  data_step,                   & ! intent(in): model time step (s)
-                  (nSnow > 0),                 & ! intent(in): logical flag to denote if snow is present
-                  ! input/output: data structures
-                  model_decisions,             & ! intent(in):    model decisions
-                  mpar_data,                   & ! intent(in):    model parameters
-                  flux_data,                   & ! intent(in):    model flux variables
-                  diag_data,                   & ! intent(inout): model diagnostic variables for a local HRU
-                  prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                  ! output: error control
-                  err,cmessage)                  ! intent(out): error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-
-  ! *** compute canopy sw radiation fluxes...
-  ! -----------------------------------------
-  call vegSWavRad(&
-                  data_step,                    & ! intent(in):    time step (s) -- only used in Noah-MP radiation, to compute albedo
-                  nSnow,                        & ! intent(in):    number of snow layers
-                  nSoil,                        & ! intent(in):    number of soil layers
-                  nLayers,                      & ! intent(in):    total number of layers
-                  computeVegFlux,               & ! intent(in):    logical flag to compute vegetation fluxes (.false. if veg buried by snow)
-                  type_data,                    & ! intent(in):    type of vegetation and soil
-                  prog_data,                    & ! intent(inout): model prognostic variables for a local HRU
-                  diag_data,                    & ! intent(inout): model diagnostic variables for a local HRU
-                  flux_data,                    & ! intent(inout): model flux variables
-                  err,cmessage)                   ! intent(out):   error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! *** compute canopy throughfall and unloading...
-  ! -----------------------------------------------
-  ! NOTE 1: this needs to be done before solving the energy and liquid water equations, to account for the heat advected with precipitation (and throughfall/unloading)
-  ! NOTE 2: the unloading flux is computed using canopy drip (scalarCanopyLiqDrainage) from the previous time step
-  call canopySnow(&
-                  ! input: model control
-                  data_step,                   & ! intent(in): time step (seconds)
-                  exposedVAI,                  & ! intent(in): exposed vegetation area index (m2 m-2)
-                  computeVegFlux,              & ! intent(in): flag to denote if computing energy flux over vegetation
-                  ! input/output: data structures
-                  model_decisions,             & ! intent(in):    model decisions
-                  forc_data,                   & ! intent(in):    model forcing data
-                  mpar_data,                   & ! intent(in):    model parameters
-                  diag_data,                   & ! intent(in):    model diagnostic variables for a local HRU
-                  prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                  flux_data,                   & ! intent(inout): model flux variables
-                  ! output: error control
-                  err,cmessage)                  ! intent(out): error control
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! adjust canopy temperature to account for new snow
-  if(computeVegFlux)then ! logical flag to compute vegetation fluxes (.false. if veg buried by snow)
-    call tempAdjust(&
-                  ! input: derived parameters
-                  canopyDepth,                 & ! intent(in): canopy depth (m)
-                  ! input/output: data structures
-                  mpar_data,                   & ! intent(in):    model parameters
-                  prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                  diag_data,                   & ! intent(out):   model diagnostic variables for a local HRU
-                  ! output: error control
-                  err,cmessage)                  ! intent(out): error control
-    if(err/=0)then
-      err=20
-      message=trim(message)//trim(cmessage)
-      return
-    end if
-  endif ! if computing fluxes over vegetation
-  
-
-  ! initialize drainage and throughfall
-  ! NOTE 1: this needs to be done before solving the energy and liquid water equations, to account for the heat advected with precipitation
-  ! NOTE 2: this initialization needs to be done AFTER the call to canopySnow, since canopySnow uses canopy drip drom the previous time step
-  if(.not.computeVegFlux)then
-    flux_data%var(iLookFLUX%scalarThroughfallRain)%dat(1)   = flux_data%var(iLookFLUX%scalarRainfall)%dat(1)
-    flux_data%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp
-  else
-    flux_data%var(iLookFLUX%scalarThroughfallRain)%dat(1)   = 0._dp
-    flux_data%var(iLookFLUX%scalarCanopyLiqDrainage)%dat(1) = 0._dp
-  end if
-
-  ! ****************************************************************************************************
-  ! *** MAIN SOLVER ************************************************************************************
-  ! ****************************************************************************************************
-
-  ! initialize the length of the sub-step
-  dt_solv = 0._dp   ! length of time step that has been completed (s)
-  dt_init = min(data_step,maxstep) / dt_init_factor  ! initial substep length (s)
-  dt_sub  = dt_init                 ! length of substep
-  dtSave  = dt_init                 ! length of substep
-
-  ! initialize the number of sub-steps
-  nsub=0
-
-  ! loop through sub-steps
-  substeps: do  ! continuous do statement with exit clause (alternative to "while")
-
-    ! print progress
-    !print*, '*** new substep'
-    !write(*,'(a,3(f11.4,1x))') 'dt_sub, dt_init = ', dt_sub, dt_init
-
-    ! print progress
-    if(globalPrintFlag)then
-      write(*,'(a,1x,4(f13.5,1x))') ' start of step: dt_init, dt_sub, dt_solv, data_step: ', dt_init, dt_sub, dt_solv, data_step
-      print*, 'stepFailure = ', stepFailure
-      print*, 'before resizeData: nSnow, nSoil = ', nSnow, nSoil
-    endif
-
-    ! increment the number of sub-steps
-    nsub = nsub+1
-
-    ! resize the "indx_data" structure
-    ! NOTE: this is necessary because the length of index variables depends on a given split
-    !        --> the resize here is overwritten later (in indexSplit)
-    !        --> admittedly ugly, and retained for now
-    if(stepFailure)then
-      call resizeData(indx_meta(:),indx_temp,indx_data,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-    else
-      call resizeData(indx_meta(:),indx_data,indx_temp,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-    endif
-
-    ! save/recover copies of index variables
-    do iVar=1,size(indx_data%var)
-     !print*, 'indx_meta(iVar)%varname = ', trim(indx_meta(iVar)%varname)
-      select case(stepFailure)
-        case(.false.); indx_temp%var(iVar)%dat(:) = indx_data%var(iVar)%dat(:)
-        case(.true.);  indx_data%var(iVar)%dat(:) = indx_temp%var(iVar)%dat(:)
-      end select
-    end do  ! looping through variables
-
-    ! save/recover copies of prognostic variables
-    do iVar=1,size(prog_data%var)
-      !print*, 'prog_meta(iVar)%varname = ', trim(prog_meta(iVar)%varname)
-      select case(stepFailure)
-        case(.false.); prog_temp%var(iVar)%dat(:) = prog_data%var(iVar)%dat(:)
-        case(.true.);  prog_data%var(iVar)%dat(:) = prog_temp%var(iVar)%dat(:)
-      end select
-    end do  ! looping through variables
-
-    ! save/recover copies of diagnostic variables
-    do iVar=1,size(diag_data%var)
-      select case(stepFailure)
-        case(.false.); diag_temp%var(iVar)%dat(:) = diag_data%var(iVar)%dat(:)
-        case(.true.);  diag_data%var(iVar)%dat(:) = diag_temp%var(iVar)%dat(:)
-      end select
-    end do  ! looping through variables
-
-    ! re-assign dimension lengths
-    nSnow   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_snow)
-    nSoil   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_soil)
-    nLayers = nSnow+nSoil
-  
-
-    ! *** merge/sub-divide snow layers...
-    ! -----------------------------------
-    call volicePack(&
-                    ! input/output: model data structures
-                    doLayerMerge,                & ! intent(in):    flag to force merge of snow layers
-                    model_decisions,             & ! intent(in):    model decisions
-                    mpar_data,                   & ! intent(in):    model parameters
-                    indx_data,                   & ! intent(inout): type of each layer
-                    prog_data,                   & ! intent(inout): model prognostic variables for a local HRU
-                    diag_data,                   & ! intent(inout): model diagnostic variables for a local HRU
-                    flux_data,                   & ! intent(inout): model fluxes for a local HRU
-                    ! output
-                    modifiedLayers,              & ! intent(out): flag to denote that layers were modified
-                    err,cmessage)                  ! intent(out): error control
-    if(err/=0)then
-      err=55
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-
-    ! save the number of snow and soil layers
-    nSnow   = indx_data%var(iLookINDEX%nSnow)%dat(1)
-    nSoil   = indx_data%var(iLookINDEX%nSoil)%dat(1)
-    nLayers = indx_data%var(iLookINDEX%nLayers)%dat(1)
-
-
-    ! compute the indices for the model state variables
-    if(firstSubStep .or. modifiedVegState .or. modifiedLayers)then
-      call indexState(computeVegFlux,          & ! intent(in):    flag to denote if computing the vegetation flux
-                      includeAquifer,          & ! intent(in):    flag to denote if included the aquifer
-                      nSnow,nSoil,nLayers,     & ! intent(in):    number of snow and soil layers, and total number of layers
-                      indx_data,               & ! intent(inout): indices defining model states and layers
-                      err,cmessage)              ! intent(out):   error control
-      if(err/=0)then
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      end if
-    end if
-
-    ! recreate the temporary data structures
-    ! NOTE: resizeData(meta, old, new, ..)
-    if(modifiedVegState .or. modifiedLayers)then
-
-      ! create temporary data structures for prognostic variables
-      call resizeData(prog_meta(:),prog_data,prog_temp,copy=.true.,err=err,message=cmessage)
-      if(err/=0)then; 
-        err=20 
-        message=trim(message)//trim(cmessage);
-        print*, message
-        return
-      endif
-
-      ! create temporary data structures for diagnostic variables
-      call resizeData(diag_meta(:),diag_data,diag_temp,copy=.true.,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-
-      ! create temporary data structures for index variables
-      call resizeData(indx_meta(:),indx_data,indx_temp,copy=.true.,err=err,message=cmessage)
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      endif
-
-      do iVar=1,size(indx_data%var)
-        !print*, 'indx_meta(iVar)%varname = ', trim(indx_meta(iVar)%varname)
-        select case(stepFailure)
-          case(.false.); indx_temp%var(iVar)%dat(:) = indx_data%var(iVar)%dat(:)
-          case(.true.);  indx_data%var(iVar)%dat(:) = indx_temp%var(iVar)%dat(:)
-        end select
-      end do  ! looping through variables
-
-    endif  ! if modified the states
-
-    ! define the number of state variables
-    nState = indx_data%var(iLookINDEX%nState)%dat(1)
-  
-
-    ! *** compute diagnostic variables for each layer...
-    ! --------------------------------------------------
-    ! NOTE: this needs to be done AFTER volicePack, since layers may have been sub-divided and/or merged
-    call diagn_evar(&
-                  ! input: control variables
-                  computeVegFlux,          & ! intent(in): flag to denote if computing the vegetation flux
-                  canopyDepth,             & ! intent(in): canopy depth (m)
-                  ! input/output: data structures
-                  mpar_data,               & ! intent(in):    model parameters
-                  indx_data,               & ! intent(in):    model layer indices
-                  prog_data,               & ! intent(in):    model prognostic variables for a local HRU
-                  diag_data,               & ! intent(inout): model diagnostic variables for a local HRU
-                  ! output: error control
-                  err,cmessage)              ! intent(out): error control
-    if(err/=0)then
-      err=55;
-      message=trim(message)//trim(cmessage)
-      return
-    end if
-
-
-    ! *** compute melt of the "snow without a layer"...
-    ! -------------------------------------------------
-    ! NOTE: forms a surface melt pond, which drains into the upper-most soil layer through the time step
-    ! (check for the special case of "snow without a layer")
-    if(nSnow==0)then
-      call implctMelt(&
-                   ! input/output: integrated snowpack properties
-                   prog_data%var(iLookPROG%scalarSWE)%dat(1),               & ! intent(inout): snow water equivalent (kg m-2)
-                   prog_data%var(iLookPROG%scalarSnowDepth)%dat(1),         & ! intent(inout): snow depth (m)
-                   prog_data%var(iLookPROG%scalarSfcMeltPond)%dat(1),       & ! intent(inout): surface melt pond (kg m-2)
-                   ! input/output: properties of the upper-most soil layer
-                   prog_data%var(iLookPROG%mLayerTemp)%dat(nSnow+1),        & ! intent(inout): surface layer temperature (K)
-                   prog_data%var(iLookPROG%mLayerDepth)%dat(nSnow+1),       & ! intent(inout): surface layer depth (m)
-                   diag_data%var(iLookDIAG%mLayerVolHtCapBulk)%dat(nSnow+1),& ! intent(inout): surface layer volumetric heat capacity (J m-3 K-1)
-                   ! output: error control
-                   err,cmessage                                             ) ! intent(out): error control
-      if(err/=0)then
-        err=20
-        message=trim(message)//trim(cmessage)
-        print*, message
-        return
-      end if
-    end if ! nsnow == 0
-
-    ! *** solve model equations...
-    ! ----------------------------
-
-    ! save input step
-    dtSave = dt_sub
-    !write(*,'(a,1x,3(f12.5,1x))') trim(message)//'before opSplittin: dt_init, dt_sub, dt_solv = ', dt_init, dt_sub, dt_solv
-  
-    ! get the new solution
-    call opSplittin(&
-                  ! input: model control
-                  nSnow,                                  & ! intent(in):    number of snow layers
-                  nSoil,                                  & ! intent(in):    number of soil layers
-                  nLayers,                                & ! intent(in):    total number of layers
-                  nState,                                 & ! intent(in):    total number of layers
-                  dt_sub,                                 & ! intent(in):    length of the model sub-step
-                  (nsub==1),                              & ! intent(in):    logical flag to denote the first substep
-                  computeVegFlux,                         & ! intent(in):    logical flag to compute fluxes within the vegetation canopy
-                  ! input/output: data structures
-                  type_data,                              & ! intent(in):    type of vegetation and soil
-                  attr_data,                              & ! intent(in):    spatial attributes
-                  forc_data,                              & ! intent(in):    model forcing data
-                  mpar_data,                              & ! intent(in):    model parameters
-                  indx_data,                              & ! intent(inout): index data
-                  prog_data,                              & ! intent(inout): model prognostic variables for a local HRU
-                  diag_data,                              & ! intent(inout): model diagnostic variables for a local HRU
-                  flux_data,                              & ! intent(inout): model fluxes for a local HRU
-                  bvar_data,                              & ! intent(in):    model variables for the local basin
-                  lookup_data,                            & ! intent(in):    lookup tables
-                  model_decisions,                        & ! intent(in):    model decisions
-                  ! output: model control
-                  dtMultiplier,                           & ! intent(out):   substep multiplier (-)
-                  tooMuchMelt,                            & ! intent(out):   flag to denote that ice is insufficient to support melt
-                  stepFailure,                            & ! intent(out):   flag to denote that the coupled step failed
-                  ixSolution,                             & ! intent(out):   solution method used in this iteration
-                  err,cmessage)                             ! intent(out):   error code and error message
-
-    ! check for all errors (error recovery within opSplittin)
-    if(err/=0)then
-      err=20
-      message=trim(message)//trim(cmessage)
-      print*, message
-      return
-    end if
-    ! print*, 'prog_data%var(iLookPROG%mLayerVolFracLiq)%dat()', prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSoil)
-  
-
-    ! process the flag for too much melt
-    if(tooMuchMelt)then
-      stepFailure  = .true.
-      doLayerMerge = .true.
-    else
-      doLayerMerge = .false.
-    endif
-
-    ! handle special case of the step failure
-    ! NOTE: need to revert back to the previous state vector that we were happy with and reduce the time step
-    ! TODO: ask isn't this what the actors program does without the code block below
-    if(stepFailure)then
-
-      ! halve step
-      dt_sub = dtSave/2._dp
-
-      ! check that the step is not tiny
-      if(dt_sub < minstep)then
-        print*,ixSolution
-        print*, 'dtSave, dt_sub', dtSave, dt_sub
-        message=trim(message)//'length of the coupled step is below the minimum step length'
-        err=20; return
-      endif
-
-      ! try again
-      cycle substeps
-
-    endif
-
-    ! update first step
-    firstSubStep=.false.
-
-    ! ***  remove ice due to sublimation...
-    ! --------------------------------------------------------------
-    sublime: associate(&
-      scalarCanopySublimation => flux_data%var(iLookFLUX%scalarCanopySublimation)%dat(1), & ! sublimation from the vegetation canopy (kg m-2 s-1)
-      scalarSnowSublimation   => flux_data%var(iLookFLUX%scalarSnowSublimation)%dat(1),   & ! sublimation from the snow surface (kg m-2 s-1)
-      scalarLatHeatCanopyEvap => flux_data%var(iLookFLUX%scalarLatHeatCanopyEvap)%dat(1), & ! latent heat flux for evaporation from the canopy to the canopy air space (W m-2)
-      scalarSenHeatCanopy     => flux_data%var(iLookFLUX%scalarSenHeatCanopy)%dat(1),     & ! sensible heat flux from the canopy to the canopy air space (W m-2)
-      scalarLatHeatGround     => flux_data%var(iLookFLUX%scalarLatHeatGround)%dat(1),     & ! latent heat flux from ground surface below vegetation (W m-2)
-      scalarSenHeatGround     => flux_data%var(iLookFLUX%scalarSenHeatGround)%dat(1),     & ! sensible heat flux from ground surface below vegetation (W m-2)
-      scalarCanopyLiq         => prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1),         & ! liquid water stored on the vegetation canopy (kg m-2)
-      scalarCanopyIce         => prog_data%var(iLookPROG%scalarCanopyIce)%dat(1),         & ! ice          stored on the vegetation canopy (kg m-2)
-      mLayerVolFracIce        => prog_data%var(iLookPROG%mLayerVolFracIce)%dat,           & ! volumetric fraction of ice in the snow+soil domain (-)
-      mLayerVolFracLiq        => prog_data%var(iLookPROG%mLayerVolFracLiq)%dat,           & ! volumetric fraction of liquid water in the snow+soil domain (-)
-      mLayerDepth             => prog_data%var(iLookPROG%mLayerDepth)%dat                 & ! depth of each snow+soil layer (m)
-      ) ! associations to variables in data structures
-
-      ! * compute change in canopy ice content due to sublimation...
-      ! ------------------------------------------------------------
-      if(computeVegFlux)then
-
-        ! remove mass of ice on the canopy
-        scalarCanopyIce = scalarCanopyIce + scalarCanopySublimation*dt_sub
-
-        ! if removed all ice, take the remaining sublimation from water
-        if(scalarCanopyIce < 0._dp)then
-          scalarCanopyLiq = scalarCanopyLiq + scalarCanopyIce
-          scalarCanopyIce = 0._dp
-        endif
-
-        ! modify fluxes if there is insufficient canopy water to support the converged sublimation rate over the time step dt_sub
-        if(scalarCanopyLiq < 0._dp)then
-          ! --> superfluous sublimation flux
-          superflousSub = -scalarCanopyLiq/dt_sub  ! kg m-2 s-1
-          superflousNrg = superflousSub*LH_sub     ! W m-2 (J m-2 s-1)
-          ! --> update fluxes and states
-          scalarCanopySublimation = scalarCanopySublimation + superflousSub
-          scalarLatHeatCanopyEvap = scalarLatHeatCanopyEvap + superflousNrg
-          scalarSenHeatCanopy     = scalarSenHeatCanopy - superflousNrg
-          scalarCanopyLiq         = 0._dp
-        endif
-      end if  ! (if computing the vegetation flux)
-
-      call computSnowDepth(&
-            dt_sub,                                           & ! intent(in)
-            nSnow,                                            & ! intent(in)
-            scalarSnowSublimation,                            & ! intent(in)
-            mLayerVolFracLiq,                                 & ! intent(inout)
-            mLayerVolFracIce,                                 & ! intent(inout)
-            prog_data%var(iLookPROG%mLayerTemp)%dat,          & ! intent(in)
-            diag_data%var(iLookDIAG%mLayerMeltFreeze)%dat,    & ! intent(in)
-            mpar_data,                                        & ! intent(in)
-            ! output
-            tooMuchSublim,                                    & ! intent(out): flag to denote that there was too much sublimation in a given time step
-            mLayerDepth,                                      & ! intent(inout)
-            ! error control
-            err,message)                                        ! intent(out):   error control
-      if(err/=0)then; err=55; message="computSnowDepth";return; end if
-
-      ! process the flag for too much sublimation
-      if(tooMuchSublim)then
-        stepFailure  = .true.
-        doLayerMerge = .true.
-      else
-        doLayerMerge = .false.
-      endif
-
-      ! handle special case of the step failure
-      ! NOTE: need to revert back to the previous state vector that we were happy with and reduce the time step
-      if(stepFailure)then
-        ! halve step
-        dt_sub = dtSave/2._rkind
-        ! check that the step is not tiny
-        if(dt_sub < minstep)then
-          print*,ixSolution
-          print*, 'dtSave, dt_sub', dtSave, dt_sub
-          message=trim(message)//'length of the coupled step is below the minimum step length'
-          err=20; return
-        endif
-        ! try again
-        cycle substeps
-      endif
-
-    end associate sublime
-
-    ! update coordinate variables
-    call calcHeight(&
-            ! input/output: data structures
-            indx_data,   & ! intent(in): layer type
-            prog_data,   & ! intent(inout): model variables for a local HRU
-            ! output: error control
-            err,cmessage)
-    if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-    ! recompute snow depth and SWE
-    if(nSnow > 0)then
-      prog_data%var(iLookPROG%scalarSnowDepth)%dat(1) = sum(  prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow))
-      prog_data%var(iLookPROG%scalarSWE)%dat(1)       = sum( (prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                        prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice) &
-                                                      * prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
-    end if
-
-    ! increment fluxes
-    dt_wght = dt_sub/data_step ! define weight applied to each sub-step
-    do iVar=1,size(averageFlux_meta)
-      flux_mean%var(iVar)%dat(:) = flux_mean%var(iVar)%dat(:) + flux_data%var(averageFlux_meta(iVar)%ixParent)%dat(:)*dt_wght
-    end do
-
-    ! increment change in storage associated with the surface melt pond (kg m-2)
-    if(nSnow==0) sfcMeltPond = sfcMeltPond + prog_data%var(iLookPROG%scalarSfcMeltPond)%dat(1)
-
-    ! increment soil compression (kg m-2)
-    totalSoilCompress = totalSoilCompress + diag_data%var(iLookDIAG%scalarSoilCompress)%dat(1) ! total soil compression over whole layer (kg m-2)
-
-    ! ****************************************************************************************************
-    ! *** END MAIN SOLVER ********************************************************************************
-    ! ****************************************************************************************************
-
-    ! increment sub-step
-    dt_solv = dt_solv + dt_sub
-
-    ! save the time step to initialize the subsequent step
-    if(dt_solv<data_step .or. nsub==1) dt_init = dt_sub
-
-    ! check
-    if(globalPrintFlag)&
-    write(*,'(a,1x,3(f18.5,1x))') 'dt_sub, dt_solv, data_step: ', dt_sub, dt_solv, data_step
-
-    ! check that we have completed the sub-step
-    if(dt_solv >= data_step-verySmall) then
-      exit substeps
-    endif
-
-    ! adjust length of the sub-step (make sure that we don't exceed the step)
-    dt_sub = min(data_step - dt_solv, dt_sub)
-
-  end do  substeps ! (sub-step loop)
-
-
-  ! *** add snowfall to the snowpack...
-  ! -----------------------------------
-
-  ! add new snowfall to the snowpack
-  ! NOTE: This needs to be done AFTER the call to canopySnow, since throughfall and unloading are computed in canopySnow
-  call newsnwfall(&
-                ! input: model control
-                data_step,                                                 & ! time step (seconds)
-                (nSnow > 0),                                               & ! logical flag if snow layers exist
-                mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1),            & ! freeezing curve parameter for snow (K-1)
-                ! input: diagnostic scalar variables
-                diag_data%var(iLookDIAG%scalarSnowfallTemp)%dat(1),        & ! computed temperature of fresh snow (K)
-                diag_data%var(iLookDIAG%scalarNewSnowDensity)%dat(1),      & ! computed density of new snow (kg m-3)
-                flux_data%var(iLookFLUX%scalarThroughfallSnow)%dat(1),     & ! throughfall of snow through the canopy (kg m-2 s-1)
-                flux_data%var(iLookFLUX%scalarCanopySnowUnloading)%dat(1), & ! unloading of snow from the canopy (kg m-2 s-1)
-                ! input/output: state variables
-                prog_data%var(iLookPROG%scalarSWE)%dat(1),                 & ! SWE (kg m-2)
-                prog_data%var(iLookPROG%scalarSnowDepth)%dat(1),           & ! total snow depth (m)
-                prog_data%var(iLookPROG%mLayerTemp)%dat(1),                & ! temperature of the top layer (K)
-                prog_data%var(iLookPROG%mLayerDepth)%dat(1),               & ! depth of the top layer (m)
-                prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1),          & ! volumetric fraction of ice of the top layer (-)
-                prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1),          & ! volumetric fraction of liquid water of the top layer (-)
-                ! output: error control
-                err,cmessage)                                                ! error control
-  if(err/=0)then
-    err=30
-    message=trim(message)//trim(cmessage)
-    print*,message
-    return
-  end if
-
-  ! re-compute snow depth and SWE
-  if(nSnow > 0)then
-    prog_data%var(iLookPROG%scalarSnowDepth)%dat(1) = sum(  prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow))
-    prog_data%var(iLookPROG%scalarSWE)%dat(1)       = sum( (prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                          prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice) &
-                                                        * prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
-  end if
-  !print*, 'SWE after snowfall = ',  prog_data%var(iLookPROG%scalarSWE)%dat(1)
-
-  ! re-assign dimension lengths
-  nSnow   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_snow)
-  nSoil   = count(indx_data%var(iLookINDEX%layerType)%dat==iname_soil)
-  nLayers = nSnow+nSoil
-
-  ! update coordinate variables
-  call calcHeight(&
-                 ! input/output: data structures
-                 indx_data,   & ! intent(in): layer type
-                 prog_data,   & ! intent(inout): model variables for a local HRU
-                 ! output: error control
-                 err,cmessage)
-  if(err/=0)then
-    err=20
-    message=trim(message)//trim(cmessage)
-    print*, message
-    return
-  end if
-
-  ! overwrite flux_data with flux_mean (returns timestep-average fluxes for scalar variables)
-  do iVar=1,size(averageFlux_meta)
-    flux_data%var(averageFlux_meta(iVar)%ixParent)%dat(:) = flux_mean%var(iVar)%dat(:)
-  end do
-
-  ! ***********************************************************************************************************************************
-  ! ***********************************************************************************************************************************
-  ! ***********************************************************************************************************************************
-  ! ***********************************************************************************************************************************
-
-  ! ---
-  ! *** balance checks...
-  ! ---------------------
-
-  ! save the average compression and melt pond storage in the data structures
-    prog_data%var(iLookPROG%scalarSfcMeltPond)%dat(1)  = sfcMeltPond
-
-    ! associate local variables with information in the data structures
-    associate(&
-      ! model forcing
-      scalarSnowfall             => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSnowfall)           )%dat(1)     ,&  ! computed snowfall rate (kg m-2 s-1)
-      scalarRainfall             => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarRainfall)           )%dat(1)     ,&  ! computed rainfall rate (kg m-2 s-1)
-      ! canopy fluxes
-      averageThroughfallSnow     => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarThroughfallSnow)    )%dat(1)     ,&  ! snow that reaches the ground without ever touching the canopy (kg m-2 s-1)
-      averageThroughfallRain     => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarThroughfallRain)    )%dat(1)     ,&  ! rain that reaches the ground without ever touching the canopy (kg m-2 s-1)
-      averageCanopySnowUnloading => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopySnowUnloading))%dat(1)     ,&  ! unloading of snow from the vegetion canopy (kg m-2 s-1)
-      averageCanopyLiqDrainage   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopyLiqDrainage)  )%dat(1)     ,&  ! drainage of liquid water from the vegetation canopy (kg m-2 s-1)
-      averageCanopySublimation   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopySublimation)  )%dat(1)     ,&  ! canopy sublimation/frost (kg m-2 s-1)
-      averageCanopyEvaporation   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopyEvaporation)  )%dat(1)     ,&  ! canopy evaporation/condensation (kg m-2 s-1)
-      ! snow fluxes
-      averageSnowSublimation     => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSnowSublimation)    )%dat(1)     ,&  ! sublimation from the snow surface (kg m-2 s-1)
-      averageSnowDrainage        => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSnowDrainage)       )%dat(1)     ,&  ! drainage from the bottom of the snowpack (m s-1)
-      ! soil fluxes
-      averageSoilInflux          => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarInfiltration)       )%dat(1)     ,&  ! influx of water at the top of the soil profile (m s-1)
-      averageSoilDrainage        => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSoilDrainage)       )%dat(1)     ,&  ! drainage from the bottom of the soil profile (m s-1)
-      averageSoilBaseflow        => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarSoilBaseflow)       )%dat(1)     ,&  ! total baseflow from throughout the soil profile (m s-1)
-      averageGroundEvaporation   => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarGroundEvaporation)  )%dat(1)     ,&  ! soil evaporation (kg m-2 s-1)
-      averageCanopyTranspiration => flux_mean%var(childFLUX_MEAN(iLookFLUX%scalarCanopyTranspiration))%dat(1)     ,&  ! canopy transpiration (kg m-2 s-1)
-      ! state variables in the vegetation canopy
-      scalarCanopyLiq            => prog_data%var(iLookPROG%scalarCanopyLiq)%dat(1)                               ,&  ! canopy liquid water (kg m-2)
-      scalarCanopyIce            => prog_data%var(iLookPROG%scalarCanopyIce)%dat(1)                               ,&  ! canopy ice content (kg m-2)
-      ! state variables in the soil domain
-      mLayerDepth                => prog_data%var(iLookPROG%mLayerDepth)%dat(nSnow+1:nLayers)                     ,&  ! depth of each soil layer (m)
-      mLayerVolFracIce           => prog_data%var(iLookPROG%mLayerVolFracIce)%dat(nSnow+1:nLayers)                ,&  ! volumetric ice content in each soil layer (-)
-      mLayerVolFracLiq           => prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(nSnow+1:nLayers)                ,&  ! volumetric liquid water content in each soil layer (-)
-      scalarAquiferStorage       => prog_data%var(iLookPROG%scalarAquiferStorage)%dat(1)                          ,&  ! aquifer storage (m)
-      ! error tolerance
-      absConvTol_liquid          => mpar_data%var(iLookPARAM%absConvTol_liquid)%dat(1)                            ,&  ! absolute convergence tolerance for vol frac liq water (-)
-      scalarTotalSoilIce         => diag_data%var(iLookDIAG%scalarTotalSoilIce)%dat(1)                            ,&  ! total ice in the soil column (kg m-2)
-      scalarTotalSoilLiq         => diag_data%var(iLookDIAG%scalarTotalSoilLiq)%dat(1)                             &  ! total liquid water in the soil column (kg m-2)
-      ) ! (association of local variables with information in the data structures
-
-      ! -----
-      ! * balance checks for the canopy...
-      ! ----------------------------------
-
-      if (model_decisions(iLookDECISIONS%num_method)%iDecision==bEuler) checkMassBalance = .true.    ! convergence criteria for bEuler
-      if (model_decisions(iLookDECISIONS%num_method)%iDecision==sundials) checkMassBalance = .false. ! sundials does not use this criteria
-
-      ! if computing the vegetation flux
-      if(computeVegFlux)then
-
-        ! canopy water balance
-        balanceCanopyWater1 = scalarCanopyLiq + scalarCanopyIce
-
-        ! balance checks for the canopy
-        ! NOTE: need to put the balance checks in the sub-step loop so that we can re-compute if necessary
-        scalarCanopyWatBalError = balanceCanopyWater1 - (balanceCanopyWater0 + (scalarSnowfall - averageThroughfallSnow)*data_step + (scalarRainfall - averageThroughfallRain)*data_step &
-                                  - averageCanopySnowUnloading*data_step - averageCanopyLiqDrainage*data_step + averageCanopySublimation*data_step + averageCanopyEvaporation*data_step)
-        if(abs(scalarCanopyWatBalError) > absConvTol_liquid*iden_water*10._rkind .and. checkMassBalance)then
-          print*, '** canopy water balance error:'
-          write(*,'(a,1x,f20.10)') 'data_step                                    = ', data_step
-          write(*,'(a,1x,f20.10)') 'balanceCanopyWater0                          = ', balanceCanopyWater0
-          write(*,'(a,1x,f20.10)') 'balanceCanopyWater1                          = ', balanceCanopyWater1
-          write(*,'(a,1x,f20.10)') 'scalarSnowfall                               = ', scalarSnowfall
-          write(*,'(a,1x,f20.10)') 'scalarRainfall                               = ', scalarRainfall
-          write(*,'(a,1x,f20.10)') '(scalarSnowfall - averageThroughfallSnow)    = ', (scalarSnowfall - averageThroughfallSnow)!*data_step
-          write(*,'(a,1x,f20.10)') '(scalarRainfall - averageThroughfallRain)    = ', (scalarRainfall - averageThroughfallRain)!*data_step
-          write(*,'(a,1x,f20.10)') 'averageCanopySnowUnloading                   = ', averageCanopySnowUnloading!*data_step
-          write(*,'(a,1x,f20.10)') 'averageCanopyLiqDrainage                     = ', averageCanopyLiqDrainage!*data_step
-          write(*,'(a,1x,f20.10)') 'averageCanopySublimation                     = ', averageCanopySublimation!*data_step
-          write(*,'(a,1x,f20.10)') 'averageCanopyEvaporation                     = ', averageCanopyEvaporation!*data_step
-          write(*,'(a,1x,f20.10)') 'scalarCanopyWatBalError                      = ', scalarCanopyWatBalError
-          message=trim(message)//'canopy hydrology does not balance'
-          err=20; return
-        end if
-
-      endif  ! if computing the vegetation flux
-
-      ! -----
-      ! * balance checks for SWE...
-      ! ---------------------------
-
-      ! recompute snow depth (m) and SWE (kg m-2)
-      if(nSnow > 0)then
-        prog_data%var(iLookPROG%scalarSnowDepth)%dat(1) = sum(  prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow))
-        prog_data%var(iLookPROG%scalarSWE)%dat(1)       = sum( (prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)*iden_water + &
-                                                                prog_data%var(iLookPROG%mLayerVolFracIce)%dat(1:nSnow)*iden_ice) &
-                                                              * prog_data%var(iLookPROG%mLayerDepth)%dat(1:nSnow) )
-      end if
-
-      ! check the individual layers
-      if(printBalance .and. nSnow>0)then
-        write(*,'(a,1x,10(f12.8,1x))') 'liqSnowInit       = ', liqSnowInit
-        write(*,'(a,1x,10(f12.8,1x))') 'volFracLiq        = ', prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow)
-        write(*,'(a,1x,10(f12.8,1x))') 'iLayerLiqFluxSnow = ', flux_data%var(iLookFLUX%iLayerLiqFluxSnow)%dat*iden_water*data_step
-        write(*,'(a,1x,10(f12.8,1x))') 'mLayerLiqFluxSnow = ', flux_data%var(iLookFLUX%mLayerLiqFluxSnow)%dat*data_step
-        write(*,'(a,1x,10(f12.8,1x))') 'change volFracLiq = ', prog_data%var(iLookPROG%mLayerVolFracLiq)%dat(1:nSnow) - liqSnowInit
-        deallocate(liqSnowInit, stat=err)
-        if(err/=0)then
-          message=trim(message)//'unable to deallocate space for the initial volumetric liquid water content of snow'
-          err=20; return
-        endif
-      endif
-
-      ! check SWE
-      if(nSnow>0)then
-        effSnowfall = averageThroughfallSnow + averageCanopySnowUnloading
-        effRainfall = averageThroughfallRain + averageCanopyLiqDrainage
-        newSWE      = prog_data%var(iLookPROG%scalarSWE)%dat(1)
-        delSWE      = newSWE - (oldSWE - sfcMeltPond)
-        massBalance = delSWE - (effSnowfall + effRainfall + averageSnowSublimation - averageSnowDrainage*iden_water)*data_step
-        if(abs(massBalance) > absConvTol_liquid*iden_water*10._rkind .and. checkMassBalance)then
-        print*,                  'nSnow       = ', nSnow
-        print*,                  'nSub        = ', nSub
-        write(*,'(a,1x,f20.10)') 'data_step   = ', data_step
-        write(*,'(a,1x,f20.10)') 'oldSWE      = ', oldSWE
-        write(*,'(a,1x,f20.10)') 'newSWE      = ', newSWE
-        write(*,'(a,1x,f20.10)') 'delSWE      = ', delSWE
-        write(*,'(a,1x,f20.10)') 'effRainfall = ', effRainfall*data_step
-        write(*,'(a,1x,f20.10)') 'effSnowfall = ', effSnowfall*data_step
-        write(*,'(a,1x,f20.10)') 'sublimation = ', averageSnowSublimation*data_step
-        write(*,'(a,1x,f20.10)') 'snwDrainage = ', averageSnowDrainage*iden_water*data_step
-        write(*,'(a,1x,f20.10)') 'sfcMeltPond = ', sfcMeltPond
-        write(*,'(a,1x,f20.10)') 'massBalance = ', massBalance
-        message=trim(message)//'SWE does not balance'
-        err=20; return
-        endif  ! if failed mass balance check
-      endif  ! if snow layers exist
-
-      ! -----
-      ! * balance checks for soil...
-      ! ----------------------------
-
-      ! compute the liquid water and ice content at the end of the time step
-      scalarTotalSoilLiq = sum(iden_water*mLayerVolFracLiq(1:nSoil)*mLayerDepth(1:nSoil))
-      scalarTotalSoilIce = sum(iden_water*mLayerVolFracIce(1:nSoil)*mLayerDepth(1:nSoil))   ! NOTE: no expansion of soil, hence use iden_water
-
-      ! get the total water in the soil (liquid plus ice) at the end of the time step (kg m-2)
-      balanceSoilWater1 = scalarTotalSoilLiq + scalarTotalSoilIce
-
-      ! get the total aquifer storage at the start of the time step (kg m-2)
-      balanceAquifer1 = scalarAquiferStorage*iden_water
-
-      ! get the input and output to/from the soil zone (kg m-2)
-      balanceSoilInflux        = averageSoilInflux*iden_water*data_step
-      balanceSoilBaseflow      = averageSoilBaseflow*iden_water*data_step
-      balanceSoilDrainage      = averageSoilDrainage*iden_water*data_step
-      balanceSoilET            = (averageCanopyTranspiration + averageGroundEvaporation)*data_step
-
-      ! check the individual layers
-      if(printBalance)then
-        write(*,'(a,1x,10(f12.8,1x))') 'liqSoilInit       = ', liqSoilInit
-        write(*,'(a,1x,10(f12.8,1x))') 'volFracLiq        = ', mLayerVolFracLiq
-        write(*,'(a,1x,10(f12.8,1x))') 'iLayerLiqFluxSoil = ', flux_data%var(iLookFLUX%iLayerLiqFluxSoil)%dat*iden_water*data_step
-        write(*,'(a,1x,10(f12.8,1x))') 'mLayerLiqFluxSoil = ', flux_data%var(iLookFLUX%mLayerLiqFluxSoil)%dat*data_step
-        write(*,'(a,1x,10(f12.8,1x))') 'change volFracLiq = ', mLayerVolFracLiq - liqSoilInit
-        deallocate(liqSoilInit, stat=err)
-        if(err/=0)then
-        message=trim(message)//'unable to deallocate space for the initial soil moisture'
-        err=20; return
-        endif
-      endif
-
-      ! check the soil water balance
-      scalarSoilWatBalError  = balanceSoilWater1 - (balanceSoilWater0 + (balanceSoilInflux + balanceSoilET - balanceSoilBaseflow - balanceSoilDrainage - totalSoilCompress) )
-      if(abs(scalarSoilWatBalError) > absConvTol_liquid*iden_water*10._rkind .and. checkMassBalance)then  ! NOTE: kg m-2, so need coarse tolerance to account for precision issues
-        write(*,*)               'solution method           = ', ixSolution
-        write(*,'(a,1x,f20.10)') 'data_step                 = ', data_step
-        write(*,'(a,1x,f20.10)') 'totalSoilCompress         = ', totalSoilCompress
-        write(*,'(a,1x,f20.10)') 'scalarTotalSoilLiq        = ', scalarTotalSoilLiq
-        write(*,'(a,1x,f20.10)') 'scalarTotalSoilIce        = ', scalarTotalSoilIce
-        write(*,'(a,1x,f20.10)') 'balanceSoilWater0         = ', balanceSoilWater0
-        write(*,'(a,1x,f20.10)') 'balanceSoilWater1         = ', balanceSoilWater1
-        write(*,'(a,1x,f20.10)') 'balanceSoilInflux         = ', balanceSoilInflux
-        write(*,'(a,1x,f20.10)') 'balanceSoilBaseflow       = ', balanceSoilBaseflow
-        write(*,'(a,1x,f20.10)') 'balanceSoilDrainage       = ', balanceSoilDrainage
-        write(*,'(a,1x,f20.10)') 'balanceSoilET             = ', balanceSoilET
-        write(*,'(a,1x,f20.10)') 'scalarSoilWatBalError     = ', scalarSoilWatBalError
-        write(*,'(a,1x,f20.10)') 'scalarSoilWatBalError     = ', scalarSoilWatBalError/iden_water
-        write(*,'(a,1x,f20.10)') 'absConvTol_liquid         = ', absConvTol_liquid
-        ! error control
-        message=trim(message)//'soil hydrology does not balance'
-        err=20; return
-      end if
-
-    ! end association of local variables with information in the data structures
-    end associate
-
-  ! end association to canopy depth
-  end associate canopy
-
-  ! Save the total soil water (Liquid+Ice)
-  diag_data%var(iLookDIAG%scalarTotalSoilWat)%dat(1) = balanceSoilWater1
-  ! save the surface temperature (just to make things easier to visualize)
-  prog_data%var(iLookPROG%scalarSurfaceTemp)%dat(1) = prog_data%var(iLookPROG%mLayerTemp)%dat(1)
-
-  ! overwrite flux data with the timestep-average value
-  if(.not.backwardsCompatibility)then
-    do iVar=1,size(flux_mean%var)
-    flux_data%var(averageFlux_meta(iVar)%ixParent)%dat = flux_mean%var(iVar)%dat
-    end do
-  end if
-
-  iLayer = nSnow+1
-  if(nsub>50000)then
-    write(message,'(a,i0)') trim(cmessage)//'number of sub-steps > 50000 for HRU ', indxHRU
-    err=20; return
-  end if
-
-
-end subroutine coupled_em
-
-
- ! *********************************************************************************************************
- ! private subroutine implctMelt: compute melt of the "snow without a layer"
- ! *********************************************************************************************************
- subroutine implctMelt(&
-                       ! input/output: integrated snowpack properties
-                       scalarSWE,         & ! intent(inout): snow water equivalent (kg m-2)
-                       scalarSnowDepth,   & ! intent(inout): snow depth (m)
-                       scalarSfcMeltPond, & ! intent(inout): surface melt pond (kg m-2)
-                       ! input/output: properties of the upper-most soil layer
-                       soilTemp,          & ! intent(inout): surface layer temperature (K)
-                       soilDepth,         & ! intent(inout): surface layer depth (m)
-                       soilHeatcap,       & ! intent(inout): surface layer volumetric heat capacity (J m-3 K-1)
-                       ! output: error control
-                       err,message        ) ! intent(out): error control
- implicit none
- ! input/output: integrated snowpack properties
- real(dp),intent(inout)    :: scalarSWE          ! snow water equivalent (kg m-2)
- real(dp),intent(inout)    :: scalarSnowDepth    ! snow depth (m)
- real(dp),intent(inout)    :: scalarSfcMeltPond  ! surface melt pond (kg m-2)
- ! input/output: properties of the upper-most soil layer
- real(dp),intent(inout)    :: soilTemp           ! surface layer temperature (K)
- real(dp),intent(inout)    :: soilDepth          ! surface layer depth (m)
- real(dp),intent(inout)    :: soilHeatcap        ! surface layer volumetric heat capacity (J m-3 K-1)
- ! output: error control
- integer(i4b),intent(out)  :: err                ! error code
- character(*),intent(out)  :: message            ! error message
- ! local variables
- real(dp)                  :: nrgRequired        ! energy required to melt all the snow (J m-2)
- real(dp)                  :: nrgAvailable       ! energy available to melt the snow (J m-2)
- real(dp)                  :: snwDensity         ! snow density (kg m-3)
- ! initialize error control
- err=0; message='implctMelt/'
-
- if(scalarSWE > 0._dp)then
-  ! only melt if temperature of the top soil layer is greater than Tfreeze
-  if(soilTemp > Tfreeze)then
-   ! compute the energy required to melt all the snow (J m-2)
-   nrgRequired     = scalarSWE*LH_fus
-   ! compute the energy available to melt the snow (J m-2)
-   nrgAvailable    = soilHeatcap*(soilTemp - Tfreeze)*soilDepth
-   ! compute the snow density (not saved)
-   snwDensity      = scalarSWE/scalarSnowDepth
-   ! compute the amount of melt, and update SWE (kg m-2)
-   if(nrgAvailable > nrgRequired)then
-    scalarSfcMeltPond  = scalarSWE
-    scalarSWE          = 0._dp
-   else
-    scalarSfcMeltPond  = nrgAvailable/LH_fus
-    scalarSWE          = scalarSWE - scalarSfcMeltPond
-   end if
-   ! update depth
-   scalarSnowDepth = scalarSWE/snwDensity
-   ! update temperature of the top soil layer (K)
-   soilTemp =  soilTemp - (LH_fus*scalarSfcMeltPond/soilDepth)/soilHeatcap
-  else  ! melt is zero if the temperature of the top soil layer is less than Tfreeze
-   scalarSfcMeltPond = 0._dp  ! kg m-2
-  end if ! (if the temperature of the top soil layer is greater than Tfreeze)
- else  ! melt is zero if the "snow without a layer" does not exist
-  scalarSfcMeltPond = 0._dp  ! kg m-2
- end if ! (if the "snow without a layer" exists)
-
- end subroutine implctMelt
-
-end module coupled_em_module
diff --git a/build/source/engine/sundials/mDecisions.f90 b/build/source/engine/sundials/mDecisions.f90
deleted file mode 100755
index 2a850ad5a535be4fbbe7517001745394319ab274..0000000000000000000000000000000000000000
--- a/build/source/engine/sundials/mDecisions.f90
+++ /dev/null
@@ -1,727 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module mDecisions_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-USE var_lookup, only: maxvarDecisions  ! maximum number of decisions
-implicit none
-private
-public::mDecisions
-! look-up values for the choice of function for the soil moisture control on stomatal resistance
-integer(i4b),parameter,public :: NoahType             =   1    ! thresholded linear function of volumetric liquid water content
-integer(i4b),parameter,public :: CLM_Type             =   2    ! thresholded linear function of matric head
-integer(i4b),parameter,public :: SiB_Type             =   3    ! exponential of the log of matric head
-! look-up values for the choice of stomatal resistance formulation
-integer(i4b),parameter,public :: BallBerry            =   1    ! Ball-Berry
-integer(i4b),parameter,public :: Jarvis               =   2    ! Jarvis
-integer(i4b),parameter,public :: simpleResistance     =   3    ! simple resistance formulation
-integer(i4b),parameter,public :: BallBerryFlex        =   4    ! flexible Ball-Berry scheme
-integer(i4b),parameter,public :: BallBerryTest        =   5    ! flexible Ball-Berry scheme (testing)
-! look-up values to define leaf temperature controls on photosynthesis + stomatal resistance
-integer(i4b),parameter,public :: q10Func              =  11    ! the q10 function used in CLM4 and Noah-MP
-integer(i4b),parameter,public :: Arrhenius            =  12    ! the Arrhenious functions used in CLM5 and Cable
-! look-up values to define humidity controls on stomatal resistance
-integer(i4b),parameter,public :: humidLeafSurface     =  21    ! humidity at the leaf surface [Bonan et al., 2011]
-integer(i4b),parameter,public :: scaledHyperbolic     =  22    ! scaled hyperbolic function [Leuning et al., 1995]
-! look-up values to define the electron transport function (dependence of photosynthesis on PAR)
-integer(i4b),parameter,public :: linear               =  31    ! linear function used in CLM4 and Noah-MP
-integer(i4b),parameter,public :: linearJmax           =  32    ! linear jmax function used in Cable [Wang et al., Ag Forest Met 1998, eq D5]
-integer(i4b),parameter,public :: quadraticJmax        =  33    ! the quadratic Jmax function, used in SSiB and CLM5
-! look up values to define the use of CO2 compensation point to calculate stomatal resistance
-integer(i4b),parameter,public :: origBWB              =  41    ! the original BWB approach
-integer(i4b),parameter,public :: Leuning              =  42    ! the Leuning approach
-! look up values to define the iterative numerical solution method used in the Ball-Berry stomatal resistance parameterization
-integer(i4b),parameter,public :: NoahMPsolution       =  51    ! the NoahMP solution (and CLM4): fixed point iteration; max 3 iterations
-integer(i4b),parameter,public :: newtonRaphson        =  52    ! full Newton-Raphson iterative solution to convergence
-! look up values to define the controls on carbon assimilation
-integer(i4b),parameter,public :: colimitation         =  61    ! enable colimitation, as described by Collatz et al. (1991) and Sellers et al. (1996)
-integer(i4b),parameter,public :: minFunc              =  62    ! do not enable colimitation: use minimum of the three controls on carbon assimilation
-! look up values to define the scaling of photosynthesis from the leaves to the canopy
-integer(i4b),parameter,public :: constantScaling      =  71    ! constant scaling factor
-integer(i4b),parameter,public :: laiScaling           =  72    ! exponential function of LAI (Leuning, Plant Cell Env 1995: "Scaling from..." [eq 9])
-! look-up values for the choice of numerical method
-integer(i4b),parameter,public :: bEuler               =  81    ! home-grown backward Euler solution with long time steps
-integer(i4b),parameter,public :: sundials             =  82    ! SUNDIALS/IDA solution
-! look-up values for method used to compute derivative
-integer(i4b),parameter,public :: numerical            =  91    ! numerical solution
-integer(i4b),parameter,public :: analytical           =  92    ! analytical solution
-! look-up values for method used to determine LAI and SAI
-integer(i4b),parameter,public :: monthlyTable         = 101    ! LAI/SAI taken directly from a monthly table for different vegetation classes
-integer(i4b),parameter,public :: specified            = 102    ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
-! look-up values for the choice of the canopy interception parameterization
-integer(i4b),parameter,public :: sparseCanopy         = 111    ! fraction of rainfall that never hits the canopy (throughfall); drainage above threshold
-integer(i4b),parameter,public :: storageFunc          = 112    ! throughfall a function of canopy storage; 100% throughfall when canopy is at capacity
-integer(i4b),parameter,public :: unDefined            = 113    ! option is undefined (backwards compatibility)
-! look-up values for the form of Richards' equation
-integer(i4b),parameter,public :: moisture             = 121    ! moisture-based form of Richards' equation
-integer(i4b),parameter,public :: mixdform             = 122    ! mixed form of Richards' equation
-! look-up values for the choice of groundwater parameterization
-integer(i4b),parameter,public :: qbaseTopmodel        = 131    ! TOPMODEL-ish baseflow parameterization
-integer(i4b),parameter,public :: bigBucket            = 132    ! a big bucket (lumped aquifer model)
-integer(i4b),parameter,public :: noExplicit           = 133    ! no explicit groundwater parameterization
-! look-up values for the choice of hydraulic conductivity profile
-integer(i4b),parameter,public :: constant             = 141    ! constant hydraulic conductivity with depth
-integer(i4b),parameter,public :: powerLaw_profile     = 142    ! power-law profile
-! look-up values for the choice of boundary conditions for thermodynamics
-integer(i4b),parameter,public :: prescribedTemp       = 151    ! prescribed temperature
-integer(i4b),parameter,public :: energyFlux           = 152    ! energy flux
-integer(i4b),parameter,public :: zeroFlux             = 153    ! zero flux
-! look-up values for the choice of boundary conditions for hydrology
-integer(i4b),parameter,public :: liquidFlux           = 161    ! liquid water flux
-integer(i4b),parameter,public :: prescribedHead       = 162    ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
-integer(i4b),parameter,public :: funcBottomHead       = 163    ! function of matric head in the lower-most layer
-integer(i4b),parameter,public :: freeDrainage         = 164    ! free drainage
-! look-up values for the choice of parameterization for vegetation roughness length and displacement height
-integer(i4b),parameter,public :: Raupach_BLM1994      = 171    ! Raupach (BLM 1994) "Simplified expressions..."
-integer(i4b),parameter,public :: CM_QJRMS1988         = 172    ! Choudhury and Monteith (QJRMS 1988) "A four layer model for the heat budget..."
-integer(i4b),parameter,public :: vegTypeTable         = 173    ! constant parameters dependent on the vegetation type
-! look-up values for the choice of parameterization for the rooting profile
-integer(i4b),parameter,public :: powerLaw             = 181    ! simple power-law rooting profile
-integer(i4b),parameter,public :: doubleExp            = 182    ! the double exponential function of Xeng et al. (JHM 2001)
-! look-up values for the choice of parameterization for canopy emissivity
-integer(i4b),parameter,public :: simplExp             = 191    ! simple exponential function
-integer(i4b),parameter,public :: difTrans             = 192    ! parameterized as a function of diffuse transmissivity
-! look-up values for the choice of parameterization for snow interception
-integer(i4b),parameter,public :: stickySnow           = 201    ! maximum interception capacity an increasing function of temerature
-integer(i4b),parameter,public :: lightSnow            = 202    ! maximum interception capacity an inverse function of new snow density
-! look-up values for the choice of wind profile
-integer(i4b),parameter,public :: exponential          = 211    ! exponential wind profile extends to the surface
-integer(i4b),parameter,public :: logBelowCanopy       = 212    ! logarithmic profile below the vegetation canopy
-! look-up values for the choice of stability function
-integer(i4b),parameter,public :: standard             = 221    ! standard MO similarity, a la Anderson (1976)
-integer(i4b),parameter,public :: louisInversePower    = 222    ! Louis (1979) inverse power function
-integer(i4b),parameter,public :: mahrtExponential     = 223    ! Mahrt (1987) exponential
-! look-up values for the choice of canopy shortwave radiation method
-integer(i4b),parameter,public :: noah_mp              = 231    ! full Noah-MP implementation (including albedo)
-integer(i4b),parameter,public :: CLM_2stream          = 232    ! CLM 2-stream model (see CLM documentation)
-integer(i4b),parameter,public :: UEB_2stream          = 233    ! UEB 2-stream model (Mahat and Tarboton, WRR 2011)
-integer(i4b),parameter,public :: NL_scatter           = 234    ! Simplified method Nijssen and Lettenmaier (JGR 1999)
-integer(i4b),parameter,public :: BeersLaw             = 235    ! Beer's Law (as implemented in VIC)
-! look-up values for the choice of albedo representation
-integer(i4b),parameter,public :: constantDecay        = 241    ! constant decay (e.g., VIC, CLASS)
-integer(i4b),parameter,public :: variableDecay        = 242    ! variable decay (e.g., BATS approach, with destructive metamorphism + soot content)
-! look-up values for the choice of compaction routine
-integer(i4b),parameter,public :: constantSettlement   = 251    ! constant settlement rate
-integer(i4b),parameter,public :: andersonEmpirical    = 252    ! semi-empirical method of Anderson (1976)
-! look-up values for the choice of method to combine and sub-divide snow layers
-integer(i4b),parameter,public :: sameRulesAllLayers   = 261    ! same combination/sub-division rules applied to all layers
-integer(i4b),parameter,public :: rulesDependLayerIndex= 262    ! combination/sub-dividion rules depend on layer index
-! look-up values for the choice of thermal conductivity representation for snow
-integer(i4b),parameter,public :: Yen1965              = 271    ! Yen (1965)
-integer(i4b),parameter,public :: Mellor1977           = 272    ! Mellor (1977)
-integer(i4b),parameter,public :: Jordan1991           = 273    ! Jordan (1991)
-integer(i4b),parameter,public :: Smirnova2000         = 274    ! Smirnova et al. (2000)
-! look-up values for the choice of thermal conductivityi representation for soil
-integer(i4b),parameter,public :: funcSoilWet          = 281    ! function of soil wetness
-integer(i4b),parameter,public :: mixConstit           = 282    ! mixture of constituents
-integer(i4b),parameter,public :: hanssonVZJ           = 283    ! test case for the mizoguchi lab experiment, Hansson et al. VZJ 2004
-! look-up values for the choice of method for the spatial representation of groundwater
-integer(i4b),parameter,public :: localColumn          = 291    ! separate groundwater representation in each local soil column
-integer(i4b),parameter,public :: singleBasin          = 292    ! single groundwater store over the entire basin
-! look-up values for the choice of sub-grid routing method
-integer(i4b),parameter,public :: timeDelay            = 301    ! time-delay histogram
-integer(i4b),parameter,public :: qInstant             = 302    ! instantaneous routing
-! look-up values for the choice of new snow density method
-integer(i4b),parameter,public :: constDens            = 311    ! Constant new snow density
-integer(i4b),parameter,public :: anderson             = 312    ! Anderson 1976
-integer(i4b),parameter,public :: hedAndPom            = 313    ! Hedstrom and Pomeroy (1998), expoential increase
-integer(i4b),parameter,public :: pahaut_76            = 314    ! Pahaut 1976, wind speed dependent (derived from Col de Porte, French Alps)
-! look-up values for the choice of snow unloading from the canopy
-integer(i4b),parameter,public :: meltDripUnload       = 321    ! Hedstrom and Pomeroy (1998), Storck et al 2002 (snowUnloadingCoeff & ratioDrip2Unloading)
-integer(i4b),parameter,public :: windUnload           = 322    ! Roesch et al 2001, formulate unloading based on wind and temperature
-! look-up values for the choice of energy equation
-integer(i4b),parameter,public :: enthalpyFD           = 323    ! enthalpyFD
-integer(i4b),parameter,public :: closedForm           = 324    ! closedForm
-! -----------------------------------------------------------------------------------------------------------
-
-contains
-
-! ************************************************************************************************
-! public subroutine mDecisions: save model decisions as named integers
-! ************************************************************************************************
-subroutine mDecisions(num_steps,err) bind(C, name='mDecisions')
-  ! model time structures
-  USE multiconst,only:secprday               ! number of seconds in a day
-  USE var_lookup,only:iLookTIME              ! named variables that identify indices in the time structures
-  USE globalData,only:refTime,refJulday      ! reference time
-  USE globalData,only:oldTime                ! time from the previous time step
-  USE globalData,only:startTime,finshTime    ! start/end time of simulation
-  USE globalData,only:dJulianStart           ! julian day of start time of simulation
-  USE globalData,only:dJulianFinsh           ! julian day of end time of simulation
-  USE globalData,only:data_step              ! length of data step (s)
-  USE globalData,only:numtim                 ! number of time steps in the simulation
-  ! model decision structures
-  USE globaldata,only:model_decisions        ! model decision structure
-  USE var_lookup,only:iLookDECISIONS         ! named variables for elements of the decision structure
-  ! forcing metadata
-  USE globalData,only:forc_meta              ! metadata structures
-  USE var_lookup,only:iLookFORCE             ! named variables to define structure elements
-  ! Noah-MP decision structures
-  USE noahmp_globals,only:DVEG               ! decision for dynamic vegetation
-  USE noahmp_globals,only:OPT_RAD            ! decision for canopy radiation
-  USE noahmp_globals,only:OPT_ALB            ! decision for snow albedo
-  ! time utility programs
-  USE time_utils_module,only:extractTime     ! extract time info from units string
-  USE time_utils_module,only:compjulday      ! compute the julian day
-  USE time_utils_module,only:fracDay         ! compute fractional day
-  USE summaFileManager,only: SIM_START_TM, SIM_END_TM   ! time info from control file module
-
-  implicit none
-  ! define output
-  integer(c_int),intent(out)           :: num_steps
-  integer(c_int),intent(out)           :: err            ! error code
-  ! define local variables
-  character(len=256)                   :: message        ! error message
-  character(len=256)                   :: cmessage       ! error message for downwind routine
-  real(rkind)                          :: dsec,dsec_tz   ! second
-  ! initialize error control
-  err=0; message='mDecisions/'
-
-  ! read information from model decisions file, and populate model decisions structure
-  call readoption(err,cmessage)
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-
-  ! put reference time information into the time structures
-  call extractTime(forc_meta(iLookFORCE%time)%varunit,                     & ! date-time string
-                    refTime%var(iLookTIME%iyyy),                           & ! year
-                    refTime%var(iLookTIME%im),                             & ! month
-                    refTime%var(iLookTIME%id),                             & ! day
-                    refTime%var(iLookTIME%ih),                             & ! hour
-                    refTime%var(iLookTIME%imin),                           & ! minute
-                    dsec,                                                  & ! second
-                    refTime%var(iLookTIME%ih_tz),                          & ! time zone hour
-                    refTime%var(iLookTIME%imin_tz),                        & ! time zone minute
-                    dsec_tz,                                               & ! time zone seconds
-                    err,cmessage)                                            ! error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-  ! compute the julian date (fraction of day) for the reference time
-  call compjulday(&
-                  refTime%var(iLookTIME%iyyy),                            & ! year
-                  refTime%var(iLookTIME%im),                              & ! month
-                  refTime%var(iLookTIME%id),                              & ! day
-                  refTime%var(iLookTIME%ih),                              & ! hour
-                  refTime%var(iLookTIME%imin),                            & ! minute
-                  0._rkind,                                               & ! second
-                  refJulday,                                              & ! julian date for the start of the simulation
-                  err, cmessage)                                            ! error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-  ! put simulation start time information into the time structures
-  call extractTime(trim(SIM_START_TM),                                     & ! date-time string
-                    startTime%var(iLookTIME%iyyy),                         & ! year
-                    startTime%var(iLookTIME%im),                           & ! month
-                    startTime%var(iLookTIME%id),                           & ! day
-                    startTime%var(iLookTIME%ih),                           & ! hour
-                    startTime%var(iLookTIME%imin),                         & ! minute
-                    dsec,                                                  & ! second
-                    startTime%var(iLookTIME%ih_tz),                        & ! time zone hour
-                    startTime%var(iLookTIME%imin_tz),                      & ! time zone minnute
-                    dsec_tz,                                               & ! time zone seconds
-                    err,cmessage)                                            ! error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-  ! compute the julian date (fraction of day) for the start of the simulation
-  call compjulday(&
-                  startTime%var(iLookTIME%iyyy),                           & ! year
-                  startTime%var(iLookTIME%im),                             & ! month
-                  startTime%var(iLookTIME%id),                             & ! day
-                  startTime%var(iLookTIME%ih),                             & ! hour
-                  startTime%var(iLookTIME%imin),                           & ! minute
-                  0._rkind,                                                & ! second
-                  dJulianStart,                                            & ! julian date for the start of the simulation
-                  err, cmessage)                                             ! error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-  ! put simulation end time information into the time structures
-  call extractTime(trim(SIM_END_TM),                                       & ! date-time string
-                    finshTime%var(iLookTIME%iyyy),                         & ! year
-                    finshTime%var(iLookTIME%im),                           & ! month
-                    finshTime%var(iLookTIME%id),                           & ! day
-                    finshTime%var(iLookTIME%ih),                           & ! hour
-                    finshTime%var(iLookTIME%imin),                         & ! minute
-                    dsec,                                                  & ! second
-                    finshTime%var(iLookTIME%ih_tz),                        & ! time zone hour
-                    finshTime%var(iLookTIME%imin_tz),                      & ! time zone minnute
-                    dsec_tz,                                               & ! time zone seconds
-                    err,cmessage)                                            ! error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-  ! compute the julian date (fraction of day) for the end of the simulation
-  call compjulday(&
-                  finshTime%var(iLookTIME%iyyy),                         & ! year
-                  finshTime%var(iLookTIME%im),                           & ! month
-                  finshTime%var(iLookTIME%id),                           & ! day
-                  finshTime%var(iLookTIME%ih),                           & ! hour
-                  finshTime%var(iLookTIME%imin),                         & ! minute
-                  0._rkind,                                              & ! second
-                  dJulianFinsh,                                          & ! julian date for the end of the simulation
-                  err, cmessage)                                           ! error control
-  if(err/=0)then; err=20; message=trim(message)//trim(cmessage); return; end if
-
-  ! check start and finish time
-  write(*,'(a,i4,1x,4(i2,1x))') 'startTime: iyyy, im, id, ih, imin = ', startTime%var(1:5)
-  write(*,'(a,i4,1x,4(i2,1x))') 'finshTime: iyyy, im, id, ih, imin = ', finshTime%var(1:5)
-
-  ! check that simulation end time is > start time
-  if(dJulianFinsh < dJulianStart)then; err=20; message=trim(message)//'end time of simulation occurs before start time'; return; end if
-
-  ! initialize the old time vector (time from the previous time step)
-  oldTime%var(:) = startTime%var(:)
-
-  ! compute the number of time steps
-  num_steps = nint( (dJulianFinsh - dJulianStart)*secprday/data_step ) + 1
-  numTim = num_steps
-
-
-  ! set Noah-MP options
-  DVEG=3      ! option for dynamic vegetation
-  OPT_RAD=3   ! option for canopy radiation
-  OPT_ALB=2   ! option for snow albedo
-
-  ! set zero option for thee category tables
-  ! NOTE: we want to keep track of these decisions, but not used in the physics routines
-  model_decisions(iLookDECISIONS%soilCatTbl)%iDecision = 0
-  model_decisions(iLookDECISIONS%vegeParTbl)%iDecision = 0
-
-  ! identify the choice of function for the soil moisture control on stomatal resistance
-  select case(trim(model_decisions(iLookDECISIONS%soilStress)%cDecision))
-    case('NoahType'); model_decisions(iLookDECISIONS%soilStress)%iDecision = NoahType             ! thresholded linear function of volumetric liquid water content
-    case('CLM_Type'); model_decisions(iLookDECISIONS%soilStress)%iDecision = CLM_Type             ! thresholded linear function of matric head
-    case('SiB_Type'); model_decisions(iLookDECISIONS%soilStress)%iDecision = SiB_Type             ! exponential of the log of matric head
-    case default
-      err=10; message=trim(message)//"unknown soil moisture function [option="//trim(model_decisions(iLookDECISIONS%soilStress)%cDecision)//"]"; return
-  end select
-
-  ! identify the choice of function for stomatal resistance
-  select case(trim(model_decisions(iLookDECISIONS%stomResist)%cDecision))
-    case('BallBerry'          ); model_decisions(iLookDECISIONS%stomResist)%iDecision = BallBerry           ! Ball-Berry
-    case('Jarvis'             ); model_decisions(iLookDECISIONS%stomResist)%iDecision = Jarvis              ! Jarvis
-    case('simpleResistance'   ); model_decisions(iLookDECISIONS%stomResist)%iDecision = simpleResistance    ! simple resistance formulation
-    case('BallBerryFlex'      ); model_decisions(iLookDECISIONS%stomResist)%iDecision = BallBerryFlex       ! flexible Ball-Berry scheme
-    case('BallBerryTest'      ); model_decisions(iLookDECISIONS%stomResist)%iDecision = BallBerryTest       ! flexible Ball-Berry scheme (testing)
-    case default
-      err=10; message=trim(message)//"unknown stomatal resistance function [option="//trim(model_decisions(iLookDECISIONS%stomResist)%cDecision)//"]"; return
-  end select
-
-  ! identify the leaf temperature controls on photosynthesis + stomatal resistance
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbTempFunc)%cDecision))
-      case('q10Func'            ); model_decisions(iLookDECISIONS%bbTempFunc)%iDecision = q10Func
-      case('Arrhenius'          ); model_decisions(iLookDECISIONS%bbTempFunc)%iDecision = Arrhenius
-      case default
-        err=10; message=trim(message)//"unknown leaf temperature function [option="//trim(model_decisions(iLookDECISIONS%bbTempFunc)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify the humidity controls on stomatal resistance
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbHumdFunc)%cDecision))
-      case('humidLeafSurface'   ); model_decisions(iLookDECISIONS%bbHumdFunc)%iDecision = humidLeafSurface
-      case('scaledHyperbolic'   ); model_decisions(iLookDECISIONS%bbHumdFunc)%iDecision = scaledHyperbolic
-      case default
-        err=10; message=trim(message)//"unknown humidity function [option="//trim(model_decisions(iLookDECISIONS%bbHumdFunc)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify functions for electron transport function (dependence of photosynthesis on PAR)
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbElecFunc)%cDecision))
-      case('linear'             ); model_decisions(iLookDECISIONS%bbElecFunc)%iDecision = linear
-      case('linearJmax'         ); model_decisions(iLookDECISIONS%bbElecFunc)%iDecision = linearJmax
-      case('quadraticJmax'      ); model_decisions(iLookDECISIONS%bbElecFunc)%iDecision = quadraticJmax
-      case default
-        err=10; message=trim(message)//"unknown electron transport function [option="//trim(model_decisions(iLookDECISIONS%bbElecFunc)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify the use of the co2 compensation point in the stomatal conductance calaculations
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbCO2point)%cDecision))
-      case('origBWB'            ); model_decisions(iLookDECISIONS%bbCO2point)%iDecision = origBWB
-      case('Leuning'            ); model_decisions(iLookDECISIONS%bbCO2point)%iDecision = Leuning
-      case default
-        err=10; message=trim(message)//"unknown option for the co2 compensation point [option="//trim(model_decisions(iLookDECISIONS%bbCO2point)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify the iterative numerical solution method used in the Ball-Berry stomatal resistance parameterization
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbNumerics)%cDecision))
-      case('NoahMPsolution'     ); model_decisions(iLookDECISIONS%bbNumerics)%iDecision = NoahMPsolution  ! the NoahMP solution (and CLM4): fixed point iteration; max 3 iterations
-      case('newtonRaphson'      ); model_decisions(iLookDECISIONS%bbNumerics)%iDecision = newtonRaphson   ! full Newton-Raphson iterative solution to convergence
-      case default
-        err=10; message=trim(message)//"unknown option for the Ball-Berry numerical solution [option="//trim(model_decisions(iLookDECISIONS%bbNumerics)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify the controls on carbon assimilation
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbAssimFnc)%cDecision))
-      case('colimitation'       ); model_decisions(iLookDECISIONS%bbAssimFnc)%iDecision = colimitation    ! enable colimitation, as described by Collatz et al. (1991) and Sellers et al. (1996)
-      case('minFunc'            ); model_decisions(iLookDECISIONS%bbAssimFnc)%iDecision = minFunc         ! do not enable colimitation: use minimum of the three controls on carbon assimilation
-      case default
-        err=10; message=trim(message)//"unknown option for the controls on carbon assimilation [option="//trim(model_decisions(iLookDECISIONS%bbAssimFnc)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify the scaling of photosynthesis from the leaf to the canopy
-  if(model_decisions(iLookDECISIONS%stomResist)%iDecision >= BallBerryFlex)then
-    select case(trim(model_decisions(iLookDECISIONS%bbCanIntg8)%cDecision))
-      case('constantScaling'    ); model_decisions(iLookDECISIONS%bbCanIntg8)%iDecision = constantScaling ! constant scaling factor
-      case('laiScaling'         ); model_decisions(iLookDECISIONS%bbCanIntg8)%iDecision = laiScaling      ! exponential function of LAI (Leuning, Plant Cell Env 1995: "Scaling from..." [eq 9])
-      case default
-        err=10; message=trim(message)//"unknown option for scaling of photosynthesis from the leaf to the canopy [option="//trim(model_decisions(iLookDECISIONS%bbCanIntg8)%cDecision)//"]"; return
-    end select
-  end if
-
-  ! identify the numerical method
-  select case(trim(model_decisions(iLookDECISIONS%num_method)%cDecision))
-    case('bEuler'   ); model_decisions(iLookDECISIONS%num_method)%iDecision = bEuler             ! home-grown backward Euler solution with long time steps
-    case('itertive' ); model_decisions(iLookDECISIONS%num_method)%iDecision = bEuler             ! home-grown backward Euler solution (included for backwards compatibility)
-    case('sundials' ); model_decisions(iLookDECISIONS%num_method)%iDecision = sundials           ! SUNDIALS/IDA solution
-    case default
-      err=10; message=trim(message)//"unknown numerical method [option="//trim(model_decisions(iLookDECISIONS%num_method)%cDecision)//"]"; return
-  end select
-
-  ! how to compute heat capacity in energy equation
-  select case(trim(model_decisions(iLookDECISIONS%howHeatCap)%cDecision))
-    case('enthalpyFD'); model_decisions(iLookDECISIONS%howHeatCap)%iDecision = enthalpyFD        ! enthalpyFD
-    case('closedForm'); model_decisions(iLookDECISIONS%howHeatCap)%iDecision = closedForm        ! closedForm
-    case default
-      err=10; message=trim(message)//"unknown Cp computation [option="//trim(model_decisions(iLookDECISIONS%howHeatCap)%cDecision)//"]"; return
-  end select
-
-  ! identify the method used to calculate flux derivatives
-  select case(trim(model_decisions(iLookDECISIONS%fDerivMeth)%cDecision))
-    case('numericl'); model_decisions(iLookDECISIONS%fDerivMeth)%iDecision = numerical           ! numerical
-    case('analytic'); model_decisions(iLookDECISIONS%fDerivMeth)%iDecision = analytical          ! analytical
-    case default
-      err=10; message=trim(message)//"unknown method used to calculate flux derivatives [option="//trim(model_decisions(iLookDECISIONS%fDerivMeth)%cDecision)//"]"; return
-  end select
-
-  ! identify the method used to determine LAI and SAI
-  select case(trim(model_decisions(iLookDECISIONS%LAI_method)%cDecision))
-    case('monTable');  model_decisions(iLookDECISIONS%LAI_method)%iDecision = monthlyTable       ! LAI/SAI taken directly from a monthly table for different vegetation classes
-    case('specified'); model_decisions(iLookDECISIONS%LAI_method)%iDecision = specified          ! LAI/SAI computed from green vegetation fraction and winterSAI and summerLAI parameters
-    case default
-      err=10; message=trim(message)//"unknown method to determine LAI and SAI [option="//trim(model_decisions(iLookDECISIONS%LAI_method)%cDecision)//"]"; return
-  end select
-
-  ! identify the canopy interception parameterization
-  select case(trim(model_decisions(iLookDECISIONS%cIntercept)%cDecision))
-    case('notPopulatedYet'); model_decisions(iLookDECISIONS%cIntercept)%iDecision = unDefined
-    case('sparseCanopy');    model_decisions(iLookDECISIONS%cIntercept)%iDecision = sparseCanopy
-    case('storageFunc');     model_decisions(iLookDECISIONS%cIntercept)%iDecision = storageFunc
-    case default
-      err=10; message=trim(message)//"unknown canopy interception parameterization [option="//trim(model_decisions(iLookDECISIONS%cIntercept)%cDecision)//"]"; return
-  end select
-
-  ! identify the form of Richards' equation
-  select case(trim(model_decisions(iLookDECISIONS%f_Richards)%cDecision))
-    case('moisture'); model_decisions(iLookDECISIONS%f_Richards)%iDecision = moisture            ! moisture-based form
-    case('mixdform'); model_decisions(iLookDECISIONS%f_Richards)%iDecision = mixdform            ! mixed form
-    case default
-      err=10; message=trim(message)//"unknown form of Richards' equation [option="//trim(model_decisions(iLookDECISIONS%f_Richards)%cDecision)//"]"; return
-  end select
-
-  ! identify the groundwater parameterization
-  select case(trim(model_decisions(iLookDECISIONS%groundwatr)%cDecision))
-    case('qTopmodl'); model_decisions(iLookDECISIONS%groundwatr)%iDecision = qbaseTopmodel       ! TOPMODEL-ish baseflow parameterization
-    case('bigBuckt'); model_decisions(iLookDECISIONS%groundwatr)%iDecision = bigBucket           ! a big bucket (lumped aquifer model)
-    case('noXplict'); model_decisions(iLookDECISIONS%groundwatr)%iDecision = noExplicit          ! no explicit groundwater parameterization
-    case default
-      err=10; message=trim(message)//"unknown groundwater parameterization [option="//trim(model_decisions(iLookDECISIONS%groundwatr)%cDecision)//"]"; return
-  end select
-
-  ! identify the hydraulic conductivity profile
-  select case(trim(model_decisions(iLookDECISIONS%hc_profile)%cDecision))
-    case('constant'); model_decisions(iLookDECISIONS%hc_profile)%iDecision = constant            ! constant hydraulic conductivity with depth
-    case('pow_prof'); model_decisions(iLookDECISIONS%hc_profile)%iDecision = powerLaw_profile    ! power-law profile
-    case default
-      err=10; message=trim(message)//"unknown hydraulic conductivity profile [option="//trim(model_decisions(iLookDECISIONS%hc_profile)%cDecision)//"]"; return
-  end select
-
-  ! identify the upper boundary conditions for thermodynamics
-  select case(trim(model_decisions(iLookDECISIONS%bcUpprTdyn)%cDecision))
-    case('presTemp'); model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision = prescribedTemp      ! prescribed temperature
-    case('nrg_flux'); model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision = energyFlux          ! energy flux
-    case('zeroFlux'); model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision = zeroFlux            ! zero flux
-    case default
-      err=10; message=trim(message)//"unknown upper boundary conditions for thermodynamics [option="//trim(model_decisions(iLookDECISIONS%bcUpprTdyn)%cDecision)//"]"; return
-  end select
-
-  ! identify the lower boundary conditions for thermodynamics
-  select case(trim(model_decisions(iLookDECISIONS%bcLowrTdyn)%cDecision))
-    case('presTemp'); model_decisions(iLookDECISIONS%bcLowrTdyn)%iDecision = prescribedTemp      ! prescribed temperature
-    case('zeroFlux'); model_decisions(iLookDECISIONS%bcLowrTdyn)%iDecision = zeroFlux            ! zero flux
-    case default
-      err=10; message=trim(message)//"unknown lower boundary conditions for thermodynamics [option="//trim(model_decisions(iLookDECISIONS%bcLowrTdyn)%cDecision)//"]"; return
-  end select
-
-  ! identify the upper boundary conditions for soil hydrology
-  select case(trim(model_decisions(iLookDECISIONS%bcUpprSoiH)%cDecision))
-    case('presHead'); model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision = prescribedHead      ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
-    case('liq_flux'); model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision = liquidFlux          ! liquid water flux
-    case default
-      err=10; message=trim(message)//"unknown upper boundary conditions for soil hydrology [option="//trim(model_decisions(iLookDECISIONS%bcUpprSoiH)%cDecision)//"]"; return
-  end select
-
-  ! identify the lower boundary conditions for soil hydrology
-  select case(trim(model_decisions(iLookDECISIONS%bcLowrSoiH)%cDecision))
-    case('presHead'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = prescribedHead      ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
-    case('bottmPsi'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = funcBottomHead      ! function of matric head in the lower-most layer
-    case('drainage'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = freeDrainage        ! free drainage
-    case('zeroFlux'); model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision = zeroFlux            ! zero flux
-    case default
-      err=10; message=trim(message)//"unknown lower boundary conditions for soil hydrology [option="//trim(model_decisions(iLookDECISIONS%bcLowrSoiH)%cDecision)//"]"; return
-  end select
-
-  ! identify the choice of parameterization for vegetation roughness length and displacement height
-  select case(trim(model_decisions(iLookDECISIONS%veg_traits)%cDecision))
-    case('Raupach_BLM1994'); model_decisions(iLookDECISIONS%veg_traits)%iDecision = Raupach_BLM1994  ! Raupach (BLM 1994) "Simplified expressions..."
-    case('CM_QJRMS1988'   ); model_decisions(iLookDECISIONS%veg_traits)%iDecision = CM_QJRMS1988     ! Choudhury and Monteith (QJRMS 1998) "A four layer model for the heat budget..."
-    case('vegTypeTable'   ); model_decisions(iLookDECISIONS%veg_traits)%iDecision = vegTypeTable     ! constant parameters dependent on the vegetation type
-    case default
-      err=10; message=trim(message)//"unknown parameterization for vegetation roughness length and displacement height [option="//trim(model_decisions(iLookDECISIONS%veg_traits)%cDecision)//"]"; return
-  end select
-
-  ! identify the choice of parameterization for the rooting profile
-  ! NOTE: for backwards compatibility select powerLaw if rooting profile is undefined
-  select case(trim(model_decisions(iLookDECISIONS%rootProfil)%cDecision))
-    case('powerLaw','notPopulatedYet');  model_decisions(iLookDECISIONS%rootProfil)%iDecision = powerLaw      ! simple power-law rooting profile
-    case('doubleExp');                   model_decisions(iLookDECISIONS%rootProfil)%iDecision = doubleExp     ! the double exponential function of Xeng et al. (JHM 2001)
-    case default
-      err=10; message=trim(message)//"unknown parameterization for rooting profile [option="//trim(model_decisions(iLookDECISIONS%rootProfil)%cDecision)//"]"; return
-  end select
-
-  ! identify the choice of parameterization for canopy emissivity
-  select case(trim(model_decisions(iLookDECISIONS%canopyEmis)%cDecision))
-    case('simplExp'); model_decisions(iLookDECISIONS%canopyEmis)%iDecision = simplExp            ! simple exponential function
-    case('difTrans'); model_decisions(iLookDECISIONS%canopyEmis)%iDecision = difTrans            ! parameterized as a function of diffuse transmissivity
-    case default
-      err=10; message=trim(message)//"unknown parameterization for canopy emissivity [option="//trim(model_decisions(iLookDECISIONS%canopyEmis)%cDecision)//"]"; return
-  end select
-
-  ! choice of parameterization for snow interception
-  select case(trim(model_decisions(iLookDECISIONS%snowIncept)%cDecision))
-    case('stickySnow'); model_decisions(iLookDECISIONS%snowIncept)%iDecision = stickySnow        ! maximum interception capacity an increasing function of temerature
-    case('lightSnow' ); model_decisions(iLookDECISIONS%snowIncept)%iDecision = lightSnow         ! maximum interception capacity an inverse function of new snow density
-    case default
-      err=10; message=trim(message)//"unknown option for snow interception capacity[option="//trim(model_decisions(iLookDECISIONS%snowIncept)%cDecision)//"]"; return
-  end select
-
-  ! identify the choice of wind profile
-  select case(trim(model_decisions(iLookDECISIONS%windPrfile)%cDecision))
-    case('exponential'   ); model_decisions(iLookDECISIONS%windPrfile)%iDecision = exponential      ! exponential wind profile extends to the surface
-    case('logBelowCanopy'); model_decisions(iLookDECISIONS%windPrfile)%iDecision = logBelowCanopy   ! logarithmic profile below the vegetation canopy
-    case default
-      err=10; message=trim(message)//"unknown option for choice of wind profile[option="//trim(model_decisions(iLookDECISIONS%windPrfile)%cDecision)//"]"; return
-  end select
-
-  ! identify the choice of atmospheric stability function
-  select case(trim(model_decisions(iLookDECISIONS%astability)%cDecision))
-    case('standard'); model_decisions(iLookDECISIONS%astability)%iDecision = standard            ! standard MO similarity, a la Anderson (1976)
-    case('louisinv'); model_decisions(iLookDECISIONS%astability)%iDecision = louisInversePower   ! Louis (1979) inverse power function
-    case('mahrtexp'); model_decisions(iLookDECISIONS%astability)%iDecision = mahrtExponential    ! Mahrt (1987) exponential
-    case default
-      err=10; message=trim(message)//"unknown stability function [option="//trim(model_decisions(iLookDECISIONS%astability)%cDecision)//"]"; return
-  end select
-
-  ! choice of canopy shortwave radiation method
-  select case(trim(model_decisions(iLookDECISIONS%canopySrad)%cDecision))
-    case('noah_mp'    ); model_decisions(iLookDECISIONS%canopySrad)%iDecision = noah_mp          ! full Noah-MP implementation (including albedo)
-    case('CLM_2stream'); model_decisions(iLookDECISIONS%canopySrad)%iDecision = CLM_2stream      ! CLM 2-stream model (see CLM documentation)
-    case('UEB_2stream'); model_decisions(iLookDECISIONS%canopySrad)%iDecision = UEB_2stream      ! UEB 2-stream model (Mahat and Tarboton, WRR 2011)
-    case('NL_scatter' ); model_decisions(iLookDECISIONS%canopySrad)%iDecision = NL_scatter       ! Simplified method Nijssen and Lettenmaier (JGR 1999)
-    case('BeersLaw'   ); model_decisions(iLookDECISIONS%canopySrad)%iDecision = BeersLaw         ! Beer's Law (as implemented in VIC)
-    case default
-      err=10; message=trim(message)//"unknown canopy radiation method [option="//trim(model_decisions(iLookDECISIONS%canopySrad)%cDecision)//"]"; return
-  end select
-
-  ! choice of albedo representation
-  select case(trim(model_decisions(iLookDECISIONS%alb_method)%cDecision))
-    case('conDecay'); model_decisions(iLookDECISIONS%alb_method)%iDecision = constantDecay       ! constant decay (e.g., VIC, CLASS)
-    case('varDecay'); model_decisions(iLookDECISIONS%alb_method)%iDecision = variableDecay       ! variable decay (e.g., BATS approach, with destructive metamorphism + soot content)
-    case default
-      err=10; message=trim(message)//"unknown option for snow albedo [option="//trim(model_decisions(iLookDECISIONS%alb_method)%cDecision)//"]"; return
-  end select
-
-  ! choice of snow compaction routine
-  select case(trim(model_decisions(iLookDECISIONS%compaction)%cDecision))
-    case('consettl'); model_decisions(iLookDECISIONS%compaction)%iDecision = constantSettlement  ! constant settlement rate
-    case('anderson'); model_decisions(iLookDECISIONS%compaction)%iDecision = andersonEmpirical   ! semi-empirical method of Anderson (1976)
-    case default
-      err=10; message=trim(message)//"unknown option for snow compaction [option="//trim(model_decisions(iLookDECISIONS%compaction)%cDecision)//"]"; return
-  end select
-
-  ! choice of method to combine and sub-divide snow layers
-  select case(trim(model_decisions(iLookDECISIONS%snowLayers)%cDecision))
-    case('jrdn1991'); model_decisions(iLookDECISIONS%snowLayers)%iDecision = sameRulesAllLayers    ! SNTHERM option: same combination/sub-dividion rules applied to all layers
-    case('CLM_2010'); model_decisions(iLookDECISIONS%snowLayers)%iDecision = rulesDependLayerIndex ! CLM option: combination/sub-dividion rules depend on layer index
-    case default
-      err=10; message=trim(message)//"unknown option for combination/sub-division of snow layers [option="//trim(model_decisions(iLookDECISIONS%snowLayers)%cDecision)//"]"; return
-  end select
-
-  ! choice of thermal conductivity representation for snow
-  select case(trim(model_decisions(iLookDECISIONS%thCondSnow)%cDecision))
-    case('tyen1965'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Yen1965             ! Yen (1965)
-    case('melr1977'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Mellor1977          ! Mellor (1977)
-    case('jrdn1991'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Jordan1991          ! Jordan (1991)
-    case('smnv2000'); model_decisions(iLookDECISIONS%thCondSnow)%iDecision = Smirnova2000        ! Smirnova et al. (2000)
-    case default
-      err=10; message=trim(message)//"unknown option for thermal conductivity of snow [option="//trim(model_decisions(iLookDECISIONS%thCondSnow)%cDecision)//"]"; return
-  end select
-
-  ! choice of thermal conductivity representation for soil
-  select case(trim(model_decisions(iLookDECISIONS%thCondSoil)%cDecision))
-    case('funcSoilWet'); model_decisions(iLookDECISIONS%thCondSoil)%iDecision = funcSoilWet      ! function of soil wetness
-    case('mixConstit' ); model_decisions(iLookDECISIONS%thCondSoil)%iDecision = mixConstit       ! mixture of constituents
-    case('hanssonVZJ' ); model_decisions(iLookDECISIONS%thCondSoil)%iDecision = hanssonVZJ       ! test case for the mizoguchi lab experiment, Hansson et al. VZJ 2004
-    case default
-      err=10; message=trim(message)//"unknown option for thermal conductivity of soil [option="//trim(model_decisions(iLookDECISIONS%thCondSoil)%cDecision)//"]"; return
-  end select
-
-  ! choice of method for the spatial representation of groundwater
-  select case(trim(model_decisions(iLookDECISIONS%spatial_gw)%cDecision))
-    case('localColumn'); model_decisions(iLookDECISIONS%spatial_gw)%iDecision = localColumn       ! separate groundwater in each local soil column
-    case('singleBasin'); model_decisions(iLookDECISIONS%spatial_gw)%iDecision = singleBasin       ! single groundwater store over the entire basin
-    case default
-      err=10; message=trim(message)//"unknown option for spatial representation of groundwater [option="//trim(model_decisions(iLookDECISIONS%spatial_gw)%cDecision)//"]"; return
-  end select
-
-  ! choice of routing method
-  select case(trim(model_decisions(iLookDECISIONS%subRouting)%cDecision))
-    case('timeDlay'); model_decisions(iLookDECISIONS%subRouting)%iDecision = timeDelay           ! time-delay histogram
-    case('qInstant'); model_decisions(iLookDECISIONS%subRouting)%iDecision = qInstant            ! instantaneous routing
-    case default
-      err=10; message=trim(message)//"unknown option for sub-grid routing [option="//trim(model_decisions(iLookDECISIONS%subRouting)%cDecision)//"]"; return
-  end select
-
-  ! choice of new snow density
-  ! NOTE: use hedAndPom as the default, where density method is undefined (not populated yet)
-  select case(trim(model_decisions(iLookDECISIONS%snowDenNew)%cDecision))
-    case('hedAndPom','notPopulatedYet'); model_decisions(iLookDECISIONS%snowDenNew)%iDecision = hedAndPom           ! Hedstrom and Pomeroy (1998), expoential increase
-    case('anderson');                    model_decisions(iLookDECISIONS%snowDenNew)%iDecision = anderson            ! Anderson 1976
-    case('pahaut_76');                   model_decisions(iLookDECISIONS%snowDenNew)%iDecision = pahaut_76           ! Pahaut 1976, wind speed dependent (derived from Col de Porte, French Alps)
-    case('constDens');                   model_decisions(iLookDECISIONS%snowDenNew)%iDecision = constDens           ! Constant new snow density
-    case default
-      err=10; message=trim(message)//"unknown option for new snow density [option="//trim(model_decisions(iLookDECISIONS%snowDenNew)%cDecision)//"]"; return
-  end select
-
-  ! choice of snow unloading from canopy
-  select case(trim(model_decisions(iLookDECISIONS%snowUnload)%cDecision))
-    case('meltDripUnload','notPopulatedYet'); model_decisions(iLookDECISIONS%snowUnload)%iDecision = meltDripUnload  ! Hedstrom and Pomeroy (1998), Storck et al 2002 (snowUnloadingCoeff & ratioDrip2Unloading)
-    case('windUnload');                       model_decisions(iLookDECISIONS%snowUnload)%iDecision = windUnload          ! Roesch et al 2001, formulate unloading based on wind and temperature
-    case default
-      err=10; message=trim(message)//"unknown option for snow unloading [option="//trim(model_decisions(iLookDECISIONS%snowUnload)%cDecision)//"]"; return
-  end select
-
-
-  ! -----------------------------------------------------------------------------------------------------------------------------------------------
-  ! check for consistency among options
-  ! -----------------------------------------------------------------------------------------------------------------------------------------------
-  ! check zero flux lower boundary for topmodel baseflow option
-  select case(model_decisions(iLookDECISIONS%groundwatr)%iDecision)
-    case(qbaseTopmodel)
-      if(model_decisions(iLookDECISIONS%bcLowrSoiH)%iDecision /= zeroFlux)then
-        message=trim(message)//'lower boundary condition for soil hydology must be zeroFlux with qbaseTopmodel option for groundwater'
-        err=20; return
-      end if
-  end select
-
-  ! check power-law profile is selected when using topmodel baseflow option
-  select case(model_decisions(iLookDECISIONS%groundwatr)%iDecision)
-    case(qbaseTopmodel)
-      if(model_decisions(iLookDECISIONS%hc_profile)%iDecision /= powerLaw_profile)then
-        message=trim(message)//'power-law transmissivity profile must be selected when using topmodel baseflow option'
-        err=20; return
-      end if
-  end select
-
-  ! check bigBucket groundwater option is used when for spatial groundwater is singleBasin
-  if(model_decisions(iLookDECISIONS%spatial_gw)%iDecision == singleBasin)then
-    if(model_decisions(iLookDECISIONS%groundwatr)%iDecision /= bigBucket)then
-      message=trim(message)//'groundwater parameterization must be bigBucket when using singleBasin for spatial_gw'
-      err=20; return
-    end if
-  end if
-
-end subroutine mDecisions
-
-
-! ************************************************************************************************
-! private subroutine readoption: read information from model decisions file
-! ************************************************************************************************
-subroutine readoption(err,message)
-  ! used to read information from model decisions file
-  USE ascii_util_module,only:file_open       ! open file
-  USE ascii_util_module,only:linewidth       ! max character number for one line
-  USE ascii_util_module,only:get_vlines      ! get a vector of non-comment lines
-  USE summaFileManager,only:SETTINGS_PATH    ! path for metadata files
-  USE summaFileManager,only:M_DECISIONS      ! definition of modeling options
-  USE get_ixname_module,only:get_ixdecisions ! identify index of named variable
-  USE globalData,only:model_decisions        ! model decision structure
-  implicit none
-  ! define output
-  integer(i4b),intent(out)             :: err            ! error code
-  character(*),intent(out)             :: message        ! error message
-  ! define local variables
-  character(len=256)                   :: cmessage       ! error message for downwind routine
-  character(LEN=256)                   :: infile         ! input filename
-  integer(i4b)                         :: unt            ! file unit (free unit output from file_open)
-  character(LEN=linewidth),allocatable :: charline(:)    ! vector of character strings
-  integer(i4b)                         :: nDecisions     ! number of model decisions
-  integer(i4b)                         :: iDecision      ! index of model decisions
-  character(len=32)                    :: decision       ! name of model decision
-  character(len=32)                    :: option         ! option for model decision
-  integer(i4b)                         :: iVar           ! index of the decision in the data structure
-  ! Start procedure here
-  err=0; message='readoption/'
-  ! build filename
-  infile = trim(SETTINGS_PATH)//trim(M_DECISIONS)
-  write(*,'(2(a,1x))') 'decisions file = ', trim(infile)
-  ! open file
-  call file_open(trim(infile),unt,err,cmessage)
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-  ! get a list of character strings from non-comment lines
-  call get_vlines(unt,charline,err,cmessage)
-  if(err/=0)then; message=trim(message)//trim(cmessage); return; end if
-  ! close the file unit
-  close(unt)
-  ! get the number of model decisions
-  nDecisions = size(charline)
-  ! populate the model decisions structure
-  do iDecision=1,nDecisions
-    ! extract name of decision and the decision selected
-    read(charline(iDecision),*,iostat=err) option, decision
-    if (err/=0) then; err=30; message=trim(message)//"errorReadLine"; return; end if
-    ! get the index of the decision in the data structure
-    iVar = get_ixdecisions(trim(option))
-    write(*,'(i4,1x,a)') iDecision, trim(option)//': '//trim(decision)
-    if(iVar<=0)then; err=40; message=trim(message)//"cannotFindDecisionIndex[name='"//trim(option)//"']"; return; end if
-    ! populate the model decisions structure
-    model_decisions(iVar)%cOption   = trim(option)
-    model_decisions(iVar)%cDecision = trim(decision)
-  end do
-end subroutine readoption
-end module mDecisions_module
diff --git a/build/source/engine/sundials/t2enthalpy.f90 b/build/source/engine/sundials/t2enthalpy.f90
deleted file mode 100644
index 2a5030389cd597071fbf3e52e2aeddd35b747bf4..0000000000000000000000000000000000000000
--- a/build/source/engine/sundials/t2enthalpy.f90
+++ /dev/null
@@ -1,779 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module t2enthalpy_module
-
-! constants
-USE multiconst, only: gravity, &                          ! gravitational acceleration (m s-1)
-                      Tfreeze, &                          ! freezing point of water (K)
-                      Cp_soil,Cp_water,Cp_ice,Cp_air,&    ! specific heat of soil, water and ice (J kg-1 K-1)
-                      iden_water,iden_ice,iden_air,&      ! intrinsic density of water and ice (kg m-3)
-                      LH_fus                              ! latent heat of fusion (J kg-1)
-
-! data types
-USE nrtype
-USE data_types,only:var_iLength                    ! var(:)%dat(:)
-USE data_types,only:var_dLength                    ! var(:)%dat(:)
-USE data_types,only:zLookup                        ! z(:)%var(:)%lookup(:)
-
-! indices within parameter structure
-USE var_lookup,only:iLookPARAM                     ! named variables to define structure element
-USE var_lookup,only:iLookINDEX                     ! named variables to define structure element
-USE var_lookup,only:iLookLOOKUP                    ! named variables to define structure element
-USE var_lookup,only:iLookDIAG       ! named variables for structure elements
-
-! data dimensions
-USE var_lookup,only:maxvarLookup                   ! maximum number of variables in the lookup tables
-
-! domain types
-USE globalData,only:iname_cas                      ! named variables for canopy air space
-USE globalData,only:iname_veg                      ! named variables for vegetation canopy
-USE globalData,only:iname_snow                     ! named variables for snow
-USE globalData,only:iname_soil                     ! named variables for soil
-USE globalData,only:iname_aquifer                  ! named variables for the aquifer
-
-! named variables to describe the state variable type
-USE globalData,only:iname_nrgCanair                ! named variable defining the energy of the canopy air space
-USE globalData,only:iname_nrgCanopy                ! named variable defining the energy of the vegetation canopy
-USE globalData,only:iname_nrgLayer                 ! named variable defining the energy state variable for snow+soil layers
-
-! missing values
-USE globalData,only:integerMissing                 ! missing integer
-USE globalData,only:realMissing                    ! missing real number
-
-! privacy
-implicit none
-private
-public::T2E_lookup
-public::t2enthalpy
-public::t2enthalpy_T
-
-! define the look-up table used to compute temperature based on enthalpy
-contains
-
-
-! ************************************************************************************************************************
-! public subroutine T2E_lookup: define a look-up table to compute enthalpy based on temperature
-! ************************************************************************************************************************
-subroutine T2E_lookup(nSoil,                       &  ! intent(in):    number of soil layers
-                     mpar_data,                   &  ! intent(in):    parameter data structure
-                     lookup_data,                 &  ! intent(inout): lookup table data structure
-                     err,message)
-  USE nr_utility_module,only:arth                       ! use to build vectors with regular increments
-  USE spline_int_module,only:spline,splint              ! use for cubic spline interpolation
-  USE soil_utils_module,only:volFracLiq                 ! use to compute the volumetric fraction of liquid water
-  implicit none
-  ! declare dummy variables
-  integer(i4b),intent(in)       :: nSoil
-  type(var_dlength),intent(in)  :: mpar_data            ! model parameters
-  type(zLookup),intent(inout)   :: lookup_data          ! lookup tables
-  integer(i4b),intent(out)      :: err                  ! error code
-  character(*),intent(out)      :: message              ! error message
-  ! declare local variables
-  character(len=128)            :: cmessage             ! error message in downwind routine
-  logical(lgt),parameter        :: doTest=.false.       ! flag to test
-  integer(i4b),parameter        :: nLook=100            ! number of elements in the lookup table
-  integer(i4b),parameter        :: nIntegr8=10000       ! number of points used in the numerical integration
-  real(rkind),parameter            :: T_lower=260.0_rkind     ! lowest temperature value where all liquid water is assumed frozen (K)
-  real(rkind),dimension(nLook)     :: xTemp                ! temporary vector
-  real(rkind)                      :: xIncr                ! temporary increment
-  real(rkind)                      :: T_incr               ! temperature increment
-  real(rkind),parameter            :: T_test=272.9742_rkind   ! test value for temperature (K)
-  real(rkind)                      :: E_test               ! test value for enthalpy (J m-3)
-  integer(i4b)                  :: iVar                 ! loop through variables
-  integer(i4b)                  :: iSoil                ! loop through soil layers
-  integer(i4b)                  :: iLook                ! loop through lookup table
-  integer(i4b)                  :: jIntegr8             ! index for numerical integration
-  logical(lgt)                  :: check                ! flag to check allocation
-  real(rkind)                      :: vGn_m                ! van Genuchten "m" parameter (-)
-  real(rkind)                      :: vFracLiq             ! volumetric fraction of liquid water (-)
-  real(rkind)                      :: vFracIce             ! volumetric fraction of ice (-)
-  real(rkind)                      :: matricHead           ! matric head (m)
-  ! initialize error control
-  err=0; message="T2E_lookup/"
-
-  ! get the values of temperature for the lookup table
-  xIncr = 1._rkind/real(nLook-1, kind(rkind))
-  xTemp = T_lower + (Tfreeze - T_lower)*arth(0._rkind,xIncr,nLook)**0.25_rkind ! use **0.25 to give more values near freezing
-
-  ! -----
-  ! * allocate space for the lookup table...
-  ! ----------------------------------------
-
-  ! initialize checks
-  check=.false.
-
-  ! allocate space for soil layers
-  if(allocated(lookup_data%z))then; check=.true.; else; allocate(lookup_data%z(nSoil), stat=err); endif
-  if(check) then; err=20; message=trim(message)//'lookup table z dimension was unexpectedly allocated already'; return; end if
-  if(err/=0)then; err=20; message=trim(message)//'problem allocating lookup table z dimension dimension'; return; end if
-
-  ! allocate space for the variables in the lookup table
-  do iSoil=1,nSoil
-    if(allocated(lookup_data%z(iSoil)%var))then; check=.true.; else; allocate(lookup_data%z(iSoil)%var(maxvarLookup), stat=err); endif
-    if(check) then; err=20; message=trim(message)//'lookup table var dimension was unexpectedly allocated already'; return; end if
-    if(err/=0)then; err=20; message=trim(message)//'problem allocating lookup table var dimension dimension'; return; end if
-
-    ! allocate space for the values in the lookup table
-    do iVar=1,maxvarLookup
-      if(allocated(lookup_data%z(iSoil)%var(iVar)%lookup))then; check=.true.; else; allocate(lookup_data%z(iSoil)%var(iVar)%lookup(nLook), stat=err); endif
-      if(check) then; err=20; message=trim(message)//'lookup table value dimension was unexpectedly allocated already'; return; end if
-      if(err/=0)then; err=20; message=trim(message)//'problem allocating lookup table vaule dimension dimension'; return; end if
-
-    end do ! (looping through variables)
-  end do ! (looping through soil layers)
-
-  ! loop through soil layers
-  do iSoil=1,nSoil
-
-    ! -----
-    ! * make association to variables in the data structures...
-    ! ---------------------------------------------------------
-
-    associate(&
-
-      ! associate model parameters
-      snowfrz_scale  => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)           , & ! scaling parameter for freezing     (K-1)
-      soil_dens_intr => mpar_data%var(iLookPARAM%soil_dens_intr)%dat(iSoil)      , & ! intrinsic soil density             (kg m-3)
-      theta_sat      => mpar_data%var(iLookPARAM%theta_sat)%dat(iSoil)           , & ! soil porosity                      (-)
-      theta_res      => mpar_data%var(iLookPARAM%theta_res)%dat(iSoil)           , & ! volumetric residual water content  (-)
-      vGn_alpha      => mpar_data%var(iLookPARAM%vGn_alpha)%dat(iSoil)           , & ! van Genuchten "alpha" parameter    (m-1)
-      vGn_n          => mpar_data%var(iLookPARAM%vGn_n)%dat(iSoil)               , & ! van Genuchten "n" parameter        (-)
-
-      ! associate values in the lookup table
-      Tk            => lookup_data%z(iSoil)%var(iLookLOOKUP%temperature)%lookup  , & ! temperature (K)
-      Ey            => lookup_data%z(iSoil)%var(iLookLOOKUP%enthalpy)%lookup     , & ! enthalpy (J m-3)
-      E2            => lookup_data%z(iSoil)%var(iLookLOOKUP%deriv2)%lookup         & ! second derivative of the interpolating function
-
-      ) ! end associate statement
-
-      ! compute vGn_m
-      vGn_m = 1._rkind - 1._rkind/vGn_n
-
-      ! -----
-      ! * populate the lookup table...
-      ! ------------------------------
-
-      ! initialize temperature and enthalpy
-      Tk(nLook) = Tfreeze
-      Ey(nLook) = 0._rkind
-
-      ! loop through lookup table
-      do iLook=(nLook-1),1,-1
-
-        ! update temperature and enthalpy
-        Tk(iLook) = Tk(iLook+1)
-        Ey(iLook) = Ey(iLook+1)
-
-        ! get the temperature increment for the numerical integration
-        T_incr = (xTemp(iLook)-xTemp(iLook+1))/real(nIntegr8, kind(rkind))
-
-        ! numerical integration between different values of the lookup table
-        do jIntegr8=1,nIntegr8
-
-          ! update temperature
-          Tk(iLook)  = Tk(iLook) + T_incr
-
-          ! compute the volumetric liquid water and ice content
-          ! NOTE: assume saturation
-          matricHead = (LH_fus/gravity)*(Tk(iLook) - Tfreeze)/Tfreeze
-          vFracLiq   = volFracLiq(matricHead,vGn_alpha,theta_res,theta_sat,vGn_n,vGn_m)
-          vFracIce   = theta_sat - vFracLiq
-
-          ! compute enthalpy
-          ! NOTE: assume intrrinsic density of ice is the intrinsic density of water
-          ! NOTE: kg m-3 J kg-1 K-1 K
-          Ey(iLook)  = Ey(iLook) + iden_water*Cp_water*vFracLiq*T_incr + iden_water*Cp_ice*vFracIce*T_incr
-
-        end do  ! numerical integration
-
-      end do  ! loop through lookup table
-
-      ! use cubic spline interpolation to obtain enthalpy values at the desired values of temperature
-      call spline(Tk,Ey,1.e30_rkind,1.e30_rkind,E2,err,cmessage)  ! get the second derivatives
-      if(err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-      ! test
-      if(doTest)then
-
-        ! calculate enthalpy
-        call splint(Tk,Ey,E2,T_test,E_test,err,cmessage)
-        if(err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-        ! write values
-        print*, 'doTest    = ', doTest
-        print*, 'T_test    = ', T_test    ! temperature (K)
-        print*, 'E_test    = ', E_test    ! enthalpy (J m-3)
-        print*, 'theta_sat = ', theta_sat ! soil porosity                      (-)
-        print*, 'theta_res = ', theta_res ! volumetric residual water content  (-)
-        print*, 'vGn_alpha = ', vGn_alpha ! van Genuchten "alpha" parameter    (m-1)
-        print*, 'vGn_n     = ', vGn_n     ! van Genuchten "n" parameter        (-)
-        print*, trim(message)//'PAUSE: Set doTest=.false. to complete simulations'
-        read(*,*)
-
-      endif  ! if testing
-
-    ! end asssociation to variables in the data structures
-    end associate
-
-  end do  ! (looping through soil layers)
-end subroutine T2E_lookup
-
-
-! ************************************************************************************************************************
-! public subroutine t2enthalpy: compute enthalpy from temperature and total water content
-! ************************************************************************************************************************
-subroutine t2enthalpy(&
-                      ! input: data structures
-                      diag_data,                         & ! intent(in):  model diagnostic variables for a local HRU
-                      mpar_data,                         & ! intent(in):  parameter data structure
-                      indx_data,                         & ! intent(in):  model indices
-                      lookup_data,                       & ! intent(in):  lookup table data structure
-                      ! input: state variables for the vegetation canopy
-                      scalarCanairTempTrial,             & ! intent(in):  trial value of canopy air temperature (K)
-                      scalarCanopyTempTrial,             & ! intent(in):  trial value of canopy temperature (K)
-                      scalarCanopyWatTrial,              & ! intent(in):  trial value of canopy total water (kg m-2)
-                      scalarCanopyIceTrial,              & ! intent(in):  trial value of canopy ice content (kg m-2)
-                      ! input: variables for the snow-soil domain
-                      mLayerTempTrial,                   & ! intent(in):  trial vector of layer temperature (K)
-                      mLayerVolFracWatTrial,             & ! intent(in):  trial vector of volumetric total water content (-)
-                      mLayerMatricHeadTrial,             & ! intent(in):  trial vector of total water matric potential (m)
-                      mLayerVolFracIceTrial,             & ! intent(in)
-                      ! output: enthalpy
-                      scalarCanairEnthalpy,              & ! intent(out):  enthalpy of the canopy air space (J m-3)
-                      scalarCanopyEnthalpy,              & ! intent(out):  enthalpy of the vegetation canopy (J m-3)
-                      mLayerEnthalpy,                    & ! intent(out):  enthalpy of each snow+soil layer (J m-3)
-                      ! output: error control
-                      err,message)                         ! intent(out): error control
-  ! -------------------------------------------------------------------------------------------------------------------------
-  ! downwind routines
-  USE soil_utils_module,only:crit_soilT     ! compute critical temperature below which ice exists
-  USE soil_utils_module,only:volFracLiq     ! compute volumetric fraction of liquid water
-  USE spline_int_module,only:splint         ! use for cubic spline interpolation
-  implicit none
-  ! delare dummy variables
-  ! -------------------------------------------------------------------------------------------------------------------------
-  ! input: data structures
-  type(var_dlength),intent(in)  :: diag_data                 ! diagnostic variables for a local HRU
-  type(var_dlength),intent(in)  :: mpar_data                 ! model parameters
-  type(var_ilength),intent(in)  :: indx_data                 ! model indices
-  type(zLookup),intent(in)      :: lookup_data               ! lookup tables
-  ! input: state variables for the vegetation canopy
-  real(rkind),intent(in)           :: scalarCanairTempTrial     ! trial value of canopy air temperature (K)
-  real(rkind),intent(in)           :: scalarCanopyTempTrial     ! trial value of canopy temperature (K)
-  real(rkind),intent(in)           :: scalarCanopyWatTrial      ! trial value of canopy total water (kg m-2)
-  real(rkind),intent(in)           :: scalarCanopyIceTrial      ! trial value of canopy ice content (kg m-2)
-  ! input: variables for the snow-soil domain
-  real(rkind),intent(in)           :: mLayerTempTrial(:)        ! trial vector of layer temperature (K)
-  real(rkind),intent(in)           :: mLayerVolFracWatTrial(:)  ! trial vector of volumetric total water content (-)
-  real(rkind),intent(in)           :: mLayerMatricHeadTrial(:)  ! trial vector of total water matric potential (m)
-  real(rkind),intent(in)           :: mLayerVolFracIceTrial(:)  ! trial vector of volumetric fraction of Ice (-)
-  ! output: enthalpy
-  real(rkind),intent(out)          :: scalarCanairEnthalpy      ! enthalpy of the canopy air space (J m-3)
-  real(rkind),intent(out)          :: scalarCanopyEnthalpy      ! enthalpy of the vegetation canopy (J m-3)
-  real(rkind),intent(out)          :: mLayerEnthalpy(:)         ! enthalpy of each snow+soil layer (J m-3)
-  ! output: error control
-  integer(i4b),intent(out)      :: err                       ! error code
-  character(*),intent(out)      :: message                   ! error message
-  ! -------------------------------------------------------------------------------------------------------------------------
-  ! declare local variables
-  character(len=128)            :: cmessage                  ! error message in downwind routine
-  integer(i4b)                  :: iState                    ! index of model state variable
-  integer(i4b)                  :: iLayer                    ! index of model layer
-  integer(i4b)                  :: ixFullVector              ! index within full state vector
-  integer(i4b)                  :: ixDomainType              ! name of a given model domain
-  integer(i4b)                  :: ixControlIndex            ! index within a given model domain
-  real(rkind)                      :: vGn_m                     ! van Genuchten "m" parameter (-)
-  real(rkind)                      :: Tcrit                     ! temperature where all water is unfrozen (K)
-  real(rkind)                      :: psiLiq                    ! matric head of liquid water (m)
-  real(rkind)                      :: vFracWat                  ! volumetric fraction of total water, liquid+ice (-)
-  real(rkind)                      :: vFracLiq                  ! volumetric fraction of liquid water (-)
-  real(rkind)                      :: vFracIce                  ! volumetric fraction of ice (-)
-  real(rkind)                      :: enthTemp                  ! enthalpy at the temperature of the control volume (J m-3)
-  real(rkind)                      :: enthTcrit                 ! enthalpy at the critical temperature where all water is unfrozen (J m-3)
-  real(rkind)                      :: enthPhase                 ! enthalpy associated with phase change (J m-3)
-  real(rkind)                      :: enthWater                 ! enthalpy of total water (J m-3)
-  real(rkind)                      :: enthSoil                  ! enthalpy of soil particles (J m-3)
-  real(rkind)                      :: enthMix                   ! enthalpy of the mixed region, liquid+ice (J m-3)
-  real(rkind)                      :: enthLiq                   ! enthalpy of the liquid region (J m-3)
-  real(rkind)                      :: enthAir                   ! enthalpy of air (J m-3)
-  real(rkind)                      :: diffT
-  real(rkind)                      :: integral
-  real(rkind)                      :: enthIce
-  real(rkind)                      :: enthVeg
-  ! --------------------------------------------------------------------------------------------------------------------------------
-  ! make association with variables in the data structures
-  generalVars: associate(&
-    ! number of model layers, and layer type
-    nSnow                   => indx_data%var(iLookINDEX%nSnow)%dat(1)                 ,& ! intent(in):  [i4b]    total number of snow layers
-    nSoil                   => indx_data%var(iLookINDEX%nSoil)%dat(1)                 ,& ! intent(in):  [i4b]    total number of soil layers
-    nLayers                 => indx_data%var(iLookINDEX%nLayers)%dat(1)               ,& ! intent(in):  [i4b]    total number of snow and soil layers
-    ! mapping between the full state vector and the state subset
-    ixMapFull2Subset        => indx_data%var(iLookINDEX%ixMapFull2Subset)%dat         ,& ! intent(in):  [i4b(:)] list of indices in the state subset for each state in the full state vector
-    ixMapSubset2Full        => indx_data%var(iLookINDEX%ixMapSubset2Full)%dat         ,& ! intent(in):  [i4b(:)] [state subset] list of indices of the full state vector in the state subset
-    ! type of domain, type of state variable, and index of control volume within domain
-    ixDomainType_subset     => indx_data%var(iLookINDEX%ixDomainType_subset)%dat      ,& ! intent(in):  [i4b(:)] [state subset] id of domain for desired model state variables
-    ixControlVolume         => indx_data%var(iLookINDEX%ixControlVolume)%dat          ,& ! intent(in):  [i4b(:)] index of the control volume for different domains (veg, snow, soil)
-    ixStateType             => indx_data%var(iLookINDEX%ixStateType)%dat              ,& ! intent(in):  [i4b(:)] indices defining the type of the state (iname_nrgLayer...)
-    ! snow parameters
-    snowfrz_scale           => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)          & ! intent(in):  [dp] scaling parameter for the snow freezing curve (K-1)
-    ) ! end associate statement
-    ! --------------------------------------------------------------------------------------------------------------------------------
-
-    ! initialize error control
-    err=0; message="t2enthalpy/"
-
-    ! loop through model state variables
-    do iState=1,size(ixMapSubset2Full)
-
-      ! -----
-      ! - compute indices...
-      ! --------------------
-
-      ! get domain type, and index of the control volume within the domain
-      ixFullVector   = ixMapSubset2Full(iState)       ! index within full state vector
-      ixDomainType   = ixDomainType_subset(iState)    ! named variables defining the domain (iname_cas, iname_veg, etc.)
-      ixControlIndex = ixControlVolume(ixFullVector)  ! index within a given domain
-
-      ! check an energy state
-      if(ixStateType(ixFullVector)==iname_nrgCanair .or. ixStateType(ixFullVector)==iname_nrgCanopy .or. ixStateType(ixFullVector)==iname_nrgLayer)then
-
-            ! get the layer index
-        select case(ixDomainType)
-          case(iname_cas);     iLayer = integerMissing
-          case(iname_veg);     iLayer = integerMissing
-          case(iname_snow);    iLayer = ixControlIndex
-          case(iname_soil);    iLayer = ixControlIndex + nSnow
-          case(iname_aquifer); cycle ! aquifer: do nothing (no thermodynamics in the aquifer)
-          case default; err=20; message=trim(message)//'expect case to be iname_cas, iname_veg, iname_snow, iname_soil, iname_aquifer'; return
-        end select
-
-        ! identify domain
-        select case(ixDomainType)
-
-          ! -----
-          ! - canopy air space...
-          ! ---------------------
-          case(iname_cas)
-            scalarCanairEnthalpy = Cp_air * iden_air * (scalarCanairTempTrial - Tfreeze)
-          ! -----
-          ! - vegetation canopy...
-          ! -----------------------
-          case(iname_veg)
-            ! association to necessary variables for vegetation
-            vegVars: associate(&     
-              canopyDepth             => diag_data%var(iLookDIAG%scalarCanopyDepth)%dat(1),         & ! intent(in): [dp]      canopy depth (m)
-              specificHeatVeg         => mpar_data%var(iLookPARAM%specificHeatVeg)%dat(1),          & ! intent(in): specific heat of vegetation (J kg-1 K-1)
-              maxMassVegetation       => mpar_data%var(iLookPARAM%maxMassVegetation)%dat(1),        & ! intent(in): maximum mass of vegetation (kg m-2)
-              snowfrz_scale           => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)   & ! intent(in):  [dp] scaling parameter for the snow freezing curve (K-1)
-              ) 
-
-              diffT = scalarCanopyTempTrial - Tfreeze
-              enthVeg = specificHeatVeg * maxMassVegetation * diffT / canopyDepth
-              if(diffT>=0._rkind)then
-                enthLiq = Cp_water * scalarCanopyWatTrial * diffT / canopyDepth
-                enthIce = 0._rkind
-                enthPhase = 0._rkind
-              else
-                integral = (1._rkind/snowfrz_scale) * atan(snowfrz_scale * diffT)
-                enthLiq = Cp_water * scalarCanopyWatTrial * integral / canopyDepth
-                enthIce = Cp_ice * scalarCanopyWatTrial * ( diffT - integral ) / canopyDepth
-                enthPhase = LH_fus * scalarCanopyIceTrial / canopyDepth
-              end if
-      
-              scalarCanopyEnthalpy =  enthVeg + enthLiq + enthIce - enthPhase           
-
-              ! end association 
-            end associate vegVars
-
-          ! -----
-          ! - snow...
-          ! ---------
-          case(iname_snow)
-    
-            ! association to necessary variables for snow
-            snowVars: associate(&
-              snowfrz_scale           => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)   & ! intent(in):  [dp] scaling parameter for the snow freezing curve (K-1)
-              ) 
-
-              diffT = mLayerTempTrial(iLayer) - Tfreeze
-              if(diffT>=0._rkind)then
-                enthLiq = iden_water * Cp_water * mLayerVolFracWatTrial(iLayer) * diffT
-                enthIce = 0._rkind
-                enthAir = iden_air * Cp_air * ( 1._rkind - mLayerVolFracWatTrial(iLayer) ) * diffT
-                enthPhase = 0._rkind
-              else
-                integral = (1._rkind/snowfrz_scale) * atan(snowfrz_scale * diffT)
-                enthLiq = iden_water * Cp_water * mLayerVolFracWatTrial(iLayer) * integral
-                enthIce = iden_water * Cp_ice * mLayerVolFracWatTrial(iLayer) * ( diffT - integral )
-                enthAir = iden_air * Cp_air * ( diffT - mLayerVolFracWatTrial(iLayer) * ( (iden_water/iden_ice)*(diffT-integral) + integral ) ) 
-                enthPhase = iden_ice * LH_fus * mLayerVolFracIceTrial(iLayer)
-              end if
-              
-              mLayerEnthalpy(iLayer) =  enthLiq + enthIce + enthAir - enthPhase           
-
-            ! end association 
-            end associate snowVars
-
-          ! -----
-          ! - soil...
-          ! ---------
-          case(iname_soil)
-
-            ! make association to variables in the data structures...
-            soilVars: associate(&
-
-              ! associate model parameters
-              soil_dens_intr => mpar_data%var(iLookPARAM%soil_dens_intr)%dat(ixControlIndex)      , & ! intrinsic soil density             (kg m-3)
-              theta_sat      => mpar_data%var(iLookPARAM%theta_sat)%dat(ixControlIndex)           , & ! soil porosity                      (-)
-              theta_res      => mpar_data%var(iLookPARAM%theta_res)%dat(ixControlIndex)           , & ! volumetric residual water content  (-)
-              vGn_alpha      => mpar_data%var(iLookPARAM%vGn_alpha)%dat(ixControlIndex)           , & ! van Genuchten "alpha" parameter    (m-1)
-              vGn_n          => mpar_data%var(iLookPARAM%vGn_n)%dat(ixControlIndex)               , & ! van Genuchten "n" parameter        (-)
-
-              ! associate values in the lookup table
-              Tk            => lookup_data%z(ixControlIndex)%var(iLookLOOKUP%temperature)%lookup  , & ! temperature (K)
-              Ey            => lookup_data%z(ixControlIndex)%var(iLookLOOKUP%enthalpy)%lookup     , & ! enthalpy (J m-3)
-              E2            => lookup_data%z(ixControlIndex)%var(iLookLOOKUP%deriv2)%lookup         & ! second derivative of the interpolating function
-
-              ) ! end associate statement
-
-              ! diagnostic variables
-              vGn_m    = 1._rkind - 1._rkind/vGn_n
-              Tcrit    = crit_soilT( mLayerMatricHeadTrial(ixControlIndex) )
-              vFracWat = volFracLiq(mLayerMatricHeadTrial(ixControlIndex),vGn_alpha,theta_res,theta_sat,vGn_n,vGn_m)
-              
-
-              ! *** compute enthalpy of water for unfrozen conditions
-              if(mlayerTempTrial(iLayer) > Tcrit)then
-                enthWater = iden_water*Cp_water*vFracWat*(mlayerTempTrial(iLayer) - Tfreeze) ! valid for temperatures below freezing also
-                enthPhase = 0._rkind
-
-              ! *** compute enthalpy of water for frozen conditions
-              else
-                ! calculate enthalpy at the temperature (cubic spline interpolation)
-                call splint(Tk,Ey,E2,mlayerTempTrial(iLayer),enthTemp,err,cmessage)
-                if(err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-                ! calculate enthalpy at the critical temperature (cubic spline interpolation)
-                call splint(Tk,Ey,E2,Tcrit,enthTcrit,err,cmessage)
-                if(err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-                ! calculate the enthalpy of water
-                enthMix   = enthTemp - enthTcrit ! enthalpy of the liquid+ice mix
-                enthLiq   = iden_water*Cp_water*vFracWat*(Tcrit - Tfreeze)
-                enthWater = enthMix + enthLiq
-
-                ! *** compute the enthalpy associated with phase change
-                psiLiq    = (mLayerTempTrial(iLayer) - Tfreeze)*LH_fus/(gravity*Tfreeze)
-                vFracLiq  = volFracLiq(psiLiq,vGn_alpha,theta_res,theta_sat,vGn_n,vGn_m)
-                vFracIce  = vFracWat - vFracLiq
-                enthPhase = iden_water*LH_fus*vFracIce
-
-              endif ! (if frozen conditions)
-
-              ! *** compute the enthalpy of soil
-              enthSoil  = soil_dens_intr*Cp_soil*(1._rkind - theta_sat)*(mlayerTempTrial(iLayer) - Tfreeze)
-
-              ! *** compute the enthalpy of air
-              enthAir   = iden_air*Cp_air*(1._rkind - theta_sat - vFracWat)*(mlayerTempTrial(iLayer) - Tfreeze)
-
-              ! *** compute the total enthalpy (J m-3)
-              mLayerEnthalpy(iLayer) = enthSoil + enthWater + enthAir - enthPhase
-
-            end associate soilVars
-
-          ! -----
-          ! - checks...
-          ! -----------
-          case(iname_aquifer); cycle ! aquifer: do nothing
-          case default; err=20; message=trim(message)//'expect case to be iname_cas, iname_veg, iname_snow, iname_soil, iname_aquifer'; return
-        end select
-
-      end if  ! if an energy layer
-    end do  ! looping through state variables
-
-  end associate generalVars
-
-end subroutine t2enthalpy
- 
-
-! ************************************************************************************************************************
-! public subroutine t2enthalpy_T: compute enthalpy from temperature and total water content
-! ************************************************************************************************************************
-subroutine t2enthalpy_T(&
-                      ! input: data structures
-                      diag_data,                         & ! intent(in):  model diagnostic variables for a local HRU
-                      mpar_data,                         & ! intent(in):  parameter data structure
-                      indx_data,                         & ! intent(in):  model indices
-                      lookup_data,                       & ! intent(in):  lookup table data structure
-                      ! input: state variables for the vegetation canopy
-                      scalarCanairTempTrial,             & ! intent(in):  trial value of canopy air temperature (K)
-                      scalarCanopyTempTrial,             & ! intent(in):  trial value of canopy temperature (K)
-                      scalarCanopyWatTrial,              & ! intent(in):  trial value of canopy total water (kg m-2)
-                      scalarCanopyIceTrial,              & ! intent(in):  trial value of canopy ice content (kg m-2)
-                      ! input: variables for the snow-soil domain
-                      mLayerTempTrial,                   & ! intent(in):  trial vector of layer temperature (K)
-                      mLayerVolFracWatTrial,             & ! intent(in):  trial vector of volumetric total water content (-)
-                      mLayerMatricHeadTrial,             & ! intent(in):  trial vector of total water matric potential (m)
-                      mLayerVolFracIceTrial,             & ! intent(in)
-                      ! output: enthalpy
-                      scalarCanairEnthalpy,              & ! intent(out):  enthalpy of the canopy air space (J m-3)
-                      scalarCanopyEnthalpy,              & ! intent(out):  enthalpy of the vegetation canopy (J m-3)
-                      mLayerEnthalpy,                    & ! intent(out):  enthalpy of each snow+soil layer (J m-3)
-                      ! output: error control
-                      err,message)                         ! intent(out): error control
-  ! -------------------------------------------------------------------------------------------------------------------------
-  ! downwind routines
-  USE soil_utils_module,only:crit_soilT     ! compute critical temperature below which ice exists
-  USE soil_utils_module,only:volFracLiq     ! compute volumetric fraction of liquid water
-  USE spline_int_module,only:splint         ! use for cubic spline interpolation
-  implicit none
-  ! delare dummy variables
-  ! -------------------------------------------------------------------------------------------------------------------------
-  ! input: data structures
-  type(var_dlength),intent(in)  :: diag_data                 ! diagnostic variables for a local HRU
-  type(var_dlength),intent(in)  :: mpar_data                 ! model parameters
-  type(var_ilength),intent(in)  :: indx_data                 ! model indices
-  type(zLookup),intent(in)      :: lookup_data               ! lookup tables
-  ! input: state variables for the vegetation canopy
-  real(rkind),intent(in)           :: scalarCanairTempTrial     ! trial value of canopy air temperature (K)
-  real(rkind),intent(in)           :: scalarCanopyTempTrial     ! trial value of canopy temperature (K)
-  real(rkind),intent(in)           :: scalarCanopyWatTrial      ! trial value of canopy total water (kg m-2)
-  real(rkind),intent(in)           :: scalarCanopyIceTrial      ! trial value of canopy ice content (kg m-2)
-  ! input: variables for the snow-soil domain
-  real(rkind),intent(in)           :: mLayerTempTrial(:)        ! trial vector of layer temperature (K)
-  real(rkind),intent(in)           :: mLayerVolFracWatTrial(:)  ! trial vector of volumetric total water content (-)
-  real(rkind),intent(in)           :: mLayerMatricHeadTrial(:)  ! trial vector of total water matric potential (m)
-  real(rkind),intent(in)           :: mLayerVolFracIceTrial(:)  ! trial vector of volumetric fraction of Ice (-)
-  ! output: enthalpy
-  real(rkind),intent(out)          :: scalarCanairEnthalpy      ! enthalpy of the canopy air space (J m-3)
-  real(rkind),intent(out)          :: scalarCanopyEnthalpy      ! enthalpy of the vegetation canopy (J m-3)
-  real(rkind),intent(out)          :: mLayerEnthalpy(:)         ! enthalpy of each snow+soil layer (J m-3)
-  ! output: error control
-  integer(i4b),intent(out)      :: err                       ! error code
-  character(*),intent(out)      :: message                   ! error message
-  ! -------------------------------------------------------------------------------------------------------------------------
-  ! declare local variables
-  character(len=128)            :: cmessage                  ! error message in downwind routine
-  integer(i4b)                  :: iState                    ! index of model state variable
-  integer(i4b)                  :: iLayer                    ! index of model layer
-  integer(i4b)                  :: ixFullVector              ! index within full state vector
-  integer(i4b)                  :: ixDomainType              ! name of a given model domain
-  integer(i4b)                  :: ixControlIndex            ! index within a given model domain
-  real(rkind)                      :: vGn_m                     ! van Genuchten "m" parameter (-)
-  real(rkind)                      :: Tcrit                     ! temperature where all water is unfrozen (K)
-  real(rkind)                      :: psiLiq                    ! matric head of liquid water (m)
-  real(rkind)                      :: vFracWat                  ! volumetric fraction of total water, liquid+ice (-)
-  real(rkind)                      :: vFracLiq                  ! volumetric fraction of liquid water (-)
-  real(rkind)                      :: vFracIce                  ! volumetric fraction of ice (-)
-  real(rkind)                      :: enthTemp                  ! enthalpy at the temperature of the control volume (J m-3)
-  real(rkind)                      :: enthTcrit                 ! enthalpy at the critical temperature where all water is unfrozen (J m-3)
-  real(rkind)                      :: enthPhase                 ! enthalpy associated with phase change (J m-3)
-  real(rkind)                      :: enthWater                 ! enthalpy of total water (J m-3)
-  real(rkind)                      :: enthSoil                  ! enthalpy of soil particles (J m-3)
-  real(rkind)                      :: enthMix                   ! enthalpy of the mixed region, liquid+ice (J m-3)
-  real(rkind)                      :: enthLiq                   ! enthalpy of the liquid region (J m-3)
-  real(rkind)                      :: enthAir                   ! enthalpy of air (J m-3)
-  real(rkind)                      :: diffT
-  real(rkind)                      :: integral
-  real(rkind)                      :: enthIce
-  real(rkind)                      :: enthVeg
-  ! --------------------------------------------------------------------------------------------------------------------------------
-  ! make association with variables in the data structures
-  generalVars: associate(&
-    ! number of model layers, and layer type
-    nSnow                   => indx_data%var(iLookINDEX%nSnow)%dat(1)                 ,& ! intent(in):  [i4b]    total number of snow layers
-    nSoil                   => indx_data%var(iLookINDEX%nSoil)%dat(1)                 ,& ! intent(in):  [i4b]    total number of soil layers
-    nLayers                 => indx_data%var(iLookINDEX%nLayers)%dat(1)               ,& ! intent(in):  [i4b]    total number of snow and soil layers
-    ! mapping between the full state vector and the state subset
-    ixMapFull2Subset        => indx_data%var(iLookINDEX%ixMapFull2Subset)%dat         ,& ! intent(in):  [i4b(:)] list of indices in the state subset for each state in the full state vector
-    ixMapSubset2Full        => indx_data%var(iLookINDEX%ixMapSubset2Full)%dat         ,& ! intent(in):  [i4b(:)] [state subset] list of indices of the full state vector in the state subset
-    ! type of domain, type of state variable, and index of control volume within domain
-    ixDomainType_subset     => indx_data%var(iLookINDEX%ixDomainType_subset)%dat      ,& ! intent(in):  [i4b(:)] [state subset] id of domain for desired model state variables
-    ixControlVolume         => indx_data%var(iLookINDEX%ixControlVolume)%dat          ,& ! intent(in):  [i4b(:)] index of the control volume for different domains (veg, snow, soil)
-    ixStateType             => indx_data%var(iLookINDEX%ixStateType)%dat              ,& ! intent(in):  [i4b(:)] indices defining the type of the state (iname_nrgLayer...)
-    ! snow parameters
-    snowfrz_scale           => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)          & ! intent(in):  [dp] scaling parameter for the snow freezing curve (K-1)
-    ) ! end associate statement
-    ! --------------------------------------------------------------------------------------------------------------------------------
-
-    ! initialize error control
-    err=0; message="t2enthalpy_T/"
-
-    ! loop through model state variables
-    do iState=1,size(ixMapSubset2Full)
-
-      ! -----
-      ! - compute indices...
-      ! --------------------
-
-      ! get domain type, and index of the control volume within the domain
-      ixFullVector   = ixMapSubset2Full(iState)       ! index within full state vector
-      ixDomainType   = ixDomainType_subset(iState)    ! named variables defining the domain (iname_cas, iname_veg, etc.)
-      ixControlIndex = ixControlVolume(ixFullVector)  ! index within a given domain
-
-      ! check an energy state
-      if(ixStateType(ixFullVector)==iname_nrgCanair .or. ixStateType(ixFullVector)==iname_nrgCanopy .or. ixStateType(ixFullVector)==iname_nrgLayer)then
-
-        ! get the layer index
-        select case(ixDomainType)
-          case(iname_cas);     iLayer = integerMissing
-          case(iname_veg);     iLayer = integerMissing
-          case(iname_snow);    iLayer = ixControlIndex
-          case(iname_soil);    iLayer = ixControlIndex + nSnow
-          case(iname_aquifer); cycle ! aquifer: do nothing (no thermodynamics in the aquifer)
-          case default; err=20; message=trim(message)//'expect case to be iname_cas, iname_veg, iname_snow, iname_soil, iname_aquifer'; return
-        end select
-
-        ! identify domain
-        select case(ixDomainType)
-          case(iname_cas)
-            scalarCanairEnthalpy = Cp_air * iden_air * (scalarCanairTempTrial - Tfreeze)
-
-          case(iname_veg)
-            ! association to necessary variables for vegetation
-            vegVars: associate(&     
-              canopyDepth             => diag_data%var(iLookDIAG%scalarCanopyDepth)%dat(1),         & ! intent(in): [dp]      canopy depth (m)
-              specificHeatVeg         => mpar_data%var(iLookPARAM%specificHeatVeg)%dat(1),          & ! intent(in): specific heat of vegetation (J kg-1 K-1)
-              maxMassVegetation       => mpar_data%var(iLookPARAM%maxMassVegetation)%dat(1),        & ! intent(in): maximum mass of vegetation (kg m-2)
-              snowfrz_scale           => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)   & ! intent(in):  [dp] scaling parameter for the snow freezing curve (K-1)
-              ) 
-
-              diffT = scalarCanopyTempTrial - Tfreeze
-              enthVeg = specificHeatVeg * maxMassVegetation * diffT / canopyDepth
-              if(diffT>=0._rkind)then
-                enthLiq = Cp_water * scalarCanopyWatTrial * diffT / canopyDepth
-                enthIce = 0._rkind
-                enthPhase = 0._rkind
-              else
-                integral = (1._rkind/snowfrz_scale) * atan(snowfrz_scale * diffT)
-                enthLiq = Cp_water * scalarCanopyWatTrial * integral / canopyDepth
-                enthIce = Cp_ice * scalarCanopyWatTrial * ( diffT - integral ) / canopyDepth
-                enthPhase = LH_fus * scalarCanopyIceTrial / canopyDepth
-              end if
-          
-              scalarCanopyEnthalpy =  enthVeg + enthLiq + enthIce           
-
-            end associate vegVars
-
-          case(iname_snow)
-        
-            ! association to necessary variables for snow
-            snowVars: associate(&
-              snowfrz_scale           => mpar_data%var(iLookPARAM%snowfrz_scale)%dat(1)   & ! intent(in):  [dp] scaling parameter for the snow freezing curve (K-1)
-              ) 
-
-              diffT = mLayerTempTrial(iLayer) - Tfreeze
-              if(diffT>=0._rkind)then
-                enthLiq = iden_water * Cp_water * mLayerVolFracWatTrial(iLayer) * diffT
-                enthIce = 0._rkind
-                enthAir = iden_air * Cp_air * ( 1._rkind - mLayerVolFracWatTrial(iLayer) ) * diffT
-                enthPhase = 0._rkind
-              else
-                integral = (1._rkind/snowfrz_scale) * atan(snowfrz_scale * diffT)
-                enthLiq = iden_water * Cp_water * mLayerVolFracWatTrial(iLayer) * integral
-                enthIce = iden_water * Cp_ice * mLayerVolFracWatTrial(iLayer) * ( diffT - integral )
-                enthAir = iden_air * Cp_air * ( diffT - mLayerVolFracWatTrial(iLayer) * ( (iden_water/iden_ice)*(diffT-integral) + integral ) ) 
-                enthPhase = iden_ice * LH_fus * mLayerVolFracIceTrial(iLayer)
-              end if
-              
-              mLayerEnthalpy(iLayer) =  enthLiq + enthIce + enthAir           
-
-            end associate snowVars
-
-          case(iname_soil)
-
-            ! make association to variables in the data structures...
-            soilVars: associate(&
-
-              ! associate model parameters
-              soil_dens_intr => mpar_data%var(iLookPARAM%soil_dens_intr)%dat(ixControlIndex)      , & ! intrinsic soil density             (kg m-3)
-              theta_sat      => mpar_data%var(iLookPARAM%theta_sat)%dat(ixControlIndex)           , & ! soil porosity                      (-)
-              theta_res      => mpar_data%var(iLookPARAM%theta_res)%dat(ixControlIndex)           , & ! volumetric residual water content  (-)
-              vGn_alpha      => mpar_data%var(iLookPARAM%vGn_alpha)%dat(ixControlIndex)           , & ! van Genuchten "alpha" parameter    (m-1)
-              vGn_n          => mpar_data%var(iLookPARAM%vGn_n)%dat(ixControlIndex)               , & ! van Genuchten "n" parameter        (-)
-
-              ! associate values in the lookup table
-              Tk            => lookup_data%z(ixControlIndex)%var(iLookLOOKUP%temperature)%lookup  , & ! temperature (K)
-              Ey            => lookup_data%z(ixControlIndex)%var(iLookLOOKUP%enthalpy)%lookup     , & ! enthalpy (J m-3)
-              E2            => lookup_data%z(ixControlIndex)%var(iLookLOOKUP%deriv2)%lookup         & ! second derivative of the interpolating function
-
-              ) ! end associate statement
-
-              ! diagnostic variables
-              vGn_m    = 1._rkind - 1._rkind/vGn_n
-              Tcrit    = crit_soilT( mLayerMatricHeadTrial(ixControlIndex) )
-              vFracWat = volFracLiq(mLayerMatricHeadTrial(ixControlIndex),vGn_alpha,theta_res,theta_sat,vGn_n,vGn_m)
-              
-
-              ! *** compute enthalpy of water for unfrozen conditions
-              if(mlayerTempTrial(iLayer) > Tcrit)then
-                enthWater = iden_water*Cp_water*vFracWat*(mlayerTempTrial(iLayer) - Tfreeze) ! valid for temperatures below freezing also
-                enthPhase = 0._rkind
-
-              ! *** compute enthalpy of water for frozen conditions
-              else
-                ! calculate enthalpy at the temperature (cubic spline interpolation)
-                call splint(Tk,Ey,E2,mlayerTempTrial(iLayer),enthTemp,err,cmessage)
-                if(err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-                ! calculate enthalpy at the critical temperature (cubic spline interpolation)
-                call splint(Tk,Ey,E2,Tcrit,enthTcrit,err,cmessage)
-                if(err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-                ! calculate the enthalpy of water
-                enthMix   = enthTemp - enthTcrit ! enthalpy of the liquid+ice mix
-                enthLiq   = iden_water*Cp_water*vFracWat*(Tcrit - Tfreeze)
-                enthWater = enthMix + enthLiq
-
-                ! *** compute the enthalpy associated with phase change
-                psiLiq    = (mLayerTempTrial(iLayer) - Tfreeze)*LH_fus/(gravity*Tfreeze)
-                vFracLiq  = volFracLiq(psiLiq,vGn_alpha,theta_res,theta_sat,vGn_n,vGn_m)
-                vFracIce  = vFracWat - vFracLiq
-                enthPhase = iden_water*LH_fus*vFracIce
-
-              endif ! (if frozen conditions)
-
-              ! *** compute the enthalpy of soil
-              enthSoil  = soil_dens_intr*Cp_soil*(1._rkind - theta_sat)*(mlayerTempTrial(iLayer) - Tfreeze)
-
-              ! *** compute the enthalpy of air
-              enthAir   = iden_air*Cp_air*(1._rkind - theta_sat - vFracWat)*(mlayerTempTrial(iLayer) - Tfreeze)
-
-              ! *** compute the total enthalpy (J m-3)
-              mLayerEnthalpy(iLayer) = enthSoil + enthWater + enthAir
-
-            end associate soilVars
-
-          ! -----
-          ! - checks...
-          ! -----------
-          case(iname_aquifer); cycle ! aquifer: do nothing
-          case default; err=20; message=trim(message)//'expect case to be iname_cas, iname_veg, iname_snow, iname_soil, iname_aquifer'; return
-        end select
-
-      end if  ! if an energy layer
-    end do  ! looping through state variables
-
-  end associate generalVars
-
-end subroutine t2enthalpy_T
-
-end module t2enthalpy_module
diff --git a/build/source/engine/vegPhenlgy.f90 b/build/source/engine/vegPhenlgy.f90
deleted file mode 100755
index 7850909fee2a19de4b315f48ef14378546d2bd6e..0000000000000000000000000000000000000000
--- a/build/source/engine/vegPhenlgy.f90
+++ /dev/null
@@ -1,198 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module vegPhenlgy_module
-
-! data types
-USE nrtype
-
-! global variables
-USE globalData,only:urbanVegCategory    ! vegetation category for urban areas
-
-! provide access to the derived types to define the data structures
-USE data_types,only:&
-                    var_i,            & ! data vector (i4b)
-                    var_d,            & ! data vector (dp)
-                    var_dlength,      & ! data vector with variable length dimension (dp)
-                    model_options       ! defines the model decisions
-
-! named variables defining elements in the data structures
-USE var_lookup,only:iLookTYPE,iLookATTR,iLookPARAM,iLookDIAG,iLookPROG  ! named variables for structure elements
-USE var_lookup,only:iLookDECISIONS                                      ! named variables for elements of the decision structure
-
-! look-up values for the boundary conditions
-USE mDecisions_module,only:      &
- prescribedHead,                 &      ! prescribed head (volumetric liquid water content for mixed form of Richards' eqn)
- prescribedTemp,                 &      ! prescribed temperature
- zeroFlux                               ! zero flux
-
-! look-up values for the choice of canopy shortwave radiation method
-USE mDecisions_module,only:      &
- noah_mp,                        &      ! full Noah-MP implementation (including albedo)
- CLM_2stream,                    &      ! CLM 2-stream model (see CLM documentation)
- UEB_2stream,                    &      ! UEB 2-stream model (Mahat and Tarboton, WRR 2011)
- NL_scatter,                     &      ! Simplified method Nijssen and Lettenmaier (JGR 1999)
- BeersLaw                               ! Beer's Law (as implemented in VIC)
-
-! privacy
-implicit none
-private
-public::vegPhenlgy
-! algorithmic parameters
-real(dp),parameter     :: valueMissing=-9999._dp  ! missing value, used when diagnostic or state variables are undefined
-real(dp),parameter     :: verySmall=1.e-6_dp      ! used as an additive constant to check if substantial difference among real numbers
-contains
-
-
- ! ************************************************************************************************
- ! public subroutine vegPhenlgy: compute vegetation phenology
- ! ************************************************************************************************
- subroutine vegPhenlgy(&
-                       ! input/output: data structures
-                       model_decisions,             & ! intent(in):    model decisions
-                       type_data,                   & ! intent(in):    type of vegetation and soil
-                       attr_data,                   & ! intent(in):    spatial attributes
-                       mpar_data,                   & ! intent(in):    model parameters
-                       prog_data,                   & ! intent(in):    prognostic variables for a local HRU
-                       diag_data,                   & ! intent(inout): diagnostic variables for a local HRU
-                       ! output
-                       computeVegFlux,              & ! intent(out): flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
-                       canopyDepth,                 & ! intent(out): canopy depth (m)
-                       exposedVAI,                  & ! intent(out): exposed vegetation area index (LAI + SAI)
-                       fracJulDay,                  &
-                       yearLength,                  &
-                       err,message)                   ! intent(out): error control
- ! -------------------------------------------------------------------------------------------------
- ! modules
- USE NOAHMP_ROUTINES,only:phenology         ! determine vegetation phenology
- implicit none
- ! -------------------------------------------------------------------------------------------------
- ! input/output
- type(model_options),intent(in)  :: model_decisions(:)  ! model decisions
- type(var_i),intent(in)          :: type_data           ! type of vegetation and soil
- type(var_d),intent(in)          :: attr_data           ! spatial attributes
- type(var_dlength),intent(in)    :: mpar_data           ! model parameters
- type(var_dlength),intent(in)    :: prog_data           ! prognostic variables for a local HRU
- type(var_dlength),intent(inout) :: diag_data           ! diagnostic variables for a local HRU
- ! output
- logical(lgt),intent(out)        :: computeVegFlux      ! flag to indicate if we are computing fluxes over vegetation (.false. means veg is buried with snow)
- real(dp),intent(out)            :: canopyDepth         ! canopy depth (m)
- real(dp),intent(out)            :: exposedVAI          ! exposed vegetation area index (LAI + SAI)
- real(dp),intent(inout)          :: fracJulDay
- integer(i4b),intent(inout)      :: yearLength
- integer(i4b),intent(out)        :: err                 ! error code
- character(*),intent(out)        :: message             ! error message
- ! -------------------------------------------------------------------------------------------------
- ! local
- real(dp)                 :: notUsed_heightCanopyTop    ! height of the top of the canopy layer (m)
- real(dp)                 :: heightAboveSnow            ! height top of canopy is above the snow surface (m)
- ! initialize error control
- err=0; message="vegPhenlgy/"
- ! ----------------------------------------------------------------------------------------------------------------------------------
- ! associate variables in the data structure
- associate(&
-
- ! input: model decisions
- ix_bcUpprTdyn                   => model_decisions(iLookDECISIONS%bcUpprTdyn)%iDecision,      & ! intent(in): [i4b] choice of upper boundary condition for thermodynamics
- ix_bcUpprSoiH                   => model_decisions(iLookDECISIONS%bcUpprSoiH)%iDecision,      & ! intent(in): [i4b] index of method used for the upper boundary condition for soil hydrology
-
- ! local attributes
- vegTypeIndex                    => type_data%var(iLookTYPE%vegTypeIndex),                     & ! intent(in): [i4b] vegetation type index
- latitude                        => attr_data%var(iLookATTR%latitude),                         & ! intent(in): [dp] latitude
-
- ! model state variables
- scalarSnowDepth                 => prog_data%var(iLookPROG%scalarSnowDepth)%dat(1),           & ! intent(in):    [dp] snow depth on the ground surface (m)
- scalarCanopyTemp                => prog_data%var(iLookPROG%scalarCanopyTemp)%dat(1),          & ! intent(in):    [dp] temperature of the vegetation canopy at the start of the sub-step (K)
-
- ! diagnostic variables and parameters (input)
- heightCanopyTop                 => mpar_data%var(iLookPARAM%heightCanopyTop)%dat(1),          & ! intent(in):    [dp] height of the top of the canopy layer (m)
- heightCanopyBottom              => mpar_data%var(iLookPARAM%heightCanopyBottom)%dat(1),       & ! intent(in):    [dp] height of the bottom of the canopy layer (m)
- scalarRootZoneTemp              => diag_data%var(iLookDIAG%scalarRootZoneTemp)%dat(1),        & ! intent(in):    [dp] root zone temperature (K)
-
- ! diagnostic variables and parameters (input/output)
- scalarLAI                       => diag_data%var(iLookDIAG%scalarLAI)%dat(1),                 & ! intent(inout): [dp] one-sided leaf area index (m2 m-2)
- scalarSAI                       => diag_data%var(iLookDIAG%scalarSAI)%dat(1),                 & ! intent(inout): [dp] one-sided stem area index (m2 m-2)
-
- ! diagnostic variables and parameters (output)
- scalarExposedLAI                => diag_data%var(iLookDIAG%scalarExposedLAI)%dat(1),          & ! intent(out): [dp] exposed leaf area index after burial by snow (m2 m-2)
- scalarExposedSAI                => diag_data%var(iLookDIAG%scalarExposedSAI)%dat(1),          & ! intent(out): [dp] exposed stem area index after burial by snow (m2 m-2)
- scalarGrowingSeasonIndex        => diag_data%var(iLookDIAG%scalarGrowingSeasonIndex)%dat(1)   & ! intent(out): [dp] growing season index (0=off, 1=on)
-
- ) ! associate variables in data structure
- ! ----------------------------------------------------------------------------------------------------------------------------------
-
- ! check if we have isolated the snow-soil domain (used in test cases)
- if(ix_bcUpprTdyn == prescribedTemp .or. ix_bcUpprTdyn == zeroFlux .or. ix_bcUpprSoiH == prescribedHead)then
-
-  ! isolated snow-soil domain: do not compute fluxes over vegetation
-  computeVegFlux = .false.
-
-  ! set vegetation phenology variables to missing
-  scalarLAI                = valueMissing    ! one-sided leaf area index (m2 m-2)
-  scalarSAI                = valueMissing    ! one-sided stem area index (m2 m-2)
-  scalarExposedLAI         = valueMissing    ! exposed leaf area index after burial by snow (m2 m-2)
-  scalarExposedSAI         = valueMissing    ! exposed stem area index after burial by snow (m2 m-2)
-  scalarGrowingSeasonIndex = valueMissing    ! growing season index (0=off, 1=on)
-  exposedVAI               = valueMissing    ! exposed vegetation area index (m2 m-2)
-  canopyDepth              = valueMissing    ! canopy depth (m)
-  heightAboveSnow          = valueMissing    ! height top of canopy is above the snow surface (m)
-
- ! compute vegetation phenology (checks for complete burial of vegetation)
- else
-
-  ! determine vegetation phenology
-  ! NOTE: recomputing phenology every sub-step accounts for changes in exposed vegetation associated with changes in snow depth
-  call phenology(&
-                 ! input
-                 vegTypeIndex,                & ! intent(in): vegetation type index
-                 urbanVegCategory,            & ! intent(in): vegetation category for urban areas
-                 scalarSnowDepth,             & ! intent(in): snow depth on the ground surface (m)
-                 scalarCanopyTemp,            & ! intent(in): temperature of the vegetation canopy at the start of the sub-step (K)
-                 latitude,                    & ! intent(in): latitude
-                 yearLength,                  & ! intent(in): number of days in the current year
-                 fracJulDay,                  & ! intent(in): fractional julian days since the start of year
-                 scalarLAI,                   & ! intent(inout): one-sided leaf area index (m2 m-2)
-                 scalarSAI,                   & ! intent(inout): one-sided stem area index (m2 m-2)
-                 scalarRootZoneTemp,          & ! intent(in): root zone temperature (K)
-                 ! output
-                 notUsed_heightCanopyTop,     & ! intent(out): height of the top of the canopy layer (m)
-                 scalarExposedLAI,            & ! intent(out): exposed leaf area index after burial by snow (m2 m-2)
-                 scalarExposedSAI,            & ! intent(out): exposed stem area index after burial by snow (m2 m-2)
-                 scalarGrowingSeasonIndex     ) ! intent(out): growing season index (0=off, 1=on)
-
-  ! determine additional phenological variables
-  exposedVAI      = scalarExposedLAI + scalarExposedSAI   ! exposed vegetation area index (m2 m-2)
-  canopyDepth     = heightCanopyTop - heightCanopyBottom  ! canopy depth (m)
-  heightAboveSnow = heightCanopyTop - scalarSnowDepth     ! height top of canopy is above the snow surface (m)
-
-  ! determine if need to include vegetation in the energy flux routines
-  computeVegFlux  = (exposedVAI > 0.05_dp .and. heightAboveSnow > 0.05_dp)
-  !write(*,'(a,1x,i2,1x,L1,1x,10(f12.5,1x))') 'vegTypeIndex, computeVegFlux, heightCanopyTop, heightAboveSnow, scalarSnowDepth = ', &
-  !                                            vegTypeIndex, computeVegFlux, heightCanopyTop, heightAboveSnow, scalarSnowDepth
-
- end if  ! (check if the snow-soil column is isolated)
-
- ! end association to variables in the data structure
- end associate
-
- end subroutine vegPhenlgy
-
-
-end module vegPhenlgy_module
diff --git a/build/source/hookup/ascii_util.f90 b/build/source/hookup/ascii_util.f90
deleted file mode 100755
index bde6b9c6b4eeea05e470672345b79c458d766e47..0000000000000000000000000000000000000000
--- a/build/source/hookup/ascii_util.f90
+++ /dev/null
@@ -1,201 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module ascii_util_module
-USE nrtype
-implicit none
-integer(i4b),parameter,public :: linewidth=4096  ! max character number for one line
-private
-public::file_open
-public::split_line
-public::get_vlines
-contains
-
-
- ! *********************************************************************************************************
- ! public subroutine file_open: open file
- ! *********************************************************************************************************
- subroutine file_open(infile,unt,err,message)
- implicit none
- ! declare dummy variables
- character(*),intent(in)              :: infile      ! filename
- integer(i4b),intent(out)             :: unt         ! file unit
- integer(i4b),intent(out)             :: err         ! error code
- character(*),intent(out)             :: message     ! error message
- ! declare local variables
- logical(lgt)                         :: xist        ! .TRUE. if the file exists
- logical(lgt)                         :: xopn        ! .TRUE. if the file is already open
- ! initialize errors
- err=0; message="f-file_open/"
- ! check if the file exists
- inquire(file=trim(infile),exist=xist) ! Check for existence of file
- if(.not.xist)then
-   message=trim(message)//"FileNotFound[file='"//trim(infile)//"']"
-   err=10; return
- end if
- ! check if the file is already open
- inquire(file=trim(infile),opened=xopn) ! Check if the file is open
- if(xopn)then
-  message=trim(message)//"FileAlreadyOpen['"//trim(infile)//"']"
-  err=20; return
- end if
- ! open file
- open(newunit=unt,file=trim(infile),status="old",action="read",iostat=err)
- if(err/=0)then
-   message=trim(message)//"OpenError['"//trim(infile)//"']"
-   err=20; return
- end if
- end subroutine file_open
-
-
- ! *********************************************************************************************************
- ! public subroutine split_line: split a line of characters into an vector of "words"
- ! *********************************************************************************************************
- subroutine split_line(inline,words,err,message)
- ! do not know how many "words", so use linked lists
- implicit none
- ! declare dummy arguments
- character(*),intent(in)                          :: inline     ! line of characters
- character(len=*),intent(out),allocatable         :: words(:)   ! vector of "words"
- integer(i4b),intent(out)                         :: err        ! error code
- character(*),intent(out)                         :: message    ! error message
- ! declare local variables
- integer(i4b),parameter                           :: cLen=8192
- character(len=cLen)                              :: temp                  ! temporary line of characters
- integer(i4b)                                     :: iword                 ! loop through words
- integer(i4b),parameter                           :: maxWords=1000         ! maximum number of words in a line
- integer(i4b)                                     :: i1                    ! index at the start of a given word
- character(len=256)                               :: cword                 ! the current word
- integer(i4b)                                     :: nWords                ! number of words in the character string
- ! define pointers for linked list
- type node
-  character(len=256)                              :: chardat
-  integer(i4b)                                    :: ix
-  type(node),pointer                              :: next=>null()
- end type node
- type(node),pointer                               :: list=>null()
- type(node),pointer                               :: current=>null()
- type(node),pointer                               :: previous=>null()
- ! start procedure here
- err=0; message='split_line/'
- temp=inline  ! initialize string of characters
- i1=1         ! initialize the index at the start of the first word
- ! ***** loop through the character string
- do iword=1,maxWords
-  ! extract a given "word"
-  temp=adjustl(temp(i1:len_trim(temp))); if(len_trim(temp)==0) exit
-  read(temp,*) cword
-  i1  =len_trim(cword)+1
-  ! add the variable to the linked list
-  if(iword==1)then
-   allocate(list); list=node(cword,iword,null())
-   current=>list
-  else
-   allocate(current%next); current%next=node(cword,iword,null())
-   current=>current%next
-  end if
-  ! check that the line has fewer words than maxWords
-  if (iword==maxWords)then; err=20; message=trim(message)//"exceedMaxWords [line = "//trim(inline)//"]"; return; end if
- end do
- ! ***** allocate space for the list of words
- nWords = current%ix
- allocate(words(nWords),stat=err)
- if(err/=0)then; err=30; message=trim(message)//"problemAllocateWords"; return; end if
- ! ***** save the list in a vector, and deallocate space as we go...
- current=>list
- do while(associated(current))
-  words(current%ix) = current%chardat
-  previous=>current; current=>current%next
-  deallocate(previous)
- end do
- end subroutine split_line
-
-
- ! *********************************************************************************************************
- ! public subroutine get_vlines: get valid lines of data from file and store as a vector of charater strings
- ! *********************************************************************************************************
-subroutine get_vlines(unt,vlines,err,message)
-  ! do not know how many valid lines, so use linked lists
-  implicit none
-  ! declare dummy arguments
-  integer(i4b),intent(in)                          :: unt         ! file unit
-  character(len=linewidth),intent(out),allocatable :: vlines(:)   ! vector of character strings
-  integer(i4b),intent(out)                         :: err         ! error code
-  character(*),intent(out)                         :: message     ! error message
-  ! declare local variables
-  integer(i4b)            :: iline                    ! loop through lines in the file
-  integer(i4b),parameter  :: maxLines=1000000         ! maximum number of valid lines in a file
-  character(len=2048)     :: temp                     ! character data or a given line
-  integer(i4b)            :: icount                   ! counter for the valid lines
-  integer(i4b)             :: iend                     ! index to indicate end of the file
-  character(len=2048),dimension(:),allocatable :: tempArray
-  ! define pointers for linked list
-  type node
-    character(len=2048)    :: chardat
-    integer(i4b)           :: ix
-    type(node),pointer     :: next=>null()
-  end type node
-  ! type(node),pointer      :: list=>null()
-  ! type(node),pointer      :: current=>null()
-  ! type(node),pointer      :: previous=>null()
-  ! start procedure here
-  err=0; message='get_vlines/'
-  allocate(tempArray(1000))
-  ! ***** get the valid lines of data from the file and store in linked lists *****
-  icount=0  ! initialize the counter for the valid lines
-  do iline=1,maxLines
-    read(unt,'(a)',iostat=iend)temp; if(iend/=0)exit    ! read line of data
-    if (temp(1:1)=='!' .or. temp == '')cycle            ! skip comment and empty lines
-    icount = icount+1
-    ! add the variable to the linked list
-    ! if(.not.associated(list))then
-    !   allocate(list)
-    !   allocate(current)
-    !   allocate(previous)
-    !   list=node(temp,icount,null())
-    !   current=>list
-    ! else
-    !  allocate(current%next)
-    !  current%next=node(temp,icount,null())
-    !  current=>current%next
-    ! end if
-    tempArray(icount) = temp
-    if (iline==maxLines)then; err=20; message=trim(message)//"exceedMaxLines"; return; end if
-  end do  ! looping through the lines in the file (exit clause above will kick in)
-  ! ***** allocate space for the valid lines *****
-  allocate(vlines(icount),stat=err)
-  if(err/=0)then; err=30; message=trim(message)//"problemAllocateVlines"; return; end if
-  ! ***** save the list in a vector, and deallocate space as we go... *****
-  do iline=1, icount
-    vlines(iline) = tempArray(iline)
-    ! print*, vlines(iline), "index = ", iline
-  end do
-  ! current=>list
-  ! do while(associated(current))
-  !   ! vlines(current%ix) = current%chardat
-  !   previous=>current; current=>current%next
-  !   deallocate(previous)
-  ! end do
-  ! if(associated(list)) nullify(list) 
-  deallocate(tempArray)
-end subroutine get_vlines
-
-
-end module ascii_util_module
diff --git a/build/source/hookup/summaActors_FileManager.f90 b/build/source/hookup/summaActors_FileManager.f90
deleted file mode 100755
index 161e8496a1cd77750b0d057fdff936e21647ffb9..0000000000000000000000000000000000000000
--- a/build/source/hookup/summaActors_FileManager.f90
+++ /dev/null
@@ -1,183 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-!******************************************************************
-! Original version based on:
-! (C) Copyright 2009-2010  ---  Dmitri Kavetski and Martyn Clark ---  All rights reserved
-!******************************************************************
-MODULE summaFileManager
-  USE, intrinsic :: iso_c_binding
-  use nrtype
-  implicit none
-  public
-  ! summa-wide pathlength
-  integer(i4b),parameter       :: summaPathLen=4096
-  ! defines the time of the run
-  CHARACTER(LEN=summaPathLen)  :: CONTROL_VRS      = 'SUMMA_FILE_MANAGER_V3.0.0'      ! control version
-  CHARACTER(LEN=summaPathLen)  :: SIM_START_TM     = '2000-01-01 00:00'               ! simulation start time
-  CHARACTER(LEN=summaPathLen)  :: SIM_END_TM       = '2000-01-01 00:00'               ! simulation end time
-  CHARACTER(LEN=summaPathLen)  :: NC_TIME_ZONE     = 'utcTime'                        ! time zone info
-  ! defines the path for data files (and default values)
-  CHARACTER(LEN=summaPathLen)  :: SETTINGS_PATH    = 'settings/'                      ! settings dir path
-  CHARACTER(LEN=summaPathLen)  :: STATE_PATH       = ''                               ! state file / init. cond. dir path (if omitted, defaults 
-                                                                                      !   to SETTINGS_PATH for input, OUTPATH for output)
-  CHARACTER(LEN=summaPathLen)  :: FORCING_PATH     = 'forcing/default/'               ! input_dir_path
-  CHARACTER(LEN=summaPathLen)  :: OUTPUT_PATH      = 'output/default/'                ! output_dir_path
-  ! define name of control files    (and default values)
-  CHARACTER(LEN=summaPathLen)  :: M_DECISIONS      = 'summa_zDecisions.txt'           ! definition of model decisions
-  CHARACTER(LEN=summaPathLen)  :: OUTPUT_CONTROL   = 'summa_zLocalModelVarMeta.txt'   ! metadata for model variables
-  CHARACTER(LEN=summaPathLen)  :: LOCAL_ATTRIBUTES = 'summa_zLocalAttributes.txt'     ! local attributes
-  CHARACTER(LEN=summaPathLen)  :: LOCALPARAM_INFO  = 'summa_zLocalParamInfo.txt'      ! default values and constraints for local model parameters
-  CHARACTER(LEN=summaPathLen)  :: BASINPARAM_INFO  = 'summa_zBasinParamInfo.txt'      ! default values and constraints for basin model parameters
-  CHARACTER(LEN=summaPathLen)  :: VEGPARM          = 'VEGPARM.TBL'                    ! noah vegetation parameter table
-  CHARACTER(LEN=summaPathLen)  :: SOILPARM         = 'SOILPARM.TBL'                   ! noah soil parameter table
-  CHARACTER(LEN=summaPathLen)  :: GENPARM          = 'GENPARM.TBL'                    ! noah general parameter table
-  CHARACTER(LEN=summaPathLen)  :: MPTABLE          = 'MPTABLE.TBL'                    ! noah mp parameter table
-  CHARACTER(LEN=summaPathLen)  :: FORCING_FILELIST = 'summa_zForcingFileList.txt'     ! list of focing files for each HRU
-  CHARACTER(LEN=summaPathLen)  :: MODEL_INITCOND   = 'summa_zInitialCond.txt'         ! model initial conditions
-  CHARACTER(LEN=summaPathLen)  :: PARAMETER_TRIAL  = 'summa_zParamTrial.txt'          ! trial values for model parameters
-  CHARACTER(LEN=summaPathLen)  :: OUTPUT_PREFIX    = 'summa_output_'                  ! prefix for the output file
-
-  contains
-
-! **************************************************************************************************
-! public subroutine summa_SetTimesDirsAndFiles: Sets times, directories and filenames for summa run
-! **************************************************************************************************
-subroutine summa_SetTimesDirsAndFiles(file_manager,err) bind(C, name="setTimesDirsAndFiles")
-  ! Purpose: Sets run times, directories and filenames for summa.
-  ! ---
-  USE ascii_util_module,only:file_open       ! function to open file
-  USE ascii_util_module,only:linewidth       ! max character number for one line
-  USE ascii_util_module,only:get_vlines      ! function to get a vector of non-comment lines
-
-  USE cppwrap_auxiliary,only:c_f_string
-
-
-  implicit none
-
-  ! input/output vars
-  character(kind=c_char,len=1),intent(in)   :: file_manager
-  integer(c_int),intent(out)                :: err
-  ! local vars
-  character(len=256)                        :: summaFileManagerIn
-  character(len=256)                        :: message
-  character(*),parameter                    :: summaFileManagerHeader='SUMMA_FILE_MANAGER_V3.0.0'
-  integer(i4b),parameter                    :: runinfo_fileunit=67   ! file unit for run time information
-  character(len=8)                          :: cdate
-  character(len=10)                         :: ctime
-  character(len=256)                        :: cmessage              ! error message for downwind routine
-  integer(i4b)                              :: unt                   ! file unit (free unit output from file_open)
-  character(LEN=linewidth),allocatable      :: charline(:)           ! vector of character strings
-  integer(i4b)                              :: iControl, nControl    ! number of model info
-  character(len=summaPathLen)               :: varEntry              ! name of model info
-  character(len=32)                         :: option                ! option for model info
-
-  err=0; message="summa_SetTimesDirsAndFiles/"
-
-  call c_f_string(file_manager, summaFileManagerIn, 256)
-  summaFileManagerIn = trim(summaFileManagerIn)
-
-
-  ! read information from model control file, and populate model control structure
-  ! populates global control information structure
-
-  ! open file, read non-comment lines, close file
-  call file_open(trim(summaFileManagerIn),unt,err,cmessage)
-  if(err/=0) then 
-    message=trim(message)//trim(cmessage)//"/Failed to open control file [''"//trim(summaFileManagerIn)//"']"
-    print*, message
-    err=-10 
-    return 
-  end if
-  call get_vlines(unt,charline,err,cmessage)  ! 'charline' is a list of strings from non-comment lines
-  if(err/=0) then
-    message=trim(message)//trim(cmessage)//"/Control file read issue in get_vlines()"
-    print*, message
-    return
-  end if
-  close(unt)
-
-  ! get the number of model control file entries
-  nControl = size(charline)
-
-  ! populate the model control info structure
-  do iControl=1,nControl
-    ! extract name of decision and the decision selected
-    read(charline(iControl),*,iostat=err) option, varEntry
-    if (err/=0) then 
-      err=30; message=trim(message)//"error reading charline array"; 
-      print*, message
-      return 
-    end if
-    ! get the index of the control file entry in the data structure
-
-    ! assign entries from control file to module public variables; add checking as needed
-    select case(trim(option))
-      case('controlVersion' );
-        CONTROL_VRS = trim(varEntry);
-        if(trim(varEntry)/=trim(summaFileManagerHeader)) then
-          message=trim(message)//"unknown control file version in '"//trim(summaFileManagerIn)//" looking for "//trim(summaFileManagerHeader)
-          err=20
-          return
-        end if
-      case('simStartTime'       ); SIM_START_TM = trim(varEntry)                  ! start simulation time
-      case('simEndTime'         ); SIM_END_TM = trim(varEntry)                    ! end simulation time
-      case('tmZoneInfo'         ); NC_TIME_ZONE = trim(varEntry)                  ! time zone info
-      case('settingsPath'       ); SETTINGS_PATH = trim(varEntry)                 ! settings directory
-      case('forcingPath'        ); FORCING_PATH = trim(varEntry)                  ! input forcing directory
-      case('outputPath'         ); OUTPUT_PATH = trim(varEntry)                   ! output directory
-      case('statePath'          ); STATE_PATH = trim(varEntry)                    ! state file input/output directory
-      case('decisionsFile'      ); M_DECISIONS = trim(varEntry)                   ! model decisions file
-      case('outputControlFile'  ); OUTPUT_CONTROL = trim(varEntry)                ! output control file
-      case('globalHruParamFile' ); LOCALPARAM_INFO = trim(varEntry)               ! default/global hru-level param file
-      case('globalGruParamFile' ); BASINPARAM_INFO = trim(varEntry)               ! default/global gru-level param file
-      case('attributeFile'      ); LOCAL_ATTRIBUTES = trim(varEntry)              ! attribute file
-      case('trialParamFile'     ); PARAMETER_TRIAL = trim(varEntry)               ! trial parameters file (hru and/or gru)
-      case('vegTableFile'       ); VEGPARM = trim(varEntry)                       ! vegetation parameter table
-      case('soilTableFile'      ); SOILPARM = trim(varEntry)                      ! soil parameter table
-      case('generalTableFile'   ); GENPARM = trim(varEntry)                       ! general parameter table
-      case('noahmpTableFile'    ); MPTABLE = trim(varEntry)                       ! noah mp parameter table
-      case('forcingListFile'    ); FORCING_FILELIST = trim(varEntry)              ! file listing forcing filenames
-      case('initConditionFile'  ); MODEL_INITCOND = trim(varEntry)                ! initial conditions file (cold State)
-      case('outFilePrefix'      ); OUTPUT_PREFIX = trim(varEntry)                 ! filename root for output files
-      ! get to here if cannot find the variable
-      case default
-        err=10
-        message=trim(message)//"unknown control file option: "//trim(option)
-        print*, message
-        return
-    end select
-  end do
-
-  ! before embarking on a run, check that the output directory is writable; write system date and time to a log file there
-  open(runinfo_fileunit,file=trim(OUTPUT_PATH)//"runinfo.txt",iostat=err)
-  if(err/=0)then
-    err=10; message=trim(message)//"cannot write to output directory '"//trim(OUTPUT_PATH)//"'"
-    print*, message
-    return
-  end if
-  call date_and_time(cdate,ctime)
-  write(runinfo_fileunit,*) 'Run start time on system:  ccyy='//cdate(1:4)//' - mm='//cdate(5:6)//' - dd='//cdate(7:8), &
-                          ' - hh='//ctime(1:2)//' - mi='//ctime(3:4)//' - ss='//ctime(5:10)
-  close(runinfo_fileunit)
-
-end subroutine summa_SetTimesDirsAndFiles
-
-END MODULE summaFileManager
diff --git a/build/source/lapack/Makefile b/build/source/lapack/Makefile
deleted file mode 100755
index 2d59c71140addf7f5e74a0368aed4386cadd81a8..0000000000000000000000000000000000000000
--- a/build/source/lapack/Makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-#========================================================================
-# PART 0: Define directory paths
-#========================================================================
-
-# Define core directory below which everything resides. This is the
-# parent directory of the 'build' directory
-F_MASTER = /home/mclark/summa
-
-# Core directory that contains source code
-F_KORE_DIR = $(F_MASTER)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(F_MASTER)/build/source/lapack
-
-# Define the directory for the executables
-EXE_PATH = $(F_MASTER)/build/source/lapack
-
-#========================================================================
-# PART 1: Assemble all of the sub-routines
-#========================================================================
-
-# Define directories
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-LAPACK_DIR = $(F_KORE_DIR)/lapack
-
-#
-# Numerical Recipes utilities
-SUMMA_NRUTIL= \
-        nrtype.f90
-NRUTIL = $(patsubst %, $(NUMREC_DIR)/%, $(SUMMA_NRUTIL))
-
-# numerical recipes routines
-SUMMA_NUMREC= \
-		luSolv_numrec.f90
-NUMREC = $(patsubst %, $(LAPACK_DIR)/%, $(SUMMA_NUMREC))
-
-# ... stitch together all programs
-LUTEST = $(NRUTIL) $(NUMREC)
-
-#========================================================================
-# PART 2: Define the libraries, driver programs, and executables
-#========================================================================
-
-# Define the Fortran Compiler
-FC  = ifort
-
-# Define the lapack library
-LAPK_PATH = /usr
-LIBLAPACK = -L$(LAPK_PATH)/lib -llapack
-
-DRIVER = test_lusolve.f90
-
-# Define the executable
-DRIVER__EX = test_lusolve.exe
-
-
-#========================================================================
-# PART 3: Compile the puppy
-#========================================================================
-
-# Define flags
-FLAGS = -debug -warn all -check all -FR -O0 -auto -WB -traceback -g -fltconsistency -fpe0
-
-all: compile link clean
-
-compile:
-	$(FC) $(FLAGS) -c $(LUTEST) $(DRIVER)
-
-link:
-	$(FC) *.o $(LIBLAPACK) -o $(DRIVER__EX)
-
-clean:
-	rm -f *.o
-	rm -f *.mod
diff --git a/build/source/lapack/README b/build/source/lapack/README
deleted file mode 100755
index c7fe5ddb9829c2421d2ce1de03dce63fd54f41d3..0000000000000000000000000000000000000000
--- a/build/source/lapack/README
+++ /dev/null
@@ -1 +0,0 @@
-Used to test the lapack routines
diff --git a/build/source/netcdf/netcdf_util.f90 b/build/source/netcdf/netcdf_util.f90
deleted file mode 100755
index 2419de413337c7769b33f5ac48bb1bbcffee9821..0000000000000000000000000000000000000000
--- a/build/source/netcdf/netcdf_util.f90
+++ /dev/null
@@ -1,103 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module netcdf_util_module
-USE nrtype
-USE netcdf
-implicit none
-private
-public::nc_file_open
-public::nc_file_close
-public::netcdf_err
-contains
-
-
- ! *********************************************************************************************************
- ! public subroutine file_open: open file
- ! *********************************************************************************************************
- subroutine nc_file_open(infile,mode,ncid,err,message)
- USE globalData,only:chunksize                       ! chunk size for netcdf read/write
- implicit none
- ! declare dummy variables
- character(*),intent(in)              :: infile      ! filename
- integer(i4b),intent(in)              :: mode        ! file open mode
- integer(i4b),intent(out)             :: ncid        ! file unit
- integer(i4b),intent(out)             :: err         ! error code
- character(*),intent(out)             :: message     ! error message
- ! declare local variables
- logical(lgt)                         :: xist        ! .TRUE. if the file exists
-
- ! initialize errors
- err=0; message="netcdf-file_open/"
-
- ! check if the file exists
- inquire(file=trim(infile),exist=xist) ! Check for existence of file
- if(.not.xist)then
-   message=trim(message)//"FileNotFound[file='"//trim(infile)//"']"
-   err=10; return
- end if
-
- ! open file
- err=nf90_open(infile, mode, ncid, chunksize=chunksize)
- if(err/=nf90_noerr) then
-   message=trim(message)//"OpenError['"//trim(infile)//"']"//trim(nf90_strerror(err))
-   err=20; return
- end if
-
- end subroutine nc_file_open
-
- ! **********************************************************************************************************
- ! private subroutine nc_file_close: close netcdf file
- ! **********************************************************************************************************
- subroutine nc_file_close(ncid,err,message)
- implicit none
-
- ! declare dummy variables
- integer(i4b),intent(in)    :: ncid         ! file id of netcdf file to close
- integer(i4b),intent(out)   :: err          ! error code
- character(*),intent(out)   :: message      ! error message
- ! initialize error control
- err=0; message = 'nc_file_close/'
-
- err = nf90_close(ncid);
- call netcdf_err(err,message)
-
- end subroutine nc_file_close
-
-! ***********************************************************************************************
-! check the status of netCDF file operation and return error message
-! ***********************************************************************************************
- subroutine netcdf_err(err,message)
-  ! used to handle errors for NetCDF calls
-  use netcdf
-  implicit none
-  ! declare dummies
-  integer(i4b), intent(inout)   :: err
-  character(*), intent(inout)   :: message
-  ! start procedure here
-  if (err/=nf90_noerr) then
-   print*, 'trim(nf90_strerror(err) = ', trim(nf90_strerror(err))
-   message=trim(message)//"["//trim(nf90_strerror(err))//"]"
-   print*, trim(message)
-   err=200
-  end if
- end subroutine netcdf_err
-
-end module netcdf_util_module
diff --git a/build/source/netcdf/read_icondActors.f90 b/build/source/netcdf/read_icondActors.f90
deleted file mode 100644
index 07223ea36ae51de5beece79856f6efdc022b48c3..0000000000000000000000000000000000000000
--- a/build/source/netcdf/read_icondActors.f90
+++ /dev/null
@@ -1,355 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module read_icond_gru_hru_module
-USE, intrinsic :: iso_c_binding
-USE nrtype
-USE netcdf
-USE globalData,only: ixHRUfile_min,ixHRUfile_max
-USE globalData,only: nTimeDelay   ! number of hours in the time delay histogram
-implicit none
-private
-public::read_icond
-public::read_icond_nlayers
-! define single HRU restart file
-integer(i4b), parameter :: singleHRU=1001
-integer(i4b), parameter :: multiHRU=1002
-integer(i4b), parameter :: restartFileType=multiHRU
-contains
-
- ! ************************************************************************************************
- ! public subroutine read_icond_nlayers: read model initial conditions file for number of snow/soil layers
- ! ************************************************************************************************
-subroutine read_icond_nlayers(nGRU,err) bind(C, name="readIcondNLayers")
-  ! --------------------------------------------------------------------------------------------------------
-  ! modules
-  USE nrtype
-  USE var_lookup,only:iLookIndex                        ! variable lookup structure
-  USE globalData,only:gru_struc                         ! gru-hru mapping structures
-  USE netcdf_util_module,only:nc_file_close             ! close netcdf file
-  USE netcdf_util_module,only:nc_file_open              ! close netcdf file
-  USE netcdf_util_module,only:netcdf_err                ! netcdf error handling
-  USE data_types,only:gru_hru_intVec                    ! actual data
-  USE data_types,only:var_info                          ! metadata
-
-  USE globalData,only:indx_meta
-  
-  ! file paths
-  USE summaFileManager,only:STATE_PATH                        ! optional path to state/init. condition files (defaults to SETTINGS_PATH)
-  USE summaFileManager,only:SETTINGS_PATH                     ! define path to settings files (e.g., parameters, soil and veg. tables)
-  USE summaFileManager,only:MODEL_INITCOND                    ! name of model initial conditions file
-
-  implicit none
-
-  ! --------------------------------------------------------------------------------------------------------
-  ! variable declarations
-  ! dummies
-  integer(c_int)        ,intent(in)     :: nGRU           ! total # of GRUs in run domain
-  integer(c_int)        ,intent(out)    :: err            ! error code
-
-  ! locals
-  integer(i4b)                        :: ncID                       ! netcdf file id
-  integer(i4b)                        :: dimID                      ! netcdf file dimension id
-  integer(i4b)                        :: fileHRU                    ! number of HRUs in netcdf file
-  integer(i4b)                        :: snowID, soilID             ! netcdf variable ids
-  integer(i4b)                        :: iGRU, iHRU                 ! loop indexes
-  integer(i4b)                        :: iHRU_global                ! index of HRU in the netcdf file
-  integer(i4b),allocatable            :: snowData(:)                ! number of snow layers in all HRUs
-  integer(i4b),allocatable            :: soilData(:)                ! number of soil layers in all HRUs
-  
-  character(len=256)                  :: iconFile          ! restart file name
-
-  
-  character(len=256)                  :: message        ! returned error message
-  character(len=256)                  :: cmessage                   ! downstream error message
-
-  ! --------------------------------------------------------------------------------------------------------
-  ! initialize error message
-  err=0
-  message = 'read_icond_nlayers/'
-
-  if(STATE_PATH == '') then
-      iconFile = trim(SETTINGS_PATH)//trim(MODEL_INITCOND)
-  else
-      iconFile = trim(STATE_PATH)//trim(MODEL_INITCOND)
-  endif
-
-  ! open netcdf file
-  call nc_file_open(iconFile,nf90_nowrite,ncid,err,cmessage);
-  if (err/=0) then; message=trim(message)//trim(cmessage); return; end if
-  
-
-  ! get number of HRUs in file (the GRU variable(s), if present, are processed at the end)
-  err = nf90_inq_dimid(ncID,"hru",dimId);               if(err/=nf90_noerr)then; message=trim(message)//'problem finding hru dimension/'//trim(nf90_strerror(err)); return; end if
-  err = nf90_inquire_dimension(ncID,dimId,len=fileHRU); if(err/=nf90_noerr)then; message=trim(message)//'problem reading hru dimension/'//trim(nf90_strerror(err)); return; end if
-
-  ! allocate storage for reading from file (allocate entire file size, even when doing subdomain run)
-  allocate(snowData(fileHRU))
-  allocate(soilData(fileHRU))
-  snowData = 0
-  soilData = 0
-
-  ! get netcdf ids for the variables holding number of snow and soil layers in each hru
-  err = nf90_inq_varid(ncid,trim(indx_meta(iLookIndex%nSnow)%varName),snowid); call netcdf_err(err,message)
-  err = nf90_inq_varid(ncid,trim(indx_meta(iLookIndex%nSoil)%varName),soilid); call netcdf_err(err,message)
-
-  ! get nSnow and nSoil data (reads entire state file)
-  err = nf90_get_var(ncid,snowid,snowData); call netcdf_err(err,message)
-  err = nf90_get_var(ncid,soilid,soilData); call netcdf_err(err,message)
-
-  ixHRUfile_min=huge(1)
-  ixHRUfile_max=0
-  ! find the min and max hru indices in the state file
-  do iGRU = 1,nGRU
-  do iHRU = 1,gru_struc(iGRU)%hruCount
-  if(gru_struc(iGRU)%hruInfo(iHRU)%hru_nc < ixHRUfile_min) ixHRUfile_min = gru_struc(iGRU)%hruInfo(iHRU)%hru_nc
-  if(gru_struc(iGRU)%hruInfo(iHRU)%hru_nc > ixHRUfile_max) ixHRUfile_max = gru_struc(iGRU)%hruInfo(iHRU)%hru_nc
-  end do
-  end do
-  
-
-  ! loop over grus in current run to update snow/soil layer information
-  do iGRU = 1,nGRU
-  do iHRU = 1,gru_struc(iGRU)%hruCount
-  iHRU_global = gru_struc(iGRU)%hruInfo(iHRU)%hru_nc
-
-  ! single HRU (Note: 'restartFileType' is hardwired above to multiHRU)
-  if(restartFileType==singleHRU) then
-      gru_struc(iGRU)%hruInfo(iHRU)%nSnow = snowData(1)
-      gru_struc(iGRU)%hruInfo(iHRU)%nSoil = soilData(1)
-
-  ! multi HRU
-  else
-      gru_struc(iGRU)%hruInfo(iHRU)%nSnow = snowData(iHRU_global)
-      gru_struc(iGRU)%hruInfo(iHRU)%nSoil = soilData(iHRU_global)
-  endif
-
-  end do
-  end do
-
-
-  ! close file
-  call nc_file_close(ncid,err,cmessage)
-  if(err/=0)then;message=trim(message)//trim(cmessage);return;end if
-
-  ! cleanup
-  deallocate(snowData,soilData)
-
-end subroutine read_icond_nlayers
-
-
-! ************************************************************************************************
-! public subroutine read_icond: read model initial conditions
-! ************************************************************************************************
-subroutine read_icond(&
-                    indxGRU,                       & ! intent(in):    Index of GRU in gru_struc
-                    indxHRU,                       & ! intent(in):    Index of HRU in gru_struc
-                    mparData,                      & ! intent(in):    model parameters
-                    progData,                      & ! intent(inout): model prognostic variables
-                    bvarData,                      & ! intent(inout): model basin (GRU) variables
-                    indxData,                      & ! intent(inout): model indices
-                    err,message)                     ! intent(out):   error control
-  ! --------------------------------------------------------------------------------------------------------
-  ! modules
-  USE nrtype
-  USE var_lookup,only:iLookVarType                       ! variable lookup structure
-  USE var_lookup,only:iLookPROG                          ! variable lookup structure
-  USE var_lookup,only:iLookPARAM                         ! variable lookup structure
-  USE var_lookup,only:iLookBVAR                          ! variable lookup structure
-  USE var_lookup,only:iLookINDEX                         ! variable lookup structure
-  USE globalData,only:prog_meta                          ! metadata for prognostic variables
-  USE globalData,only:bvar_meta                          ! metadata for basin (GRU) variables
-  USE globalData,only:gru_struc                          ! gru-hru mapping structures
-  USE globaldata,only:iname_soil,iname_snow              ! named variables to describe the type of layer
-  USE data_types,only:var_ilength                        ! full integer structure
-  USE data_types,only:var_dlength                        ! double precision structure for a single HRU
-  USE data_types,only:var_info                           ! metadata
-  USE get_ixName_module,only:get_varTypeName             ! to access type strings for error messages
-  USE updatState_module,only:updateSoil                  ! update soil states
-
-  USE netcdf
-
-  USE globalData,only:init_cond_prog
-  USE globalData,only:init_cond_bvar
-
-
-  implicit none
-
-  ! --------------------------------------------------------------------------------------------------------
-  ! variable declarations
-  ! dummies
-  integer(i4b)     ,intent(in)             :: indxGRU      ! index of GRU in gru_struc
-  integer(i4b)     ,intent(in)             :: indxHRU      ! index of HRU in hru_struc
-  type(var_dlength),intent(in)             :: mparData     ! model parameters
-  type(var_dlength),intent(inout)          :: progData     ! model prognostic variables
-  type(var_dlength),intent(inout)          :: bvarData     ! model basin (GRU) variables
-  type(var_ilength),intent(inout)          :: indxData     ! model indices
-  integer(i4b)     ,intent(out)            :: err          ! error code
-  character(*)     ,intent(out)            :: message      ! returned error message
-
-  ! locals
-  character(len=256)                     :: cmessage     ! downstream error message
-  integer(i4b)                           :: fileHRU      ! number of HRUs in file
-  integer(i4b)                           :: fileGRU      ! number of GRUs in file
-  integer(i4b)                           :: iVar, i      ! loop indices
-  integer(i4b),dimension(1)              :: ndx          ! intermediate array of loop indices
-  integer(i4b)                           :: dimID        ! varible dimension ids
-  integer(i4b)                           :: ncVarID      ! variable ID in netcdf file
-  character(256)                         :: dimName      ! not used except as a placeholder in call to inq_dim function
-  integer(i4b)                           :: dimLen       ! data dimensions
-  integer(i4b)                           :: ncID         ! netcdf file ID
-  integer(i4b)                           :: ixFile       ! index in file
-  integer(i4b)                           :: nSoil, nSnow, nToto ! # layers
-  integer(i4b)                           :: nTDH          ! number of points in time-delay histogram
-  integer(i4b)                           :: iLayer,jLayer ! layer indices
-  integer(i4b),parameter                 :: nBand=2       ! number of spectral bands
-
-  character(len=32),parameter            :: scalDimName   ='scalarv'  ! dimension name for scalar data
-  character(len=32),parameter            :: midSoilDimName='midSoil'  ! dimension name for soil-only layers
-  character(len=32),parameter            :: midTotoDimName='midToto'  ! dimension name for layered varaiables
-  character(len=32),parameter            :: ifcTotoDimName='ifcToto'  ! dimension name for layered varaiables
-  character(len=32),parameter            :: tdhDimName    ='tdh'      ! dimension name for time-delay basin variables
-
-  ! --------------------------------------------------------------------------------------------------------
-
-  ! Start procedure here
-  err=0; message="read_icondActors.f90 - read_icond/"
-
-  ! loop through prognostic variables
-  do iVar = 1,size(prog_meta)
-
-    ! skip variables that are computed later
-    if(prog_meta(iVar)%varName=='scalarCanopyWat'           .or. &
-      prog_meta(iVar)%varName=='spectralSnowAlbedoDiffuse' .or. &
-      prog_meta(iVar)%varName=='scalarSurfaceTemp'         .or. &
-      prog_meta(iVar)%varName=='mLayerVolFracWat'          .or. &
-      prog_meta(iVar)%varName=='mLayerHeight'                   ) cycle
-
-
-    ! get the number of layers
-    nSnow = gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow
-    nSoil = gru_struc(indxGRU)%hruInfo(indxHRU)%nSoil
-    nToto = nSnow + nSoil
-
-    ! put the data into data structures and check that none of the values are set to nf90_fill_double
-    select case (prog_meta(iVar)%varType)
-      case (iLookVarType%scalarv)
-        progData%var(iVar)%dat(1)       = init_cond_prog(iVar)%var_data(indxGRU,1)
-        if(abs(progData%var(iVar)%dat(1) - nf90_fill_double) < epsilon(init_cond_prog(iVar)%var_data))then; err=20; endif
-      case (iLookVarType%midSoil)
-        progData%var(iVar)%dat(1:nSoil) = init_cond_prog(iVar)%var_data(indxGRU,1:nSoil)
-        if(any(abs(progData%var(iVar)%dat(1:nSoil) - nf90_fill_double) < epsilon(init_cond_prog(iVar)%var_data)))then; err=20; endif
-      case (iLookVarType%midToto)
-        progData%var(iVar)%dat(1:nToto) = init_cond_prog(iVar)%var_data(indxGRU,1:nToto)
-        if(any(abs(progData%var(iVar)%dat(1:nToto) - nf90_fill_double) < epsilon(init_cond_prog(iVar)%var_data)))then; err=20; endif
-      case (iLookVarType%ifcToto)
-        progData%var(iVar)%dat(0:nToto) = init_cond_prog(iVar)%var_data(indxGRU,1:nToto+1)
-        if(any(abs(progData%var(iVar)%dat(0:nToto) - nf90_fill_double) < epsilon(init_cond_prog(iVar)%var_data)))then; err=20; endif
-      case default
-        message=trim(message)//"unexpectedVariableType[name='"//trim(prog_meta(iVar)%varName)//"';type='"//trim(get_varTypeName(prog_meta(iVar)%varType))//"']"
-        print*,message
-        err=20; return
-    end select
-
-    if(err==20)then; 
-      message=trim(message)//"data set to the fill value (name='"//trim(prog_meta(iVar)%varName)//"')"; 
-      print*, message
-      return;
-    endif
-
-    ! fix the snow albedo
-    if(progData%var(iLookPROG%scalarSnowAlbedo)%dat(1) < 0._dp)then
-    progData%var(iLookPROG%scalarSnowAlbedo)%dat(1) = mparData%var(iLookPARAM%albedoMax)%dat(1)
-    endif
-
-    ! initialize the spectral albedo
-    progData%var(iLookPROG%spectralSnowAlbedoDiffuse)%dat(1:nBand) = progData%var(iLookPROG%scalarSnowAlbedo)%dat(1)
-
-  end do ! end looping through prognostic variables (iVar)
-
-  ! --------------------------------------------------------------------------------------------------------
-  ! (2) set number of layers
-  ! --------------------------------------------------------------------------------------------------------
-
-  ! save the number of layers
-  indxData%var(iLookINDEX%nSnow)%dat(1)   = gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow
-  indxData%var(iLookINDEX%nSoil)%dat(1)   = gru_struc(indxGRU)%hruInfo(indxHRU)%nSoil
-  indxData%var(iLookINDEX%nLayers)%dat(1) = gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow + gru_struc(indxGRU)%hruInfo(indxHRU)%nSoil
-
-  ! set layer type
-  indxData%var(iLookINDEX%layerType)%dat(1:gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow) = iname_snow
-  indxData%var(iLookINDEX%layerType)%dat((gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow+1):(gru_struc(indxGRU)%hruInfo(indxHRU)%nSnow+gru_struc(indxGRU)%hruInfo(indxHRU)%nSoil)) = iname_soil
-
-
-  ! --------------------------------------------------------------------------------------------------------
-  ! (3) update soil layers (diagnostic variables)
-  ! --------------------------------------------------------------------------------------------------------
-  ! loop through soil layers
-  do iLayer = 1,indxData%var(iLookINDEX%nSoil)%dat(1)
-
-    ! get layer in the total vector
-    jLayer = iLayer+indxData%var(iLookINDEX%nSnow)%dat(1)
-
-    ! update soil layers
-    call updateSoil(&
-                    ! input
-                    progData%var(iLookPROG%mLayerTemp          )%dat(jLayer),& ! intent(in): temperature vector (K)
-                    progData%var(iLookPROG%mLayerMatricHead    )%dat(iLayer),& ! intent(in): matric head (m)
-                    mparData%var(iLookPARAM%vGn_alpha          )%dat(iLayer),& ! intent(in): van Genutchen "alpha" parameter
-                    mparData%var(iLookPARAM%vGn_n              )%dat(iLayer),& ! intent(in): van Genutchen "n" parameter
-                    mparData%var(iLookPARAM%theta_sat          )%dat(iLayer),& ! intent(in): soil porosity (-)
-                    mparData%var(iLookPARAM%theta_res          )%dat(iLayer),& ! intent(in): soil residual volumetric water content (-)
-                    1._dp - 1._dp/mparData%var(iLookPARAM%vGn_n)%dat(iLayer),& ! intent(in): van Genutchen "m" parameter (-)
-                    ! output
-                    progData%var(iLookPROG%mLayerVolFracWat    )%dat(jLayer),& ! intent(out): volumetric fraction of total water (-)
-                    progData%var(iLookPROG%mLayerVolFracLiq    )%dat(jLayer),& ! intent(out): volumetric fraction of liquid water (-)
-                    progData%var(iLookPROG%mLayerVolFracIce    )%dat(jLayer),& ! intent(out): volumetric fraction of ice (-)
-                    err,message)                                                                   ! intent(out): error control
-    if (err/=0) then; message=trim(message)//trim(cmessage); return; end if
-
-  end do  ! looping through soil layers
-
-  ! --------------------------------------------------------------------------------------------------------
-  ! (2) now get the basin variable(s)
-  ! --------------------------------------------------------------------------------------------------------
-
-  ! get the index in the file: single HRU
-  if(allocated(init_cond_bvar))then
-
-    ! loop through specific basin variables (currently 1 but loop provided to enable inclusion of others)
-    ndx = (/iLookBVAR%routingRunoffFuture/)   ! array of desired variable indices
-    do i = 1,size(ndx)
-      iVar = ndx(i)
-
-      ! store data in basin var (bvar) structure
-
-      ! put the data into data structures
-      bvarData%var(iVar)%dat(1:nTDH) = init_cond_bvar(i)%var_data(indxGRU,1:nTDH)
-      ! check whether the first values is set to nf90_fill_double
-      if(any(abs(bvarData%var(iVar)%dat(1:nTDH) - nf90_fill_double) < epsilon(init_cond_bvar(i)%var_data)))then; err=20; endif
-      if(err==20)then; message=trim(message)//"data set to the fill value (name='"//trim(bvar_meta(iVar)%varName)//"')"; return; endif
-
-    end do ! end looping through basin variables
-  endif  ! end if case for not being a singleHRU run - gaurded by the structure not being allocated
-
-
-end subroutine read_icond
-
-end module read_icond_gru_hru_module
diff --git a/build/source/netcdf/writeOutput.f90 b/build/source/netcdf/writeOutput.f90
deleted file mode 100644
index 26e84a3a72a58d7772c9cfcddd068d183d93b194..0000000000000000000000000000000000000000
--- a/build/source/netcdf/writeOutput.f90
+++ /dev/null
@@ -1,458 +0,0 @@
-! SUMMA - Structure for Unifying Multiple Modeling Alternatives
-! Copyright (C) 2014-2020 NCAR/RAL; University of Saskatchewan; University of Washington
-!
-! This file is part of SUMMA
-!
-! For more information see: http://www.ral.ucar.edu/projects/summa
-!
-! This program is free software: you can redistribute it and/or modify
-! it under the terms of the GNU General Public License as published by
-! the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! This program is distributed in the hope that it will be useful,
-! but WITHOUT ANY WARRANTY; without even the implied warranty of
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-! GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License
-! along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-module writeOutput_module
-
-! NetCDF types
-USE netcdf
-USE netcdf_util_module,only:netcdf_err                    ! netcdf error handling function
-
-! top-level data types
-USE nrtype
-
-! missing values
-USE globalData,only: integerMissing, realMissing
-
-! provide access to global data
-USE globalData,only:gru_struc                             ! gru->hru mapping structure
-
-USE data_types,only:var_i
-
-! provide access to the derived types to define the data structures
-USE data_types,only:&
-                    ! final data vectors
-                    dlength,             & ! var%dat
-                    ilength,             & ! var%dat
-                    time_dlength,        & ! var(:)%tim(:)%dat (dp)
-                    ! no spatial dimension
-                    var_i,               & ! x%var(:)            (i4b)
-                    var_i8,              & ! x%var(:)            integer(8)
-                    var_d,               & ! x%var(:)            (dp)
-                    var_ilength,         & ! x%var(:)%dat        (i4b)
-                    var_dlength,         & ! x%var(:)%dat        (dp)
-                    ! no variable dimension
-                    hru_i,               & ! x%hru(:)            (i4b)
-                    hru_d,               & ! x%hru(:)            (dp)
-                    time_i,              &
-                    ! gru dimension
-                    gru_int,             & ! x%gru(:)%var(:)     (i4b)
-                    gru_double,          & ! x%gru(:)%var(:)     (dp)
-                    gru_intVec,          & ! x%gru(:)%var(:)%dat (i4b)
-                    gru_doubleVec,       & ! x%gru(:)%var(:)%dat (dp)
-                    ! gru+hru dimension
-                    gru_hru_int,         & ! x%gru(:)%hru(:)%var(:)     (i4b)
-                    gru_hru_int8,        & ! x%gru(:)%hru(:)%var(:)     integer(8)
-                    gru_hru_double,      & ! x%gru(:)%hru(:)%var(:)     (dp)
-                    gru_hru_intVec,      & ! x%gru(:)%hru(:)%var(:)%dat (i4b)
-                    gru_hru_doubleVec,   & ! x%gru(:)%hru(:)%var(:)%dat (dp)
-                    gru_hru_time_double, &
-                    gru_hru_time_doubleVec,&
-                    gru_hru_time_intVec
-
-! vector lengths
-USE var_lookup, only: maxvarFreq ! number of output frequencies
-USE var_lookup, only: maxvarStat ! number of statistics
-
-implicit none
-private
-public::writeParm
-public::writeData
-public::writeBasin
-public::writeTime
-
-! define dimension lengths
-integer(i4b),parameter      :: maxSpectral=2              ! maximum number of spectral bands
-contains
-
-    ! **********************************************************************************************************
-    ! public subroutine writeParm: write model parameters
-    ! **********************************************************************************************************
-subroutine writeParm(ncid,ispatial,struct,meta,err,message)
-  USE data_types,only:var_info                    ! metadata info
-  USE var_lookup,only:iLookStat                   ! index in statistics vector
-  USE var_lookup,only:iLookFreq                   ! index in vector of model output frequencies
-  implicit none
-
-  ! declare input variables
-  type(var_i)   ,intent(in)   :: ncid             ! file ids
-  integer(i4b)  ,intent(in)   :: iSpatial         ! hydrologic response unit
-  class(*)      ,intent(in)   :: struct           ! data structure
-  type(var_info),intent(in)   :: meta(:)          ! metadata structure
-  integer(i4b)  ,intent(out)  :: err              ! error code
-  character(*)  ,intent(out)  :: message          ! error message
-  ! local variables
-  integer(i4b)                :: iVar             ! loop through variables
-
-  ! initialize error control
-  err=0;message="writeParm/"
-  ! loop through local column model parameters
-  do iVar = 1,size(meta)
-
-    ! check that the variable is desired
-    if (meta(iVar)%statIndex(iLookFREQ%timestep)==integerMissing) cycle
-
-    ! initialize message
-    message=trim(message)//trim(meta(iVar)%varName)//'/'
-
-    ! HRU data
-    if (iSpatial/=integerMissing) then
-      select type (struct)
-        class is (var_i)
-          err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)/),start=(/iSpatial/),count=(/1/))
-        class is (var_i8)
-          err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)/),start=(/iSpatial/),count=(/1/))
-        class is (var_d)
-          err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)/),start=(/iSpatial/),count=(/1/))
-        class is (var_dlength)
-          err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)%dat/),start=(/iSpatial,1/),count=(/1,size(struct%var(iVar)%dat)/))
-        class default; err=20; message=trim(message)//'unknown variable type (with HRU)'; return
-      end select
-      call netcdf_err(err,message); if (err/=0) return
-
-      ! GRU data
-    else
-      select type (struct)
-        class is (var_d)
-          err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)/),start=(/1/),count=(/1/))
-        class is (var_i8)
-          err = nf90_put_var(ncid%var(iLookFreq%timestep),meta(iVar)%ncVarID(iLookFreq%timestep),(/struct%var(iVar)/),start=(/1/),count=(/1/))
-        class default; err=20; message=trim(message)//'unknown variable type (no HRU)'; return
-      end select
-    end if
-    call netcdf_err(err,message); if (err/=0) return
-
-    ! re-initialize message
-    message="writeParm/"
-  end do  ! looping through local column model parameters
-
-end subroutine writeParm
-
-! Change Name to writeData when done
-subroutine writeData(ncid, finalize_stats, output_timestep, max_layers, index_gru, num_gru, meta, &
-    stat, dat, struct_name, map, indx, err, message)
-  USE netcdf
-  USE data_types,only:var_info                       ! metadata type
-  USE globalData,only:outFreq                        ! output file information
-  USE var_lookup,only:iLookVarType                   ! index into type structure
-  USE var_lookup,only:iLookIndex                     ! index into index structure
-  USE var_lookup,only:iLookProg                    ! index into index structure
-  USE get_ixName_module,only:get_statName            ! to access type strings for error messages
-  implicit none
-  ! dummy variables
-  type(var_i),      intent(in)       :: ncid
-  logical(lgt),     intent(in)       :: finalize_stats(:)  ! flags to finalize statistics
-  integer(i4b),     intent(inout)    :: output_timestep(:) ! number of HRUs in the run domain
-  integer(i4b),     intent(in)       :: max_layers
-  integer(i4b),     intent(in)       :: index_gru
-  integer(i4b),     intent(in)       :: num_gru
-  type(var_info),   intent(in)       :: meta(:)           ! meta data
-  class(*),         intent(in)       :: stat              ! stats data
-  class(*),         intent(in)       :: dat               ! timestep data
-  character(*),     intent(in)       :: struct_name
-  integer(i4b),     intent(in)       :: map(:)            ! map into stats child struct
-  type(var_ilength),intent(in)       :: indx
-  integer(i4b),     intent(out)      :: err               ! error code
-  character(*),     intent(out)      :: message           ! error message
-  ! local variables
-  integer(i4b)                       :: iVar              ! variable index
-  integer(i4b)                       :: iStat             ! statistics index
-  integer(i4b)                       :: iFreq             ! frequency index
-  integer(i4b)                       :: ncVarID           ! used only for time
-  integer(i4b)                       :: index_hru
-  integer(i4b)                       :: nSnow             ! number of snow layers
-  integer(i4b)                       :: nSoil             ! number of soil layers
-  integer(i4b)                       :: nLayers           ! total number of layers
-  ! output array
-  integer(i4b)                       :: datLength         ! length of each data vector
-  integer(i4b)                       :: maxLength         ! maximum length of each data vector
-  real(rkind)                        :: realVec(num_gru)  ! real vector for all HRUs in the run domain
-  real(rkind)                        :: realArray(num_gru,max_layers+1)  ! real array for all HRUs in the run domain
-  integer(i4b)                       :: intArray(num_gru,max_layers+1)  ! real array for all HRUs in the run domain
-  integer(i4b)                       :: dataType          ! type of data
-  integer(i4b),parameter             :: ixInteger=1001    ! named variable for integer
-  integer(i4b),parameter             :: ixReal=1002       ! named variable for real
-  
-  err=0;message="writeOutput.f90 - writeDataNew/"
-
-  ! loop through output frequencies
-  do iFreq=1,maxvarFreq
-    if(.not.outFreq(iFreq)) cycle ! check if frequency is desired (timestep, day, month, year)
-    
-    if(.not.finalize_stats(iFreq)) cycle ! check we have statistics for a frequency
-    
-    do iVar = 1,size(meta)
-      ! handle time
-      if (meta(iVar)%varName=='time' .and. struct_name == 'forc')then
-        
-        ! get variable index
-        err = nf90_inq_varid(ncid%var(iFreq),trim(meta(iVar)%varName),ncVarID)
-        call netcdf_err(err,message)
-        if (err/=0) then
-          print*, message
-          return
-        endif 
-
-        select type(dat)
-          class is(var_d)
-            err = nf90_put_var(ncid%var(iFreq),ncVarID,dat%var(iVar),start=(/output_timestep(iFreq)/))
-            call netcdf_err(err,message)
-            if (err/=0) then
-              print*, message
-              return
-            endif
-            cycle
-            class default
-              err=20
-              message=trim(message)//'time variable must be of type var_dlength (forcing data structure)'
-              print*, message
-              return
-        end select
-        
-        call netcdf_err(err,message)
-        if (err/=0) then
-          print*, message
-          return
-        endif
-      endif 
-
-      ! define the statistics index
-      iStat = meta(iVar)%statIndex(iFreq)
-
-      ! check that the variable is desired
-      if (iStat==integerMissing.or.trim(meta(iVar)%varName)=='unknown') cycle
-      
-      ! check if we are writing a vector or a scalar
-      if(meta(iVar)%varType==iLookVarType%scalarv) then
-        select type(stat)
-          class is (var_dlength)
-            realVec(1) = stat%var(map(iVar))%dat(iFreq)
-            err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),realVec,start=(/index_gru,output_timestep(iFreq)/),count=(/num_gru,1/))
-            if (err/=0) then
-              print*, message
-              return
-            endif 
-          class default
-            err=20
-            message=trim(message)//'stats must be scalarv and of type var_dlength'
-            print*, message
-            return
-        end select ! stat
-
-      else
-
-         ! Write the data
-        select type(dat)
-          class is (var_dlength)
-            realArray(:,:) = realMissing;    dataType=ixReal
-          class is (var_ilength)
-            intArray(:,:) = integerMissing; dataType=ixInteger
-          class default
-          err=20
-          message=trim(message)//'data must be of type integer or real'
-          print*, message
-          return
-      end select
-        ! vector
-        nSoil   = indx%var(iLookIndex%nSoil)%dat(1)
-        nSnow   = indx%var(iLookIndex%nSnow)%dat(1)
-        nLayers = indx%var(iLookIndex%nLayers)%dat(1)
-
-         ! get the length of each data vector
-        select case (meta(iVar)%varType)
-          case(iLookVarType%wLength); datLength = maxSpectral
-          case(iLookVarType%midToto); datLength = nLayers
-          case(iLookVarType%midSnow); datLength = nSnow
-          case(iLookVarType%midSoil); datLength = nSoil
-          case(iLookVarType%ifcToto); datLength = nLayers+1
-          case(iLookVarType%ifcSnow); datLength = nSnow+1
-          case(iLookVarType%ifcSoil); datLength = nSoil+1
-          case default; cycle
-        end select ! vartype
-
-                ! get the data vectors
-        select type (dat)
-          class is (var_dlength)
-            realArray(1,1:datLength) = dat%var(iVar)%dat(:)
-          class is (var_ilength);  intArray(1,1:datLength) = dat%var(iVar)%dat(:)
-          class default; err=20; message=trim(message)//'data must not be scalarv and either of type gru_hru_doubleVec or gru_hru_intVec'; return
-        end select
-
-        ! get the maximum length of each data vector
-        select case (meta(iVar)%varType)
-          case(iLookVarType%wLength); maxLength = maxSpectral
-          case(iLookVarType%midToto); maxLength = max_layers
-          case(iLookVarType%midSnow); maxLength = max_layers-nSoil
-          case(iLookVarType%midSoil); maxLength = nSoil
-          case(iLookVarType%ifcToto); maxLength = max_layers+1
-          case(iLookVarType%ifcSnow); maxLength = (max_layers-nSoil)+1
-          case(iLookVarType%ifcSoil); maxLength = nSoil+1
-          case default; cycle
-        end select ! vartype
-
-        ! Write the data
-        select case(dataType)
-          case(ixReal)
-            err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),realArray(1:num_gru,1:maxLength),start=(/index_gru,1,output_timestep(iFreq)/),count=(/num_gru,maxLength,1/))
-          case(ixInteger)
-            err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),intArray(1:num_gru,1:maxLength),start=(/index_gru,1,output_timestep(iFreq)/),count=(/num_gru,maxLength,1/))
-          case default
-            err=20
-            message=trim(message)//'data must be of type integer or real'
-            print*, message
-            return
-        end select
-      endif
-
-         ! process error code
-      if (err/=0)then
-        message=trim(message)//trim(meta(iVar)%varName)//'_'//trim(get_statName(iStat))
-        print*, message
-      end if
-      call netcdf_err(err,message)
-      if (err/=0) then
-        print*, message
-        return
-      endif
-
-    end do ! iVar
-  end do ! iFreq
-end subroutine writeData
-
-! **************************************************************************************
-! public subroutine writeBasin: write basin-average variables
-! **************************************************************************************
-subroutine writeBasin(ncid,iGRU,finalizeStats,outputTimestep,meta,stat,dat,map,err,message)
-  USE data_types,only:var_info                       ! metadata type
-  USE var_lookup,only:maxVarStat                     ! index into stats structure
-  USE var_lookup,only:iLookVarType                   ! index into type structure
-  USE globalData,only:outFreq                        ! output file information
-  USE get_ixName_module,only:get_varTypeName         ! to access type strings for error messages
-  USE get_ixName_module,only:get_statName            ! to access type strings for error messages
-  implicit none
-
-  ! declare dummy variables
-  type(var_i),   intent(in)     :: ncid              ! file ids
-  integer(i4b),  intent(in)     :: iGRU              ! GRU index
-  logical(lgt),  intent(in)     :: finalizeStats(:)    
-  integer(i4b),  intent(inout)  :: outputTimestep(:) ! output time step
-  type(var_info),intent(in)     :: meta(:)           ! meta data
-  type(dlength),intent(in)      :: stat(:)           ! stats data
-  type(dlength),intent(in)      :: dat(:)            ! timestep data
-  integer(i4b)  ,intent(in)     :: map(:)            ! map into stats child struct
-  integer(i4b)  ,intent(out)    :: err               ! error code
-  character(*)  ,intent(out)    :: message           ! error message
-  ! local variables
-  integer(i4b)                  :: iVar              ! variable index
-  integer(i4b)                  :: iStat             ! statistics index
-  integer(i4b)                  :: iFreq             ! frequency index
-  ! initialize error control
-  err=0;message="f-writeBasin/"
-
-  ! loop through output frequencies
-  do iFreq=1,maxvarFreq
-
-    ! skip frequencies that are not needed
-    if(.not.outFreq(iFreq)) cycle
-
-    ! check that we have finalized statistics for a given frequency
-    if(.not.finalizeStats(iFreq)) cycle
-
-    ! loop through model variables
-    do iVar = 1,size(meta)
-
-      ! define the statistics index
-      iStat = meta(iVar)%statIndex(iFreq)
-
-      ! check that the variable is desired
-      if (iStat==integerMissing.or.trim(meta(iVar)%varName)=='unknown') cycle
-
-      ! stats/data output - select data type
-      select case (meta(iVar)%varType)
-
-        case (iLookVarType%scalarv)
-          err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),(/stat(map(iVar))%dat(iFreq)/),start=(/iGRU,outputTimestep(iFreq)/),count=(/1,1/))
-
-        case (iLookVarType%routing)
-          if (iFreq==1 .and. outputTimestep(iFreq)==1) then
-            err = nf90_put_var(ncid%var(iFreq),meta(iVar)%ncVarID(iFreq),(/dat(iVar)%dat/),start=(/1/),count=(/1000/))
-          end if
-        case default
-          err=40; message=trim(message)//"unknownVariableType[name='"//trim(meta(iVar)%varName)//"';type='"//trim(get_varTypeName(meta(iVar)%varType))//    "']"; return
-      end select ! variable type
-
-      ! process error code
-      if (err.ne.0) message=trim(message)//trim(meta(iVar)%varName)//'_'//trim(get_statName(iStat))
-      call netcdf_err(err,message); if (err/=0) return
-    end do ! iVar
-  end do ! iFreq
-
-end subroutine writeBasin
-
-    ! **************************************************************************************
-    ! public subroutine writeTime: write current time to all files
-    ! **************************************************************************************
-subroutine writeTime(ncid,finalizeStats,outputTimestep,meta,dat,err,message)
-USE data_types,only:var_info                       ! metadata type
-USE var_lookup,only:iLookStat                      ! index into stat structure
-implicit none
-
-! declare dummy variables
-type(var_i)   ,intent(in)     :: ncid              ! file ids
-logical(lgt)  ,intent(in)     :: finalizeStats(:)  ! flags to finalize statistics
-integer(i4b)  ,intent(inout)  :: outputTimestep(:) ! output time step
-type(var_info),intent(in)     :: meta(:)           ! meta data
-integer       ,intent(in)     :: dat(:)            ! timestep data
-integer(i4b)  ,intent(out)    :: err               ! error code
-character(*)  ,intent(out)    :: message           ! error message
-! local variables
-integer(i4b)                  :: iVar              ! variable index
-integer(i4b)                  :: iFreq             ! frequency index
-integer(i4b)                  :: ncVarID           ! used only for time
-! initialize error control
-err=0;message="f-writeTime/"
-! loop through output frequencies
-do iFreq=1,maxvarFreq
-
-  ! check that we have finalized statistics for a given frequency
-  if(.not.finalizeStats(iFreq)) cycle
-
-  ! loop through model variables
-  do iVar = 1,size(meta)
-
-    ! check instantaneous
-  if (meta(iVar)%statIndex(iFreq)/=iLookStat%inst) cycle
-      ! get variable id in file
-    err = nf90_inq_varid(ncid%var(iFreq),trim(meta(iVar)%varName),ncVarID)
-    if (err/=0) message=trim(message)//trim(meta(iVar)%varName); call netcdf_err(err,message)
-    if (err/=0) then; err=20; return; end if
-
-    ! add to file
-    err = nf90_put_var(ncid%var(iFreq),ncVarID,(/dat(iVar)/),start=(/outputTimestep(iFreq)/),count=(/1/))
-    if (err/=0) message=trim(message)//trim(meta(iVar)%varName);call netcdf_err(err,message)
-    if (err/=0) then; err=20; return; end if
-
-  end do ! iVar
-end do ! iFreq
-
-
-end subroutine writeTime
-
-   
-end module writeOutput_module
\ No newline at end of file
diff --git a/build/source/netcdf/writeRestart.f90 b/build/source/netcdf/writeRestart.f90
deleted file mode 100644
index 116851765bc31f63af15d0ff5277d95b920cbb68..0000000000000000000000000000000000000000
--- a/build/source/netcdf/writeRestart.f90
+++ /dev/null
@@ -1,253 +0,0 @@
- ! *********************************************************************************************************
-    ! public subroutine printRestartFile: print a re-start file
-    ! *********************************************************************************************************
-    subroutine writeRestart(filename,         & ! intent(in): name of restart file
-        nGRU,             & ! intent(in): number of GRUs
-        nHRU,             & ! intent(in): number of HRUs
-        prog_meta,        & ! intent(in): prognostics metadata
-        prog_data,        & ! intent(in): prognostics data
-        bvar_meta,        & ! intent(in): basin (gru) variable metadata
-        bvar_data,        & ! intent(in): basin (gru) variable data
-        maxLayers,        & ! intent(in): maximum number of layers
-        maxSnowLayers,    & ! intent(in): maximum number of snow layers
-        indx_meta,        & ! intent(in): index metadata
-        indx_data,        & ! intent(in): index data
-        err,message)        ! intent(out): error control
-! --------------------------------------------------------------------------------------------------------
-! --------------------------------------------------------------------------------------------------------
-! access the derived types to define the data structures
-USE data_types,only:var_info               ! metadata
-! access named variables defining elements in the data structures
-USE var_lookup,only:iLookINDEX             ! named variables for structure elements
-USE var_lookup,only:iLookVarType           ! named variables for structure elements
-USE var_lookup,only:iLookBVAR              ! named variables for structure elements
-! constants
-USE globalData,only:gru_struc              ! gru-hru mapping structures
-! external routines
-USE netcdf_util_module,only:nc_file_close  ! close netcdf file
-USE netcdf_util_module,only:nc_file_open   ! open netcdf file
-USE globalData,only:nTimeDelay             ! number of timesteps in the time delay histogram
-
-implicit none
-! --------------------------------------------------------------------------------------------------------
-! input
-character(len=256),intent(in)      :: filename      ! name of the restart file
-integer(i4b),intent(in)            :: nGRU          ! number of GRUs
-integer(i4b),intent(in)            :: nHRU          ! number of HRUs
-type(var_info),intent(in)          :: prog_meta(:)  ! prognostic variable metadata
-type(gru_hru_doubleVec),intent(in) :: prog_data     ! prognostic vars
-type(var_info),intent(in)          :: bvar_meta(:)  ! basin variable metadata
-type(gru_doubleVec),intent(in)     :: bvar_data     ! basin variables
-type(var_info),intent(in)          :: indx_meta(:)  ! metadata
-type(gru_hru_intVec),intent(in)    :: indx_data     ! indexing vars
-! output: error control
-integer(i4b),intent(out)           :: err           ! error code
-character(*),intent(out)           :: message       ! error message
-! --------------------------------------------------------------------------------------------------------
-! dummy variables
-integer(i4b), intent(in)           :: maxLayers     ! maximum number of total layers
-integer(i4b), intent(in)           :: maxSnowLayers ! maximum number of snow layers
-
-! local variables
-integer(i4b)                       :: ncid          ! netcdf file id
-integer(i4b),allocatable           :: ncVarID(:)    ! netcdf variable id
-integer(i4b)                       :: ncSnowID      ! index variable id
-integer(i4b)                       :: ncSoilID      ! index variable id
-
-integer(i4b)                       :: nSoil         ! number of soil layers
-integer(i4b)                       :: nSnow         ! number of snow layers
-integer(i4b)                       :: maxSnow       ! maximum number of snow layers
-integer(i4b)                       :: maxSoil       ! maximum number of soil layers
-integer(i4b)                       :: nLayers       ! number of total layers
-integer(i4b),parameter             :: nSpectral=2   ! number of spectal bands
-integer(i4b),parameter             :: nScalar=1     ! size of a scalar
-integer(i4b)                       :: nProgVars     ! number of prognostic variables written to state file
-
-integer(i4b)                       :: hruDimID      ! variable dimension ID
-integer(i4b)                       :: gruDimID      ! variable dimension ID
-integer(i4b)                       :: tdhDimID      ! variable dimension ID
-integer(i4b)                       :: scalDimID     ! variable dimension ID
-integer(i4b)                       :: specDimID     ! variable dimension ID
-integer(i4b)                       :: midSnowDimID  ! variable dimension ID
-integer(i4b)                       :: midSoilDimID  ! variable dimension ID
-integer(i4b)                       :: midTotoDimID  ! variable dimension ID
-integer(i4b)                       :: ifcSnowDimID  ! variable dimension ID
-integer(i4b)                       :: ifcSoilDimID  ! variable dimension ID
-integer(i4b)                       :: ifcTotoDimID  ! variable dimension ID
-
-character(len=32),parameter        :: hruDimName    ='hru'      ! dimension name for HRUs
-character(len=32),parameter        :: gruDimName    ='gru'      ! dimension name for GRUs
-character(len=32),parameter        :: tdhDimName    ='tdh'      ! dimension name for time-delay basin variables
-character(len=32),parameter        :: scalDimName   ='scalarv'  ! dimension name for scalar data
-character(len=32),parameter        :: specDimName   ='spectral' ! dimension name for spectral bands
-character(len=32),parameter        :: midSnowDimName='midSnow'  ! dimension name for snow-only layers
-character(len=32),parameter        :: midSoilDimName='midSoil'  ! dimension name for soil-only layers
-character(len=32),parameter        :: midTotoDimName='midToto'  ! dimension name for layered varaiables
-character(len=32),parameter        :: ifcSnowDimName='ifcSnow'  ! dimension name for snow-only layers
-character(len=32),parameter        :: ifcSoilDimName='ifcSoil'  ! dimension name for soil-only layers
-character(len=32),parameter        :: ifcTotoDimName='ifcToto'  ! dimension name for layered variables
-
-integer(i4b)                       :: cHRU          ! count of HRUs
-integer(i4b)                       :: iHRU          ! index of HRUs
-integer(i4b)                       :: iGRU          ! index of GRUs
-integer(i4b)                       :: iVar          ! variable index
-logical(lgt)                       :: okLength      ! flag to check if the vector length is OK
-character(len=256)                 :: cmessage      ! downstream error message
-! --------------------------------------------------------------------------------------------------------
-
-! initialize error control
-err=0; message='writeRestart/'
-
-! size of prognostic variable vector
-nProgVars = size(prog_meta)
-allocate(ncVarID(nProgVars+1))     ! include 1 additional basin variable in ID array (possibly more later)
-
-! maximum number of soil layers
-maxSoil = gru_struc(1)%hruInfo(1)%nSoil
-
-! maximum number of snow layers
-maxSnow = maxSnowLayers
-
-! create file
-err = nf90_create(trim(filename),nf90_classic_model,ncid)
-message='iCreate[create]'; call netcdf_err(err,message); if(err/=0)return
-
-! define dimensions
-err = nf90_def_dim(ncid,trim(hruDimName)    ,nHRU       ,    hruDimID); message='iCreate[hru]'     ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(gruDimName)    ,nGRU       ,    gruDimID); message='iCreate[gru]'     ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(tdhDimName)    ,nTimeDelay ,    tdhDimID); message='iCreate[tdh]'     ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(scalDimName)   ,nScalar    ,   scalDimID); message='iCreate[scalar]'  ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(specDimName)   ,nSpectral  ,   specDimID); message='iCreate[spectral]'; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(midSoilDimName),maxSoil    ,midSoilDimID); message='iCreate[ifcSoil]' ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(midTotoDimName),maxLayers  ,midTotoDimID); message='iCreate[midToto]' ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(ifcSoilDimName),maxSoil+1  ,ifcSoilDimID); message='iCreate[ifcSoil]' ; call netcdf_err(err,message); if(err/=0)return
-err = nf90_def_dim(ncid,trim(ifcTotoDimName),maxLayers+1,ifcTotoDimID); message='iCreate[ifcToto]' ; call netcdf_err(err,message); if(err/=0)return
-if (maxSnow>0) err = nf90_def_dim(ncid,trim(midSnowDimName),maxSnow    ,midSnowDimID); message='iCreate[ifcSnow]' ; call netcdf_err(err,message); if(err/=0)return
-if (maxSnow>0) err = nf90_def_dim(ncid,trim(ifcSnowDimName),maxSnow+1  ,ifcSnowDimID); message='iCreate[ifcSnow]' ; call netcdf_err(err,message); if(err/=0)return
-! re-initialize error control
-err=0; message='writeRestart/'
-
-! define prognostic variables
-do iVar = 1,nProgVars
-if (prog_meta(iVar)%varType==iLookvarType%unknown) cycle
-
-! define variable
-select case(prog_meta(iVar)%varType)
-case(iLookvarType%scalarv);                err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,  scalDimID /),ncVarID(iVar))
-case(iLookvarType%wLength);                err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,  specDimID /),ncVarID(iVar))
-case(iLookvarType%midSoil);                err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,midSoilDimID/),ncVarID(iVar))
-case(iLookvarType%midToto);                err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,midTotoDimID/),ncVarID(iVar))
-case(iLookvarType%ifcSoil);                err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,ifcSoilDimID/),ncVarID(iVar))
-case(iLookvarType%ifcToto);                err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,ifcTotoDimID/),ncVarID(iVar))
-case(iLookvarType%midSnow); if (maxSnow>0) err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,midSnowDimID/),ncVarID(iVar))
-case(iLookvarType%ifcSnow); if (maxSnow>0) err = nf90_def_var(ncid,trim(prog_meta(iVar)%varname),nf90_double,(/hruDimID,ifcSnowDimID/),ncVarID(iVar))
-end select
-
-! check errors
-if(err/=0)then
-message=trim(message)//trim(cmessage)//' [variable '//trim(prog_meta(iVar)%varName)//']'
-return
-end if
-
-! add parameter description
-err = nf90_put_att(ncid,ncVarID(iVar),'long_name',trim(prog_meta(iVar)%vardesc))
-call netcdf_err(err,message)
-
-! add parameter units
-err = nf90_put_att(ncid,ncVarID(iVar),'units',trim(prog_meta(iVar)%varunit))
-call netcdf_err(err,message)
-
-end do ! iVar
-
-! define selected basin variables (derived) -- e.g., hillslope routing
-err = nf90_def_var(ncid, trim(bvar_meta(iLookBVAR%routingRunoffFuture)%varName), nf90_double, (/gruDimID, tdhDimID /), ncVarID(nProgVars+1))
-err = nf90_put_att(ncid,ncVarID(nProgVars+1),'long_name',trim(bvar_meta(iLookBVAR%routingRunoffFuture)%vardesc));   call netcdf_err(err,message)
-err = nf90_put_att(ncid,ncVarID(nProgVars+1),'units'    ,trim(bvar_meta(iLookBVAR%routingRunoffFuture)%varunit));   call netcdf_err(err,message)
-
-! define index variables - snow
-err = nf90_def_var(ncid,trim(indx_meta(iLookIndex%nSnow)%varName),nf90_int,(/hruDimID/),ncSnowID); call netcdf_err(err,message)
-err = nf90_put_att(ncid,ncSnowID,'long_name',trim(indx_meta(iLookIndex%nSnow)%vardesc));           call netcdf_err(err,message)
-err = nf90_put_att(ncid,ncSnowID,'units'    ,trim(indx_meta(iLookIndex%nSnow)%varunit));           call netcdf_err(err,message)
-
-! define index variables - soil
-err = nf90_def_var(ncid,trim(indx_meta(iLookIndex%nSoil)%varName),nf90_int,(/hruDimID/),ncSoilID); call netcdf_err(err,message)
-err = nf90_put_att(ncid,ncSoilID,'long_name',trim(indx_meta(iLookIndex%nSoil)%vardesc));           call netcdf_err(err,message)
-err = nf90_put_att(ncid,ncSoilID,'units'    ,trim(indx_meta(iLookIndex%nSoil)%varunit));           call netcdf_err(err,message)
-
-! end definition phase
-err = nf90_enddef(ncid); call netcdf_err(err,message); if (err/=0) return
-
-! write variables
-do iGRU = 1,nGRU
-do iHRU = 1,gru_struc(iGRU)%hruCount
-cHRU = gru_struc(iGRU)%hruInfo(iHRU)%hru_ix
-do iVar = 1,size(prog_meta)
-
-! excape if this variable is not used
-if (prog_meta(iVar)%varType==iLookvarType%unknown) cycle
-
-! actual number of layers
-nSnow = gru_struc(iGRU)%hruInfo(iHRU)%nSnow
-nSoil = gru_struc(iGRU)%hruInfo(iHRU)%nSoil
-nLayers = nSoil + nSnow
-
-! check size
-! NOTE: this may take time that we do not wish to use
-okLength=.true.
-select case (prog_meta(iVar)%varType)
-case(iLookVarType%scalarv);              okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nScalar  )
-case(iLookVarType%wlength);              okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nSpectral)
-case(iLookVarType%midSoil);              okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nSoil    )
-case(iLookVarType%midToto);              okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nLayers  )
-case(iLookVarType%ifcSoil);              okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nSoil+1  )
-case(iLookVarType%ifcToto);              okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nLayers+1)
-case(iLookVarType%midSnow); if (nSnow>0) okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nSnow    )
-case(iLookVarType%ifcSnow); if (nSnow>0) okLength = (size(prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat) == nSnow+1  )
-case default; err=20; message=trim(message)//'unknown var type'; return
-end select
-
-! error check
-if(.not.okLength)then
-message=trim(message)//'bad vector length for variable '//trim(prog_meta(iVar)%varname)
-err=20; return
-endif
-
-! write data
-select case (prog_meta(iVar)%varType)
-case(iLookVarType%scalarv);              err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nScalar  /))
-case(iLookVarType%wlength);              err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nSpectral/))
-case(iLookVarType%midSoil);              err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nSoil    /))
-case(iLookVarType%midToto);              err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nLayers  /))
-case(iLookVarType%ifcSoil);              err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nSoil+1  /))
-case(iLookVarType%ifcToto);              err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nLayers+1/))
-case(iLookVarType%midSnow); if (nSnow>0) err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nSnow    /))
-case(iLookVarType%ifcSnow); if (nSnow>0) err=nf90_put_var(ncid,ncVarID(iVar),(/prog_data%gru(iGRU)%hru(iHRU)%var(iVar)%dat/),start=(/cHRU,1/),count=(/1,nSnow+1  /))
-case default; err=20; message=trim(message)//'unknown var type'; return
-end select
-
-! error check
-if (err.ne.0) message=trim(message)//'writing variable:'//trim(prog_meta(iVar)%varName)
-call netcdf_err(err,message); if (err/=0) return
-err=0; message='writeRestart/'
-
-end do ! iVar loop
-
-! write index variables
-err=nf90_put_var(ncid,ncSnowID,(/indx_data%gru(iGRU)%hru(iHRU)%var(iLookIndex%nSnow)%dat/),start=(/cHRU/),count=(/1/))
-err=nf90_put_var(ncid,ncSoilID,(/indx_data%gru(iGRU)%hru(iHRU)%var(iLookIndex%nSoil)%dat/),start=(/cHRU/),count=(/1/))
-
-end do ! iHRU loop
-
-! write selected basin variables
-err=nf90_put_var(ncid,ncVarID(nProgVars+1),(/bvar_data%gru(iGRU)%var(iLookBVAR%routingRunoffFuture)%dat/),  start=(/iGRU/),count=(/1,nTimeDelay/))
-
-end do  ! iGRU loop
-
-! close file
-call nc_file_close(ncid,err,cmessage)
-if(err/=0)then;message=trim(message)//trim(cmessage);return;end if
-
-! cleanup
-deallocate(ncVarID)
-
-end subroutine writeRestart
\ No newline at end of file
diff --git a/config/configuration.py b/config/configuration.py
deleted file mode 100644
index 3faa35edf3e278dd5776660acad98d73225d64c8..0000000000000000000000000000000000000000
--- a/config/configuration.py
+++ /dev/null
@@ -1,215 +0,0 @@
-from distutils.command.config import config
-import json
-import os
-import math
-from os.path import exists
-from datetime import date
-
-"""
-Function to create the inital summa_actors_settings file
-"""
-def create_init_config():
-    Settings_file = { 
-        "Configuration": {
-            "controlVersion": "",
-            "simStartTime": "",
-            "simEndTime": "",
-            "tmZoneInfo": "",
-            "settingsPath": "",
-            "forcingPath": "",
-            "outputPath": "",
-            "forcingFreq": "",
-            "forcingStart": "",
-            "decisionsFile": "",
-            "outputControlFile": "",
-            "globalHruParamFile": "",
-            "globalGruParamFile": "",
-            "attributeFile": "",
-            "trialParamFile": "",
-            "forcingListFile": "",
-            "initConditionFile": "",
-            "outFilePrefix": "",
-            "vegTableFile": "",
-            "soilTableFile": "",
-            "generalTableFile": "",
-            "noahmpTableFile": ""
-        },
-        
-        "JobSubmissionParams": {
-            "cpus-per-task": 1,
-            "memory": "",
-            "job-name": "",
-            "account": "",
-            "numHRUs": 1,
-            "maxNumberOfJobs": 1,
-            "maxGRUsPerSubmission": 1,
-            "executablePath": ""
-            },
-
-        "SummaActor": {
-            "OuputStructureSize": 1,
-            "maxGRUPerJob": 1
-        },
-
-        "FileAccessActor": {
-            "num_vectors_in_output_manager": 1
-        },
-    
-        "JobActor": {
-            "FileManagerPath": "",
-            "outputCSV": "",
-            "csvPath": ""
-        },
-
-        "HRUActor": {
-            "printOutput": "",
-            "outputFrequency": 1
-        }
-    }
-    with open('Summa_Actors_Settings.json', 'w') as outfile:
-        json.dump(Settings_file, outfile, indent=2)
-
-"""
-Function that creates the paths for the slurm output and the netCDF data
-"""
-def create_output_path(outputPath):
-    print("The output path exists, now seperating this run by today's date")
-    today = date.today()
-    todays_date = today.strftime("%b-%d-%Y")
-    outputPath += "{}/".format(todays_date)
-    if not exists(outputPath):
-        os.mkdir(outputPath)
-    print("Directory Created. Now Creating sub directories for SLURM Data and NetCDF data")
-    outputNetCDF = outputPath + "netcdf/"
-    outputSlurm = outputPath + "slurm/"
-    outputCSV = outputPath + "csv/"
-    if not exists(outputNetCDF):
-        os.mkdir(outputNetCDF)
-    if not exists(outputSlurm):
-        os.mkdir(outputSlurm)
-    if not exists(outputCSV):
-        os.mkdir(outputCSV)
-    
-    # need to add the file name to outputSlurm
-    # The job will not be submitted without a file name
-    outputSlurm += "slurm-%A_%a.out"
-    
-    return outputNetCDF, outputSlurm, outputCSV
-
-
-"""
-Function to create the file manager for SummaActors,
-THis is a text file that is created from the settings in the Configuration section
-in the JSON file.
-"""
-def create_file_manager():
-    json_file = open("Summa_Actors_Settings.json")
-    fileManagerSettings = json.load(json_file)
-    json_file.close()
-    
-    # add the date for the run
-    outputPath = fileManagerSettings["Configuration"]["outputPath"]
-    if exists(outputPath):
-        outputNetCDF, outputSlurm, outputCSV = create_output_path(outputPath)
-        fileManagerSettings["Configuration"]["outputPath"] = outputNetCDF
-    else:
-        print("Output path does not exist, Ensure it exists before running this setup")
-        return -1
-    
-    fileManager = open("fileManager.txt", "w")
-    for key,value in fileManagerSettings["Configuration"].items():
-        fileManager.write(key + "    \'{}\'\n".format(value))
-    fileManager.close()
-
-    with open("Summa_Actors_Settings.json") as settings_file:
-        data = json.load(settings_file)
-        data["JobActor"]["FileManagerPath"] = os.getcwd() + "/" + "fileManager.txt"
-        data["JobActor"]["csvPath"] = outputCSV
-
-    with open("Summa_Actors_Settings.json", "w") as updated_settings:
-        json.dump(data, updated_settings, indent=2) 
-
-
-    print("File Manager for this job has been created")
-    return outputSlurm
-
-
-def create_caf_config():
-    json_file = open("Summa_Actors_Settings.json")
-    SummaSettings = json.load(json_file)
-    json_file.close()
-
-    numCPUs = SummaSettings["JobSubmissionParams"]["cpus-per-task"]
-
-
-    caf_config_name = "caf-application.conf"
-    caf_config = open(caf_config_name, "w")
-    caf_config.write("caf {{ \n  scheduler {{\n   max-threads = {}\n    }}\n}}".format(numCPUs))
-    caf_config.close()
-    
-    caf_config_path = os.getcwd()
-    caf_config_path += "/"
-    caf_config_path += caf_config_name
-    return caf_config_path
-
-
-def create_sbatch_file(outputSlurm, configFile):
-    json_file = open("Summa_Actors_Settings.json")
-    SummaSettings = json.load(json_file)
-    json_file.close()
-
-    numCPUs = SummaSettings["JobSubmissionParams"]["cpus-per-task"]
-    memory = SummaSettings["JobSubmissionParams"]["memory"]
-    jobName = SummaSettings["JobSubmissionParams"]["job-name"]
-    account = SummaSettings["JobSubmissionParams"]["account"]
-    numberOfTasks = SummaSettings["JobSubmissionParams"]["numHRUs"]
-    GRUPerJob = SummaSettings["JobSubmissionParams"]["maxGRUsPerSubmission"]
-    executablePath = SummaSettings["JobSubmissionParams"]["executablePath"]
-
-    jobCount = math.ceil(numberOfTasks / GRUPerJob - 1)
-
-    configPath = os.getcwd()
-
-    sbatch = open("run_summa.sh", "w")
-    sbatch.write("#!/bin/bash\n")
-    sbatch.write("#SBATCH --cpus-per-task={}\n".format(numCPUs))
-    sbatch.write("#SBATCH --time=24:00:00\n")
-    sbatch.write("#SBATCH --mem={}\n".format(memory))
-    sbatch.write("#SBATCH --job-name={}\n".format(jobName))
-    sbatch.write("#SBATCH --account={}\n".format(account))
-    sbatch.write("#SBATCH --output={}\n".format(outputSlurm))
-    sbatch.write("#SBATCH --array=0-{}\n\n".format(jobCount))
-    sbatch.write("gruMax={}\n".format(numberOfTasks))
-    sbatch.write("gruCount={}\n".format(GRUPerJob))
-    sbatch.write("offset=$SLURM_ARRAY_TASK_ID\n")
-    sbatch.write("gruStart=$(( 1 + gruCount*offset ))\n")
-    sbatch.write("check=$(( $gruStart + $gruCount ))\n")
-    sbatch.write("if [ $check -gt $gruMax ]\n")
-    sbatch.write("then\n")
-    sbatch.write("    gruCount=$(( gruMax-gruStart+1 ))\n")
-    sbatch.write("fi\n\n")
-    sbatch.write("{} -g ${{gruStart}} -n ${{gruCount}} -c {} --config-file={}".format(executablePath, configPath, configFile))
-
-
-
-"""
-Funciton checks if the Summa_Actors_Settings.json file exists.
-If yes:
-    move on
-If no:
-    create it
-"""
-def init_run():
-    Summa_Settings_Path = './Summa_Actors_Settings.json'
-    if exists('./Summa_Actors_Settings.json'):
-        print("File Exists, What do we do next")
-        outputSlurm = create_file_manager()
-        configFile = create_caf_config()
-        create_sbatch_file(outputSlurm, configFile)
-        
-
-    else:
-        print("File Does not Exist and we need to create it")
-        create_init_config()       
-
-init_run()
\ No newline at end of file
diff --git a/config/create_client_config.py b/config/create_client_config.py
deleted file mode 100644
index 2de8f83a63e399a05cc58b827ca006eccae4eee8..0000000000000000000000000000000000000000
--- a/config/create_client_config.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import json
-import sys
-
-def distributed_settings(hostname, port):
-    distributed_settings = {
-        "distributed_mode": True,
-        "hostname":hostname,
-        "port":port,
-        "total_hru_count": 5,
-        "num_hru_per_batch": 1,
-        "heartbeat_interval": 20,
-        "lost_node_threshold": 3
-    }   
-    return distributed_settings
-
-
-settings_dict = {
-    "Distributed_Settings": {}
-}
-
-hostname = sys.argv[1]
-port = sys.argv[2]
-
-
-settings_dict['Distributed_Settings'] = distributed_settings(hostname, int(port))
-with open('Summa_Actors_Settings.json', 'w') as summa_actors_settings_file:
-        json.dump(settings_dict, summa_actors_settings_file, indent=2)
\ No newline at end of file
diff --git a/config/create_summa_actors_config.py b/config/create_summa_actors_config.py
deleted file mode 100644
index 32ff9f448ba0ed994f8058d90fae89cc7d368589..0000000000000000000000000000000000000000
--- a/config/create_summa_actors_config.py
+++ /dev/null
@@ -1,97 +0,0 @@
-import json
-
-def distributed_settings():
-    distributed_settings = {
-        "distributed-mode": False,
-        "host":"localhost",
-        "port":4444,
-        "total_hru_count": 5,
-        "num_hru_per_batch": 1,
-        "heartbeat_interval": 20,
-        "lost_node_threshold": 3
-    }   
-    return distributed_settings
-
-def simulation_settings():
-    simulation_settings = {
-        "total_hru_count": 0,
-        "num_hru_per_batch": 0
-    }
-    return simulation_settings
-
-def summa_actor_settings():
-    summa_actor_settings = {
-        "OutputStructureSize": 250,
-        "maxGRUPerJob":        250
-    }
-    return summa_actor_settings
-
-def file_access_actor_settings():
-    file_access_actor_settings = {
-        "num_vectors_in_output_manager": 1
-    }
-    return file_access_actor_settings
-
-def job_actor_settings():
-    job_actor_settings = {
-        "FileManagerPath"       : "",
-        "controlVersion"        : "",
-        "simStartTime"          : "",
-        "simEndTime"            : "",
-        "tmZoneInfo"            : "",
-        "settingsPath"          : "",
-        "forcingPath"           : "",
-        "outputPath"            : "",
-        "forcingFreq"           : "",
-        "forcingStart"          : "",
-        "decisionsFile"         : "",
-        "outputControlFile"     : "",
-        "globalHruParamFile"    : "",
-        "globalGruParamFile"    : "",
-        "attributeFile"         : "",
-        "trialParamFile"        : "",
-        "forcingListFile"       : "",
-        "initConditionFile"     : "",
-        "outFilePrefix"         : "",
-        "vegTableFile"          : "",
-        "soilTableFile"         : "",
-        "generalTableFile"      : "",
-        "noahmpTableFile"       : "",
-        "outputCSV": False,
-        "csvPath": ""
-    }
-    return job_actor_settings
-
-def hru_actor_settings():
-    hru_actor_settings = {
-        "printOutput": True,
-        "outputFrequency": 1
-    }
-    return hru_actor_settings
-
-
-
-
-
-def create_config():
-    settings_dict = {
-        "DistributedSettings": {},
-        "SimulationSettings" : {},
-        "SummaActor"         : {},
-        "FileAccessActor"    : {},
-        "JobActor"           : {},
-        "HRUActor"           : {}
-    }
-    settings_dict['DistributedSettings'] = distributed_settings()
-    settings_dict['SimulationSettings'] = simulation_settings()
-    settings_dict['SummaActor'] = summa_actor_settings()
-    settings_dict['FileAccessActor'] = file_access_actor_settings()
-    settings_dict['JobActor'] = job_actor_settings()
-    settings_dict['HRUActor'] = hru_actor_settings()
-    with open('Summa_Actors_Settings.json', 'w') as summa_actors_settings_file:
-        json.dump(settings_dict, summa_actors_settings_file, indent=2)
-
-
-
-
-create_config()
\ No newline at end of file
diff --git a/config/summa-distributed/launch_client.sh b/config/summa-distributed/launch_client.sh
deleted file mode 100755
index 67d92e5bdbb896b83874454daa523696068a1301..0000000000000000000000000000000000000000
--- a/config/summa-distributed/launch_client.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-
-nohup apptainer exec --bind /gladwell:/gladwell \
-     --bind /scratch:/scratch \
-     --bind /home/kck540/Summa-Actors:/Summa-Actors \
-     /gladwell/kck540/container_files/summa_actors.sif \
-     /Summa-Actors/config/summa-distributed/run_client.sh 2>&1 > \
-     /scratch/kck540/Summa_Distributed_test/logs/`hostname`-client.out &
\ No newline at end of file
diff --git a/config/summa-distributed/launch_remote_clients.sh b/config/summa-distributed/launch_remote_clients.sh
deleted file mode 100755
index d517fd3bb77222323913d3221e0a628f297ea11b..0000000000000000000000000000000000000000
--- a/config/summa-distributed/launch_remote_clients.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-ssh kck540@simlab01.usask.ca /home/kck540/Summa-Actors/config/summa-distributed/launch_client.sh &
-ssh kck540@simlab05.usask.ca /home/kck540/Summa-Actors/config/summa-distributed/launch_client.sh &
-ssh kck540@simlab17.usask.ca /home/kck540/Summa-Actors/config/summa-distributed/launch_client.sh &
-ssh kck540@simlab18.usask.ca /home/kck540/Summa-Actors/config/summa-distributed/launch_client.sh &
\ No newline at end of file
diff --git a/config/summa-distributed/launch_server.sh b/config/summa-distributed/launch_server.sh
deleted file mode 100755
index 36859162dca095f19d954a7f28c2eebf979928fb..0000000000000000000000000000000000000000
--- a/config/summa-distributed/launch_server.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-
-apptainer exec --bind /gladwell:/gladwell \
-     --bind /scratch:/scratch \
-     --bind /home/kck540/Summa-Actors:/Summa-Actors \
-     /gladwell/kck540/container_files/summa_actors.sif \
-     /Summa-Actors/config/summa-distributed/run_server.sh > /scratch/kck540/Summa_Distributed_test/logs/`hostname`-server.out
\ No newline at end of file
diff --git a/config/summa-distributed/run_client.sh b/config/summa-distributed/run_client.sh
deleted file mode 100755
index a73b81cf42968cabb9ebd7b8749869695bfa8be6..0000000000000000000000000000000000000000
--- a/config/summa-distributed/run_client.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-export LD_LIBRARY_PATH=/Summa-Actors/bin/:/usr/local/lib
-cd /Summa-Actors/config/
-python3 create_client_config.py "simlab03" 4444
-cd /Summa-Actors/build
-make
-/Summa-Actors/bin/summaMain -c /Summa-Actors/config/Summa_Actors_Settings.json
\ No newline at end of file
diff --git a/config/summa-distributed/run_server.sh b/config/summa-distributed/run_server.sh
deleted file mode 100755
index c8d21db9ee5cf574a1b296d730f80de3b95c0f66..0000000000000000000000000000000000000000
--- a/config/summa-distributed/run_server.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# !/bin/bash
-export LD_LIBRARY_PATH=/Summa-Actors/bin/:/usr/local/lib
-cd /Summa-Actors/build
-make
-/Summa-Actors/bin/summaMain -s -c /Summa-Actors/config/Summa_Actors_Settings.json
\ No newline at end of file
diff --git a/utils/StatisticsScripts/UsageStatsCSV.py b/utils/StatisticsScripts/UsageStatsCSV.py
deleted file mode 100644
index bd90464ef2be5e7e1835578057ef6280e021bb7f..0000000000000000000000000000000000000000
--- a/utils/StatisticsScripts/UsageStatsCSV.py
+++ /dev/null
@@ -1,159 +0,0 @@
-import numpy as np
-import pandas as pd
-import statistics as stat
-import csv
-import matplotlib as mpl
-import matplotlib.pyplot as plt
-
-def time_convert(x):
-    h,m,s = map(int,x.split(':'))
-    return (h*60+m)*60+s
-
-
-def ramUsage():
-    data_set_1_actors = pd.read_csv("/home/kklenk/projects/rpp-kshook/kklenk/SummaActorsOutput/Jul-08-2022/SummaActors_jobStats_63007640_Filled_failed.csv")
-    # data_set_2_actors = pd.read_csv("/home/kklenk/projects/rpp-kshook/kklenk/SummaActorsOutput/Jun-17-2022/SummaActors_jobStats_62270590.csv")
-    # data_set_3_actors = pd.read_csv("/home/kklenk/projects/rpp-kshook/kklenk/SummaActorsOutput/May-26-2022/SummaActors_jobStats_61263427.csv")
-
-    data_set_1_original = pd.read_csv("/home/kklenk/SummaProjects/Summa-Actors/utils/StatisticsScripts/SummaOriginal_jobStats_63155456.csv")
-    # data_set_2_original = pd.read_csv("/home/kklenk/projects/rpp-kshook/kklenk/SummaOriginalOuput/May-27-2022/SummaOriginal_jobStats_61377500.csv")
-    # data_set_3_original = pd.read_csv("/home/kklenk/projects/rpp-kshook/kklenk/SummaOriginalOuput/May-30-2022/SummaOriginal_jobStats_61415123.csv")
-
-
-    df1_actors = pd.DataFrame(data_set_1_actors)
-    # df2_actors = pd.DataFrame(data_set_2_actors)
-    # df3_actors = pd.DataFrame(data_set_3_actors)
-
-
-    df1_original = pd.DataFrame(data_set_1_original)
-    # df2_original = pd.DataFrame(data_set_2_original)
-    # df3_original = pd.DataFrame(data_set_3_original)
-
-
-    actors_stat1 = []
-    for x in df1_actors["Wall-Clock Time"].values:
-        actors_stat1.append(round((time_convert(x) / 60) / 60, 2))
-    # actors_stat2 = []
-    # for x in df2_actors["Wall-Clock Time"].values:
-    #     actors_stat2.append(round((time_convert(x) / 60) / 60, 2))
-    # actors_stat3 = []
-    # for x in df3_actors["Wall-Clock Time"].values:
-    #     actors_stat3.append(round((time_convert(x) / 60) / 60, 2))
-
-    print("SUMMA-Actors Array Job 1 Total Wall-Clock =", sum(actors_stat1))
-    # print("SUMMA-Actors Array Job 2 Total Wall-Clock =", sum(actors_stat2))
-    # print("SUMMA-Actors Array Job 3 Total Wall-Clock =", sum(actors_stat3))
-
-    original_stat1 = []
-    for x in df1_original["Wall-Clock Time"].values:
-        original_stat1.append(round((time_convert(x) / 60) / 60, 2))
-    # original_stat2 = []
-    # for x in df2_original["Wall-Clock Time"].values:
-    #     original_stat2.append(round((time_convert(x) / 60) / 60, 2))
-    # original_stat3 = []
-    # for x in df3_original["Wall-Clock Time"].values:
-    #     original_stat3.append(round((time_convert(x) / 60) / 60, 2))
-    print()
-    print("SUMMA-Original Array Job 1 Total Wall-Clock =", sum(original_stat1))
-    # print("SUMMA-Original Array Job 2 Total Wall-Clock =", sum(original_stat2))
-    # print("SUMMA-Original Array Job 3 Total Wall-Clock =", sum(original_stat3))
-
-
-
-    # usageStat4 = []
-    # for x in df4["Wall-Clock Time"].values:
-    #     usageStat4.append(round((time_convert(x) / 60) / 60, 2))
-
-    # print("Total Time Actor = ", sum(usageStat1))
-    # print("Max Actor = ", max(usageStat1))
-    # print("Min Actor = ", min(usageStat1))
-    # print("----------------------------------------")
-    # print("Total Time Original = ", sum(usageStat2))
-    # print("Max Original = ", max(usageStat2))
-    # print("Min Original = ", min(usageStat2))
-
-    # # totalRam = [sum(usageStat1), sum(usageStat2), sum(usageStat4)]
-    # print("usageStat1 Total Ram Used = ", sum(usageStat1))
-    # # print("usageStat1 Mean Ram Used = ", stat.mean(usageStat1))
-    # print("usageStat2 Total Ram Used = ", sum(usageStat2))
-    # print("usageStat2 Mean Ram Used = ", stat.mean(usageStat2))
-    # print("usageStat4 Total Ram Used = ", sum(usageStat4))
-    # print("usageStat4 Mean Ram Used = ", stat.mean(usageStat4))
-    # print()
-    # print("variation = ", stat.stdev(totalRam) / stat.mean(totalRam))
-    # csvFile = open("VarationStats.csv", 'w')
-    # header = ["relative standard deviation"]
-
-    # csvFile.write("{}\n".format("relative standard deviation"))
-
-    # for i in range(0, len(usageStat1)):
-    #     l = [usageStat1[i], usageStat2[i], usageStat4[i]]
-    #     csvFile.write("{}\n".format(stat.stdev(l) / stat.mean(l)))
-
-
-def scatterPlot():
-    data_set_1 = pd.read_csv("/home/kklenk/SummaProjects/Summa-Actors/utils/StatisticsScripts/VarationStats.csv")
-
-    df = pd.DataFrame(data_set_1)
-
-    d = df["relative standard deviation"].values
-    x = []
-    for i in range(1, 515):
-        x.append(i)
-    print(len(x))
-    print(len(d))
-    plt.scatter(x, d)
-    plt.title("Coefficient of Variation Plot")
-    plt.xlabel("Job number")
-    plt.ylabel("Relative Standard Deviation")
-    plt.savefig("RSD-Actors.pdf", format="pdf", bbox_inches="tight")
-    plt.show()
-    
-
-
-def initDuration():
-    data_set_1 = pd.read_csv("/home/kklenk/projects/rpp-kshook/kklenk/SummaActorsOutput/Jun-06-2022/csv/Success1.csv")
-    df = pd.DataFrame(data_set_1)
-    print(sum(df["initDuration"].values))
-
-def findRow(df, startHRU):
-    bool_val = False
-    for row in df.iterrows():
-        if row[1].iloc[0] == startHRU:
-            bool_val = True
-            break
-    
-    if (bool_val):
-        print("found", startHRU)
-    else:
-        print("did not find", startHRU)
-    
-
-
-
-
-
-
-def compareCompleted():
-    data_actor = pd.read_csv("/home/kklenk/SummaProjects/Summa-Actors/utils/StatisticsScripts/SummaActors_jobStats_62666948.csv", index_col=False)
-    data_original = pd.read_csv("/home/kklenk/SummaProjects/Summa-Actors/utils/StatisticsScripts/SummaOriginal_jobStats_62667162.csv", index_col=False)
-    df_actors = pd.DataFrame(data_actor)
-    df_original = pd.DataFrame(data_original)
-
-    df_actors = df_actors.drop(df_actors[df_actors.Status == "TIMEOUT"].index)
-    # df_actors = df_actors.drop(columns=["Status","#-CPU","CPU Efficiency","Memory Used"])
-    
-    df_original = df_original.drop(df_original[df_original.Status == "TIMEOUT"].index)
-    # df_original = df_original.drop(columns=["Status","#-CPU","CPU Efficiency","Memory Used"])
-    
-    
-    for row in df_original.iterrows():
-        # print(row[1].iloc[0])
-        findRow(df_actors, row[1].iloc[0])
-
-    
-    # df_actors.to_csv("actors_no_timeout.csv", index=False)
-    # df_original.to_csv("original_no_timeout.csv", index=False)
-ramUsage()
-# compareCompleted()
-# initDuration()
diff --git a/utils/StatisticsScripts/resourageUsage.py b/utils/StatisticsScripts/resourageUsage.py
index f150a1339d2c533872cf4296a89689ab1e8f4ae8..8f4a76d95b2bac040071b61b348456fcb9540a60 100644
--- a/utils/StatisticsScripts/resourageUsage.py
+++ b/utils/StatisticsScripts/resourageUsage.py
@@ -3,6 +3,8 @@ import csv
 from sys import argv
 '''
 This is a script that gets the resource usage of jobs and output the stats as a csv.
+
+Usage: python resourceUsage.py <jobId> <numJobs> <gru_per_job>
 '''
 
 '''
@@ -42,7 +44,7 @@ def seffCommand(jobId, numJobs, gru_per_job):
         cmdString = "seff {}_{}".format(jobId, i)
         cmd = subprocess.Popen(cmdString, shell=True, stdout=subprocess.PIPE)
         for line in cmd.stdout:
-            if b'Cores:' in line:
+            if b'Cores' in line:
                 cores = line.decode().split(" ")[-1]
                 cores = cores.strip()
             
diff --git a/utils/StatisticsScripts/sortCSV.py b/utils/StatisticsScripts/sortCSV.py
deleted file mode 100644
index 59f6ca1108c9b4f65cd70c52ff072fc691757b93..0000000000000000000000000000000000000000
--- a/utils/StatisticsScripts/sortCSV.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import pandas as pd
-
-# Read CSV file into a DataFrame
-df = pd.read_csv('/home/kklenk/scratch/Summa-Original-Output/logs/_log_summaryOriginal_5666268_broadwell.csv')
-
-# Sort DataFrame by column
-df = df.sort_values('start_hru')
-
-# Write sorted DataFrame back to CSV file
-df.to_csv('/home/kklenk/scratch/Summa-Original-Output/logs/_log_summaryOriginal_5666268_broadwell.csv', index=False)
\ No newline at end of file
diff --git a/utils/StatisticsScripts/stats.py b/utils/StatisticsScripts/stats.py
deleted file mode 100644
index 7555152a1a5fd5be0b6fbdf137cdc46ca9e887f4..0000000000000000000000000000000000000000
--- a/utils/StatisticsScripts/stats.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import numpy as np
-import pandas as pd
-import statistics as stat
-import csv
-import matplotlib as mpl
-import matplotlib.pyplot as plt
-
-def time_convert(x):
-    h,m,s = map(int,x.split(':'))
-    return (h*60+m)*60+s
-
-def wallClockTime(data_set_1, data_set_2):
-    df1 = pd.DataFrame(data_set_1)
-    df2 = pd.DataFrame(data_set_2)
-
-    df1_stat = []
-    for time in df1["Wall-Clock Time"].values:
-        df1_stat.append(round((time_convert(time) / 60) / 60, 2))
-    print("Total Wall Clock for data_set_1 =", sum(df1_stat))
-    df2_stat = []
-    for time in df2["Wall-Clock Time"].values:
-        df2_stat.append(round((time_convert(time) / 60) / 60, 2))
-    print("Total Wall Clock for data_set_2 =", sum(df2_stat))
-
-def cpuEfficiency(data_set_1, data_set_2):
-    df1 = pd.DataFrame(data_set_1)
-    df2 = pd.DataFrame(data_set_2)
-
-    df1_stat = []
-    for cpu_e in df1["CPU Efficiency"].values:
-        df1_stat.append(cpu_e)
-    print("Average CPU Efficiency for data_set_1 =", sum(df1_stat) / len(df1_stat))
-    df2_stat = []
-    for cpu_e in df2["CPU Efficiency"].values:
-        df2_stat.append(cpu_e)
-    print("Average CPU Efficiency for data_set_2 =", sum(df2_stat) / len(df1_stat))
-
-def wins_losses(data_set_1, data_set_2):
-    df1 = pd.DataFrame(data_set_1)
-    df2 = pd.DataFrame(data_set_2)
-
-    wins_d1 = 0
-    wins_d2 = 0
-
-    for i in range(0,len(df1["Wall-Clock Time"].values)):
-        if df1["Wall-Clock Time"].values[i] > df2["Wall-Clock Time"].values[i]:
-            wins_d1 += 1
-        else:
-            wins_d2 += 1
-
-    print("Winds DataSet 1 = ", wins_d1)
-    print("Winds DataSet 2 = ", wins_d2)
-
-
-
-data_set_actors = pd.read_csv("/home/kklenk/scratch/Single_CPU_TEST/actors_attempt_1/SummaActors_jobStats_5175342.csv")
-data_set_original = pd.read_csv("/home/kklenk/scratch/Single_CPU_TEST/non-actors_attempt_1/SummaOriginal_jobStats_5201937.csv")
-
-# wallClockTime(data_set_actors, data_set_original)
-print("")
-cpuEfficiency(data_set_actors, data_set_original)
-# wins_losses(data_set_actors, data_set_original)
\ No newline at end of file
diff --git a/utils/Summa_Actors_Settings_backup.json b/utils/Summa_Actors_Settings_backup.json
deleted file mode 100644
index b6f659b78b9656388f1096c34e198aaeb978a2ce..0000000000000000000000000000000000000000
--- a/utils/Summa_Actors_Settings_backup.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
-    "DistributedSettings": {
-        "distributed-mode": true,
-        "host": "simlab03",
-        "port": 4444
-    },
-  
-    "SimulationSettings": {
-        "total_hru_count": 100,
-        "num_hru_per_batch": 20
-    },
-  
-    "SummaActor": {
-        "OuputStructureSize": 250,
-        "maxGRUPerJob": 20
-    },
-  
-    "FileAccessActor": {
-        "num_vectors_in_output_manager": 1
-    },
-    
-    "JobActor": {
-        "FileManagerPath": "/gladwell/SummaActorsSettings/fileManager.txt",
-        "outputCSV": false,
-        "csvPath": ""
-    },
-  
-    "HRUActor": {
-        "printOutput": true,
-        "outputFrequency": 500
-    }
-  }
\ No newline at end of file
diff --git a/utils/build_scripts/build_actors.sh b/utils/build_scripts/build_actors.sh
new file mode 100755
index 0000000000000000000000000000000000000000..df3b1a7a911d1e524eae77dd68d87d45b8d408c7
--- /dev/null
+++ b/utils/build_scripts/build_actors.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+  
+# build on Mac, from cmake directory run this as ./build_actors.mac.bash
+
+# Mac Example using MacPorts:
+export FC=gfortran                                            # Fortran compiler family
+export LINK_DIRS='/usr/local/lib;/usr/lib'                               # Link directories for cmake
+export INCLUDES_DIRS='/usr/local/include;/usr/include'      # directories for INCLUDES cmake variable (cmake uses semicolons as separators)
+export LIBRARY_LINKS='-llapack;-lgfortran;-lnetcdff;-lnetcdf' # list of library links (cmake uses semicolons as separators)
+#export FLAGS_OPT="-flto=1"                                   # -flto=1 is slow to compile, but might want to use
+
+export SUNDIALS_PATH="/usr/local/sundials/v6.6"
+export ACTOR_FRAMEWORK_PATH="/usr/local"
+cmake -B ../cmake_build -S . -DCMAKE_BUILD_TYPE=Sundials_Actors_Debug
+cmake --build ../cmake_build --target all
diff --git a/utils/build_scripts/build_cluster.bash b/utils/build_scripts/build_cluster.bash
new file mode 100755
index 0000000000000000000000000000000000000000..19e63063079e788342297f366fae8375c8bdbd05
--- /dev/null
+++ b/utils/build_scripts/build_cluster.bash
@@ -0,0 +1,14 @@
+#!/bin/bash
+  
+# build on Copernicus or Graham, from cmake directory run this as ./build_actors.cluster.bash
+# for Summa
+module load gcc/9.3.0
+module load netcdf-fortran
+module load openblas
+module load caf
+
+export SUNDIALS_PATH="/globalhome/kck540/HPC/Libraries/sundials/instdir"
+
+cmake -B ../cmake_build -S . -DCMAKE_BUILD_TYPE=Actors_Sundials_Cluster
+cmake --build ../cmake_build --target all
+
diff --git a/utils/containers/apptainer.def b/utils/containers/apptainer.def
new file mode 100644
index 0000000000000000000000000000000000000000..aa1f124096ac21f42cfc8536cd2eb65bf113f07a
--- /dev/null
+++ b/utils/containers/apptainer.def
@@ -0,0 +1,49 @@
+Bootstrap: docker
+From: ubuntu:22.04
+
+%post
+    apt-get update -y
+    apt-get install locales -y
+    locale-gen en_CA.UTF-8
+    apt-get upgrade -y
+
+    # Install dependencies
+    DEBIAN_FRONTEND="noninteractive" apt-get install -y software-properties-common \
+        libnetcdf-dev \
+        libnetcdff-dev \
+        liblapack-dev \
+        libopenblas-dev \
+        cmake \
+        g++ \
+        git \
+        libssl-dev \
+        make \
+        gfortran \
+        wget \
+        python3-pip \
+        valgrind \
+        gdb &&\
+        apt-get autoclean
+
+    # Install Sundials v6.6
+    cd /opt
+    wget https://github.com/LLNL/sundials/releases/download/v6.6.0/sundials-6.6.0.tar.gz
+    tar -xzf sundials-6.6.0.tar.gz
+    mkdir /usr/local/sundials/
+    mkdir /usr/local/sundials/v6.6
+    cd sundials-6.6.0
+    mkdir build
+    cd build
+    cmake .. -DBUILD_FORTRAN_MODULE_INTERFACE=ON -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_INSTALL_PREFIX=/usr/local/sundials/v6.6 -DEXAMPLES_INSTALL_PATH=/usr/local/sundials/v6.6/examples
+    make
+    make install
+
+    # Install C++ Actor Framework
+    cd /opt
+    wget https://github.com/actor-framework/actor-framework/archive/refs/tags/0.18.6.tar.gz
+    tar -xzf 0.18.6.tar.gz
+    cd actor-framework-0.18.6
+    ./configure
+    cd build
+    make
+    make install
\ No newline at end of file
diff --git a/utils/extra_scripts/build_container.sh b/utils/extra_scripts/build_container.sh
deleted file mode 100755
index fc65a05c128655e452f3f2ed8ec625723ac12173..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/build_container.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-if test -f "summa_actors.sif"; then
-    echo "Conatiner exists"
-else
-    sudo apptainer build summa_actors.sif summa_actors.def
-fi
diff --git a/utils/extra_scripts/build_summa_actors_container.sh b/utils/extra_scripts/build_summa_actors_container.sh
deleted file mode 100755
index 06626809129981407a74a4ef33124f1f64bb4566..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/build_summa_actors_container.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-cd /Summa-Actors/build
-make -f /Summa-Actors/build/makefile-container all
\ No newline at end of file
diff --git a/utils/extra_scripts/compile_summa.sh b/utils/extra_scripts/compile_summa.sh
deleted file mode 100644
index 77ce42b45a077b06c4677b353dd9cec44bedffab..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/compile_summa.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-#### load modules if using Compute Canada or Copernicus ####
-module load gcc/9.3.0
-module load netcdf-fortran
-module load openblas
-module load caf
-
-#### Specifiy Master Directory, parent of build directory
-export F_MASTER=/home/kklenk/SummaProjects/Summa-Actors
-
-#### Specifiy Compilers ####
-export FC=gfortran
-export CC=g++
-
-#### Includes and Libraries ####
-
-export INCLUDES="-I$EBROOTNETCDFMINFORTRAN/include"
-export LIBRARIES="-L$EBROOTNETCDFMINFORTRAN/lib64\
-    -L$EBROOTOPENBLAS/lib\
-    -lnetcdff -lopenblas"
-
-# INCLUDES FOR Actors Component
-export ACTORS_INCLUDES="-I$EBROOTCAF/include\
-    -I$EBROOTNETCDFMINFORTRAN/include"
-
-export ACTORS_LIBRARIES="-L$EBROOTCAF/lib\
-    -L$EBROOTCAF/lib64\
-    -L$EBROOTNETCDFMINFORTRAN/lib64\
-    -L$EBROOTOPENBLAS/lib\
-    -L$F_MASTER/bin\
-    -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff"
-
-#### Compile with the Makefile ####
-make -f ${F_MASTER}/build/makefile
-
-
-export LD_LIBRARY_PATH=${F_MASTER}/bin
\ No newline at end of file
diff --git a/utils/extra_scripts/launch_summa_actors_build_process.sh b/utils/extra_scripts/launch_summa_actors_build_process.sh
deleted file mode 100755
index 6a537f51d4c3ed1a1e926b3bcdc338abf66f07ff..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/launch_summa_actors_build_process.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-#############
-## File in the path that SUMMA-Actors top level directory is located in
-###############
-
-SUMMA_ACTORS=/home/kklenk/Summa-Projects/Summa-Actors # top level directory
-
-apptainer exec --bind $SUMMA_ACTORS:/Summa-Actors summa_actors.sif /Summa-Actors/build/build_summa_actors_container.sh
\ No newline at end of file
diff --git a/utils/extra_scripts/makefile-container b/utils/extra_scripts/makefile-container
deleted file mode 100644
index 0f30d90d4168361c46b82ecd461ee7e4d844515c..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/makefile-container
+++ /dev/null
@@ -1,370 +0,0 @@
-#### parent directory of the 'build' directory ####
-ROOT_DIR = /Summa-Actors
-
-#### Compilers ####
-FC = gfortran # Fortran
-CC = g++	  # C++
-
-#### Includes AND Libraries ####
-INCLUDES = -I/usr/include -I/usr/local/include
-LIBRARIES = -L/usr/local/lib -lnetcdff -lopenblas
-
-ACTORS_INCLUDES = -I/usr/local/include -I/usr/local/include
-ACTORS_LIBRARIES = -L/usr/local/lib -L$(ROOT_DIR)/bin -lcaf_core -lcaf_io -lsumma -lopenblas -lnetcdff
-
-
-# Production runs
-FLAGS_NOAH = -O3 -ffree-form -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_COMM = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_SUMMA = -O3 -ffree-line-length-none -fmax-errors=0 -fPIC -Wfatal-errors
-FLAGS_ACTORS = -O3 -Wfatal-errors -std=c++17
-
-# # Debug runs
-# FLAGS_NOAH = -g -O0 -ffree-form -ffree-line-length-none -fmax-errors=0 -fbacktrace -Wno-unused -Wno-unused-dummy-argument -fPIC
-# FLAGS_COMM = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_SUMMA = -g -O0 -Wall -ffree-line-length-none -fmax-errors=0 -fbacktrace -fcheck=bounds -fPIC
-# FLAGS_ACTORS = -g -O0 -Wall -std=c++17
-
-
-
-#========================================================================
-# PART 1: Define directory paths
-#========================================================================
-
-# Core directory that contains source code
-F_KORE_DIR = $(ROOT_DIR)/build/source
-
-# Location of the compiled modules
-MOD_PATH = $(ROOT_DIR)/build
-
-# Define the directory for the executables
-EXE_PATH = $(ROOT_DIR)/bin
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-# Define directories
-DRIVER_DIR = $(F_KORE_DIR)/driver
-HOOKUP_DIR = $(F_KORE_DIR)/hookup
-NETCDF_DIR = $(F_KORE_DIR)/netcdf
-DSHARE_DIR = $(F_KORE_DIR)/dshare
-NUMREC_DIR = $(F_KORE_DIR)/numrec
-NOAHMP_DIR = $(F_KORE_DIR)/noah-mp
-ENGINE_DIR = $(F_KORE_DIR)/engine
-ACTORS_DIR = $(F_KORE_DIR)/actors
-JOB_ACTOR_DIR = $(ACTORS_DIR)/job_actor
-FILE_ACCESS_DIR = $(ACTORS_DIR)/file_access_actor
-HRU_ACTOR_DIR = $(ACTORS_DIR)/hru_actor
-
-#  utilities
-SUMMA_NRUTIL= \
-		nrtype.f90 \
-		f2008funcs.f90 \
-		nr_utility.f90
-NRUTIL = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRUTIL))
-
-# Numerical recipes procedures
-# NOTE: all numerical recipes procedures are now replaced with free versions
-SUMMA_NRPROC= \
-		expIntegral.f90 \
-		spline_int.f90
-NRPROC = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_NRPROC))
-
-# Hook-up modules (set files and directory paths)
-SUMMA_HOOKUP= \
-		ascii_util.f90 \
-		summaActors_FileManager.f90
-HOOKUP = $(patsubst %, $(HOOKUP_DIR)/%, $(SUMMA_HOOKUP))
-
-# Data modules
-SUMMA_DATAMS= \
-		multiconst.f90 \
-		var_lookup.f90 \
-		data_types.f90 \
-		globalData.f90 \
-		flxMapping.f90 \
-		get_ixname.f90 \
-		popMetadat.f90 \
-		outpt_stat.f90
-DATAMS = $(patsubst %, $(DSHARE_DIR)/%, $(SUMMA_DATAMS))
-
-# utility modules
-SUMMA_UTILMS= \
-		time_utils.f90 \
-		mDecisions.f90 \
-		snow_utils.f90 \
-		soil_utils.f90 \
-		updatState.f90 \
-		matrixOper.f90
-UTILMS = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_UTILMS))
-
-# Model guts
-SUMMA_MODGUT= \
-		MODGUT = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODGUT))
-
-# Solver
-SUMMA_SOLVER= \
-		vegPhenlgy.f90 \
-		diagn_evar.f90 \
-		stomResist.f90 \
-		groundwatr.f90 \
-		vegSWavRad.f90 \
-		vegNrgFlux.f90 \
-		ssdNrgFlux.f90 \
-		vegLiqFlux.f90 \
-		snowLiqFlx.f90 \
-		soilLiqFlx.f90 \
-		bigAquifer.f90 \
-		computFlux.f90 \
-		computResid.f90 \
-		computJacob.f90 \
-		eval8summa.f90 \
-		summaSolve.f90 \
-		systemSolv.f90 \
-		varSubstep.f90 \
-		opSplittin.f90 \
-		coupled_em.f90
-		
-SOLVER = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_SOLVER))
-
-# Interface code for Fortran-C++
-SUMMA_INTERFACE= \
-		cppwrap_datatypes.f90 \
-		cppwrap_auxiliary.f90 \
-		cppwrap_metadata.f90 \
-
-INTERFACE = $(patsubst %, $(ACTORS_DIR)/global/%, $(SUMMA_INTERFACE))
-
-SUMMA_FILEACCESS_INTERFACE = \
-		initOutputStruc.f90 \
-		deallocateOutputStruc.f90 \
-		cppwrap_fileAccess.f90
-
-FILEACCESS_INTERFACE = $(patsubst %, $(FILE_ACCESS_DIR)/%, $(SUMMA_FILEACCESS_INTERFACE))
-
-SUMMA_JOB_INTERFACE = \
-		cppwrap_job.f90
-
-JOB_INTERFACE =  $(patsubst %, $(JOB_ACTOR_DIR)/%, $(SUMMA_JOB_INTERFACE))
-
-SUMMA_HRU_INTERFACE = \
-		cppwrap_hru.f90
-
-HRU_INTERFACE = $(patsubst %, $(HRU_ACTOR_DIR)/%, $(SUMMA_HRU_INTERFACE))
-		
-
-# Define routines for SUMMA preliminaries
-SUMMA_PRELIM= \
-		conv_funcs.f90 \
-		sunGeomtry.f90 \
-		convE2Temp.f90 \
-		allocspaceActors.f90 \
-		alloc_file_access.f90\
-		checkStruc.f90 \
-		childStruc.f90 \
-		ffile_info.f90 \
-		read_attribute.f90 \
-		read_pinit.f90 \
-		pOverwrite.f90 \
-		read_paramActors.f90 \
-		paramCheck.f90 \
-		check_icondActors.f90 \
-		# allocspace.f90
-PRELIM = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_PRELIM))
-
-SUMMA_NOAHMP= \
-		module_model_constants.F \
-		module_sf_noahutl.F \
-		module_sf_noahlsm.F \
-		module_sf_noahmplsm.F
-
-NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
-
-# Define routines for the SUMMA model runs
-SUMMA_MODRUN = \
-		indexState.f90 \
-		getVectorz.f90 \
-		updateVars.f90 \
-		var_derive.f90 \
-		read_forcingActors.f90 \
-		access_forcing.f90\
-		access_write.f90 \
-		derivforce.f90 \
-		snowAlbedo.f90 \
-		canopySnow.f90 \
-		tempAdjust.f90 \
-		snwCompact.f90 \
-		layerMerge.f90 \
-		layerDivide.f90 \
-		volicePack.f90 \
-		qTimeDelay.f90
-MODRUN = $(patsubst %, $(ENGINE_DIR)/%, $(SUMMA_MODRUN))
-
-# Define NetCDF routines
-# OutputStrucWrite is not a netcdf subroutine and should be
-# moved
-SUMMA_NETCDF = \
-		netcdf_util.f90 \
-		def_output.f90 \
-		outputStrucWrite.f90 \
-		writeOutput.f90	\
-		read_icondActors.f90
-NETCDF = $(patsubst %, $(NETCDF_DIR)/%, $(SUMMA_NETCDF))
-
-# ... stitch together common programs
-COMM_ALL = $(NRUTIL) $(NRPROC) $(HOOKUP) $(DATAMS) $(UTILMS)
-
-# ... stitch together SUMMA programs
-SUMMA_ALL = $(NETCDF) $(PRELIM) $(MODRUN) $(SOLVER) 
-
-# Define the driver routine
-SUMMA_DRIVER= \
-		summaActors_type.f90 \
-		summaActors_util.f90 \
-		summaActors_globalData.f90 \
-		summaActors_init.f90 \
-		SummaActors_setup.f90 \
-		summaActors_restart.f90 \
-		summaActors_forcing.f90 \
-		SummaActors_modelRun.f90 \
-		summaActors_alarms.f90 \
-		summaActors_wOutputStruc.f90
-		
-		
-DRIVER = $(patsubst %, $(DRIVER_DIR)/%, $(SUMMA_DRIVER))
-
-####################################################################################################
-###################################### Assemble Fortran Files ######################################
-####################################################################################################
-
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-INCLUDE_DIR = $(ROOT_DIR)/build/includes
-SOURCE_DIR = $(ROOT_DIR)/build/source/actors
-
-
-GLOBAL_INCLUDES = -I$(INCLUDE_DIR)/global
-GLOBAL = $(SOURCE_DIR)/global/global.cpp
-TIMEINFO = $(SOURCE_DIR)/global/timing_info.cpp
-
-SUMMA_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/summa_actor
-SUMMA_ACTOR = $(SOURCE_DIR)/summa_actor/summa_actor.cpp
-SUMMA_CLIENT = $(SOURCE_DIR)/summa_actor/summa_client.cpp
-SUMMA_SERVER = $(SOURCE_DIR)/summa_actor/summa_server.cpp
-
-BATCH_MANGER = $(SOURCE_DIR)/summa_actor/batch_manager.cpp
-CLIENT_MANAGER = $(SOURCE_DIR)/summa_actor/client.cpp
-
-JOB_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/job_actor
-JOB_ACTOR = $(SOURCE_DIR)/job_actor/job_actor.cpp
-GRUinfo = $(SOURCE_DIR)/job_actor/GRUinfo.cpp
-
-FILE_ACCESS_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/file_access_actor
-FILE_ACCESS_ACTOR = $(SOURCE_DIR)/file_access_actor/file_access_actor.cpp
-FORCING_FILE_INFO = $(SOURCE_DIR)/file_access_actor/forcing_file_info.cpp
-OUTPUT_MANAGER = $(SOURCE_DIR)/file_access_actor/output_manager.cpp
-
-HRU_ACTOR_INCLUDES = -I$(INCLUDE_DIR)/hru_actor
-HRU_ACTOR = $(SOURCE_DIR)/hru_actor/hru_actor.cpp
-
-MAIN = $(F_KORE_DIR)/actors/main.cpp
-
-ACTOR_TEST = $(F_KORE_DIR)/testing/testing_main.cc
-####################################################################################################
-######################################## Assemble C++ Files ########################################
-####################################################################################################
-
-
-#========================================================================
-# PART 3: compilation
-#======================================================================
-all: fortran cpp
-
-fortran: compile_noah compile_comm compile_summa link clean_fortran
-
-cpp: compile_globals compile_hru_actor compile_file_access_actor compile_job_actor compile_summa_actor \
-	compile_summa_client compile_summa_server compile_main link_cpp clean_cpp
-
-test: actors_test actors_testLink actorsClean
-	
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-compile_noah:
-	$(FC) $(FLAGS_NOAH) -c $(NRUTIL) $(NOAHMP)
-
-# compile common routines
-compile_comm:
-	$(FC) $(FLAGS_COMM) -c $(COMM_ALL) $(INTERFACE) $(INCLUDES)
-
-# compile SUMMA routines
-compile_summa: 
-	$(FC) $(FLAGS_SUMMA) -c $(SUMMA_ALL) $(DRIVER) $(JOB_INTERFACE) $(FILEACCESS_INTERFACE) $(HRU_INTERFACE) $(INCLUDES)
-
-# generate library
-link:   
-	$(FC) -shared *.o -o libsumma.so  
-	mv libsumma.so $(ROOT_DIR)/bin
-
-# Remove object files
-clean_fortran:
-	rm -f *.o *.mod soil_veg_gen_parm__genmod.f90
-###################################################################################################################
-############################################## COMPILE SUMMA-Fortran ##############################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-compile_globals:
-	$(CC) $(FLAGS_ACTORS) -c $(GLOBAL) $(TIMEINFO) $(GLOBAL_INCLUDES)
-
-compile_hru_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(HRU_ACTOR) $(HRU_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_file_access_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(FILE_ACCESS_ACTOR) $(FORCING_FILE_INFO) $(OUTPUT_MANAGER) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES)
-
-compile_job_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(JOB_ACTOR) $(GRUinfo) $(JOB_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(FILE_ACCESS_ACTOR_INCLUDES) $(HRU_ACTOR_INCLUDES)
-
-compile_summa_actor:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_ACTOR) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES) $(ACTORS_INCLUDES) \
-	$(JOB_ACTOR_INCLUDES)
-
-compile_summa_client:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_CLIENT) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_summa_server:
-	$(CC) $(FLAGS_ACTORS) -c $(SUMMA_SERVER) $(BATCH_MANGER) $(CLIENT_MANAGER) $(SUMMA_ACTOR_INCLUDES) $(GLOBAL_INCLUDES)
-
-compile_main:
-	$(CC) $(FLAGS_ACTORS) -c $(MAIN) $(GLOBAL_INCLUDES) $(SUMMA_ACTOR_INCLUDES) $(JOB_ACTOR_INCLUDES)
-
-link_cpp:
-	$(CC) $(FLAGS_ACTORS) -o summaMain *.o $(ACTORS_LIBRARIES)
-	mv summaMain $(ROOT_DIR)/bin
-
-clean_cpp:
-	rm *.o
-###################################################################################################################
-################################################ COMPILE SUMMA-C++ ################################################
-###################################################################################################################
-
-
-###################################################################################################################
-################################################## COMPILE TESTS ##################################################
-###################################################################################################################
-actors_test:
-	$(CC) $(FLAGS_ACTORS) -c $(ACTOR_TEST) -std=c++17 $(ACTORS_INCLUDES)
-
-actors_testLink:
-	$(CC) -o summaTest *.o $(ACTORS_LIBRARIES)
-
-clean_lib:
-	rm *.so
diff --git a/utils/extra_scripts/module_load.sh b/utils/extra_scripts/module_load.sh
deleted file mode 100755
index 041d0e199a153b24fe8e9ba6836160dcd49ec32e..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/module_load.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-#### load modules if using Compute Canada or Copernicus ####
-module load gcc/9.3.0
-module load netcdf-fortran
-module load openblas
-module load caf
-
-export LD_LIBRARY_PATH=/globalhome/kck540/HPC/SummaProjects/Summa-Actors/bin
\ No newline at end of file
diff --git a/utils/extra_scripts/run_script.sh b/utils/extra_scripts/run_script.sh
deleted file mode 100755
index 06e4b8284a4c456803cc40dcd783abd1ee3028d2..0000000000000000000000000000000000000000
--- a/utils/extra_scripts/run_script.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-cd /Summa-Actors/build
-# make -f /Summa-Actors/build/makefile-container all
-export LD_LIBRARY_PATH=/Summa-Actors/bin
-cd /Summa-Actors/bin
-./summaMain -c /gladwell/kck540/Summa-Distributed/herschel/
\ No newline at end of file
diff --git a/utils/fileManager_example.txt b/utils/fileManager_example.txt
deleted file mode 100755
index 5da49ed582ee0831cb7bf4bf1acdb355c2587e40..0000000000000000000000000000000000000000
--- a/utils/fileManager_example.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-controlVersion       'SUMMA_FILE_MANAGER_V3.0.0' !  file manager version 
-simStartTime         '1979-01-01 00:00' ! 
-simEndTime           '1988-12-31 23:00' ! 
-tmZoneInfo           'utcTime' ! 
-settingsPath         '/project/gwf/gwf_cmt/kck540/domain_NorthAmerica/settings/SUMMA/' ! 
-forcingPath          '/project/gwf/gwf_cmt/kck540/domain_NorthAmerica/forcing/SummaChunkedData/' !           
-outputPath           '/scratch/gwf/gwf_cmt/kck540/SummaOutput/SummaActors/netcdf/Mar-23-2022/' ! 
-forcingFreq          'month'  ! the frequeny of forcing files (month, year)
-forcingStart         '1979-01-01' 
-decisionsFile        'modelDecisions.txt' !  Relative to settingsPath
-outputControlFile    'outputControl.txt' !  Relative to settingsPath 
-globalHruParamFile   'localParamInfo.txt' !  Relative to settingsPath 
-globalGruParamFile   'basinParamInfo.txt' !  Relative to settingsPatho 
-attributeFile        'attributes.nc' ! Relative to settingsPath 
-trialParamFile       'trialParams.nc' ! Relative to settingsPath
-forcingListFile      'forcingFileList.txt' ! Relative to settingsPath 
-initConditionFile    'coldState.nc' ! Relative to settingsPath 
-outFilePrefix        'SummaActors' ! 
-vegTableFile         'TBL_VEGPARM.TBL' ! Relative to settingsPath 
-soilTableFile        'TBL_SOILPARM.TBL' ! Relative to settingsPath 
-generalTableFile     'TBL_GENPARM.TBL' ! Relative to settingsPath 
-noahmpTableFile      'TBL_MPTABLE.TBL' ! Relative to settingsPath 
diff --git a/utils/netcdf/OutputVerification/checkOutput.py b/utils/netcdf/OutputVerification/checkOutput.py
old mode 100644
new mode 100755
index 104f83fc4f56654fc7fa07f7f85e587f6dfeb447..7c25f2c2ecabc22d37ef84767c8917df416ed619
--- a/utils/netcdf/OutputVerification/checkOutput.py
+++ b/utils/netcdf/OutputVerification/checkOutput.py
@@ -3,17 +3,10 @@ from os.path import isfile, join
 from pathlib import Path
 import xarray as xr
 import numpy as np
+import sys
 
 
-def check_variable_length(hru_from_dataset_1, hru_from_dataset_2, variable):
-    if len(hru_from_dataset_1[variable].values) != len(hru_from_dataset_2[variable].values):
-        print("ERROR: output variable", variable, "does not contain the same amount of data")
-        print("     hru_from_dataset_1 = ", len(hru_from_dataset_1[variable].values))
-        print("     hru_from_dataset_2 = ", len(hru_from_dataset_2[variable].values))
-        return False
-    else:
-        return True
-
+# Get data in usable format
 def extract_variable_data(hru_dataset, var):
     hru_variable_data_from_dataset = []
 
@@ -28,29 +21,49 @@ def extract_variable_data(hru_dataset, var):
             hru_variable_data_from_dataset.append(data)
     return hru_variable_data_from_dataset
 
+
+# Check Functions
+def check_variable_length(hru_from_dataset_1, hru_from_dataset_2, variable):
+    if len(hru_from_dataset_1[variable].values) != len(hru_from_dataset_2[variable].values):
+        print("ERROR: output variable", variable, "does not contain the same amount of data")
+        print("     hru_from_dataset_1 = ", len(hru_from_dataset_1[variable].values))
+        print("     hru_from_dataset_2 = ", len(hru_from_dataset_2[variable].values))
+        return False
+    else:
+        return True
 def check_data_for_errors(dataset_1, dataset_2, tolerance):
     error_counter = 0
     for i in range(0, len(dataset_1)):
-        if abs(dataset_1[i] - dataset_2[i]) > tolerance:
+        if abs(dataset_1[i] - dataset_2[i]) > tolerance: 
             error_counter += 1
+            # Open an error file and append the error to it
+            error_file = open("error_file.txt", "a")
+            error_file.write("     dataset_1 = " + str(dataset_1[i]) + "\n")
+            error_file.write("     dataset_2 = " + str(dataset_2[i]) + "\n")
+            error_file.write("     " + str(i))
+            error_file.write("\n")
+            error_file.close()
+
+
     return error_counter
 
 
 
 def verify_data(dataset_1, dataset_2, num_hru, output_variables):
-   
     dataset_1 = xr.open_dataset(dataset_1)
     dataset_2 = xr.open_dataset(dataset_2)
-
     total_errors = 0
     for i_hru in range(0, num_hru):
         hru_from_dataset_1 = dataset_1.isel(hru=i_hru).copy()
         hru_from_dataset_2 = dataset_2.isel(hru=i_hru).copy()
-        
-        # print("\nHRU - hru_dataset_1", hru_from_dataset_1["hruId"].values)
-        # print("HRU - hru_dataset_2", hru_from_dataset_2["hruId"].values, "\n")
+        # print(hru_from_dataset_1)
+        # print("CHECKING HRU", i_hru, "OF", num_hru)
 
         for var in output_variables:
+            # Open an error file and append the error to it
+            error_file = open("error_file.txt", "a")
+            error_file.write("Checking: " + str(var) + "\n")
+            error_file.close()
             if not check_variable_length(hru_from_dataset_1, hru_from_dataset_2, var):
                 print("ERROR: output variable", var, "does not contain the same amount of data")
 
@@ -61,7 +74,7 @@ def verify_data(dataset_1, dataset_2, num_hru, output_variables):
                 print("     hru_from_dataset_1 = ", len(hru_variable_data_from_dataset_1))
                 print("     hru_from_dataset_2 = ", len(hru_variable_data_from_dataset_2))
 
-            error_tolerance = 0.1
+            error_tolerance = 0.0
             errors = check_data_for_errors(hru_variable_data_from_dataset_1, hru_variable_data_from_dataset_2, error_tolerance)
             print("Errors for variable", var, ":", errors)        
 
@@ -80,15 +93,14 @@ def get_output_vars(model_output_file):
 
 
 
-num_hru = 125
+num_hru = 25
 print("Checking output for", num_hru, "HRUs")
-dataset_1 = "/home/kklenk/scratch/Single_CPU_TEST/actors/netcdf/SummaActorsGRU6126-125_day.nc"
-dataset_2 = "/home/kklenk/scratch/Single_CPU_TEST/non-actors/netcdf/SummaOriginal_G006126-006250_day.nc"
 
-# dataset_1 = "/scratch/kck540/Summa_Sundials/non-actors/SummaOriginal-BE_G000001-000002_timestep.nc"
-# dataset_2 = "/scratch/kck540/Summa_Sundials/actors/SummaActors-BEGRU1-2_timestep.nc"
 
-model_output_file = "/home/kklenk/scratch/Single_CPU_TEST/settings/outputControl.txt"
+dataset_1 = sys.argv[1]
+dataset_2 = sys.argv[2]
+
+model_output_file = "/project/gwf/gwf_cmt/kck540/domain_NorthAmerica/Summa-Projects/input_data/summa_actors_input/outputControl_state_vars.txt"
 
 output_vars = get_output_vars(model_output_file)
 verify_data(dataset_1, dataset_2, num_hru, output_vars)
diff --git a/utils/netcdf/OutputVerification/compareOutput.py b/utils/netcdf/OutputVerification/compareOutput.py
index 8f4d3adea1ec3c377890ebc37eb47f063e151846..bb14c77be340236cf08503f728cd5b2a05b684d6 100644
--- a/utils/netcdf/OutputVerification/compareOutput.py
+++ b/utils/netcdf/OutputVerification/compareOutput.py
@@ -3,7 +3,7 @@ from os.path import isfile, join
 from pathlib import Path
 import xarray as xr 
 
-numHRU = 125
+numHRU = 1
 
 time = 'time'
 scalarSWE = 'scalarSWE'
diff --git a/build/source/testing/actor_testing.cpp b/utils/testing/actor_testing.cpp
similarity index 100%
rename from build/source/testing/actor_testing.cpp
rename to utils/testing/actor_testing.cpp
diff --git a/utils/testing/class_vs_actor/Makefile b/utils/testing/class_vs_actor/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..5f79edbe63dd59c40dad811f918c339231f82431
--- /dev/null
+++ b/utils/testing/class_vs_actor/Makefile
@@ -0,0 +1,19 @@
+CC = g++	  # C++
+INCLUDES=-I/usr/local/include 
+LIBRARIES=-L/usr/local/lib -lcaf_core -lcaf_io
+FLAGS = -g -O3 -Wfatal-errors -std=c++17
+
+GRU_CLASS_INCLUDES = -I/u1/kck540/Projects/hydrology/Summa-Sundials-Actors/Summa-Actors/build/includes/job_actor/
+GRU_CLASS_SOURCE =/u1/kck540/Projects/hydrology/Summa-Sundials-Actors/Summa-Actors/build/source/actors/job_actor/GRU.cpp
+
+
+all: compile link clean
+
+compile:
+	$(CC) $(FLAGS) -c main.cpp $(INCLUDES) $(GRU_CLASS_INCLUDES) $(GRU_CLASS_SOURCE)
+
+link:
+	$(CC) $(FLAGS) -Wl,-rpath='/usr/local/lib' -o main *.o $(LIBRARIES)
+
+clean:
+	rm *.o
\ No newline at end of file
diff --git a/utils/testing/class_vs_actor/README.md b/utils/testing/class_vs_actor/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..522b1b5459406e5ffb94ffd6a984a7b1b7b3eaad
--- /dev/null
+++ b/utils/testing/class_vs_actor/README.md
@@ -0,0 +1,11 @@
+Test to investigate if calling an actor for the information we want is faster than calling a class for the same information.
+
+We will use the GRU class as the example:
+
+When running with 10000 GRUs:
+- Actor time = 1.4335s
+- Class time = 0.2429s
+
+When running with 100000 GRUs:
+- Actor time = 14.7135s
+- Class time = 2.074549s
diff --git a/utils/testing/class_vs_actor/main.cpp b/utils/testing/class_vs_actor/main.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..d9ecf6144244849e44ef970e385e787e1aec55eb
--- /dev/null
+++ b/utils/testing/class_vs_actor/main.cpp
@@ -0,0 +1,135 @@
+#include "caf/all.hpp"
+#include "GRU.hpp"
+#include <chrono>
+
+
+using namespace caf;
+CAF_BEGIN_TYPE_ID_BLOCK(summa_test, first_custom_type_id)
+    CAF_ADD_ATOM(summa_test, start_gru)
+    CAF_ADD_ATOM(summa_test, get_info)
+    CAF_ADD_TYPE_ID(summa_test, (std::tuple<int, int, double, double, double, double, double>))
+CAF_END_TYPE_ID_BLOCK(summa_test)
+
+struct gru_state_test {
+    int global_gru_index;
+    int local_gru_index;
+    int dt_init_factor;
+    int attempts_left;
+    double run_time;
+    double init_duration;
+    double forcing_duration;
+    double run_physics_duration;
+    double write_output_duration;
+};
+
+
+behavior gru_actor(stateful_actor<gru_state_test>* self, int global_gru_index, int local_gru_index) {
+    self->state.global_gru_index = global_gru_index;
+    self->state.local_gru_index = local_gru_index;
+    self->state.run_time = 0.0;
+    self->state.init_duration = 0.0;
+    self->state.forcing_duration = 0.0;
+    self->state.run_physics_duration = 0.0;
+    self->state.write_output_duration = 0.0;
+
+    return {
+        [=](get_info) {
+
+            return std::make_tuple(self->state.global_gru_index, 
+                                   self->state.local_gru_index, 
+                                   self->state.run_time, 
+                                   self->state.init_duration, 
+                                   self->state.forcing_duration, 
+                                   self->state.run_physics_duration, 
+                                   self->state.write_output_duration);
+        },
+
+    };
+
+}
+
+
+
+
+void caf_main(actor_system& sys) {
+    scoped_actor self{sys};
+    int num_actors = 100000;
+
+    auto gru_list = std::vector<actor>{};
+    auto container_list = std::vector<GRU*>{};
+
+    for (int i = 0; i < num_actors; ++i) {
+        gru_list.push_back(sys.spawn(gru_actor, i, i));
+
+        container_list.push_back(new GRU(i, i, gru_list[i], 1, 1));
+
+    }
+
+    // Retreive the information from the GRU actors
+
+    std::chrono::time_point<std::chrono::system_clock> actor_start, actor_end;
+
+    actor_start = std::chrono::system_clock::now();
+    for (auto& actor : gru_list) {
+        self->request(actor, infinite, get_info_v).receive(
+            [&](std::tuple<int, int, double, double, double, double, double> info) {
+                // aout(self) << "Recieved\n";
+                int global_gru_index = std::get<0>(info);
+                int local_gru_index = std::get<1>(info);
+                double run_time = std::get<2>(info);
+                double init_duration = std::get<3>(info);
+                double forcing_duration = std::get<4>(info);
+                double run_physics_duration = std::get<5>(info);
+                double write_output_duration = std::get<6>(info);
+
+                aout(self) << "global_gru_index = " << global_gru_index 
+                           << "local_gru_index = " << local_gru_index
+                           << "run_time = " << run_time
+                           << "init_duration = " << init_duration
+                           << "forcing_duration = " << forcing_duration
+                           << "run_physics_duration = " << run_physics_duration
+                           << "write_output_duration = " << write_output_duration << "\n";
+                            
+                self->send_exit(actor, exit_reason::user_shutdown);
+            },
+            [&](error& err) {
+                aout(self) << to_string(err) << std::endl;
+            });
+    }
+    actor_end = std::chrono::system_clock::now();
+
+    std::chrono::time_point<std::chrono::system_clock> class_start, class_end;
+
+    class_start = std::chrono::system_clock::now();
+    for(auto& gru : container_list) {
+        int global_gru_index = gru->getGlobalGRUIndex();
+        int local_gru_index = gru->getLocalGRUIndex();
+        double run_time = gru->getRunTime();
+        double init_duration = gru->getInitDuration();
+        double forcing_duration = gru->getForcingDuration();
+        double run_physics_duration = gru->getRunPhysicsDuration();
+        double write_output_duration = gru->getWriteOutputDuration();
+
+        aout(self) << "global_gru_index = " << global_gru_index 
+                   << "local_gru_index = " << local_gru_index
+                   << "run_time = " << run_time
+                   << "init_duration = " << init_duration
+                   << "forcing_duration = " << forcing_duration
+                   << "run_physics_duration = " << run_physics_duration
+                   << "write_output_duration = " << write_output_duration << "\n";
+        delete gru;
+    }
+    class_end = std::chrono::system_clock::now();
+
+    std::chrono::duration<double> elapsed_seconds_actor = actor_end - actor_start;
+    aout(self) << "Actor Elapsed time: " << elapsed_seconds_actor.count() << "s\n";
+
+    std::chrono::duration<double> elapsed_seconds_class = class_end - class_start;
+    aout(self) << "Class Elapsed time: " << elapsed_seconds_class.count() << "s\n";
+
+
+
+
+}
+
+CAF_MAIN(id_block::summa_test)
\ No newline at end of file
diff --git a/build/source/testing/containers/main.cpp b/utils/testing/containers/main.cpp
similarity index 100%
rename from build/source/testing/containers/main.cpp
rename to utils/testing/containers/main.cpp
diff --git a/build/source/testing/containers/makefile b/utils/testing/containers/makefile
similarity index 100%
rename from build/source/testing/containers/makefile
rename to utils/testing/containers/makefile
diff --git a/build/source/testing/containers/output_container/main.cpp b/utils/testing/containers/output_container/main.cpp
similarity index 100%
rename from build/source/testing/containers/output_container/main.cpp
rename to utils/testing/containers/output_container/main.cpp
diff --git a/build/source/testing/containers/output_container/makefile b/utils/testing/containers/output_container/makefile
similarity index 100%
rename from build/source/testing/containers/output_container/makefile
rename to utils/testing/containers/output_container/makefile
diff --git a/build/source/testing/containers/output_container/test.cpp b/utils/testing/containers/output_container/test.cpp
similarity index 100%
rename from build/source/testing/containers/output_container/test.cpp
rename to utils/testing/containers/output_container/test.cpp
diff --git a/build/source/testing/containers/output_container/test.hpp b/utils/testing/containers/output_container/test.hpp
similarity index 100%
rename from build/source/testing/containers/output_container/test.hpp
rename to utils/testing/containers/output_container/test.hpp
diff --git a/build/source/testing/containers/test.cpp b/utils/testing/containers/test.cpp
similarity index 100%
rename from build/source/testing/containers/test.cpp
rename to utils/testing/containers/test.cpp
diff --git a/build/source/testing/containers/test.hpp b/utils/testing/containers/test.hpp
similarity index 100%
rename from build/source/testing/containers/test.hpp
rename to utils/testing/containers/test.hpp
diff --git a/build/source/testing/inspector/inspector_test b/utils/testing/inspector/inspector_test
similarity index 100%
rename from build/source/testing/inspector/inspector_test
rename to utils/testing/inspector/inspector_test
diff --git a/build/source/testing/inspector/main.cpp b/utils/testing/inspector/main.cpp
similarity index 100%
rename from build/source/testing/inspector/main.cpp
rename to utils/testing/inspector/main.cpp
diff --git a/build/source/testing/inspector/main.hpp b/utils/testing/inspector/main.hpp
similarity index 100%
rename from build/source/testing/inspector/main.hpp
rename to utils/testing/inspector/main.hpp
diff --git a/build/source/testing/inspector/main.o b/utils/testing/inspector/main.o
similarity index 100%
rename from build/source/testing/inspector/main.o
rename to utils/testing/inspector/main.o
diff --git a/build/source/testing/inspector/makefile b/utils/testing/inspector/makefile
similarity index 100%
rename from build/source/testing/inspector/makefile
rename to utils/testing/inspector/makefile
diff --git a/build/source/testing/passing_vectors/makefile b/utils/testing/passing_vectors/makefile
similarity index 100%
rename from build/source/testing/passing_vectors/makefile
rename to utils/testing/passing_vectors/makefile
diff --git a/build/source/testing/passing_vectors/test.cpp b/utils/testing/passing_vectors/test.cpp
similarity index 100%
rename from build/source/testing/passing_vectors/test.cpp
rename to utils/testing/passing_vectors/test.cpp
diff --git a/build/source/testing/settings_functions/config_files/Summa_Actors_Settings.json b/utils/testing/settings_functions/config_files/Summa_Actors_Settings.json
similarity index 100%
rename from build/source/testing/settings_functions/config_files/Summa_Actors_Settings.json
rename to utils/testing/settings_functions/config_files/Summa_Actors_Settings.json
diff --git a/build/source/testing/settings_functions/main.cpp b/utils/testing/settings_functions/main.cpp
similarity index 100%
rename from build/source/testing/settings_functions/main.cpp
rename to utils/testing/settings_functions/main.cpp
diff --git a/build/source/testing/settings_functions/makefile b/utils/testing/settings_functions/makefile
similarity index 100%
rename from build/source/testing/settings_functions/makefile
rename to utils/testing/settings_functions/makefile
diff --git a/build/source/testing/settings_functions/test.cpp b/utils/testing/settings_functions/test.cpp
similarity index 100%
rename from build/source/testing/settings_functions/test.cpp
rename to utils/testing/settings_functions/test.cpp
diff --git a/build/source/testing/settings_functions/test.hpp b/utils/testing/settings_functions/test.hpp
similarity index 100%
rename from build/source/testing/settings_functions/test.hpp
rename to utils/testing/settings_functions/test.hpp
diff --git a/build/source/testing/summa_actor/main.cpp b/utils/testing/summa_actor/main.cpp
similarity index 100%
rename from build/source/testing/summa_actor/main.cpp
rename to utils/testing/summa_actor/main.cpp
diff --git a/build/source/testing/summa_actor/makefile b/utils/testing/summa_actor/makefile
similarity index 100%
rename from build/source/testing/summa_actor/makefile
rename to utils/testing/summa_actor/makefile
diff --git a/build/source/testing/summa_actor/test.cpp b/utils/testing/summa_actor/test.cpp
similarity index 100%
rename from build/source/testing/summa_actor/test.cpp
rename to utils/testing/summa_actor/test.cpp
diff --git a/build/source/testing/summa_actor/test.hpp b/utils/testing/summa_actor/test.hpp
similarity index 100%
rename from build/source/testing/summa_actor/test.hpp
rename to utils/testing/summa_actor/test.hpp
diff --git a/build/source/testing/summa_actor/test_config/Summa_Actors_Settings.json b/utils/testing/summa_actor/test_config/Summa_Actors_Settings.json
similarity index 100%
rename from build/source/testing/summa_actor/test_config/Summa_Actors_Settings.json
rename to utils/testing/summa_actor/test_config/Summa_Actors_Settings.json
diff --git a/build/source/testing/testCoordinator.h b/utils/testing/testCoordinator.h
similarity index 100%
rename from build/source/testing/testCoordinator.h
rename to utils/testing/testCoordinator.h
diff --git a/build/source/testing/testing_main.cc b/utils/testing/testing_main.cc
similarity index 100%
rename from build/source/testing/testing_main.cc
rename to utils/testing/testing_main.cc
diff --git a/build/source/testing/write_to_netcdf.f90 b/utils/testing/write_to_netcdf.f90
similarity index 98%
rename from build/source/testing/write_to_netcdf.f90
rename to utils/testing/write_to_netcdf.f90
index 9fffe61f245be6e5a6c333d2d188293d6c6c92e0..f694f1ef72ef56595ad0533dc942ea0905349243 100644
--- a/build/source/testing/write_to_netcdf.f90
+++ b/utils/testing/write_to_netcdf.f90
@@ -58,7 +58,7 @@ subroutine writeParamToNetCDF(handle_ncid,    &
                           err) bind(C, name="writeParamToNetCDF")
   USE globalData,only:attr_meta,type_meta,mpar_meta,bpar_meta ! meta structures
   USE globalData,only:gru_struc
-  USE writeOutput_module,only:writeParm 
+  USE modelwrite_module,only:writeParm 
   USE globalData,only:structInfo                              ! information on the data structures
   implicit none
   ! dummy variables
@@ -136,8 +136,8 @@ subroutine writeDataToNetCDF(handle_ncid,          &
   USE globalData, only:forcChild_map, progChild_map, diagChild_map, fluxChild_map, indxChild_map
   USE globalData,only:maxLayers                               ! maximum number of layers
   USE globalData,only:structInfo
-  USE writeOutput_module,only:writeParm 
-  USE writeOutput_module,only:writeData
+  USE modelwrite_module,only:writeParm 
+  USE modelwrite_module,only:writeData
 
   implicit none
   ! dummy variables
@@ -233,7 +233,7 @@ end subroutine writeDataToNetCDF
 
 subroutine writeBasinToNetCDF(handle_ncid, index_gru, handle_finalize_stats, &
   handle_output_timestep, handle_bvar_stat, handle_bvar_struct, err) bind(C, name="writeBasinToNetCDF")
-  USE writeOutput_module,only:writeBasin
+  USE modelwrite_module,only:writeBasin
   USE globalData,only:bvar_meta                 ! metadata on basin-average variables
   USE globalData,only:bvarChild_map             ! index of the child data structure: stats bvar
  
@@ -277,7 +277,7 @@ end subroutine writeBasinToNetCDF
 
 subroutine writeTimeToNetCDF(handle_ncid, handle_finalize_stats, handle_output_timestep, &
     handle_time_struct, err) bind(C, name="writeTimeToNetCDF")
-  USE writeOutput_module,only:writeTime
+  USE modelwrite_module,only:writeTime
   USE globalData,only:time_meta
 
   implicit none