glemieux / E3SM

Energy Exascale Earth System Model source code.
https://e3sm.org/
Other
0 stars 0 forks source link

Condense seed dispersal update in `elm_drv` with a fates procedure #9

Closed glemieux closed 1 year ago

glemieux commented 1 year ago

The regular seed dispersal update code in elm_drv should be neatly wrapped up into fates code.

glemieux commented 1 year ago

Order of operations:

Init:

  1. Allocate bc_in/out via allocate_bcin/bcout (called from elmfates init <- elm_inst_biogeochem)
  2. Zero out bc_in(s)%seed_in and bc_out(s)%seed_out via zero_bcs (called from elmfates init <- elm_inst_biogeochem)

Dynamics:

  1. Calculate and set bc_out%seed_out(pft) via call to SeedIn (called from ed_integrate_state_variables <- ed_ecosystem_dynamics <- dynamics_driv)
  2. Send seed from bc_out%seed_out into an local output buffer for the current gridcell
  3. Distribute seed information from current gridcell to all gridcells (wrapped mpi call in elm_drv out OMP thread area)
  4. Accumulate incoming seed from global gridcell-sized array and pass back into bc_in%seed_in values via wrap_seed_dispersal
glemieux commented 1 year ago

Unless we are planning on sharing the seed information with the host land model, we don't really need this to be formatted as part of the bc_in/out data structure. That said, this setup will provide future-proofing if so desired. The wrapped mpi call does need to take place within elm_drv outside of the OMP threading pragmas, but we could still use separate fates type structure.

glemieux commented 1 year ago

I need to refresh myself on how the probability density is used in conjunction with the seed mass. This PD value for each neighboring grid cell in held in the neighborhood type and not used currently. Since its held in the neighborhood_type and indexed by gridcell, the calculation needs to happen in WrapSeedGlobal outside of the fates threaded area.

UPDATE: Yes, I need to update the incoming_global value based on the PD. See https://github.com/glemieux/fates/issues/23 for further updates.

glemieux commented 1 year ago

Complete