amrex icon indicating copy to clipboard operation
amrex copied to clipboard

Extend Fortran interface for particle methods

Open rajeeja opened this issue 4 years ago • 4 comments

We need fortran routines for AddRealComp and AddIntComp https://amrex-codes.github.io/amrex/docs_html/Particle.html#adding-particle-components-at-runtime added to https://github.com/AMReX-Codes/amrex/blob/development/Src/F_Interfaces/Particle/AMReX_particlecontainer_mod.F90

These would be used for additional property (PDENS, PTEMP etc.) that'd be later mapped from mesh in FLASH5.

@adubey64 @kweide do we need more features?

rajeeja avatar Oct 16 '20 15:10 rajeeja

Sure, we can add wrappers for these.

atmyers avatar Oct 16 '20 16:10 atmyers

The following would be useful and should be easy to do:

  • wrapper for getting the number or particles in a container
  • (maybe) wrapper for getting the total number of particles (including invalid one) - [not sure whether we will need to use this]

It seems the following would also be useful to us but may be less trivial:

  • Expose the particle iterator through the Fortran interface.

kweide avatar Oct 16 '20 16:10 kweide

wrapper for getting the number or particles in a container

also, if there are a methods for this:

  • wrapper for getting the total number of particles on the rank
  • wrapper for getting the total number of particles across all ranks

kweide avatar Oct 16 '20 17:10 kweide

After digging through some of the documentation (and the existing sources in F_Interface/Particles), I now think that what we need, for implementing existing FLASH Particles behavior on top of AMReX, is not so much AddRealComp and AddIntComp (which add SoA components at run time), but just a more flexible way to specify AoS components at FLASH compile time.

I mean "more flexible" in comparison to the existing AMReX_particlecontainer_* implementation.

Current implementation:

  • The number of additional components is hardwired (AMREX_FI_NSTRUCTREAL, AMREX_FI_NSTRUCTINT in AMReX_particlecontainer_fi.cpp).
  • The Fortran-visible derived type amrex_particle is similarly hardwired in AMReX_particlecontainer_mod.F90.

It would be great if we could specify these at setup time / compile time of FLASH instead (with AMReX being provided as libamrex, not compiled at the same time as FLASH).

kweide avatar Oct 22 '20 18:10 kweide