ufs-community / ccpp-physics

UFS fork for CCPP
Other
4 stars 34 forks source link

Reduce library dependencies in ccpp-physics #46

Open grantfirl opened 1 year ago

grantfirl commented 1 year ago

Description

The ccpp-physics repository depends on 3 libraries in NCEPlibs: sp, w3emc, and bacio. The sp library is used by GFS_phys_time_vary.fv3.F90/gcycle/sfccycle (the actual dependency is in sfcsub.F). The dependency is something like 300 lines with comments from the sp library, but it is all contained in splat.F and lapack_gen.F in https://github.com/NOAA-EMC/NCEPLIBS-sp. lapack_gen.F contains code from Numerical Recipes for matrix inversion. splat.F does Computes cosines of colatitude and Gaussian weights for sets of latitudes according to the comments.

Additionally, several schemes use subroutines from the w3emc library, which also has a dependency on the bacio library.

Solution

It would be relatively straightforward to remove the dependency on the sp library by including the necessary code directly in sfcsub.F, albeit duplicating from the library.

Removing the w3 dependency looks like significantly more work.

@ChunxiZhang-NOAA also mentioned a more complete refactoring of gcycle to remove the dependency.

Alternatives (optional)

Keep the dependencies.

Related to (optional)

https://github.com/ufs-community/ccpp-physics/pull/41

scrasmussen commented 7 months ago

Just making a note that I've assigned myself to work on this issue

grantfirl commented 7 months ago

FYI, if you search for w3movdat and w3difdat, that should give you the files with dependency on the w3 library.