Skip to content

Commit df52192

Browse files
committed
Merge branch 'update_to_reference'
2 parents adceb73 + ff789ce commit df52192

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1547
-2152
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
cd rfmip
4747
./make_links.sh
4848
ln -sf ../build/test_rte_rrtmgp .
49-
python3 stage_files.py
5049
python3 rfmip_init.py
5150
python3 rfmip_run.py
5251
cd ../allsky
@@ -58,7 +57,7 @@ jobs:
5857
- name: Check results
5958
run: |
6059
cd rfmip
61-
python3 compare-to-reference.py --ref_dir ../rrtmgp-data/examples/rfmip-clear-sky/reference --var rld rlu rsd rsu --file r??_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc --failure_threshold=7.e-4
60+
python3 compare-to-reference.py --ref_dir ../rrtmgp-data/examples/rfmip-clear-sky/reference --tst_dir . --var rld rlu rsd rsu --file r??_Efx_RTE-RRTMGP-181204_rad-irf_r1i1p1f1_gn.nc --failure_threshold=5.8e-2
6261
cd ../allsky
63-
python3 allsky_check.py
62+
python3 allsky_check.py --failure_threshold=5.8e-2
6463

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ before_script:
2525
script:
2626
- cd rfmip
2727
- ./make_links.sh
28-
- python3 stage_files.py
29-
- python3 rfmip_init.py
30-
- python3 rfmip_run.py
31-
- python3 compare-to-reference.py --fail=7.e-4
28+
- ln -s ../build/test_rte_rrtmgp .
29+
- ./check_rfmip.sh
3230
- cd ..
3331
- cd allsky
3432
- ./make_links.sh
33+
- ln -s ../build/test_rte_rrtmgp .
3534
- python3 allsky_init.py
3635
- python3 allsky_run.py
37-
- python3 compare-to-reference.py
36+
- python3 allsky_check.py
3837

3938
#notifications:
4039
# slack: microhh:hA8nIix9Z34cn6uG8xnz8Uiu

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,3 @@ if(USECUDA)
115115
add_subdirectory(src_cuda_rt)
116116
endif()
117117
add_subdirectory(src_test)
118-

allsky/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ files into this directory as `coefficients_lw.nc`, `coefficients_sw.nc`,
55

66
Follow the steps:
77

8-
1. `./make_links.sh` (link the executable, coefficients, and Python scripts)
9-
2. `python allsky_init.py` (preparing the model input data)
10-
3. `python allsky_run.py` (run the model and prepare the file for comparison)
11-
4. `python allsky_check.py` (download reference file and compare output)
12-
5. `python allsky_plot.py` (plot the fluxes for clear and cloudy skies)
8+
1. `./make_links.sh` (link the coefficients, and Python scripts)
9+
2. `ln -s {BUILD_DIRECTORY}/{EXECUTABLE_NAME} test_rte_rrtmgp` (link the executable)
10+
3. `python allsky_init.py` (preparing the model input data)
11+
4. `python allsky_run.py` (run the model and prepare the file for comparison)
12+
5. `python allsky_check.py` (download reference file and compare output)
13+
6. `python allsky_plot.py` (plot the fluxes for clear and cloudy skies)
1314

allsky/check_allsky.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /bin/sh
2+
python3 allsky_init.py
3+
python3 allsky_run.py
4+
python3 allsky_check.py
5+

config/snellius.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ set(LIBS ${NETCDF_LIB_C} ${HDF5_LIB} ${SZIP_LIB})
6868

6969
if(USECUDA)
7070
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
71+
set(CMAKE_CUDA_ARCHITECTURES 80)
7172
set(LIBS ${LIBS} -rdynamic $ENV{EBROOTCUDA}/lib64/libcufft.so)
72-
set(USER_CUDA_FLAGS "-arch=sm_80 -std=c++14 --expt-relaxed-constexpr")
73+
set(USER_CUDA_FLAGS "-arch=sm_80 -std=c++14 -O3 --expt-relaxed-constexpr")
7374
set(USER_CUDA_FLAGS_RELEASE "-DNDEBUG")
7475
add_definitions(-DRTE_RRTMGP_GPU_MEMPOOL_CUDA)
7576
endif()

