Skip to content

Commit

Permalink
Replace other less common contructs of querying double precision
Browse files Browse the repository at this point in the history
  • Loading branch information
islas committed Aug 24, 2024
1 parent ab44106 commit 1b5b1d7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
5 changes: 2 additions & 3 deletions chem/module_phot_tuv.F
Original file line number Diff line number Diff line change
Expand Up @@ -1457,11 +1457,10 @@ subroutine get_xsqy_tab
CALL wrf_dm_bcast_bytes( temp_data, n_temp_data*RWORDSIZE )
CALL wrf_dm_bcast_bytes( o3_data, n_o3_data*RWORDSIZE )
CALL wrf_dm_bcast_bytes( air_dens_data, n_air_dens_data*RWORDSIZE )
#if RWORDSIZE == 4
#ifndef DOUBLE_PRECISION
CALL wrf_dm_bcast_bytes( chebev_ac, nchebev_term*nchebev_wave*2*RWORDSIZE )
CALL wrf_dm_bcast_bytes( chebev_bc, nchebev_term*nchebev_wave*2*RWORDSIZE )
#endif
#if RWORDSIZE == 8
#else
CALL wrf_dm_bcast_bytes( chebev_ac, nchebev_term*nchebev_wave*RWORDSIZE )
CALL wrf_dm_bcast_bytes( chebev_bc, nchebev_term*nchebev_wave*RWORDSIZE )
#endif
Expand Down
6 changes: 3 additions & 3 deletions external/RSL_LITE/module_dm.F
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ MODULE module_dm
#endif

INTERFACE wrf_dm_maxval
#if ( defined(PROMOTE_FLOAT) || ( RWORDSIZE == DWORDSIZE ) )
#ifdef DOUBLE_PRECISION
MODULE PROCEDURE wrf_dm_maxval_real , wrf_dm_maxval_integer
#else
MODULE PROCEDURE wrf_dm_maxval_real , wrf_dm_maxval_integer, wrf_dm_maxval_doubleprecision
#endif
END INTERFACE

