Skip to content

Commit

Permalink
Added ecrad_ifs driver demonstrating the use of [setup_]radiation_sch…
Browse files Browse the repository at this point in the history
…eme routine[s]
  • Loading branch information
Robin Hogan committed Nov 1, 2022
1 parent b5d083f commit a8a28b2
Show file tree
Hide file tree
Showing 39 changed files with 3,198 additions and 2,563 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
version 1.5.1
- Added Makefile_include.intel_atos to match compiler options on
ECMWF supercomputer, plus "-heap-arrays" which is necessary for
the Intel compiler
the Intel compiler
- Added "make ifsdriver" which compiles ifs/libifs.a and
bin/ecrad_ifs to demonstrate use of IFS's radiation_scheme and
setup_radiation_schem

version 1.5.0 (22 May 2022)
- Added ecCKD gas optics scheme and generalized cloud description
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ lib:
deps: clean-deps
cd ifsaux && $(MAKE) deps
cd ifsrrtm && $(MAKE) deps
cd ifs && $(MAKE) deps

clean-deps:
rm -f include/*.intfb.h

ifsdriver: libifsaux libdummydrhook libifsrrtm libutilities libradiation
cd ifs && $(MAKE)
cd driver && $(MAKE) ecrad_ifs_driver

libifsaux:
cd ifsaux && $(MAKE)

Expand Down Expand Up @@ -162,6 +167,7 @@ clean-utilities:
cd utilities && $(MAKE) clean
cd ifsrrtm && $(MAKE) clean
cd drhook && $(MAKE) clean
cd ifs && $(MAKE) clean

clean-mods:
rm -f mod/*.mod
Expand All @@ -173,5 +179,5 @@ clean-autosaves:
rm -f *~ .gitignore~ */*~ */*/*~

.PHONY: all build help deps clean-deps libifsaux libdrhook libutilities libifsrrtm \
libradiation driver symlinks clean clean-toplevel test test_ifs \
libradiation driver symlinks clean clean-toplevel test test_ifs ifsdriver \
test_i3rc clean-tests clean-utilities clean-mods clean-symlinks
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ The subdirectories are as follows:

- `driver` - the source code for the offline driver program

- `ifs` - source files from the IFS that are used to provide inputs to
ecRad (but not used in this offline version)
- `ifs` - slightly modified source files from the IFS that are used to provide inputs to
ecRad, but not used in this offline version except if you compile the ecrad_ifs_driver executable

- `mod` - where Fortran module files are written

Expand Down
37 changes: 37 additions & 0 deletions bin/fcm-make-interfaces.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# (C) Copyright 2011- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

# FCM configuration file used to auto-generate interface files
# for F77 and F90 files.
# Interface files will have the extention "@P_SUFFIX@"
# Results will be in a directory "interfaces/include" relative to cwd

# Usage: fcm make --config-file=<path -to-this-file> \
# interfaces.ns-incl="<space-sep-list-of-dirs>"

$SRC{?} = $HERE

step.class[interfaces] = build
steps = interfaces

interfaces.target{task} = ext-iface

interfaces.source = $SRC

# Exclude all
interfaces.ns-excl = /

# Include some
# interfaces.ns-incl = <list of dirs passed at command-line>

# Extention of interface files
interfaces.prop{file-ext.f90-interface} = .intfb.h

# Do not follow includes
interfaces.prop{no-dep.f.module} = *
interfaces.prop{no-dep.include} = *
4 changes: 2 additions & 2 deletions bin/make_intfbl.1.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/local/apps/perl/current/bin/perl
#!/usr/bin/perl
#!/usr/local/apps/perl/current/bin/perl
#
# (C) Copyright 2010- ECMWF.
#
Expand All @@ -16,7 +16,7 @@

use strict;
use warnings;
use lib "/home/rd/rdx/bin/prepifs/perl";
#use lib "/home/rd/rdx/bin/prepifs/perl";
use Fortran90_stuff;
use Data::Dumper;
$Data::Dumper::Indent = 1;
Expand Down
13 changes: 8 additions & 5 deletions driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ TEST = test_aerosol_optics_description

# In dependency order:
SOURCES = ecrad_driver_read_input.F90 \
ecrad_driver_config.F90 \
ecrad_driver.F90 \
ecrad_driver_config.F90

OBJECTS := $(SOURCES:.F90=.o)
EXECUTABLE = ../bin/ecrad
IFS_EXECUTABLE = ../bin/ecrad_ifs

all: $(EXECUTABLE) $(TEST)

$(EXECUTABLE): $(OBJECTS) ../lib/*.a
$(FC) $(FCFLAGS) $(OBJECTS) $(LIBS) -o $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) ../lib/*.a ecrad_driver.o
$(FC) $(FCFLAGS) ecrad_driver.o $(OBJECTS) $(LIBS) -o $(EXECUTABLE)

ecrad_ifs_driver: $(OBJECTS) ../lib/*.a ecrad_ifs_driver.o
$(FC) $(FCFLAGS) ecrad_ifs_driver.o $(OBJECTS) -lifs $(LIBS) -o $(IFS_EXECUTABLE)

$(TEST): $(TEST).F90 ../lib/*.a
$(FC) $(FCFLAGS) $(TEST).F90 $(LIBS) -o $(TEST)
Expand All @@ -25,7 +28,7 @@ $(TEST): $(TEST).F90 ../lib/*.a
$(FC) $(FCFLAGS) -c $<

clean:
rm -f *.o $(OBJECTS) $(EXECUTABLE) $(TEST)
rm -f *.o $(EXECUTABLE) $(IFS_EXECUTABLE) $(TEST)

ecrad_driver.o: ecrad_driver_config.o ecrad_driver_read_input.o
ecrad_driver_read_input.o: ecrad_driver_config.o
19 changes: 13 additions & 6 deletions driver/ecrad_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ program ecrad_driver
use radiation_cloud, only : cloud_type
use radiation_aerosol, only : aerosol_type
use radiation_flux, only : flux_type
use radiation_save, only : save_fluxes, save_inputs
use radiation_save, only : save_fluxes, save_net_fluxes, save_inputs
use ecrad_driver_config, only : driver_config_type
use ecrad_driver_read_input, only : read_input
use easy_netcdf
Expand Down Expand Up @@ -333,11 +333,18 @@ program ecrad_driver
is_out_of_bounds = flux%out_of_physical_bounds(driver_config%istartcol, driver_config%iendcol)

! Store the fluxes in the output file
call save_fluxes(file_name, config, thermodynamics, flux, &
& iverbose=driver_config%iverbose, is_hdf5_file=driver_config%do_write_hdf5, &
& experiment_name=driver_config%experiment_name, &
& is_double_precision=driver_config%do_write_double_precision)

if (.not. driver_config%do_save_net_fluxes) then
call save_fluxes(file_name, config, thermodynamics, flux, &
& iverbose=driver_config%iverbose, is_hdf5_file=driver_config%do_write_hdf5, &
& experiment_name=driver_config%experiment_name, &
& is_double_precision=driver_config%do_write_double_precision)
else
call save_net_fluxes(file_name, config, thermodynamics, flux, &
& iverbose=driver_config%iverbose, is_hdf5_file=driver_config%do_write_hdf5, &
& experiment_name=driver_config%experiment_name, &
& is_double_precision=driver_config%do_write_double_precision)
end if

if (driver_config%iverbose >= 2) then
write(nulout,'(a)') '------------------------------------------------------------------------------------'
end if
Expand Down
9 changes: 7 additions & 2 deletions driver/ecrad_driver_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ module ecrad_driver_config
! Save aerosol optical properties to "aerosol_optics.nc"
logical :: do_save_aerosol_optics

! Save only net and surface/TOA fluxes, rather than up and down
logical :: do_save_net_fluxes

! Do we ignore the inv_inhom_effective_size variable and instead
! assume the scale of cloud inhomogeneities is the same as the
! scale of the clouds themselves?
Expand Down Expand Up @@ -168,7 +171,7 @@ subroutine read_config_from_namelist(this, file_name, is_success)
logical :: do_parallel
integer :: nblocksize

logical :: do_save_inputs, do_save_aerosol_optics, &
logical :: do_save_inputs, do_save_aerosol_optics, do_save_net_fluxes, &
& do_ignore_inhom_effective_size, &
& do_correct_unphysical_inputs, do_write_hdf5, &
& do_write_double_precision
Expand All @@ -194,7 +197,7 @@ subroutine read_config_from_namelist(this, file_name, is_success)
& cloud_fraction_scaling, overlap_decorr_length_scaling, &
& skin_temperature, do_parallel, nblocksize, iverbose, &
& nrepeat, do_save_inputs, do_ignore_inhom_effective_size, &
& do_save_aerosol_optics, &
& do_save_aerosol_optics, do_save_net_fluxes, &
& cloud_separation_scale_toa, cloud_separation_scale_surface, &
& cloud_separation_scale_power, do_correct_unphysical_inputs, &
& do_write_hdf5, h2o_scaling, co2_scaling, o3_scaling, co_scaling, &
Expand All @@ -210,6 +213,7 @@ subroutine read_config_from_namelist(this, file_name, is_success)
do_parallel = .true.
do_save_inputs = .false.
do_save_aerosol_optics = .false.
do_save_net_fluxes = .false.
do_ignore_inhom_effective_size = .false.
nblocksize = 8

Expand Down Expand Up @@ -281,6 +285,7 @@ subroutine read_config_from_namelist(this, file_name, is_success)
this%do_parallel = do_parallel
this%do_save_inputs = do_save_inputs
this%do_save_aerosol_optics = do_save_aerosol_optics
this%do_save_net_fluxes = do_save_net_fluxes
this%do_ignore_inhom_effective_size = do_ignore_inhom_effective_size
this%nblocksize = nblocksize
this%iverbose = iverbose
Expand Down
1 change: 1 addition & 0 deletions driver/ecrad_driver_read_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ subroutine read_input(file, config, driver_config, ncol, nlev, &
cloud%q_ice => cloud%mixing_ratio(:,:,2)
cloud%re_liq => cloud%effective_radius(:,:,1)
cloud%re_ice => cloud%effective_radius(:,:,2)
cloud%ntype = size(cloud%mixing_ratio,3)

! Simple initialization of the seeds for the Monte Carlo scheme
call single_level%init_seed_simple(1,ncol)
Expand Down
Loading

0 comments on commit a8a28b2

Please sign in to comment.