diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index a554c4ff3aa2f3f58e4d6b2bc5a746c2f11a177f..4152b68221362012e2af34d398a2fa6f38bf4b07 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -85,13 +85,6 @@ 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 directories for source files that might be replaced by actors (identical if not using actors) -set(SUB_DRIVER_DIR ${PARENT_DIR}/build/source/driver) -set(SUB_DSHARE_DIR ${PARENT_DIR}/build/source/dshare) -set(SUB_ENGINE_DIR ${PARENT_DIR}/build/source/engine) -set(SUB_HOOKUP_DIR ${PARENT_DIR}/build/source/hookup) -set(SUB_NETCDF_DIR ${PARENT_DIR}/build/source/netcdf) - # Define Actors specific directories set(ACTORS_DIR ${PARENT_DIR}/build/source/actors) set(FILE_ACCESS_DIR ${ACTORS_DIR}/file_access_actor) @@ -144,7 +137,7 @@ set(UTILMS # NetCDF routines set(NETCDF - ${FILE_ACCESS_DIR}/def_output.f90 + ${NETCDF_DIR}/def_output.f90 ${NETCDF_DIR}/netcdf_util.f90 ${NETCDF_DIR}/read_icond.f90) diff --git a/build/source/actors/hru_actor/hru_actor.cpp b/build/source/actors/hru_actor/hru_actor.cpp index 4939a6f45e5dd148a017bae44bbceac59cf83e2c..dec18f1d98dfec96f827d4e4a71e22f9c4b5f4f6 100644 --- a/build/source/actors/hru_actor/hru_actor.cpp +++ b/build/source/actors/hru_actor/hru_actor.cpp @@ -1,12 +1,5 @@ #include "hru_actor.hpp" -// Compiler set flag for sundials -#ifdef SUNDIALS_ACTIVE - bool sundials_active = true; -#else - bool sundials_active = false; -#endif - namespace caf { behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, @@ -67,13 +60,12 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU, err = Run_HRU(self); // Simulate a Timestep if (err != 0) { - if (sundials_active) { +#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 { +#else self->send(self->state.parent, hru_error::run_physics_unhandleable, self); - } - +#endif self->quit(); return; @@ -147,9 +139,10 @@ void Initialize_HRU(stateful_actor<hru_state>* self) { 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); + 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) { diff --git a/build/source/actors/hru_actor/hru_modelRun.f90 b/build/source/actors/hru_actor/hru_modelRun.f90 index 7e53b11cce48e08ff198e51046fad3af503fb7ce..efd46871b937f89d89c08c68b0dbe31fadfa90b4 100644 --- a/build/source/actors/hru_actor/hru_modelRun.f90 +++ b/build/source/actors/hru_actor/hru_modelRun.f90 @@ -69,8 +69,10 @@ USE mDecisions_module,only:& ! look-up values for LAI decisions 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 @@ -349,6 +351,7 @@ 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 @@ -407,6 +410,6 @@ subroutine set_sundials_tolerances(handle_hru_data, rtol, atol) bind(C, name='se 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