config/ubuntu_22lts.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if(USECUDA)
2929
set(USER_CUDA_FLAGS_RELEASE "-Xptxas -O3 -DNDEBUG")
3030
set(USER_CUDA_FLAGS_DEBUG "-Xptxas -O0 -g -G -DCUDACHECKS")
3131
# add_definitions(-DRTE_RRTMGP_GPU_MEMPOOL_OWN)
32-
# add_definitions(-DRTE_RRTMGP_GPU_MEMPOOL_CUDA)
32+
add_definitions(-DRTE_RRTMGP_GPU_MEMPOOL_CUDA)
3333
endif()
3434

3535
add_definitions(-DRTE_USE_CBOOL)

data/mie_lut_broadband.nc

12 Bytes
Binary file not shown.

include/Source_functions.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,18 @@ class Source_func_lw : public Optical_props
5151
Array<Float,2>& get_sfc_source() { return sfc_source; }
5252
Array<Float,2>& get_sfc_source_jac() { return sfc_source_jac; }
5353
Array<Float,3>& get_lay_source() { return lay_source; }
54-
Array<Float,3>& get_lev_source_inc() { return lev_source_inc; }
55-
Array<Float,3>& get_lev_source_dec() { return lev_source_dec; }
54+
Array<Float,3>& get_lev_source() { return lev_source; }
5655

5756
const Array<Float,2>& get_sfc_source() const { return sfc_source; }
5857
const Array<Float,2>& get_sfc_source_jac() const { return sfc_source_jac; }
5958
const Array<Float,3>& get_lay_source() const { return lay_source; }
60-
const Array<Float,3>& get_lev_source_inc() const { return lev_source_inc; }
61-
const Array<Float,3>& get_lev_source_dec() const { return lev_source_dec; }
59+
const Array<Float,3>& get_lev_source() const { return lev_source; }
6260

6361
private:
6462
Array<Float,2> sfc_source;
6563
Array<Float,2> sfc_source_jac;
6664
Array<Float,3> lay_source;
67-
Array<Float,3> lev_source_inc;
68-
Array<Float,3> lev_source_dec;
65+
Array<Float,3> lev_source;
6966
};
7067

7168

@@ -81,21 +78,18 @@ class Source_func_lw_gpu : public Optical_props_gpu
8178
Array_gpu<Float,2>& get_sfc_source() { return sfc_source; }
8279
Array_gpu<Float,2>& get_sfc_source_jac() { return sfc_source_jac; }
8380
Array_gpu<Float,3>& get_lay_source() { return lay_source; }
84-
Array_gpu<Float,3>& get_lev_source_inc() { return lev_source_inc; }
85-
Array_gpu<Float,3>& get_lev_source_dec() { return lev_source_dec; }
81+
Array_gpu<Float,3>& get_lev_source() { return lev_source; }
8682

8783
const Array_gpu<Float,2>& get_sfc_source() const { return sfc_source; }
8884
const Array_gpu<Float,2>& get_sfc_source_jac() const { return sfc_source_jac; }
8985
const Array_gpu<Float,3>& get_lay_source() const { return lay_source; }
90-
const Array_gpu<Float,3>& get_lev_source_inc() const { return lev_source_inc; }
91-
const Array_gpu<Float,3>& get_lev_source_dec() const { return lev_source_dec; }
86+
const Array_gpu<Float,3>& get_lev_source() const { return lev_source; }
9287

9388
private:
9489
Array_gpu<Float,2> sfc_source;
9590
Array_gpu<Float,2> sfc_source_jac;
9691
Array_gpu<Float,3> lay_source;
97-
Array_gpu<Float,3> lev_source_inc;
98-
Array_gpu<Float,3> lev_source_dec;
92+
Array_gpu<Float,3> lev_source;
9993
};
10094
#endif
10195

include/rrtmgp_kernels.h

Lines changed: 126 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,48 @@
3232
namespace rrtmgp_kernels
3333
{
3434
extern "C" void rte_sum_broadband(
35-
int* ncol, int* nlev, int* ngpt,
36-
Float* spectral_flux, Float* broadband_flux);
35+
int* ncol,
36+
int* nlev,
37+
int* ngpt,
38+
Float* spectral_flux,
39+
Float* broadband_flux);
3740

