Skip to content
Snippets Groups Projects
Commit 5ce65e1e authored by Kyle's avatar Kyle
Browse files

added t2enthalpy.f90 and tested

parent 9ee8ed6e
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,8 @@ extern "C" { ...@@ -22,6 +22,8 @@ extern "C" {
void* attrStruct, void* typeStruct, void* idStruct, void* attrStruct, void* typeStruct, void* idStruct,
// primary data structures (variable length vectors) // primary data structures (variable length vectors)
void* mparStruct, void* bparStruct, void* bvarStruct, void* dparStruct, void* mparStruct, void* bparStruct, void* bvarStruct, void* dparStruct,
// lookup tables
void* lookupStruct,
// local HRU data // local HRU data
void* startTime, void* oldTime, void* startTime, void* oldTime,
// miscellaneous // miscellaneous
......
...@@ -198,9 +198,11 @@ SUMMA_NOAHMP= \ ...@@ -198,9 +198,11 @@ SUMMA_NOAHMP= \
NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP)) NOAHMP = $(patsubst %, $(NOAHMP_DIR)/%, $(SUMMA_NOAHMP))
# Define routines for the SUMMA model runs # Define routines for the SUMMA model runs
# sundials - t2enthalpy.f90
SUMMA_MODRUN = \ SUMMA_MODRUN = \
indexState.f90 \ indexState.f90 \
getVectorz.f90 \ getVectorz.f90 \
t2enthalpy.f90 \
updateVars.f90 \ updateVars.f90 \
var_derive.f90 \ var_derive.f90 \
read_forcingActors.f90 \ read_forcingActors.f90 \
......
...@@ -198,6 +198,7 @@ void Initialize_HRU(stateful_actor<hru_state>* self) { ...@@ -198,6 +198,7 @@ void Initialize_HRU(stateful_actor<hru_state>* self) {
self->state.handle_bparStruct, self->state.handle_bparStruct,
self->state.handle_bvarStruct, self->state.handle_bvarStruct,
self->state.handle_dparStruct, self->state.handle_dparStruct,
self->state.handle_lookupStruct,
self->state.handle_startTime, self->state.handle_startTime,
self->state.handle_oldTime, self->state.handle_oldTime,
&self->state.upArea, &self->state.err); &self->state.upArea, &self->state.err);
......
...@@ -29,7 +29,8 @@ USE data_types,only:& ...@@ -29,7 +29,8 @@ USE data_types,only:&
var_i8, & ! x%var(:) (i8b) var_i8, & ! x%var(:) (i8b)
var_d, & ! x%var(:) (dp) var_d, & ! x%var(:) (dp)
var_ilength, & ! x%var(:)%dat (i4b) var_ilength, & ! x%var(:)%dat (i4b)
var_dlength ! x%var(:)%dat (dp) var_dlength, & ! x%var(:)%dat (dp)
zLookup
! access missing values ! access missing values
USE globalData,only:integerMissing ! missing integer USE globalData,only:integerMissing ! missing integer
...@@ -77,7 +78,8 @@ subroutine setupHRUParam(& ...@@ -77,7 +78,8 @@ subroutine setupHRUParam(&
handle_bparStruct, & ! basin-average parameters handle_bparStruct, & ! basin-average parameters
handle_bvarStruct, & ! basin-average variables handle_bvarStruct, & ! basin-average variables
handle_dparStruct, & ! default model parameters handle_dparStruct, & ! default model parameters
! local HRU data handle_lookupStruct, & ! lookup tables
! local HRU data
handle_startTime, & ! start time for the model simulation handle_startTime, & ! start time for the model simulation
handle_oldTime, & ! time for the previous model time step handle_oldTime, & ! time for the previous model time step
! miscellaneous variables ! miscellaneous variables
...@@ -96,6 +98,7 @@ subroutine setupHRUParam(& ...@@ -96,6 +98,7 @@ subroutine setupHRUParam(&
USE pOverwrite_module,only:pOverwrite ! module to overwrite default parameter values with info from the Noah tables USE pOverwrite_module,only:pOverwrite ! module to overwrite default parameter values with info from the Noah tables
USE read_param4chm_module,only:read_param ! module to read model parameter sets USE read_param4chm_module,only:read_param ! module to read model parameter sets
USE ConvE2Temp_module,only:E2T_lookup ! module to calculate a look-up table for the temperature-enthalpy conversion 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 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 USE module_sf_noahmplsm,only:read_mp_veg_parameters ! module to read NOAH vegetation tables
! global data structures ! global data structures
...@@ -135,6 +138,7 @@ subroutine setupHRUParam(& ...@@ -135,6 +138,7 @@ subroutine setupHRUParam(&
type(c_ptr), intent(in), value :: handle_bparStruct ! basin-average 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_bvarStruct ! basin-average variables
type(c_ptr), intent(in), value :: handle_dparStruct ! default model parameters 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_startTime ! start time for the model simulation
type(c_ptr), intent(in), value :: handle_oldTime ! time for the previous model time step type(c_ptr), intent(in), value :: handle_oldTime ! time for the previous model time step
real(c_double),intent(inout) :: upArea real(c_double),intent(inout) :: upArea
...@@ -148,6 +152,7 @@ subroutine setupHRUParam(& ...@@ -148,6 +152,7 @@ subroutine setupHRUParam(&
type(var_d),pointer :: bparStruct ! basin-average parameters type(var_d),pointer :: bparStruct ! basin-average parameters
type(var_dlength),pointer :: bvarStruct ! basin-average variables type(var_dlength),pointer :: bvarStruct ! basin-average variables
type(var_d),pointer :: dparStruct ! default model parameters 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 :: startTime ! start time for the model simulation
type(var_i),pointer :: oldTime ! time for the previous model time step type(var_i),pointer :: oldTime ! time for the previous model time step
character(len=256) :: message ! error message character(len=256) :: message ! error message
...@@ -167,6 +172,7 @@ subroutine setupHRUParam(& ...@@ -167,6 +172,7 @@ subroutine setupHRUParam(&
call c_f_pointer(handle_bparStruct, bparStruct) call c_f_pointer(handle_bparStruct, bparStruct)
call c_f_pointer(handle_bvarStruct, bvarStruct) call c_f_pointer(handle_bvarStruct, bvarStruct)
call c_f_pointer(handle_dparStruct, dparStruct) 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_startTime, startTime)
call c_f_pointer(handle_oldTime, oldTime) call c_f_pointer(handle_oldTime, oldTime)
...@@ -252,6 +258,13 @@ subroutine setupHRUParam(& ...@@ -252,6 +258,13 @@ subroutine setupHRUParam(&
return return
endif endif
! calculate a lookup table to compute enthalpy from temperature
call T2E_lookup(gru_struc(indxGRU)%hruInfo(indxHRU)%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); return; endif
! overwrite the vegetation height ! overwrite the vegetation height
HVT(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyTop)%dat(1) HVT(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyTop)%dat(1)
HVB(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyBottom)%dat(1) HVB(typeStruct%var(iLookTYPE%vegTypeIndex)) = mparStruct%var(iLookPARAM%heightCanopyBottom)%dat(1)
......
This diff is collapsed.
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