@@ -60,10 +60,10 @@ void calc_het_rates(const Real satf, // saturation fraction in cloud //in
6060// =================================================================================
6161KOKKOS_INLINE_FUNCTION
6262void calc_precip_rescale (
63- const ColumnView cmfdqr, // dq/dt for convection [kg/kg/s] //in
64- const ColumnView nrain, // stratoform precip [kg/kg/s] //in
65- const ColumnView nevapr, // evaporation [kg/kg/s] // in
66- const ColumnView precip) { // precipitation [kg/kg/s] // out
63+ const ColumnView & cmfdqr, // dq/dt for convection [kg/kg/s] //in
64+ const ColumnView & nrain, // stratoform precip [kg/kg/s] //in
65+ const ColumnView & nevapr, // evaporation [kg/kg/s] // in
66+ const ColumnView & precip) { // precipitation [kg/kg/s] // out
6767 // -----------------------------------------------------------------------
6868 // calculate precipitation rate at each grid
6969 // this is added to rescale the variable precip (which can only be positive)
@@ -103,12 +103,12 @@ void gas_washout(
103103 const int plev, // calculate from this level below //in
104104 const Real xkgm, // mass flux on rain drop //in
105105 const Real xliq_ik, // liquid rain water content [gm/m^3] // in
106- const ColumnView xhen_i, // henry's law constant
107- const ColumnView tfld_i, // temperature [K]
108- const ColumnView delz_i, // layer depth about interfaces [cm] // in
109- const ColumnView xeqca, // internal variable
110- const ColumnView xca, // internal variable
111- const ColumnView xgas) { // gas concentration // inout
106+ const ColumnView & xhen_i, // henry's law constant
107+ const ColumnView & tfld_i, // temperature [K]
108+ const ColumnView & delz_i, // layer depth about interfaces [cm] // in
109+ const ColumnView & xeqca, // internal variable
110+ const ColumnView & xca, // internal variable
111+ const ColumnView & xgas) { // gas concentration // inout
112112 // ------------------------------------------------------------------------
113113 // calculate gas washout by cloud if not saturated
114114 // ------------------------------------------------------------------------
@@ -141,7 +141,7 @@ void gas_washout(
141141 // otherwise
142142 // hno3(gas)_new = hno3(gas)_old
143143 // -----------------------------------------------------------------
144- for (int kk = 0 ; kk < plev ; kk++) {
144+ for (int kk = plev ; kk < pver ; kk++) {
145145 allca += xca (kk);
146146 if (allca < xeqca (kk)) {
147147 xgas (kk) = haero::max (xgas (kk) - xca (kk), 0.0 );
@@ -153,7 +153,7 @@ void gas_washout(
153153KOKKOS_INLINE_FUNCTION
154154void find_ktop (
155155 Real rlat, // latitude in radians for columns
156- ColumnView press, // pressure [Pa] // in
156+ const ColumnView & press, // pressure [Pa] // in
157157 int &ktop) { // index that only calculate het_rates above this level //out
158158 // ---------------------------------------------------------------------------
159159 // -------- find the top level that het_rates are set as 0 above it ---------
@@ -183,32 +183,32 @@ void sethet(
183183 const ColumnView
184184 het_rates[gas_pcnst], // [pver][gas_pcnst], rainout rates [1/s] //out
185185 const Real rlat, // latitude in radians for columns
186- const ColumnView press, // pressure [pascals] //in
187- const ColumnView zmid, // midpoint geopot [km] //in
186+ const ColumnView & press, // pressure [pascals] //in
187+ const ColumnView & zmid, // midpoint geopot [km] //in
188188 const Real phis, // surf geopotential //in
189- const ColumnView tfld, // temperature [K] //in
190- const ColumnView cmfdqr, // dq/dt for convection [kg/kg/s] //in
191- const ColumnView nrain, // stratoform precip [kg/kg/s] //in
192- const ColumnView nevapr, // evaporation [kg/kg/s] //in
189+ const ColumnView & tfld, // temperature [K] //in
190+ const ColumnView & cmfdqr, // dq/dt for convection [kg/kg/s] //in
191+ const ColumnView & nrain, // stratoform precip [kg/kg/s] //in
192+ const ColumnView & nevapr, // evaporation [kg/kg/s] //in
193193 const Real delt, // time step [s] //in
194- const ColumnView xhnm, // total atms density [cm^-3] //in
194+ const ColumnView & xhnm, // total atms density [cm^-3] //in
195195 const ColumnView qin[gas_pcnst], // xported species [vmr] //in
196196 // working variables
197- const ColumnView xeqca, // var for gas_washout
198- const ColumnView xca, // var for gas_washout
197+ const ColumnView & xeqca, // var for gas_washout
198+ const ColumnView & xca, // var for gas_washout
199199 const ColumnView
200- xgas2, // gas phase species for h2o2 (2) and so2 (3) [molecules/cm^3]
200+ & xgas2, // gas phase species for h2o2 (2) and so2 (3) [molecules/cm^3]
201201 const ColumnView
202- xgas3, // gas phase species for h2o2 (2) and so2 (3) [molecules/cm^3]
203- const ColumnView delz, // layer depth about interfaces [cm]
204- const ColumnView xh2o2, // h2o2 concentration [molecules/cm^3]
205- const ColumnView xso2, // so2 concentration [molecules/cm^3]
206- const ColumnView xliq, // liquid rain water content in a grid cell [gm/m^3]
207- const ColumnView rain, // precipitation (rain) rate [molecules/cm^3/s]
208- const ColumnView precip, // precipitation rate [kg/kg/s]
209- const ColumnView xhen_h2o2, // henry law constants
210- const ColumnView xhen_hno3, // henry law constants
211- const ColumnView xhen_so2, // henry law constants
202+ & xgas3, // gas phase species for h2o2 (2) and so2 (3) [molecules/cm^3]
203+ const ColumnView & delz, // layer depth about interfaces [cm]
204+ const ColumnView & xh2o2, // h2o2 concentration [molecules/cm^3]
205+ const ColumnView & xso2, // so2 concentration [molecules/cm^3]
206+ const ColumnView & xliq, // liquid rain water content in a grid cell [gm/m^3]
207+ const ColumnView & rain, // precipitation (rain) rate [molecules/cm^3/s]
208+ const ColumnView & precip, // precipitation rate [kg/kg/s]
209+ const ColumnView & xhen_h2o2, // henry law constants
210+ const ColumnView & xhen_hno3, // henry law constants
211+ const ColumnView & xhen_so2, // henry law constants
212212 const ColumnView tmp_hetrates[gas_pcnst], const int spc_h2o2_ndx,
213213 const int spc_so2_ndx, const int h2o2_ndx, const int so2_ndx,
214214 const int h2so4_ndx, const int gas_wetdep_cnt, const int wetdep_map[3 ]) {
@@ -432,22 +432,22 @@ void sethet(
432432 work1 = avo2 * xliq (kk);
433433 work2 = const0 * tfld (kk);
434434
435- if (h2o2_ndx > 0 ) {
435+ if (h2o2_ndx >= 0 ) {
436436 calc_het_rates (satf_h2o2, rain (kk), xhen_h2o2 (kk), // in
437437 tmp_hetrates[1 ](kk), work1, work2, // in
438438 het_rates[h2o2_ndx](kk)); // out
439439 }
440440
441441 // if ( prog_modal_aero .and.
442- if (so2_ndx > 0 && h2o2_ndx > 0 ) {
442+ if (so2_ndx >= 0 && h2o2_ndx >= 0 ) {
443443 het_rates[so2_ndx](kk) = het_rates[h2o2_ndx](kk);
444- } else if (so2_ndx > 0 ) {
444+ } else if (so2_ndx >= 0 ) {
445445 calc_het_rates (satf_so2, rain (kk), xhen_so2 (kk), // in
446446 tmp_hetrates[2 ](kk), work1, work2, // in
447447 het_rates[so2_ndx](kk)); // out
448448 }
449449
450- if (h2so4_ndx > 0 ) {
450+ if (h2so4_ndx >= 0 ) {
451451 calc_het_rates (satf_hno3, rain (kk), xhen_hno3 (kk), // in
452452 tmp_hetrates[0 ](kk), work1, work2, // in
453453 het_rates[h2so4_ndx](kk)); // out
0 commit comments