3841
extern "C" void rte_net_broadband_precalc(
39-
int* ncol, int* nlev,
40-
Float* broadband_flux_dn, Float* broadband_flux_up,
42+
int* ncol,
43+
int* nlev,
44+
Float* broadband_flux_dn,
45+
Float* broadband_flux_up,
4146
Float* broadband_flux_net);
4247

4348
extern "C" void sum_byband(
44-
int* ncol, int* nlev, int* ngpt, int* nbnd,
49+
int* ncol,
50+
int* nlev,
51+
int* ngpt,
52+
int* nbnd,
4553
int* band_lims,
4654
Float* spectral_flux,
4755
Float* byband_flux);
4856

4957
extern "C" void net_byband_precalc(
50-
int* ncol, int* nlev, int* nbnd,
51-
Float* byband_flux_dn, Float* byband_flux_up,
58+
int* ncol,
59+
int* nlev,
60+
int* nbnd,
61+
Float* byband_flux_dn,
62+
Float* byband_flux_up,
5263
Float* byband_flux_net);
5364

5465
extern "C" void zero_array_3D(
55-
int* ni, int* nj, int* nk, Float* array);
66+
int* ni,
67+
int* nj,
68+
int* nk,
69+
Float* array);
5670

5771
extern "C" void zero_array_4D(
58-
int* ni, int* nj, int* nk, int* nl, Float* array);
72+
int* ni,
73+
int* nj,
74+
int* nk,
75+
int* nl,
76+
Float* array);
5977

6078
extern "C" void rrtmgp_interpolation(
6179
int* ncol, int* nlay,
@@ -123,7 +141,7 @@ namespace rrtmgp_kernels
123141
Float* fmajor, int* jeta, Bool* tropo, int* jtemp, int* jpress,
124142
int* gpoint_bands, int* band_lims_gpt, Float* pfracin, Float* temp_ref_min,
125143
Float* totplnk_delta, Float* totplnk, int* gpoint_flavor,
126-
Float* sfc_src, Float* lay_src, Float* lev_src, Float* lev_source_dec,
144+
Float* sfc_src, Float* lay_src, Float* lev_src,
127145
Float* sfc_src_jac);
128146

129147
extern "C" void rrtmgp_compute_tau_rayleigh(
@@ -137,42 +155,113 @@ namespace rrtmgp_kernels
137155
Bool* tropo, int* jtemp,
138156
Float* tau_rayleigh);
139157

158+
/*
140159
extern "C" void apply_BC_0(
141-
int* ncol, int* nlay, int* ngpt,
142-
Bool* top_at_1, Float* gpt_flux_dn);
160+
const int& ncol,
161+
const int& nlay,
162+
const int& ngpt,
163+
const Bool& top_at_1,
164+
Float* gpt_flux_dn);
143165
144166
extern "C" void apply_BC_gpt(
145-
int* ncol, int* nlay, int* ngpt,
146-
Bool* top_at_1, Float* inc_flux, Float* gpt_flux_dn);
167+
const int& ncol,
168+
const int& nlay,
169+
const int& ngpt,
170+
const Bool& top_at_1,
171+
const Float* inc_flux,
172+
Float* gpt_flux_dn);
173+
*/
174+
175+
// ROBERTS REF: REMOVE COMMENTS.
176+
// void rte_lw_solver_noscat(
177+
// const int& ncol,
178+
// const int& nlay,
179+
// const int& ngpt,
180+
// const Bool& top_at_1,
181+
// const int& nmus,
182+
// const Float* secants, // (nmus)
183+
// const Float* weights, // (nmus)
184+
// const Float* tau, // (ncol,nlay, ngpt)
185+
// const Float* lay_source, // (ncol,nlay, ngpt)
186+
// const Float* lev_source, // (ncol,nlay+1,ngpt)
187+
// const Float* sfc_emis, // (ncol, ngpt)
188+
// const Float* sfc_src, // (ncol, ngpt)
189+
// const Float* inc_flux, // (ncol, ngpt)
190+
// Float* flux_up, // [out] (ncol,nlay+1,ngpt)
191+
// Float* flux_dn, // [out] (ncol,nlay+1,ngpt)
192+
// const Bool& do_broadband,
193+
// Float* broadband_up,
194+
// // [out] (ncol,nlay+1)
195+
// Float* broadband_dn,
196+
// // [out] (ncol,nlay+1)
197+
// const Bool& do_jacobians,
198+
// const Float* sfc_src_jac,
199+
// // (ncol, ngpt)
200+
// Float* flux_up_jac,
201+
// // [out] (ncol,nlay+1,ngpt)
202+
// const Bool& do_rescaling,
203+
// const Float* ssa, // (ncol,nlay, ngpt)
204+
// const Float* g); // (ncol,nlay, ngpt)
205+
147206

