-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hook up drydep interface. #376
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #376 +/- ##
=======================================
Coverage 95.86% 95.87%
=======================================
Files 45 45
Lines 9342 9352 +10
=======================================
+ Hits 8956 8966 +10
Misses 386 386 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
const Real adv_mass_kg_per_moles[gas_pcnst], | ||
const Real adv_mass_kg_per_moles[gas_pcnst], const Real mmr[gas_pcnst], | ||
const Real fraction_landuse[mam4::mo_drydep::n_land_type], | ||
const int col_index_season[mam4::mo_drydep::n_land_type], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @overfelt. I just left some comments (may edit them later).
src/mam4xx/seq_drydep.hpp
Outdated
for (int i = 0; i < NSeas; ++i) { | ||
for (int j = 0; j < NLUse; ++j) { | ||
data.rac(i, j) = rac_a[i][j]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way of initialization works on CPU but probably not for GPU. Need to fix it. @odiazib @singhbalwinder and I discussed it before, I @odiazib has ways to fix it.
src/mam4xx/mo_gas_phase_chemdr.hpp
Outdated
mam4::mo_drydep::drydep_xactive( | ||
drydep_data, | ||
fraction_landuse, // fraction of land use for column by land type | ||
month, // month | ||
col_index_season, // column-specific mapping of month indices to | ||
// seasonal land-type indices [-] | ||
sfc_temp, // surface temperature [K] | ||
air_temp, // surface air temperature [K] | ||
tv, // potential temperature [K] | ||
pressure_sfc, // surface pressure [Pa] | ||
pressure_10m, // 10-meter pressure [Pa] | ||
spec_hum, // specific humidity [kg/kg] | ||
wind_speed, // 10-meter wind spped [m/s] | ||
rain, // rain content [??] | ||
snow, // snow height [m] | ||
solar_flux, // direct shortwave surface radiation [W/m^2] | ||
mmr, // constituent MMRs [kg/kg] | ||
dvel, // deposition velocity [1/cm/s] | ||
dflx // deposition flux [1/cm^2/s] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to add if (kk == nlev)
for drydep_xactive. Only gas dry dep fluxes and velocity are only calculated at bottom layer.
Some input vars need calculation. For example, wind_speed, it is calculated as sqrt(ubot^2 + vbot^2). Not sure which is prefered, I guess it would be better to calculations here in MAMxx code.
8652ecb
to
29c29a5
Compare
I should have tested it before pushing. I will test it and fix the build errors. |
src/mam4xx/mo_sethet.hpp
Outdated
} | ||
Kokkos::fence(); | ||
for (int mm = 0; mm < gas_wetdep_cnt; mm++) { | ||
int mm2 = wetdep_map[mm]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use team.team_barrier()
, as this part of the code is within a parallel_for
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are modifying the code anyway, doing a ThreadVectorRange inside a TeamThreadRange as on line 298 is the way to go. And, yes, team_barrier() is the right call in this case.
A team_barrier() right before the abort check on line 496 might be overkill, but there are already five team_barrier()s in this function, maybe one more would not hurt.
src/mam4xx/mo_gas_phase_chemdr.hpp
Outdated
mam4::mo_drydep::drydep_xactive( | ||
drydep_data, | ||
fraction_landuse, // fraction of land use for column by land type | ||
month, // month | ||
col_index_season, // column-specific mapping of month indices to | ||
// seasonal land-type indices [-] | ||
sfc_temp, // surface temperature [K] | ||
air_temp, // surface air temperature [K] | ||
tv, // potential temperature [K] | ||
pressure_sfc, // surface pressure [Pa] | ||
pressure_10m, // 10-meter pressure [Pa] | ||
spec_hum, // specific humidity [kg/kg] | ||
wind_speed, // 10-meter wind spped [m/s] | ||
rain, // rain content [??] | ||
snow, // snow height [m] | ||
solar_flux, // direct shortwave surface radiation [W/m^2] | ||
qq, // constituent MMRs [kg/kg] | ||
dvel, // deposition velocity [1/cm/s] | ||
dflx // deposition flux [1/cm^2/s] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gas dry dep is only executed for bottom layer. I think we need to add if condition here. Some of the input vars for dry dep needs calculation. Currently it is done in EAMxx branch. We might consider move them to MAMxx code if it is the preferred practice.
* Hook up drydep interface. * Inequality needs to be >= to account for fortran -> C++ indexing. * Only call mam4::mo_drydep::drydep_xactive on the bottom level: nlev-1 --------- Co-authored-by: Balwinder Singh <[email protected]>
No description provided.