INTERFACE wrf_dm_minval ! gopal's doing
#if ( defined(PROMOTE_FLOAT) || ( RWORDSIZE == DWORDSIZE ) )
#ifdef DOUBLE_PRECISION
MODULE PROCEDURE wrf_dm_minval_real , wrf_dm_minval_integer
#else
MODULE PROCEDURE wrf_dm_minval_real , wrf_dm_minval_integer, wrf_dm_minval_doubleprecision
Expand Down Expand Up @@ -1458,7 +1458,7 @@ SUBROUTINE wrf_dm_minval_real ( val, idex, jdex )
# endif
END SUBROUTINE wrf_dm_minval_real
#ifndef PROMOTE_FLOAT
#ifndef DOUBLE_PRECISION
SUBROUTINE wrf_dm_maxval_doubleprecision ( val, idex, jdex )
# ifndef STUBMPI
IMPLICIT NONE
Expand Down
2 changes: 1 addition & 1 deletion external/ioapi_share/wrf_io_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
integer, parameter :: WRF_FILE_OPENED_FOR_READ = 103
integer, parameter :: WRF_REAL = 104
integer, parameter :: WRF_DOUBLE = 105
#ifdef PROMOTE_FLOAT
#ifdef DOUBLE_PRECISION
integer, parameter :: WRF_FLOAT=WRF_DOUBLE
#else
integer, parameter :: WRF_FLOAT=WRF_REAL
Expand Down
4 changes: 2 additions & 2 deletions phys/module_mp_ntu.F
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ REAL FUNCTION GAMLN(XX) ! Referred to
y = y+1.D0
ser = ser+cof(J)/y
ENDDO
#if (DWORDSIZE == 8 && RWORDSIZE == 8)
#ifdef DOUBLE_PRECISION
GAMLN = TMP+LOG(stp*ser/X)
#elif (DWORDSIZE == 8 && RWORDSIZE == 4)
#else
GAMLN = SNGL(TMP+LOG(stp*ser/X))
#else
! This is a temporary hack assuming double precision is 8 bytes.
Expand Down
4 changes: 2 additions & 2 deletions phys/module_ra_goddard.F
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ subroutine goddardrad( sw_or_lw, dx &
taual=dble(taual_sw), ssaal=dble(ssaal_sw), asyal=dble(asyal_sw), &
cosz=dble(cosz), rsuvbm=dble(rsuvbm), rsuvdf=dble(rsuvdf), rsirbm=dble(rsirbm), rsirdf=dble(rsirdf),&
flx_out=flx, flxd_out=flxd,flxu_out=flxu, flxd_surf = flxd_surf, lmask=lmask, irestrict=min(CHUNK,ite-ii+1) )
#elif (RWORDSIZE == 8)
#else
call swrad ( np=dk_half, icb=icb, ict=ict, fcld=fcld1d, &
pl=p8w1d, ta=t1d, wa=sh1d, oa=o31d, &
taucl=taucl_sw, ssacl=ssacl_sw, asycl=asycl_sw, &
Expand Down Expand Up @@ -2319,7 +2319,7 @@ subroutine goddardrad( sw_or_lw, dx &
taucl=dble(taucl_lw), ssacl=dble(ssacl_lw), asycl=dble(asycl_lw), &
taual=dble(taual_lw), ssaal=dble(ssaal_lw), asyal=dble(asyal_lw), &
flx_out=flx, acflxd_out=flxd, acflxu_out=flxu, irestrict=min(CHUNK,ite-ii+1) )
#elif (RWORDSIZE == 8)
#else
call lwrad ( np=dk_half, tb=tsfc, ts=tskin, ict=ict, icb=icb,&
pl=p8w1d, ta=t1d, wa=sh1d, oa=o31d, &
emiss=emis1d, fcld=fcld1d, &
Expand Down
2 changes: 1 addition & 1 deletion share/module_check_a_mundo.F
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ END FUNCTION bep_bem_ngr_u
!-----------------------------------------------------------------------
! There is a binary file for Goddard radiation. It is single precision.
!-----------------------------------------------------------------------
# if ( defined(PROMOTE_FLOAT) || ( RWORDSIZE == DWORDSIZE ) )
# ifdef DOUBLE_PRECISION
god_r8 : DO i = 1, model_config_rec % max_dom
IF ( .NOT. model_config_rec % grid_allowed(i) ) CYCLE
IF ( ( model_config_rec % ra_lw_physics(i) == goddardlwscheme ) .OR. &
Expand Down
2 changes: 1 addition & 1 deletion var/da/da_control/da_control.f90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module da_control
!hcl-note: should the top and interval be namelist options?
integer, parameter :: interpolate_level = 2000

#if RWORDSIZE==8
#ifdef DOUBLE_PRECISION
real, parameter :: da_zero = 0D0
#else
real, parameter :: da_zero = 0.0
Expand Down
4 changes: 2 additions & 2 deletions var/da/da_par_util/da_par_util1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module da_par_util1
use da_control, only : rootproc, ierr, comm, root
#ifdef DM_PARALLEL

#if ( DWORDSIZE != RWORDSIZE )
#ifndef DOUBLE_PRECISION
! use mpi, only : mpi_sum, mpi_integer, mpi_complex, mpi_real
#else
! use mpi, only : mpi_sum, mpi_integer, mpi_double_complex, mpi_real8
Expand All @@ -21,7 +21,7 @@ module da_par_util1

#ifdef DM_PARALLEL
include 'mpif.h'
#if ( DWORDSIZE != RWORDSIZE )
#ifndef DOUBLE_PRECISION
integer, parameter :: true_mpi_real = mpi_real
integer, parameter :: true_mpi_complex = mpi_complex
#else
Expand Down

0 comments on commit 1b5b1d7

Please sign in to comment.