Skip to content

Commit

Permalink
MAM4xx: use ConstView.
Browse files Browse the repository at this point in the history
  • Loading branch information
odiazib committed Nov 15, 2024
1 parent f5d53ef commit ccfb8f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
6 changes: 4 additions & 2 deletions src/mam4xx/mo_gas_phase_chemdr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using mam4::mo_setinv::num_tracer_cnst;
using View2D = DeviceType::view_2d<Real>;
using ConstView2D = DeviceType::view_2d<const Real>;
using View1D = DeviceType::view_1d<Real>;
using ConstView1D = DeviceType::view_1d<const Real>;

KOKKOS_INLINE_FUNCTION
void mmr2vmr_col(const ThreadTeam &team, const haero::Atmosphere &atm,
Expand Down Expand Up @@ -114,8 +115,9 @@ void perform_atmospheric_chemistry_and_microphysics(
const Real phis, // surf geopotential //in
const View1D &cmfdqr, // dq/dt for convection [kg/kg/s] //in ndx_cmfdqr =
// pbuf_get_index('RPRDTOT') // from convect shallow
const View1D &prain, // stratoform precip [kg/kg/s] //in precip_total_tend
const View1D &nevapr, // nevapr evaporation [kg/kg/s] //in
const ConstView1D
&prain, // stratoform precip [kg/kg/s] //in precip_total_tend
const ConstView1D &nevapr, // nevapr evaporation [kg/kg/s] //in
const View1D &work_set_het) {

auto work_set_het_ptr = (Real *)work_set_het.data();
Expand Down
28 changes: 14 additions & 14 deletions src/mam4xx/mo_sethet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ void calc_het_rates(const Real satf, // saturation fraction in cloud //in
KOKKOS_INLINE_FUNCTION
void calc_precip_rescale(
const ThreadTeam &team,
const ColumnView &cmfdqr, // dq/dt for convection [kg/kg/s] //in
const ColumnView &nrain, // stratoform precip [kg/kg/s] //in
const ColumnView &nevapr, // evaporation [kg/kg/s] // in
const ColumnView &precip) { // precipitation [kg/kg/s] // out
const ColumnView &cmfdqr, // dq/dt for convection [kg/kg/s] //in
const ConstColumnView &nrain, // stratoform precip [kg/kg/s] //in
const ConstColumnView &nevapr, // evaporation [kg/kg/s] // in
const ColumnView &precip) { // precipitation [kg/kg/s] // out
// -----------------------------------------------------------------------
// calculate precipitation rate at each grid
// this is added to rescale the variable precip (which can only be positive)
Expand Down Expand Up @@ -214,8 +214,8 @@ void sethet_detail(
const Real phis, // surf geopotential //in
const ConstColumnView &tfld, // temperature [K] //in
const ColumnView &cmfdqr, // dq/dt for convection [kg/kg/s] //in
const ColumnView &nrain, // stratoform precip [kg/kg/s] //in
const ColumnView &nevapr, // evaporation [kg/kg/s] //in
const ConstColumnView &nrain, // stratoform precip [kg/kg/s] //in
const ConstColumnView &nevapr, // evaporation [kg/kg/s] //in
const Real delt, // time step [s] //in
const ColumnView &xhnm, // total atms density [cm^-3] //in
const ColumnView qin[gas_pcnst], // xported species [vmr] //in
Expand Down Expand Up @@ -503,14 +503,14 @@ void sethet_detail(
KOKKOS_INLINE_FUNCTION
void sethet(
const ThreadTeam &team, const haero::Atmosphere &atm,
const View2D &het_rates, //[pver][gas_pcnst], rainout rates [1/s] //out
const Real rlat, // latitude in radians for columns
const Real phis, // surf geopotential //in
const ColumnView &cmfdqr, // dq/dt for convection [kg/kg/s] //in
const ColumnView &prain, // stratoform precip [kg/kg/s] //in
const ColumnView &nevapr, // evaporation [kg/kg/s] //in
const Real dt, // time step [s] //in
const View2D &invariants, //
const View2D &het_rates, //[pver][gas_pcnst], rainout rates [1/s] //out
const Real rlat, // latitude in radians for columns
const Real phis, // surf geopotential //in
const ColumnView &cmfdqr, // dq/dt for convection [kg/kg/s] //in
const ConstColumnView &prain, // stratoform precip [kg/kg/s] //in
const ConstColumnView &nevapr, // evaporation [kg/kg/s] //in
const Real dt, // time step [s] //in
const View2D &invariants, //
const ColumnView vmr[gas_pcnst], // xported species [vmr] //in
// working variables
const View1D &work) {
Expand Down

0 comments on commit ccfb8f7

Please sign in to comment.