diff --git a/README.md b/README.md index f971e226ad61dbbee6ac8ee3dce95e886815e6e7..5223131e158f39d6ee252bf80c1b278ef0c223c0 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,10 @@ Before compiling, make sure to install the following dependencies: Here are the steps to compile SUMMA-Actors: - cd into `build/{$YOUR_SUMMA_DIR}/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. + - change the build type in file `build.cluster.bash` to one of the above containing Cluster and Actors + - run `./build.cluster.bash` + - or if you are not using a cluster, you can do the same on the `build.mac.bash` if you have installed the Actors Framework +- 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_type` 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 diff --git a/actorsChanges.txt b/actorsChanges.txt index e99432b3b840657032d634a9528dd397999a8506..2772fe0c0bae9c9c409688819c7eb4d00933f8d4 100644 --- a/actorsChanges.txt +++ b/actorsChanges.txt @@ -1,5 +1,6 @@ driver -/summaActors_alarms.f90 -- remove /summaActors_globalData.-- could combine and remove, renamed for now +/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 @@ -10,25 +11,27 @@ dshare /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 +/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/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 +/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.-- part of read_attrb, - very different, actors doesn't use rest of read_attribute which was cut, maybe better, but then this and the other changes in it should be applied to all versions! and I don't see it called anywhere in Actors ... removed BUT SHOULD IT JUST REPLACE THE SUMMA read_dimension? - also Actors assumes don't have aspect variable .. why? -/read_pinit.f90 -- remove /vegPhenlgy.f90 -- remove with ACTORS_ACTIVE needs fracJulday, yearLength +/read_pinit.f90 -- remove +/vegPhenlgy.f90 -- remove with ACTORS_ACTIVE needs fracJulDay, yearLength changed calls in run_oneHRU so can use (modded) currently in actors /derivforce.f90 /coupled_em.f90 /vegPhenlgy.f90 as is @@ -49,7 +52,8 @@ 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 +/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/build/source/actors/file_access_actor/fortran_code/read_forcing.f90 b/build/source/actors/file_access_actor/fortran_code/read_forcing.f90 index 18d639e471db9435698d491bae53b8a6df32f0ee..3ed7f31d6126da0a924484d68f5e02a03da877fa 100644 --- a/build/source/actors/file_access_actor/fortran_code/read_forcing.f90 +++ b/build/source/actors/file_access_actor/fortran_code/read_forcing.f90 @@ -155,12 +155,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 +209,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/hru_actor/fortran_code/hru_actor.f90 b/build/source/actors/hru_actor/fortran_code/hru_actor.f90 index 1f14acb8df6cd157653225c25da17c68aade2f5c..3b815dd092a3280720cc1216e0f8c1ca95310f6e 100644 --- a/build/source/actors/hru_actor/fortran_code/hru_actor.f90 +++ b/build/source/actors/hru_actor/fortran_code/hru_actor.f90 @@ -27,7 +27,7 @@ subroutine getFirstTimestep(iFile, iRead, err) bind(C, name="getFirstTimestep") 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 globalData,only:refJulDay_data ! reference time for data files (fractional julian days) USE multiconst,only:secprday ! number of seconds in a day @@ -48,10 +48,10 @@ subroutine getFirstTimestep(iFile, iRead, err) bind(C, name="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 & + fileTime = arth(0,1,forcingDataStruct(iFile)%nTimeSteps) * data_step/secprday + refJulDay_data & + timeVal(1)/forcingDataStruct(iFile)%convTime2Days - ! find difference of fileTime from currentJulday + ! find difference of fileTime from currentJulDay diffTime=abs(fileTime-dJulianStart) if(any(diffTime < verySmall))then @@ -112,7 +112,7 @@ subroutine readForcingHRU(indxGRU, iStep, iRead, handle_timeStruct, handle_forcS ! 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: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 @@ -134,7 +134,7 @@ subroutine readForcingHRU(indxGRU, iStep, iRead, handle_timeStruct, handle_forcS ! 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) :: 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 @@ -162,8 +162,8 @@ subroutine readForcingHRU(indxGRU, iStep, iRead, handle_timeStruct, handle_forcS 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 + 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 @@ -223,10 +223,10 @@ 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 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) + 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 @@ -238,7 +238,7 @@ subroutine computeTimeForcingHRU(handle_timeStruct, handle_forcStruct, fracJulDa 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 + 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 @@ -263,13 +263,13 @@ subroutine computeTimeForcingHRU(handle_timeStruct, handle_forcStruct, fracJulDa 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 + 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 + 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 + forcStruct%var(iLookFORCE%time) = (currentJulDay-refJulDay)*secprday ! compute the number of days in the current year yearLength = 365 diff --git a/build/source/actors/hru_actor/fortran_code/model_run.f90 b/build/source/actors/hru_actor/fortran_code/model_run.f90 index 3ac77cd6c2063b03e5588f18cbbf470d4ef2abbd..b0814e54c1bc6d055a81c3e2770fbcff550ed5e0 100644 --- a/build/source/actors/hru_actor/fortran_code/model_run.f90 +++ b/build/source/actors/hru_actor/fortran_code/model_run.f90 @@ -103,7 +103,7 @@ subroutine runPhysics(& ! 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 + dt_init_factor, & ! used to adjust the length of the timestep in the event of a failure err) bind(C, name='RunPhysics') ! --------------------------------------------------------------------------------------- ! * desired modules @@ -142,13 +142,13 @@ subroutine runPhysics(& 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 + type(c_ptr),intent(in), value :: handle_lookupStruct ! enthalpy lookup structures + real(c_double),intent(inout) :: fracJulDay ! fractional julian days since the start of year real(c_double),intent(inout) :: tmZoneOffsetFracDay - integer(c_int),intent(inout) :: yearLength + integer(c_int),intent(inout) :: yearLength ! number of days in the current year 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 + 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 @@ -208,6 +208,9 @@ subroutine runPhysics(& ! get vegetation phenology ! (compute the exposed LAI and SAI and whether veg is buried by snow) call vegPhenlgy(& + ! model control + fracJulDay, & ! intent(in): fractional julian days since the start of year + yearLength, & ! intent(in): number of days in the current year ! input/output: data structures model_decisions, & ! intent(in): model decisions typeStruct, & ! intent(in): type of vegetation and soil @@ -219,8 +222,6 @@ subroutine runPhysics(& 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) @@ -325,7 +326,7 @@ subroutine runPhysics(& progStruct, & ! data structure of model prognostic variables diagStruct, & ! data structure of model diagnostic variables fluxStruct, & ! data structure of model fluxes - tmZoneOffsetFracDay,& + tmZoneOffsetFracDay,& ! time zone offset in fractional days err,cmessage) ! error control if(err/=0)then err=20 @@ -344,6 +345,8 @@ subroutine runPhysics(& 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 + fracJulDay, & ! intent(in): fractional julian days since the start of year + yearLength, & ! intent(in): number of days in the current year ! data structures (input) typeStruct, & ! intent(in): local classification of soil veg etc. for each HRU attrStruct, & ! intent(in): local attributes for each HRU @@ -356,8 +359,6 @@ subroutine runPhysics(& 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