ECP-WarpX / WarpX

WarpX is an advanced electromagnetic & electrostatic Particle-In-Cell code.
https://ecp-warpx.github.io
Other
299 stars 191 forks source link

Stop calling amrex fortran routines #751

Closed MaxThevenet closed 4 years ago

MaxThevenet commented 4 years ago

WarpX still calls some AMReX Fortran functions, in particular in Diagnostics/FieldIO.cpp and Utils/Interpolate.cpp, for instance

Instead of re-writing all of these functions, let's check if we can call other existing C++ functions instead, like amrex::average_face_to_cellcenter etc.

ax3l commented 4 years ago

Since AMReX supports this now, our goal should be to compile successfully with make BL_NO_FORT=TRUE

(and then change the default to that).

EZoni commented 4 years ago

Do we want to try to replace the functions above with the function Average::CoarsenAndInterpolate introduced in #853 as a first step? Or do we want to write a specific new function that possibly interpolates over more than 1 or 2 points? Since the functions above are used for I/O purposes, I would expect Average::CoarsenAndInterpolate to be enough, but I would like to receive feedback on this.

MaxThevenet commented 4 years ago

Can CoarsenAndInterpolate reproduce the behavior of all functions above to machine precision, or do some of them use several-point averaging?

MaxThevenet commented 4 years ago

Ah, the comment above doesn't apply to amrex_interp_div_free_bfield, which is doing a more elaborate interpolation but we don't need that.

EZoni commented 4 years ago

Thanks for the feedback, I will check each of the functions above and report here.

EZoni commented 4 years ago

My conclusion so far is that we cannot use Average::CoarsenAndInterpolate for the functions above, as they seem to be used for interpolating fields from coarse grids to fine grids (hence refining and not coarsening). The replacement of the functions mentioned in this issue would also correspond to resolving the fifth point "Output of raw data: Interpolation of fields from coarse to fine" mentioned in issue 797.

ax3l commented 4 years ago

Finalized with #1103