diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 78babbc0efcd1e07d13c98ba74581eec13af8561..a554c4ff3aa2f3f58e4d6b2bc5a746c2f11a177f 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -9,6 +9,7 @@ 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 @@ -37,7 +38,6 @@ if (CMAKE_BUILD_TYPE MATCHES Cluster) ${CAF_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) @@ -64,7 +64,6 @@ else() ${OpenBLAS_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") @@ -98,7 +97,6 @@ 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) -set(GRU_ACTOR_DIR ${ACTORS_DIR}/gru_actor) # NOAHMP modules set(NOAHMP diff --git a/build/includes/file_access_actor/file_access_actor.hpp b/build/includes/file_access_actor/file_access_actor.hpp index ff064c3c07ff09814da3add536050bc6e58c6658..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; - int rel_tol_var_id; - int abs_tol_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); + + 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,12 +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); - -void initalizeOutputHandles(stateful_actor<file_access_state>* self); +/********************************************* + * Functions for the file access actor + *********************************************/ /* 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 817fb92b4fb01292e2c29d8d0310b58a35f9683f..0000000000000000000000000000000000000000 --- a/build/includes/file_access_actor/file_access_actor_subroutine_wrappers.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once -#include "file_access_actor.hpp" - -extern "C" { - // initalizeFileAccessActor - 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, - netcdf_gru_actor_info* actor_info, - int* err); - - // OutputStructure and Output functions - void deallocateOutputStructure(int* err); - void writeOutput_fortran(void* handle_ncid, int* num_steps, int* start_gru, int* max_gru, bool* writeParamFlag, 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 5c2247f1e0cb8039a3204ced77f12acd8a2b0efa..78c14bc098ec85f22541ecf3a2f7ae527fe1e120 100644 --- a/build/includes/file_access_actor/output_container.hpp +++ b/build/includes/file_access_actor/output_container.hpp @@ -109,110 +109,51 @@ class Output_Container { }; -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 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; -}; +// 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); +// // 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); +// // 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); +// // 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, 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); +// // 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); +// 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); +// /* +// * 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/hru_actor/hru_actor.hpp b/build/includes/hru_actor/hru_actor.hpp index e05d2f28f4f45c469687db2d4338011f7eeb8499..7f8f8fe42f11a387cf9ad8001d662cf85b065a5a 100644 --- a/build/includes/hru_actor/hru_actor.hpp +++ b/build/includes/hru_actor/hru_actor.hpp @@ -24,29 +24,27 @@ struct hru_state { int refGRU; // The actual ID of the GRU we are // Variables for forcing structures - int stepsInCurrentFFile; // number of time steps in current forcing file + 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 - 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 + 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 // Settings HRU_Actor_Settings hru_actor_settings; // error control - int err = 0; + int err = 0; ~hru_state() { delete_handle_hru_type(hru_data); @@ -67,13 +65,4 @@ void Initialize_HRU(stateful_actor<hru_state>* self); */ 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/source/actors/file_access_actor/cppwrap_fileAccess.f90 b/build/source/actors/file_access_actor/cppwrap_fileAccess.f90 index 1b925f92ea540f502d5d24b93d4e8a5907f0b4d0..7540f7512e256bebadacfd81aeb0a5f651e82fc8 100644 --- a/build/source/actors/file_access_actor/cppwrap_fileAccess.f90 +++ b/build/source/actors/file_access_actor/cppwrap_fileAccess.f90 @@ -17,6 +17,11 @@ module cppwrap_fileAccess 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 @@ -31,13 +36,11 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing start_gru,& num_gru,& num_hru,& - actor_stats,& 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 def_output_actors_module,only:def_output ! module to define output variables 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 @@ -47,19 +50,17 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing 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 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 + 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 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 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 @@ -69,7 +70,7 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing USE var_lookup,only:iLookBVAR ! look-up values for basin-average variables USE output_structure_module,only:outputStructure ! output structure USE output_structure_module,only:failedHRUs ! Flag for file access actor to know which GRUs have failed - + 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 @@ -80,17 +81,19 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing 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 - - USE ConvE2Temp_module,only:E2T_lookup ! module to calculate a look-up table for the temperature-enthalpy conversion - + 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 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 ConvE2Temp_module,only:E2T_lookup ! module to calculate a look-up table for the temperature-enthalpy conversion - USE globalData,only:numtim ! number of time steps in the simulation + 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 @@ -101,10 +104,8 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing integer(c_int),intent(out) :: start_gru integer(c_int),intent(out) :: num_gru integer(c_int),intent(out) :: num_hru - type(netcdf_gru_actor_info),intent(out):: actor_stats ! netcdf actor information integer(c_int),intent(out) :: err - ! local Variables type(file_info_array),pointer :: forcFileInfo type(var_i),pointer :: output_ncid ! id of output file @@ -113,7 +114,8 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing 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 + character(LEN=256) :: restartFile ! restart file name + integer(i4b) :: indxGRU=1 character(len=256) :: message ! error message for downwind routine @@ -195,8 +197,19 @@ subroutine fileAccessActor_init_fortran(& ! Variables for forcing ! ***************************************************************************** ! *** Define Output Files ! ***************************************************************************** - call def_output(output_ncid,start_gru,num_gru,num_hru,actor_stats,err,message) + 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 diff --git a/build/source/actors/file_access_actor/fileAccess_writeOutput.f90 b/build/source/actors/file_access_actor/fileAccess_writeOutput.f90 index 0887094590eb8429e2959736460ed2bf16bbfbc2..e2b9242fee16a595ca0b2224df8311495e639fe2 100644 --- a/build/source/actors/file_access_actor/fileAccess_writeOutput.f90 +++ b/build/source/actors/file_access_actor/fileAccess_writeOutput.f90 @@ -84,7 +84,6 @@ public::writeBasin public::writeTime private::writeScalar private::writeVector -public::writeGRUStatistics ! define dimension lengths integer(i4b),parameter :: maxSpectral=2 ! maximum number of spectral bands contains @@ -248,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 @@ -318,7 +316,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 @@ -330,29 +327,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%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%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 @@ -664,8 +648,7 @@ subroutine writeTime(ncid,outputTimestep,iStep,meta,dat,err,message) ! 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 @@ -679,70 +662,5 @@ subroutine writeTime(ncid,outputTimestep,iStep,meta,dat,err,message) end do ! iFreq -end subroutine writeTime - -subroutine writeGRUStatistics(handle_ncid, & - gru_var_ids, & - gru_stats_vector, & - num_gru, & - err) bind(C, name="WriteGRUStatistics") - USE data_types,only:var_i - USE actor_data_types,only: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 - real(c_double), dimension(num_gru) :: rel_tol_array - real(c_double), dimension(num_gru) :: abs_tol_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 - rel_tol_array(i) = gru_stats_vector(i)%rel_tol - abs_tol_array(i) = gru_stats_vector(i)%abs_tol - 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) - err = nf90_put_var(ncid%var(iFreq), gru_var_ids%rel_tol_var_id, rel_tol_array) - err = nf90_put_var(ncid%var(iFreq), gru_var_ids%abs_tol_var_id, abs_tol_array) - end do - -end subroutine writeGRUStatistics - - +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 index 6a645d510fcd3e4591cb8d2bb1b72e89555ef38f..5c29fc5362ff01cc0746f3af704bebf4b788c2da 100644 --- a/build/source/actors/file_access_actor/file_access_actor.cpp +++ b/build/source/actors/file_access_actor/file_access_actor.cpp @@ -1,6 +1,5 @@ #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" @@ -8,7 +7,6 @@ using json = nlohmann::json; - namespace caf { behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gru, int num_gru, @@ -19,13 +17,11 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr 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.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; @@ -39,7 +35,6 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr &self->state.start_gru, &self->state.num_gru, &self->state.num_gru, // Filler for num_hrus - &self->state.gru_actor_stats, &self->state.err); if (self->state.err != 0) { aout(self) << "ERROR: File Access Actor - File_Access_init_Fortran\n"; @@ -178,22 +173,12 @@ behavior file_access_actor(stateful_actor<file_access_state>* self, int start_gr }, - [=](finalize, 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); - + [=](finalize) { - // call output_container deconstructor - self->state.output_container->~Output_Container(); - - - aout(self) << "Deallocating Structure" << std::endl; + 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); - // 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"; diff --git a/build/source/actors/file_access_actor/output_structure.f90 b/build/source/actors/file_access_actor/output_structure.f90 index 54db360ba1057b8dad0f7a3eba91930ab9431b06..6526b5cdacc9b446c3b18b32d487cc912b3f54bc 100644 --- a/build/source/actors/file_access_actor/output_structure.f90 +++ b/build/source/actors/file_access_actor/output_structure.f90 @@ -135,7 +135,7 @@ subroutine initOutputStructure(forcFileInfo, maxSteps, num_gru, err) 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 SUNDIALS_ACTIVE +#ifdef V4_ACTIVE USE globalData,only:lookup_meta #endif USE globalData,only:statForc_meta ! child metadata for stats @@ -254,7 +254,7 @@ subroutine initOutputStructure(forcFileInfo, maxSteps, num_gru, err) 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 SUNDIALS_ACTIVE +#ifdef V4_ACTIVE case('lookup'); call allocGlobal(lookup_meta,outputStructure(1)%lookupStruct,err, message); #endif end select 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 index 7f92ddfac281d64142d4466441b8448e3a9b370e..1367876cfc6feb4fe3d52c5e52e1203a9981cd54 100644 --- a/build/source/actors/global/actor_data_types.f90 +++ b/build/source/actors/global/actor_data_types.f90 @@ -27,35 +27,7 @@ module actor_data_types 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 - integer(C_INT) :: rel_tol_var_id - integer(C_INT) :: abs_tol_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 - real(C_DOUBLE) :: rel_tol - real(C_DOUBLE) :: abs_tol - end type serializable_netcdf_gru_actor_info - - - ! ** double precision type of for time series + ! ** double precision type of for time series type, public :: time_dlength type(dlength),allocatable :: tim(:) ! tim(:)%dat endtype time_dlength diff --git a/build/source/actors/hru_actor/hru_actor.cpp b/build/source/actors/hru_actor/hru_actor.cpp index 13eeb6ef853e9704bb2f4bfc7f6dce3eb364f388..38af62baeabc0df93f4fd9cc0c242ffd3a5c5b8d 100644 --- a/build/source/actors/hru_actor/hru_actor.cpp +++ b/build/source/actors/hru_actor/hru_actor.cpp @@ -21,11 +21,6 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, 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; @@ -147,21 +142,21 @@ void Initialize_HRU(stateful_actor<hru_state>* self) { } // Set HRU Tolerances - setIDATolerances(self->state.hru_data, - &self->state.hru_actor_settings.relTolTempCas, - &self->state.hru_actor_settings.absTolTempCas, - &self->state.hru_actor_settings.relTolTempVeg, - &self->state.hru_actor_settings.absTolTempVeg, - &self->state.hru_actor_settings.relTolWatVeg, - &self->state.hru_actor_settings.absTolWatVeg, - &self->state.hru_actor_settings.relTolTempSoilSnow, - &self->state.hru_actor_settings.absTolTempSoilSnow, - &self->state.hru_actor_settings.relTolWatSnow, - &self->state.hru_actor_settings.absTolWatSnow, - &self->state.hru_actor_settings.relTolMatric, - &self->state.hru_actor_settings.absTolMatric, - &self->state.hru_actor_settings.relTolAquifr, - &self->state.hru_actor_settings.absTolAquifr); + // setIDATolerances(self->state.hru_data, + // &self->state.hru_actor_settings.relTolTempCas, + // &self->state.hru_actor_settings.absTolTempCas, + // &self->state.hru_actor_settings.relTolTempVeg, + // &self->state.hru_actor_settings.absTolTempVeg, + // &self->state.hru_actor_settings.relTolWatVeg, + // &self->state.hru_actor_settings.absTolWatVeg, + // &self->state.hru_actor_settings.relTolTempSoilSnow, + // &self->state.hru_actor_settings.absTolTempSoilSnow, + // &self->state.hru_actor_settings.relTolWatSnow, + // &self->state.hru_actor_settings.absTolWatSnow, + // &self->state.hru_actor_settings.relTolMatric, + // &self->state.hru_actor_settings.absTolMatric, + // &self->state.hru_actor_settings.relTolAquifr, + // &self->state.hru_actor_settings.absTolAquifr); } @@ -190,7 +185,8 @@ int Run_HRU(stateful_actor<hru_state>* self) { if (self->state.hru_actor_settings.print_output && self->state.timestep % self->state.hru_actor_settings.output_frequency == 0) { - printOutput(self); + // Print the current timestep + aout(self) << self->state.refGRU << " - Timestep = " << self->state.timestep << "\n"; } @@ -232,8 +228,4 @@ int Run_HRU(stateful_actor<hru_state>* self) { } -void printOutput(stateful_actor<hru_state>* self) { - aout(self) << self->state.refGRU << " - Timestep = " << self->state.timestep << "\n"; -} - } \ 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 index 44259d1359026323c3fb7ed4834b69e1a9f7e9a0..fb71c401ec4b52a21af10cc2f9c6001010e081df 100755 --- a/build/source/actors/hru_actor/hru_init.f90 +++ b/build/source/actors/hru_actor/hru_init.f90 @@ -10,7 +10,7 @@ USE data_types,only:& var_ilength, & ! x%var(:)%dat (i4b) var_dlength ! x%var(:)%dat (dp) #ifdef V4_ACTIVE -USE data_types,only:z_lookup ! x%z(:)%var(:)%lookup(:) -- lookup tables +USE data_types,only:zlookup ! x%z(:)%var(:)%lookup(:) -- lookup tables #endif USE actor_data_types,only:hru_type ! hru_type diff --git a/build/source/actors/hru_actor/hru_modelRun.f90 b/build/source/actors/hru_actor/hru_modelRun.f90 index d7c8467042b8f4bf48b2821da18c1ac5ae754a3a..6867737fc72aeb7d64f28786aae5dc75a022eca8 100644 --- a/build/source/actors/hru_actor/hru_modelRun.f90 +++ b/build/source/actors/hru_actor/hru_modelRun.f90 @@ -272,7 +272,7 @@ subroutine runPhysics(& 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 SUNDIALS_ACTIVE +#ifdef V4_ACTIVE hru_data%lookupStruct, & #endif ! data structures (input-output) diff --git a/build/source/actors/job_actor/job_actor.cpp b/build/source/actors/job_actor/job_actor.cpp index 14e26db91a75e02e282bb0764e7cd0e4fc5be332..34b06d2ea7e429bd4c036f1e1138fa9a519c7642 100644 --- a/build/source/actors/job_actor/job_actor.cpp +++ b/build/source/actors/job_actor/job_actor.cpp @@ -6,7 +6,6 @@ #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>; @@ -194,15 +193,9 @@ behavior job_actor(stateful_actor<job_state>* self, return !gru_info.successful; }); - self->request(self->state.file_access_actor, - infinite, - finalize_v, netcdf_gru_info) - .await( + 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; } diff --git a/build/source/actors/job_actor/job_actor.f90 b/build/source/actors/job_actor/job_actor.f90 index bee10b60c47b3d8ed26dd5327ed6887802a4f7df..10eb1d1271ea23aa8da31183e54bf975485e2880 100644 --- a/build/source/actors/job_actor/job_actor.f90 +++ b/build/source/actors/job_actor/job_actor.f90 @@ -41,6 +41,7 @@ subroutine job_init_fortran(file_manager, start_gru, num_gru,& 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 @@ -57,6 +58,7 @@ subroutine job_init_fortran(file_manager, start_gru, num_gru,& 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 @@ -89,6 +91,24 @@ subroutine job_init_fortran(file_manager, start_gru, num_gru,& 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 ! ***************************************************************************** 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/build/source/testing/class_vs_actor/Makefile b/utils/testing/class_vs_actor/Makefile similarity index 100% rename from build/source/testing/class_vs_actor/Makefile rename to utils/testing/class_vs_actor/Makefile diff --git a/build/source/testing/class_vs_actor/README.md b/utils/testing/class_vs_actor/README.md similarity index 100% rename from build/source/testing/class_vs_actor/README.md rename to utils/testing/class_vs_actor/README.md diff --git a/build/source/testing/class_vs_actor/main.cpp b/utils/testing/class_vs_actor/main.cpp similarity index 100% rename from build/source/testing/class_vs_actor/main.cpp rename to utils/testing/class_vs_actor/main.cpp 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 100% rename from build/source/testing/write_to_netcdf.f90 rename to utils/testing/write_to_netcdf.f90