148207
extern "C" void rte_lw_solver_noscat(
149-
int* ncol, int* nlay, int* ngpt, Bool* top_at_1, int* n_quad_angs,
150-
Float* secants, Float* gauss_wts_subset,
151-
Float* tau,
152-
Float* lay_source, Float* lev_source_inc, Float* lev_source_dec,
153-
Float* sfc_emis_gpt, Float* sfc_source,
154-
Float* inc_flux_diffuse,
155-
Float* gpt_flux_up, Float* gpt_flux_dn,
156-
Bool* do_broadband, Float* flux_up_loc, Float* flux_dn_loc,
157-
Bool* do_jacobians, Float* sfc_source_jac, Float* gpt_flux_up_jac,
158-
Bool* do_rescaling, Float* ssa, Float* g);
208+
const int& ncol,
209+
const int& nlay,
210+
const int& ngpt,
211+
const Bool& top_at_1,
212+
const int& n_quad_angs,
213+
const Float* secants,
214+
const Float* gauss_wts_subset,
215+
const Float* tau,
216+
const Float* lay_source,
217+
const Float* lev_source,
218+
const Float* sfc_emis_gpt,
219+
const Float* sfc_source,
220+
const Float* inc_flux_diffuse,
221+
Float* gpt_flux_up,
222+
Float* gpt_flux_dn,
223+
const Bool& do_broadband,
224+
Float* flux_up_loc,
225+
Float* flux_dn_loc,
226+
const Bool& do_jacobians,
227+
const Float* sfc_source_jac,
228+
Float* gpt_flux_up_jac,
229+
const Bool& do_rescaling,
230+
const Float* ssa,
231+
const Float* g);
159232

233+
/*
160234
extern "C" void apply_BC_factor(
161-
int* ncol, int* nlay, int* ngpt,
162-
Bool* top_at_1, Float* inc_flux,
163-
Float* factor, Float* flux_dn);
235+
const int& ncol,
236+
const int& nlay,
237+
const int& ngpt,
238+
const Bool& top_at_1,
239+
const Float* inc_flux,
240+
const Float* factor,
241+
Float* flux_dn);
242+
*/
164243

165244
extern "C" void rte_sw_solver_2stream(
166-
int* ncol, int* nlay, int* ngpt, Bool* top_at_1,
167-
Float* tau,
168-
Float* ssa,
169-
Float* g,
170-
Float* mu0,
171-
Float* sfc_alb_dir_gpt, Float* sfc_alb_dif_gpt,
172-
Float* inc_flux_dir,
173-
Float* gpt_flux_up, Float* gpt_flux_dn, Float* gpt_flux_dir,
174-
Bool* has_dif_bc, Float* inc_flux_dif,
175-
Bool* do_broadband, Float* flux_up_loc, Float* flux_dn_loc, Float* flux_dir_loc);
245+
const int& ncol,
246+
const int& nlay,
247+
const int& ngpt,
248+
const Bool& top_at_1,
249+
const Float* tau,
250+
const Float* ssa,
251+
const Float* g,
252+
const Float* mu0,
253+
const Float* sfc_alb_dir_gpt,
254+
const Float* sfc_alb_dif_gpt,
255+
const Float* inc_flux_dir,
256+
Float* gpt_flux_up,
257+
Float* gpt_flux_dn,
258+
Float* gpt_flux_dir,
259+
const Bool& has_dif_bc,
260+
const Float* inc_flux_dif,
261+
const Bool& do_broadband,
262+
Float* flux_up_loc,
263+
Float* flux_dn_loc,
264+
Float* flux_dir_loc);
176265

177266
extern "C" void rte_increment_2stream_by_2stream(
178267
int* ncol, int* nlev, int* ngpt,

0 commit comments

Comments
 (0)