Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build/cmake/build.mac.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
# Actual settings may vary

# Mac Example using MacPorts:
export FC=/opt/local/bin/gfortran # Fortran compiler family
export FC=/opt/homebrew/bin/gfortran # Fortran compiler family
#export FLAGS_OPT="-flto=1" # -flto=1 is slow to compile, but might want to use
export LIBRARY_LINKS='-llapack' # list of library links
export SUNDIALS_DIR=../../../sundials/instdir/
export SUNDIALS_DIR=$HOME/local/sundials

cmake -B ../cmake_build -S ../. -DUSE_SUNDIALS=ON -DSPECIFY_LAPACK_LINKS=ON -DCMAKE_BUILD_TYPE=Release
#cmake -B ../cmake_build -S ../. -DUSE_SUNDIALS=ON -DSPECIFY_LAPACK_LINKS=ON -DCMAKE_BUILD_TYPE=Debug
#cmake -B ../cmake_build -S ../. -DCMAKE_BUILD_TYPE=Debug \
# -DCMAKE_Fortran_FLAGS_DEBUG="-O0 -g -fbacktrace -fcheck=all -Wall -Wextra -Wuninitialized -Wmaybe-uninitialized -fcheck=all -finit-real=snan -finit-integer=2147483647"
cmake --build ../cmake_build --target all -j
30 changes: 22 additions & 8 deletions build/source/driver/summa_alarms.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
module summa_alarms
! used to set alarms to write model output

! named variables for time information
USE globalData, only: numtim ! number of model time steps

! named variables to define new output files
USE globalData, only: noNewFiles ! no new output files
USE globalData, only: newFileEveryOct1 ! create a new file on Oct 1 every year (start of the USA water year)
Expand Down Expand Up @@ -53,19 +56,21 @@ module summa_alarms
contains

! used to set alarms to write model output
subroutine summa_setWriteAlarms(oldTime, newTime, endTime, & ! time vectors
newOutputFile, defNewOutputFile, & ! flag to define new output file
ixRestart, printRestart, & ! flag to print the restart file
ixProgress, printProgress, & ! flag to print simulation progress
resetStats, finalizeStats, & ! flags to reset and finalize stats
statCounter, & ! statistics counter
err,message) ! error control
subroutine summa_setWriteAlarms(modelTimeStep, & ! time index
oldTime, newTime, endTime, & ! time vectors
newOutputFile, defNewOutputFile, & ! flag to define new output file
ixRestart, printRestart, & ! flag to print the restart file
ixProgress, printProgress, & ! flag to print simulation progress
resetStats, finalizeStats, & ! flags to reset and finalize stats
statCounter, & ! statistics counter
err,message) ! error control
! ---------------------------------------------------------------------------------------
! data types
USE nrtype ! variable types, etc.
! ---------------------------------------------------------------------------------------
implicit none
! dummy variables: time vectors
integer(i4b),intent(in) :: modelTimeStep ! index of model time step
integer(i4b),intent(in) :: oldTime(:) ! time vector from the previous time step
integer(i4b),intent(in) :: newTime(:) ! time vector from the current time step
integer(i4b),intent(in) :: endTime(:) ! time vector at the end of the simulation
Expand Down Expand Up @@ -111,6 +116,12 @@ subroutine summa_setWriteAlarms(oldTime, newTime, endTime, & ! time vector

end select

! check that we do not have multiple files for the buffered write
if(defNewOutputFile .and. modelTimeStep>1)then
err=10
message=trim(message)//'cannot have multiple output files when using the buffered write decision (check the -n option)'; return
endif

! *****************************************************************************
! *** define the need to create a restart file
! *****************************************************************************
Expand Down Expand Up @@ -157,11 +168,14 @@ subroutine summa_setWriteAlarms(oldTime, newTime, endTime, & ! time vector
case default; err=20; message=trim(message)//'unable to identify output frequency'; return
end select

! force finalize the stats if the last model time step
if(modelTimeStep == numtim) finalizeStats(iFreq)=.true.

! reset ouput timestep
if(resetStats(iFreq)) statCounter(iFreq)=1

end do ! looping through output frequencies

end subroutine summa_setWriteAlarms

end module summa_alarms
end module summa_alarms
3 changes: 3 additions & 0 deletions build/source/driver/summa_forcing.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ subroutine summa_readForcing(modelTimeStep, summa1_struc, err, message)
! timing variables
USE globalData,only:startRead,endRead ! date/time for the start and end of reading forcing data
USE globalData,only:elapsedRead ! elapsed time to read forcing data
! model decisions
USE globalData,only:model_decisions ! model decision structure
! ---------------------------------------------------------------------------------------
! * variables
! ---------------------------------------------------------------------------------------
Expand Down Expand Up @@ -73,6 +75,7 @@ subroutine summa_readForcing(modelTimeStep, summa1_struc, err, message)
call read_force(&
! input
modelTimeStep, & ! intent(in): time step index
model_decisions, & ! intent(in): model decisions structure
! input-output
iFile, & ! intent(inout): index of current forcing file in forcing file list
forcingStep, & ! intent(inout): index of read position in time dimension in current netcdf file
Expand Down
2 changes: 1 addition & 1 deletion build/source/driver/summa_setup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ subroutine summa_paramSetup(summa1_struc, err, message)
USE nrtype ! variable types, etc.
USE summa_type, only:summa1_type_dec ! master summa data type
! subroutines and functions
use time_utils_module,only:elapsedSec ! calculate the elapsed time
USE time_utils_module,only:elapsedSec ! calculate the elapsed time
USE mDecisions_module,only:mDecisions ! module to read model decisions
USE ffile_info_module,only:ffile_info ! module to read information on forcing datafile
USE read_attrb_module,only:read_attrb ! module to read local attributes
Expand Down
Loading