Skip to content

Commit

Permalink
More functions updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiil committed Apr 15, 2024
1 parent 668aa41 commit 3c8391c
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 30 deletions.
67 changes: 57 additions & 10 deletions include/rrtmgp_kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,64 @@ namespace rrtmgp_kernels
Float* gpt_flux_dn);
*/

// ROBERTS REF: REMOVE COMMENTS.
// void rte_lw_solver_noscat(
// const int& ncol,
// const int& nlay,
// const int& ngpt,
// const Bool& top_at_1,
// const int& nmus,
// const Float* secants, // (nmus)
// const Float* weights, // (nmus)
// const Float* tau, // (ncol,nlay, ngpt)
// const Float* lay_source, // (ncol,nlay, ngpt)
// const Float* lev_source, // (ncol,nlay+1,ngpt)
// const Float* sfc_emis, // (ncol, ngpt)
// const Float* sfc_src, // (ncol, ngpt)
// const Float* inc_flux, // (ncol, ngpt)
// Float* flux_up, // [out] (ncol,nlay+1,ngpt)
// Float* flux_dn, // [out] (ncol,nlay+1,ngpt)
// const Bool& do_broadband,
// Float* broadband_up,
// // [out] (ncol,nlay+1)
// Float* broadband_dn,
// // [out] (ncol,nlay+1)
// const Bool& do_jacobians,
// const Float* sfc_src_jac,
// // (ncol, ngpt)
// Float* flux_up_jac,
// // [out] (ncol,nlay+1,ngpt)
// const Bool& do_rescaling,
// const Float* ssa, // (ncol,nlay, ngpt)
// const Float* g); // (ncol,nlay, ngpt)


extern "C" void rte_lw_solver_noscat(
int* ncol, int* nlay, int* ngpt, Bool* top_at_1, int* n_quad_angs,
Float* secants, Float* gauss_wts_subset,
Float* tau,
Float* lay_source, Float* lev_source_inc, Float* lev_source_dec,
Float* sfc_emis_gpt, Float* sfc_source,
Float* inc_flux_diffuse,
Float* gpt_flux_up, Float* gpt_flux_dn,
Bool* do_broadband, Float* flux_up_loc, Float* flux_dn_loc,
Bool* do_jacobians, Float* sfc_source_jac, Float* gpt_flux_up_jac,
Bool* do_rescaling, Float* ssa, Float* g);
const int& ncol,
const int& nlay,
const int& ngpt,
const Bool& top_at_1,
const int& n_quad_angs,
const Float* secants,
const Float* gauss_wts_subset,
const Float* tau,
const Float* lay_source,
const Float* lev_source_inc,
const Float* lev_source_dec,
const Float* sfc_emis_gpt,
const Float* sfc_source,
const Float* inc_flux_diffuse,
Float* gpt_flux_up,
Float* gpt_flux_dn,
const Bool& do_broadband,
Float* flux_up_loc,
Float* flux_dn_loc,
const Bool& do_jacobians,
const Float* sfc_source_jac,
Float* gpt_flux_up_jac,
const Bool& do_rescaling,
const Float* ssa,
const Float* g);

/*
extern "C" void apply_BC_factor(
Expand Down
63 changes: 43 additions & 20 deletions src/Rte_lw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,58 @@ namespace rrtmgp_kernel_launcher

template<typename Float>
void lw_solver_noscat_GaussQuad(
int ncol, int nlay, int ngpt, Bool top_at_1, int n_quad_angs,
const int ncol,
const int nlay,
const int ngpt,
const Bool top_at_1,
const int n_quad_angs,
const Array<Float,3>& secants,
const Array<Float,2>& gauss_wts_subset,
const Array<Float,3>& tau,
const Array<Float,3>& lay_source,
const Array<Float,3>& lev_source_inc, const Array<Float,3>& lev_source_dec,
const Array<Float,2>& sfc_emis_gpt, const Array<Float,2>& sfc_source,
const Array<Float,3>& lev_source_inc,
const Array<Float,3>& lev_source_dec,
const Array<Float,2>& sfc_emis_gpt,
const Array<Float,2>& sfc_source,
const Array<Float,2>& inc_flux_diffuse,
Array<Float,3>& gpt_flux_up, Array<Float,3>& gpt_flux_dn,
Bool do_broadband, Array<Float,3>& flux_up_loc, Array<Float,3>& flux_dn_loc,
Bool do_jacobians, const Array<Float,2>& sfc_source_jac, Array<Float,3>& gpt_flux_up_jac,
Bool do_rescaling, const Array<Float,3>& ssa, const Array<Float,3>& g)
Array<Float,3>& gpt_flux_up,
Array<Float,3>& gpt_flux_dn,
const Bool do_broadband,
Array<Float,3>& flux_up_loc,
Array<Float,3>& flux_dn_loc,
const Bool do_jacobians,
const Array<Float,2>& sfc_source_jac,
Array<Float,3>& gpt_flux_up_jac,
const Bool do_rescaling,
const Array<Float,3>& ssa,
const Array<Float,3>& g)
{
rrtmgp_kernels::rte_lw_solver_noscat(
&ncol, &nlay, &ngpt, &top_at_1, &n_quad_angs,
const_cast<Float*>(secants.ptr()),
const_cast<Float*>(gauss_wts_subset.ptr()),
const_cast<Float*>(tau.ptr()),
const_cast<Float*>(lay_source.ptr()),
const_cast<Float*>(lev_source_inc.ptr()),
const_cast<Float*>(lev_source_dec.ptr()),
const_cast<Float*>(sfc_emis_gpt.ptr()),
const_cast<Float*>(sfc_source.ptr()),
const_cast<Float*>(inc_flux_diffuse.ptr()),
ncol,
nlay,
ngpt,
top_at_1,
n_quad_angs,
secants.ptr(),
gauss_wts_subset.ptr(),
tau.ptr(),
lay_source.ptr(),
lev_source_inc.ptr(),
lev_source_dec.ptr(),
sfc_emis_gpt.ptr(),
sfc_source.ptr(),
inc_flux_diffuse.ptr(),
gpt_flux_up.ptr(),
gpt_flux_dn.ptr(),
&do_broadband, flux_up_loc.ptr(), flux_dn_loc.ptr(),
&do_jacobians, const_cast<Float*>(sfc_source_jac.ptr()), gpt_flux_up_jac.ptr(),
&do_rescaling, const_cast<Float*>(ssa.ptr()), const_cast<Float*>(g.ptr()));
do_broadband,
flux_up_loc.ptr(),
flux_dn_loc.ptr(),
do_jacobians,
sfc_source_jac.ptr(),
gpt_flux_up_jac.ptr(),
do_rescaling,
ssa.ptr(),
g.ptr());
}
}

Expand Down

0 comments on commit 3c8391c

Please sign in to comment.