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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ mod
practical/data
practical/ecrad
/build*
.vimgit/*
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ endif()
# ... before doing a final find_package to make it available.
find_package( ecbuild ${MINIMUM_ECBUILD_VERSION} REQUIRED )

# We set the <PNAME>_ECBUILD_COMPILE_FLAGS variable to an empty file. This ensures that we can
# specify a default set of compilation flags as well as per-file overwrites as part of the CMake config.
set( ECRAD_ECBUILD_COMPILE_FLAGS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ecrad_init_flags.cmake CACHE FILEPATH "")
#### The following lines purges compiler flags, which erases options passed into -DFortran_FLAGS=...
#### # We set the <PNAME>_ECBUILD_COMPILE_FLAGS variable to an empty file. This ensures that we can
#### # specify a default set of compilation flags as well as per-file overwrites as part of the CMake config.
#### set( ECRAD_ECBUILD_COMPILE_FLAGS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ecrad_init_flags.cmake CACHE FILEPATH "")

project( ecrad LANGUAGES Fortran )
ecbuild_enable_fortran( REQUIRED )
Expand Down Expand Up @@ -65,6 +66,12 @@ ecbuild_add_option(
REQUIRED_PACKAGES "OpenMP COMPONENTS Fortran"
)

ecbuild_add_option(
FEATURE DRIVER
DEFAULT ON
DESCRIPTION "Build the driver programs"
)

set( _PRECISIONS "" )
ecbuild_add_option(
FEATURE DOUBLE_PRECISION
Expand Down Expand Up @@ -140,7 +147,9 @@ foreach( PREC IN LISTS _PRECISIONS )
add_subdirectory(ifsrrtm ifsrrtm.${PREC})
add_subdirectory(radiation radiation.${PREC})
add_subdirectory(ifs ifs.${PREC})
add_subdirectory(driver driver.${PREC})
if( HAVE_DRIVER )
add_subdirectory(driver driver.${PREC})
endif()
endforeach()

# Include test directories only if tests are enabled (which is the default
Expand Down
2 changes: 1 addition & 1 deletion bin/make_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# nor does it submit to any jurisdiction.


EXT="parkind1.o|yomhook.o|yomcst.o|yomdyncore.o|yomlun.o|abor1.o|yomtag.o|mpl_module.o|yommp0_ifsaux.o"
EXT="parkind1.o|yomhook.o|yomcst.o|yomdyncore_ecrad.o|yomlun_ecrad.o|abor1.o|yomtag.o|mpl_module.o|yommp0_ifsaux.o"

while [ "$1" ]
do
Expand Down
10 changes: 5 additions & 5 deletions ifs/cos_sza.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBROUTINE COS_SZA(KSTART,KEND,KCOL,PGEMU,PGELAM,LDRADIATIONTIMESTEP,PMU0)

!**** *COS_SZA*
!**** *COS_SZA*
!
! (C) Copyright 2015- ECMWF.
!
Expand Down Expand Up @@ -28,7 +28,7 @@ SUBROUTINE COS_SZA(KSTART,KEND,KCOL,PGEMU,PGELAM,LDRADIATIONTIMESTEP,PMU0)
! ----------
! *CALL* *COS_SZA(...)

! Explicit arguments :
! Explicit arguments :
! ------------------
! PGEMU - Sine of latitude
! PGELAM - Geographic longitude in radians
Expand Down Expand Up @@ -82,7 +82,7 @@ SUBROUTINE COS_SZA(KSTART,KEND,KCOL,PGEMU,PGELAM,LDRADIATIONTIMESTEP,PMU0)
USE YOMRIP , ONLY : YRRIP
USE YOERIP , ONLY : YRERIP
USE YOERAD , ONLY : YRERAD
USE YOMLUN , ONLY : NULOUT
USE YOMLUN_ECRAD, ONLY : NULOUT

! ------------------------------------------------------------------

Expand Down Expand Up @@ -189,7 +189,7 @@ SUBROUTINE COS_SZA(KSTART,KEND,KCOL,PGEMU,PGELAM,LDRADIATIONTIMESTEP,PMU0)
! range 0 to 2PI)
IF (YRERIP%RWSOVRM + PGELAM(JCOL) < 2.0_JPRB*RPI) THEN
ZHOURANGLESTART = ZSOLARTIMESTART + PGELAM(JCOL) - RPI
ZHOURANGLEEND = ZSOLARTIMEEND + PGELAM(JCOL) - RPI
ZHOURANGLEEND = ZSOLARTIMEEND + PGELAM(JCOL) - RPI
ELSE
ZHOURANGLESTART = ZSOLARTIMESTART + PGELAM(JCOL) - 3.0_JPRB*RPI
ZHOURANGLEEND = ZSOLARTIMEEND + PGELAM(JCOL) - 3.0_JPRB*RPI
Expand Down Expand Up @@ -288,7 +288,7 @@ SUBROUTINE COS_SZA(KSTART,KEND,KCOL,PGEMU,PGELAM,LDRADIATIONTIMESTEP,PMU0)
! range 0 to 2PI)
IF (YRRIP%RWSOVR + PGELAM(JCOL) < 2.0_JPRB*RPI) THEN
ZHOURANGLESTART = ZSOLARTIMESTART + PGELAM(JCOL) - RPI
ZHOURANGLEEND = ZSOLARTIMEEND + PGELAM(JCOL) - RPI
ZHOURANGLEEND = ZSOLARTIMEEND + PGELAM(JCOL) - RPI
ELSE
ZHOURANGLESTART = ZSOLARTIMESTART + PGELAM(JCOL) - 3.0_JPRB*RPI
ZHOURANGLEEND = ZSOLARTIMEEND + PGELAM(JCOL) - 3.0_JPRB*RPI
Expand Down
10 changes: 5 additions & 5 deletions ifs/ice_effective_radius.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SUBROUTINE ICE_EFFECTIVE_RADIUS &
USE PARKIND1 , ONLY : JPIM, JPRB
USE YOMHOOK , ONLY : LHOOK, DR_HOOK, JPHOOK
USE YOERAD , ONLY : TERAD
USE YOMLUN , ONLY : NULERR
USE YOMLUN_ECRAD, ONLY : NULERR
USE YOMCST , ONLY : RD, RTT

! -------------------------------------------------------------------
Expand Down Expand Up @@ -73,7 +73,7 @@ SUBROUTINE ICE_EFFECTIVE_RADIUS &

REAL(KIND=JPRB) :: ZTEMPERATURE_C ! Temperature, degrees Celcius
REAL(KIND=JPRB) :: ZAIWC, ZBIWC ! Factors in empirical relationship
REAL(KIND=JPRB) :: ZDEFAULT_RE_UM ! Default effective radius in microns
REAL(KIND=JPRB) :: ZDEFAULT_RE_UM ! Default effective radius in microns
REAL(KIND=JPRB) :: ZDIAMETER_UM ! Effective diameter in microns

! Min effective diameter in microns; may vary with latitude
Expand All @@ -96,7 +96,7 @@ SUBROUTINE ICE_EFFECTIVE_RADIUS &
SELECT CASE(YDERAD%NRADIP)
CASE(0)
! Ice effective radius fixed at 40 microns
PRE_UM(KIDIA:KFDIA,:) = 40.0_JPRB
PRE_UM(KIDIA:KFDIA,:) = 40.0_JPRB

CASE(1,2)
! Ice effective radius from Liou and Ou (1994)
Expand Down Expand Up @@ -162,7 +162,7 @@ SUBROUTINE ICE_EFFECTIVE_RADIUS &
ENDIF
ENDDO
ENDDO

CASE DEFAULT
WRITE(NULERR,'(A,I0,A)') 'ICE EFFECTIVE RADIUS OPTION NRADLP=',YDERAD%NRADIP,' NOT AVAILABLE'
CALL ABOR1('ERROR IN ICE_EFFECTIVE_RADIUS')
Expand All @@ -172,5 +172,5 @@ SUBROUTINE ICE_EFFECTIVE_RADIUS &
! -------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('ICE_EFFECTIVE_RADIUS',1,ZHOOK_HANDLE)

END SUBROUTINE ICE_EFFECTIVE_RADIUS
26 changes: 13 additions & 13 deletions ifs/liquid_effective_radius.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
USE YOMHOOK , ONLY : LHOOK, DR_HOOK, JPHOOK
USE YOERAD , ONLY : TERAD
USE YOERDU , ONLY : REPLOG, REPSCW
USE YOMLUN , ONLY : NULERR
USE YOMLUN_ECRAD, ONLY : NULERR
USE YOMCST , ONLY : RD, RPI

! -------------------------------------------------------------------
Expand All @@ -57,7 +57,7 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
REAL(KIND=JPRB), INTENT(IN) :: PQ_LIQ(KLON,KLEV) ! (kg/kg)
REAL(KIND=JPRB), INTENT(IN) :: PQ_RAIN(KLON,KLEV) ! (kg/kg)

! *** Single-level variables
! *** Single-level variables
REAL(KIND=JPRB), INTENT(IN) :: PLAND_FRAC(KLON) ! 1=land, 0=sea
REAL(KIND=JPRB), INTENT(IN) :: PCCN_LAND(KLON)
REAL(KIND=JPRB), INTENT(IN) :: PCCN_SEA(KLON)
Expand Down Expand Up @@ -105,7 +105,7 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
! Very old parameterization as a function of pressure, used in ERA-15
PRE_UM(KIDIA:KFDIA,:) = 10.0_JPRB&
& + (100000.0_JPRB-PPRESSURE(KIDIA:KFDIA,:))*3.5_JPRB

CASE(1)
! Simple distinction between land (10um) and ocean (13um) by Zhang
! and Rossow
Expand All @@ -116,7 +116,7 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
PRE_UM(JL,:) = 10.0_JPRB
ENDIF
ENDDO

CASE(2)
! Martin et al. (JAS 1994)
DO JL = KIDIA,KFDIA
Expand All @@ -134,19 +134,19 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
ZNTOT_CM3 = -1.15E-03_JPRB*ZCCN*ZCCN + 0.963_JPRB*ZCCN + 5.30_JPRB
ELSE
! Land case
IF (YDERAD%LCCNL) THEN
IF (YDERAD%LCCNL) THEN
ZCCN=PCCN_LAND(JL)
ELSE
ELSE
ZCCN=YDERAD%RCCNLND
ENDIF
ZSPECTRAL_DISPERSION = 0.69_JPRB
! Cloud droplet concentration in cm-3 (activated CCN) over
! land
ZNTOT_CM3 = -2.10E-04_JPRB*ZCCN*ZCCN + 0.568_JPRB*ZCCN - 27.9_JPRB
ENDIF

ZRATIO = (0.222_JPRB/ZSPECTRAL_DISPERSION)**0.333_JPRB

DO JK = 1,KLEV

! Only consider cloudy regions
Expand All @@ -160,7 +160,7 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
! fraction
ZLWC_GM3 = ZAIR_DENSITY_GM3 * PQ_LIQ(JL,JK) / PCLOUD_FRAC(JL,JK)
ZRWC_GM3 = ZAIR_DENSITY_GM3 * PQ_RAIN(JL,JK) / PCLOUD_FRAC(JL,JK)

! Wood's (2000, eq. 19) adjustment to Martin et al's
! parameterization
IF (ZLWC_GM3 > REPSCW) THEN
Expand All @@ -170,7 +170,7 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
ELSE
ZWOOD_FACTOR = 1.0_JPRB
ENDIF

! g m-3 and cm-3 units cancel out with density of water
! 10^6/(1000*1000); need a factor of 10^6 to convert to
! microns and cubed root is factor of 100 which appears in
Expand All @@ -193,9 +193,9 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
ENDIF

ENDDO

ENDDO

CASE DEFAULT
WRITE(NULERR,'(A,I0,A)') 'LIQUID EFFECTIVE RADIUS OPTION IRADLP=',IRADLP,' NOT AVAILABLE'
CALL ABOR1('ERROR IN LIQUID_EFFECTIVE_RADIUS')
Expand All @@ -204,5 +204,5 @@ SUBROUTINE LIQUID_EFFECTIVE_RADIUS &
! -------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('LIQUID_EFFECTIVE_RADIUS',1,ZHOOK_HANDLE)

END SUBROUTINE LIQUID_EFFECTIVE_RADIUS
2 changes: 1 addition & 1 deletion ifs/radiation_scheme.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SUBROUTINE RADIATION_SCHEME &
USE PARKIND1 , ONLY : JPIM, JPRB, JPRD
USE YOMHOOK , ONLY : LHOOK, DR_HOOK, JPHOOK
USE YOMCST , ONLY : RPI, RSIGMA ! Stefan-Boltzmann constant
USE YOMLUN , ONLY : NULERR, NULOUT
USE YOMLUN_ECRAD , ONLY : NULERR, NULOUT
USE RADIATION_SETUP, ONLY : ITYPE_TROP_BG_AER, ITYPE_STRAT_BG_AER, TRADIATION

! Modules from ecRad radiation library
Expand Down
7 changes: 3 additions & 4 deletions ifs/radiation_setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ MODULE RADIATION_SETUP
SUBROUTINE SETUP_RADIATION_SCHEME(PRADIATION,LDOUTPUT,FILE_NAME)

USE YOMHOOK, ONLY : LHOOK, DR_HOOK, JPHOOK
USE YOMLUN, ONLY : NULOUT, NULERR
USE YOMLUN_ECRAD, ONLY : NULOUT, NULERR
!USE YOESRTWN, ONLY : NMPSRTM
USE YOERAD, ONLY : TERAD
USE YOEPHY, ONLY : TEPHY
Expand Down Expand Up @@ -236,8 +236,7 @@ SUBROUTINE SETUP_RADIATION_SCHEME(PRADIATION,LDOUTPUT,FILE_NAME)
ENDIF
ELSEIF (YDERAD%NICEOPT == 4) THEN
RAD_CONFIG%I_ICE_MODEL = IICEMODELBARAN
IF (RAD_CONFIG%I_GAS_MODEL_SW == IGasModelECCKD &
.OR. RAD_CONFIG%I_GAS_MODEL_LW == IGasModelECCKD) THEN
IF (RAD_CONFIG%I_GAS_MODEL == IGasModelECCKD) THEN
WRITE(NULERR,'(a,i0)') '*** Error: Baran ice optics unavailable with generalized cloud optics'
CALL ABOR1('RADIATION_SETUP: error interpreting NICEOPT')
ENDIF
Expand Down Expand Up @@ -521,7 +520,7 @@ SUBROUTINE SETUP_RADIATION_SCHEME(PRADIATION,LDOUTPUT,FILE_NAME)

! Do we scale the incoming solar radiation in each band?
IF (YDERAD%NSOLARSPECTRUM > 0 &
& .AND. RAD_CONFIG%I_GAS_MODEL_SW == IGasModelIFSRRTMG) THEN
& .AND. RAD_CONFIG%I_GAS_MODEL == IGasModelIFSRRTMG) THEN
IF (RAD_CONFIG%N_BANDS_SW /= 14) THEN
WRITE(NULERR,'(a,i0,a)') '*** Error: ', RAD_CONFIG%N_BANDS_SW, &
& ' shortwave bands but need 14 to apply spectral scaling'
Expand Down
2 changes: 1 addition & 1 deletion ifs/yoe_spectral_planck.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SUBROUTINE INIT(SELF, KINTERVALS, PWAVLEN_BOUND, KINTERVAL_MAP)

USE YOMCST, ONLY : RPI, RKBOL, RHPLA, RCLUM
USE YOMHOOK, ONLY : LHOOK, DR_HOOK, JPHOOK
USE YOMLUN, ONLY : NULOUT
USE YOMLUN_ECRAD, ONLY : NULOUT

CLASS(TSPECTRALPLANCK), INTENT(INOUT) :: SELF
INTEGER(KIND=JPIM) , INTENT(IN) :: KINTERVALS
Expand Down
5 changes: 2 additions & 3 deletions ifsaux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

set( ifsaux_SOURCES
yomcst.F90
yomdyncore.F90
yomlun_ifsaux.F90
yomlun.F90
yomdyncore_ecrad.F90
yomlun_ecrad.F90
yommp0_ifsaux.F90
yomtag.F90
)
Expand Down
8 changes: 4 additions & 4 deletions ifsaux/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SOURCES = parkind1.F90 yomlun_ifsaux.F90 yomcst.F90 abor1.F90 \
yomtag.F90 mpl_module.F90 yommp0_ifsaux.F90 yomdyncore.F90 yomlun.F90
SOURCES = parkind1.F90 yomlun_ecrad.F90 yomcst.F90 abor1.F90 \
yomtag.F90 mpl_module.F90 yommp0_ifsaux.F90 yomdyncore_ecrad.F90
MAKE_INCLUDES = ../bin/make_intfbl.1.pl
INCLUDE_DIR = ../include

Expand All @@ -22,7 +22,7 @@ includes:
clean:
rm -f *.o $(LIBIFSAUX)

yomlun_ifsaux.o yomhook.o random_numbers_mix.o yomcst.o yomtag.o mpl_module.o yomdyncore.o: parkind1.o
abor1.o yomlun.o : yomlun_ifsaux.o
yomlun_ecrad.o yomhook.o random_numbers_mix.o yomcst.o yomtag.o mpl_module.o yomdyncore_ecrad.o: parkind1.o
abor1.o: yomlun_ecrad.o

.PHONY: deps includes
2 changes: 1 addition & 1 deletion ifsaux/abor1.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SUBROUTINE ABOR1(CDTEXT)

USE PARKIND1, ONLY : JPIM, JPRB
USE YOMLUN_IFSAUX, ONLY : NULOUT, NULERR
USE YOMLUN_ECRAD, ONLY : NULOUT, NULERR

IMPLICIT NONE

Expand Down
4 changes: 2 additions & 2 deletions ifsaux/yomdyncore.F90 → ifsaux/yomdyncore_ecrad.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
! granted to it by virtue of its status as an intergovernmental organisation
! nor does it submit to any jurisdiction.

MODULE YOMDYNCORE
MODULE YOMDYNCORE_ECRAD

USE PARKIND1 ,ONLY : JPRB

Expand All @@ -23,4 +23,4 @@ MODULE YOMDYNCORE
REAL(KIND=JPRB) :: RPLRG = 1.0


END MODULE YOMDYNCORE
END MODULE YOMDYNCORE_ECRAD
24 changes: 0 additions & 24 deletions ifsaux/yomlun.F90

This file was deleted.

11 changes: 6 additions & 5 deletions ifsaux/yomlun_ifsaux.F90 → ifsaux/yomlun_ecrad.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@

! This is taken from yomlun_ifsaux in the IFS

MODULE YOMLUN_IFSAUX
MODULE YOMLUN_ECRAD

#ifdef HAVE_FIAT
USE EC_LUN ,ONLY : NULOUT, NULERR
#else
USE PARKIND1 ,ONLY : JPIM
#endif
USE PARKIND1 ,ONLY : JPIM

IMPLICIT NONE

SAVE
PRIVATE
PUBLIC :: NULOUT, NULERR
PUBLIC :: NULOUT, NULERR, NULRAD

! ------------------------------------------------------------------

Expand All @@ -35,5 +34,7 @@ MODULE YOMLUN_IFSAUX
INTEGER(KIND=JPIM) :: NULERR = 0
#endif

INTEGER(KIND=JPIM) :: NULRAD = 25

! ------------------------------------------------------------------
END MODULE YOMLUN_IFSAUX
END MODULE YOMLUN_ECRAD
Loading