diff --git a/src/mptrac.c b/src/mptrac.c index 6fdb0e8a9..f2735d856 100644 --- a/src/mptrac.c +++ b/src/mptrac.c @@ -2455,7 +2455,7 @@ void module_chemgrid( double *restrict const press = (double *) malloc((size_t) nz * sizeof(double)); double *restrict const mass = - (double *) malloc((size_t) ngrid * sizeof(double)); + (double *) calloc((size_t) ngrid, sizeof(double)); double *restrict const area = (double *) malloc((size_t) ny * sizeof(double)); double *restrict const lon = @@ -2472,10 +2472,6 @@ void module_chemgrid( const double dlon = (ctl->chemgrid_lon1 - ctl->chemgrid_lon0) / nx; const double dlat = (ctl->chemgrid_lat1 - ctl->chemgrid_lat0) / ny; - /* Initialize mass... */// TODO: does not work on GPU? - for (int i = 0; i < ngrid; i++) - mass[i] = 0; - /* Set vertical coordinates... */ #ifdef _OPENACC #pragma acc enter data create(ixs[0:np],iys[0:np],izs[0:np],z[0:nz],press[0:nz],mass[0:ngrid],area[0:ny],lon[0:nx],lat[0:ny]) @@ -2505,8 +2501,7 @@ void module_chemgrid( izs[ip] = (int) ((Z(atm->p[ip]) - ctl->chemgrid_z0) / dz); if (atm->time[ip] < t0 || atm->time[ip] > t1 || ixs[ip] < 0 || ixs[ip] >= nx - || iys[ip] < 0 || iys[ip] >= ny - || izs[ip] < 0 || izs[ip] >= nz) + || iys[ip] < 0 || iys[ip] >= ny || izs[ip] < 0 || izs[ip] >= nz) izs[ip] = -1; } diff --git a/src/trac.c b/src/trac.c index c8b96f91c..1384e7267 100644 --- a/src/trac.c +++ b/src/trac.c @@ -287,7 +287,7 @@ int main( if (ctl.oh_chem_reaction != 0 || ctl.h2o2_chem_reaction != 0 || (ctl.kpp_chem && fmod(t, ctl.dt_kpp) == 0)) module_chemgrid(&ctl, met0, met1, atm, t); - + /* OH chemistry... */ if (ctl.oh_chem_reaction != 0) module_oh_chem(&ctl, clim, met0, met1, atm, dt);