PrincetonUniversity / athena

Athena++ radiation GRMHD code and adaptive mesh refinement (AMR) framework
https://www.athena-astro.app
BSD 3-Clause "New" or "Revised" License
226 stars 122 forks source link

Missing documentation and instructions for creating user-defined Coordinates class; Get/Compute naming convention is confusing #505

Open felker opened 1 year ago

felker commented 1 year ago

Brought up by Lizhong Zhang at the 2nd Athena++ Workshop. This page on the Wiki: https://github.com/PrincetonUniversity/athena/wiki/Coordinate-Systems-and-Meshes should be expanded with another section (although it is already quite long) about the code modifications that are necessary for adding a new (relativistic and/or nonrelativistic?) Coordinates derived class to Athena++. Should probably include:

Anything else?


Also, related:

Our Coordinates abstract base class has 3x types of methods that are "Get"-prefixed counterparts to existing methods:

Real GetEdgeXLength(const int k, const int j, const int i);
...
Real GetFaceXArea(const int k, const int j, const int i);
...
Real GetCellVolume(const int k, const int j, const int i);

The non-"Get" functions fill a provided AthenaArray at a given k,j along an x1 slice. These functions imply that they are "getters" for accessing private members/arrays of the Coordinates class, but they actually compute the quantities like their counterparts, just at a single cell.

A user/developer may have no idea why there are seemingly 2x versions of the same type of function (including me, I completely forgot):

c-white commented 1 year ago

Just to clarify the relativistic/nonrelativistic issue for anyone reading this thread: This task is about writing new Coordinates classes deep inside the code, modifying src/coordinates/ in the process. Such coordinates might be used for any physics.

Orthogonal to this, the GRUser Coordinates class already exists and is documented, allowing those using GR to specify arbitrary metrics by enrolling simple functions in their pgen files. Thus GR users don't need to write new classes, which makes sense, since the whole essence of GR is to abstract away from any particular instantiations of coordinates.

c-white commented 9 months ago

Naming conventions aside, I updated the wiki with some description of how to add new coordinates.