evanoconnor / NuLib

open-source neutrino interaction library
23 stars 16 forks source link

Refactored weak rate library. #10

Closed csullivan closed 8 years ago

csullivan commented 8 years ago

List of changes: Updated to v1.1 of weak rates library (available here: https://github.com/csullivan/weakrates) Now, arbitrarily many tables of disparate ranges in t9/log10(rhoYe) and grid resolution may be used simultaneously. Each table is stored as an object with it's own interpolation routines. The RateLibrary class is composed of one RateApprox object and many RateTable objects. The weakrates_interface module serves as an interface between the weakrate library and NuLib. Thread safety is implemented and verified for OpenMP shared memory threading. Distributed threading via MPI shouldn't be affected See commit logs for full details.

nuclei_distribution_helpers: --Wrapped in module nuclei_hempel which holds the hempel_lookup_table instead of storing this in NuLib

input_parser: --Wrapped in module to export the parsing functions which were previously only accessible to the primary input_parser subroutine (this way I can define parsing that is only necessary if the weakrates library is included).

Makefile/make.inc/make_table_example: In order to remove some preprocessor clutter, I made a new executable (make_table_weakrates.F90) which is optionally compiled if WEAK_RATES=1 in make.inc make_table_example.F90 no longer employs the weak-rates library, but I left in the preprocessor lines for NUCLEI_HEMPEL.

csullivan commented 8 years ago

I think I got everything in the list, but if you notice something I forgot to mention let me know.

One difference to note is that because the rate tables are derived types, and because OpenMP cannot COPYIN derived types with allocatable arrays, I had to convert all my allocatables to pointers, and for each thread create a separate instance of each pointer and target (target=array pointed to by pointer). This means that the initialization is a bit slower than before. However, from my tests the code is over all faster, so it balances out.