Skip to content

Commit

Permalink
Merge pull request #29 from MennoVeerman/main
Browse files Browse the repository at this point in the history
compute grid size in rt kernels and improve gas optics
  • Loading branch information
Chiil authored Jan 10, 2024
2 parents 2706998 + 8c3d6c9 commit a8213e2
Show file tree
Hide file tree
Showing 11 changed files with 400 additions and 575 deletions.
29 changes: 16 additions & 13 deletions include_rt/Gas_optics_rrtmgp_rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Gas_optics_rrtmgp_rt : public Gas_optics_rt

// Longwave variant.
void gas_optics(
const int igpt,
const int igpt, const int col_s, const int ncol_block, const int ncol,
const Array_gpu<Float,2>& play,
const Array_gpu<Float,2>& plev,
const Array_gpu<Float,2>& tlay,
Expand All @@ -154,7 +154,7 @@ class Gas_optics_rrtmgp_rt : public Gas_optics_rt

// shortwave variant
void gas_optics(
const int igpt,
const int igpt, const int col_s, const int ncol_block, const int ncol,
const Array_gpu<Float,2>& play,
const Array_gpu<Float,2>& plev,
const Array_gpu<Float,2>& tlay,
Expand Down Expand Up @@ -249,14 +249,12 @@ class Gas_optics_rrtmgp_rt : public Gas_optics_rt
Array_gpu<int,2> jtemp;
Array_gpu<int,2> jpress;;
Array_gpu<Bool,2> tropo;
Array_gpu<Float,6> fmajor;
Array_gpu<int,4> jeta;
Array_gpu<Float,5> fmajor;
Array_gpu<int,3> jeta;
Array_gpu<Float,3> vmr;
Array_gpu<Float,3> col_gas;
Array_gpu<Float,4> col_mix;
Array_gpu<Float,5> fminor;
Array_gpu<Float,3> scalings_lower;
Array_gpu<Float,3> scalings_upper;
Array_gpu<Float,3> col_mix;
Array_gpu<Float,4> fminor;

int get_ngas() const { return this->gas_names.dim(1); }

Expand Down Expand Up @@ -296,16 +294,17 @@ class Gas_optics_rrtmgp_rt : public Gas_optics_rt
const Float md_index, const Float sb_index);

void compute_gas_taus(
const int ncol, const int nlay, const int ngpt, const int nband, const int igpt,
const int col_s, const int ncol_block, const int ncol, const int nlay,
const int ngpt, const int nband, const int igpt,
const Array_gpu<Float,2>& play,
const Array_gpu<Float,2>& plev,
const Array_gpu<Float,2>& tlay,
const Gas_concs_gpu& gas_desc,
std::unique_ptr<Optical_props_arry_rt>& optical_props,
Array_gpu<int,2>& jtemp, Array_gpu<int,2>& jpress,
Array_gpu<int,4>& jeta,
Array_gpu<int,3>& jeta,
Array_gpu<Bool,2>& tropo,
Array_gpu<Float,6>& fmajor,
Array_gpu<Float,5>& fmajor,
const Array_gpu<Float,2>& col_dry);

void combine_abs_and_rayleigh(
Expand All @@ -318,10 +317,14 @@ class Gas_optics_rrtmgp_rt : public Gas_optics_rt
const Array_gpu<Float,2>& play, const Array_gpu<Float,2>& plev,
const Array_gpu<Float,2>& tlay, const Array_gpu<Float,1>& tsfc,
const Array_gpu<int,2>& jtemp, const Array_gpu<int,2>& jpress,
const Array_gpu<int,4>& jeta, const Array_gpu<Bool,2>& tropo,
const Array_gpu<Float,6>& fmajor,
const Array_gpu<int,3>& jeta, const Array_gpu<Bool,2>& tropo,
const Array_gpu<Float,5>& fmajor,
Source_func_lw_rt& sources,
const Array_gpu<Float,2>& tlev);

void find_relevant_gases_gpt(
const int igpt,
std::vector<int>& gases);
};
#endif

Expand Down
4 changes: 2 additions & 2 deletions include_rt/Gas_optics_rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Gas_optics_rt : public Optical_props_rt

