Skip to content

Commit 33478db

Browse files
committed
build routing_model.F90 with O2 in GNU
1 parent ff111ad commit 33478db

2 files changed

Lines changed: 6 additions & 22 deletions

File tree

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSroute_GridComp/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ set (srcs
66
reservoir.F90
77
)
88

9+
if (CMAKE_Fortran_COMPILER_ID MATCHES GNU AND CMAKE_BUILD_TYPE MATCHES Release)
10+
set_source_files_properties(routing_model.F90 PROPERTIES COMPILE_OPTIONS ${FOPT2})
11+
endif ()
12+
913
esma_add_library (${this} SRCS ${srcs} DEPENDENCIES MAPL GEOS_LandShared ESMF::ESMF NetCDF::NetCDF_Fortran)

GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/GEOSroute_GridComp/routing_model.F90

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ SUBROUTINE RIVER_ROUTING_HYD ( &
9797
real, parameter :: small = 1.e-20
9898

9999
real, dimension(NCAT) :: Qrunf,Ws,Wr
100-
real, dimension(NCAT) :: Qs0,ks,Ws_last, tmpR1, tmpR2
100+
real, dimension(NCAT) :: Qs0,ks,Ws_last
101101

102-
real :: dt, exp1, exp2
103-
integer :: i
102+
real :: dt
104103

105104
! convert volume units to mass
106105
Qrunf = Qrunf0 * rho ! m3/s -> kg/s
@@ -111,20 +110,8 @@ SUBROUTINE RIVER_ROUTING_HYD ( &
111110

112111
! Update state variables: ks, Ws, and Qs
113112
where(Qrunf<=small)Qrunf=0. ! Set runoff to zero if it's too small
114-
#ifdef __GFORTRAN__
115-
exp1 = 1./(1.-RRM_mm)
116-
exp2 = RRM_mm/(1.-RRM_mm)
117-
118-
do i = 1, NCAT
119-
tmpR1(i) = Ws(i)**exp1
120-
tmpR2(i) = Ws(i)**exp2
121-
enddo
122-
Qs0=max(0.,RRM_ALPHA_STR * tmpR1) ! Initial flow from local stream storage (kg/s)
123-
ks =max(0.,(RRM_ALPHA_STR/(1.-RRM_mm)) * tmpR2) ! Flow coefficient (s^-1)
124-
#else
125113
Qs0=max(0.,RRM_ALPHA_STR * Ws**(1./(1.-RRM_mm))) ! Initial flow from local stream storage (kg/s)
126114
ks =max(0.,(RRM_ALPHA_STR/(1.-RRM_mm)) * Ws**(RRM_mm/(1.-RRM_mm))) ! Flow coefficient (s^-1)
127-
#endif
128115
Ws_last=Ws ! Store the current water storage
129116
where(ks>small) Ws=Ws + (Qrunf-Qs0)/ks*(1.-exp(-ks*dt)) ! Update storage (kg)
130117
where(ks<=small) Ws=Ws + (Qrunf-Qs0)*dt ! Simplified update if ks is small
@@ -133,14 +120,7 @@ SUBROUTINE RIVER_ROUTING_HYD ( &
133120

134121
! Calculate variables related to river routing: Qr0, kr
135122
Wr=Wr+Qs*dt
136-
#ifdef __GFORTRAN__
137-
do i = 1, NCAT
138-
tmpR1(i) = Wr(i)**exp1
139-
enddo
140-
Qout=max(0.,RRM_ALPHA_RIV * tmpR1 ) ! River flow based on water storage (kg/s)
141-
#else
142123
Qout=max(0.,RRM_ALPHA_RIV * Wr**(1./(1.-RRM_mm))) ! River flow based on water storage (kg/s)
143-
#endif
144124
Qout=min(Qout,Wr/dt)
145125
Wr=max(0.,Wr-Qout*dt)
146126

0 commit comments

Comments
 (0)