[Dart-dev] DART/branches Revision: 10759

dart at ucar.edu dart at ucar.edu
Thu Nov 17 09:35:10 MST 2016


thoar at ucar.edu
2016-11-17 09:35:09 -0700 (Thu, 17 Nov 2016)
251
Changed two integer parameters with binary values and then used in logical expressions to logical variables.
The PGI and Intel compilers accepted the integer application, but gfortran balked. Using them as logicals is
more portable and more correct.




Modified: DART/branches/wrfHydro/models/wrfHydro/model_mod.f90
===================================================================
--- DART/branches/wrfHydro/models/wrfHydro/model_mod.f90	2016-11-17 15:47:51 UTC (rev 10758)
+++ DART/branches/wrfHydro/models/wrfHydro/model_mod.f90	2016-11-17 16:35:09 UTC (rev 10759)
@@ -358,7 +358,8 @@
 real(R8), dimension(:,:,:), allocatable :: sh2oDisag
 real(R8), dimension(:,:),   allocatable :: sfcHeadDisag
 real(r8) :: fineGridArea, coarseGridArea
-integer  :: hydroSmcPresent, hydroSfcHeadPresent
+logical :: hydroSmcPresent
+logical :: hydroSfcHeadPresent
 
 interface vector_to_prog_var
    module procedure vector_to_1d_prog_var
@@ -649,18 +650,19 @@
 lsmSmcPresent =  sum( keepLsmVars0 , mask = (lsm_state_variables(1,:) .eq. 'SOIL_W') .or. &
      (lsm_state_variables(1,:) .eq. 'SH2O') )
 
-hydroSmcPresent = 0
-hydroSfcHeadPresent = 0
+hydroSmcPresent     = .false.
+hydroSfcHeadPresent = .false.
 if (hydro_model_active) then
    hydroSmcPresent     = any( hydro_state_variables(1,:) .eq. 'sh2ox' )
    hydroSfcHeadPresent = any( hydro_state_variables(1,:) .eq. 'sfcheadrt' )
-   if (hydroSmcPresent)     allocate(sh2oDisag(fine3dShape(1),fine3dShape(2),fine3dShape(3)))
+
+   if (hydroSmcPresent    ) allocate(sh2oDisag(fine3dShape(1),fine3dShape(2),fine3dShape(3)))
    if (hydroSfcHeadPresent) allocate(sfcHeadDisag(fine2dShape(1),fine2dShape(2)))
    if (hydroSmcPresent .OR. hydroSfcHeadPresent) call disagHydro()
 endif
 
 
-if (lsmSmcPresent > 0 .and. hydroSmcPresent > 0) then
+if (lsmSmcPresent > 0 .and. hydroSmcPresent) then
    if (rst_typ /= 1) then
       write(string1,*) 'Seems BAD: Using hydro SMC but rst_type != 1!'
       call error_handler(E_ERR,'static_init_model',string1,source,revision,revdate)
@@ -2900,7 +2902,7 @@
 end do !JX
 
 !! this is not vegas? (what happens here stays here or not).
-if (hydroSmcPresent)     sh2oDisag    = sh2oRt
+if (hydroSmcPresent    ) sh2oDisag    = sh2oRt
 if (hydroSfcHeadPresent) sfcHeadDisag = sfcHeadSubRt
 
 if (hydroSfcHeadPresent) then 


More information about the Dart-dev mailing list