// Longwave variant.
virtual void gas_optics(
const int igpt,
const int igpt, const int col_s, const int ncol_block, const int ncol,
const Array_gpu<Float,2>& play,
const Array_gpu<Float,2>& plev,
const Array_gpu<Float,2>& tlay,
Expand All @@ -70,7 +70,7 @@ class Gas_optics_rt : public Optical_props_rt

// Shortwave variant.
virtual void gas_optics(
const int igpt,
const int igpt, const int col_s, const int ncol_block, const int ncol,
const Array_gpu<Float,2>& play,
const Array_gpu<Float,2>& plev,
const Array_gpu<Float,2>& tlay,
Expand Down
47 changes: 10 additions & 37 deletions include_rt_kernels/gas_optics_rrtmgp_kernels_cuda_rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ namespace Gas_optics_rrtmgp_kernels_cuda_rt


void interpolation(
const int ncol, const int nlay,
const int col_s, const int ncol_sub, const int ncol, const int nlay, const int igpt,
const int ngas, const int nflav, const int neta, const int npres, const int ntemp,
const int* gpoint_flavor,
const int* flavor,
const Float* press_ref_log,
const Float* temp_ref,
Expand All @@ -64,40 +65,15 @@ namespace Gas_optics_rrtmgp_kernels_cuda_rt
int* jeta,
int* jpress);


void minor_scalings(
const int ncol, const int nlay, const int nflav, const int ngpt,
const int nminorlower, const int nminorupper,
const int idx_h2o,
const int* gpoint_flavor,
const int* minor_limits_gpt_lower,
const int* minor_limits_gpt_upper,
const Bool* minor_scales_with_density_lower,
const Bool* minor_scales_with_density_upper,
const Bool* scale_by_complement_lower,
const Bool* scale_by_complement_upper,
const int* idx_minor_lower,
const int* idx_minor_upper,
const int* idx_minor_scaling_lower,
const int* idx_minor_scaling_upper,
const Float* play,
const Float* tlay,
const Float* col_gas,
const Bool* tropo,
Float* scalings_lower,
Float* scalings_upper);


void combine_abs_and_rayleigh(
const int ncol, const int nlay,
const int col_s, const int ncol_sub, const int ncol, const int nlay,
const Float* tau_local, const Float* tau_rayleigh,
Float* tau, Float* ssa, Float* g);


void compute_tau_rayleigh(
const int ncol, const int nlay, const int nband, const int ngpt, const int igpt,
const int col_s, const int ncol_sub, const int ncol, const int nlay, const int nband, const int ngpt, const int igpt,
const int ngas, const int nflav, const int neta, const int npres, const int ntemp,
const int* gpoint_flavor,
const int* gpoint_bands,
const int* band_lims_gpt,
const Float* krayl,
Expand All @@ -106,14 +82,14 @@ namespace Gas_optics_rrtmgp_kernels_cuda_rt
const Bool* tropo, const int* jtemp,
Float* tau_rayleigh);


void compute_tau_absorption(
const int ncol, const int nlay, const int nband, const int ngpt, const int igpt,
const int col_s, const int ncol_sub, const int ncol, const int nlay, const int nband,
const int ngpt, const int igpt,
const int ngas, const int nflav, const int neta, const int npres, const int ntemp,
const int nminorlower, const int nminorklower,
const int nminorupper, const int nminorkupper,
const int idx_h2o,
const int* gpoint_flavor,
const int* band_lims_gpt,
const Float* kmajor,
const Float* kminor_lower,
Expand All @@ -137,12 +113,10 @@ namespace Gas_optics_rrtmgp_kernels_cuda_rt
const Float* fminor, const Float* play,
const Float* tlay, const Float* col_gas,
const int* jeta, const int* jtemp,
const int* jpress,
const Float* scalings_lower,
const Float* scalings_upper,
const int* jpress,
Float* tau);


void Planck_source(
const int ncol, const int nlay, const int nbnd, const int ngpt, const int igpt,
const int nflav, const int neta, const int npres, const int ntemp,
Expand All @@ -161,7 +135,6 @@ namespace Gas_optics_rrtmgp_kernels_cuda_rt
const Float* pfracin,
const Float temp_ref_min, const Float totplnk_delta,
const Float* totplnk,
const int* gpoint_flavor,
Float* sfc_src,
Float* lay_src,
Float* lev_src_inc,
Expand Down
Loading

0 comments on commit a8213e2

Please sign in to comment.