Skip to content
Snippets Groups Projects
Commit 2bd3b36c authored by KyleKlenk's avatar KyleKlenk
Browse files

Ensured backward compatibility with V3 Summa

parent c638ba9b
No related branches found
No related tags found
1 merge request!5add in compiler def ACTORS_ACTIVE to turn on some stuff so can move...
......@@ -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)
......
#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) {
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment