diff --git a/CHANGELOG.md b/CHANGELOG.md index 5be1bcb3..f024e945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Silenced unwarranted error messages from wavelength/channel retrieval functions occurring when 470nm and/or 870nm channels are not included in GOCART resource file. - Add explicit `find_package()` calls for missing dependencies for MAPL for builds with spack-stack. Will eventually be fixed in MAPL in later versions - Corrected the units of the gravimetric soil moisture to percent instead of fractional in the FENGSHA dust scheme. @@ -29,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `soil_moisture_factor` to the DU2G_instance_DU.rc (same name used in the K14 scheme) and DU2G_GridCompMod.F90 files for FENGSHA - Add `soil_drylimit_factor` to the DU2G_instance_DU.rc and DU2G_GridCompMod.F90 files for FENGSHA +- Moved process library macros to header file. + ## [v2.2.1] - 2023-05-30 ### Fixed diff --git a/Process_Library/GOCART2G_MieMod.F90 b/Process_Library/GOCART2G_MieMod.F90 index a595d8d4..15966ba2 100644 --- a/Process_Library/GOCART2G_MieMod.F90 +++ b/Process_Library/GOCART2G_MieMod.F90 @@ -1,3 +1,4 @@ +#include "Process.H" !BOP ! ! !MODULE: GOCART2G_MieMod --- Reader for aerosol mie tables @@ -540,13 +541,15 @@ integer function getChannel(this, wavelength, rc) result (ch) endif enddo - if (present(rc)) rc = 0 - - if (ch < 0) then - !$omp critical (GetCha) - print*, "wavelength of ",wavelength, " is an invalid value." - !$omp end critical (GetCha) - if (present(rc)) rc = -1 + if (present(rc)) then + if (ch > 0) then + rc = __SUCCESS__ + else + rc = __FAIL__ + !$omp critical (GetCha) + print*, "wavelength of ",wavelength, " is an invalid value." + !$omp end critical (GetCha) + endif endif end function getChannel @@ -558,18 +561,22 @@ real function getWavelength(this, ith_channel, rc) result (wavelength) real, parameter :: w_tol = 1.e-9 integer :: i - if (present(rc)) rc = 0 - if (ith_channel <=0 .or. ith_channel > this%nch ) then - !$omp critical (GetWav) - print*, "The channel of ",ith_channel, " is an invalid channel number." - !$omp end critical (GetWav) - if (present(rc)) rc = -1 - wavelength = -1. ! meanlingless nagative - return + wavelength = -1. ! meaningless negative + else + wavelength = this%wavelengths(ith_channel) endif - - wavelength = this%wavelengths(ith_channel) + + if (present(rc)) then + if (wavelength > 0) then + rc = __SUCCESS__ + else + rc = __FAIL__ + !$omp critical (GetWav) + print*, "The channel of ",ith_channel, " is an invalid channel number." + !$omp end critical (GetWav) + endif + endif end function getWavelength diff --git a/Process_Library/GOCART2G_Process.F90 b/Process_Library/GOCART2G_Process.F90 index cc0b5999..b303b970 100644 --- a/Process_Library/GOCART2G_Process.F90 +++ b/Process_Library/GOCART2G_Process.F90 @@ -1,13 +1,4 @@ -#define __SUCCESS__ 0 -#define __FAIL__ 1 -#define __VERIFY__(x) if(x/=0) then; if(present(rc)) rc=x; return; endif -#define __VERIFY_NO_OPT__(x) if(x/=0) then; rc=x; return; endif -#define __RC__ rc=status); __VERIFY__(status -#define __RC_NO_OPT__ rc=status); __VERIFY_NO_OPT__(status -#define __STAT__ stat=status); __VERIFY__(status -#define __IOSTAT__ iostat=status); __VERIFY__(status -#define __RETURN__(x) if (present(rc)) rc=x; return -#define __ASSERT__(expr) if(.not. (expr)) then; if (present(rc)) rc=-1; return; endif +#include "Process.H" !------------------------------------------------------------------------- ! ! !MODULE: GOCART2G_Process -- GOCART2G process library diff --git a/Process_Library/Process.H b/Process_Library/Process.H new file mode 100644 index 00000000..fa74ee6c --- /dev/null +++ b/Process_Library/Process.H @@ -0,0 +1,10 @@ +#define __SUCCESS__ 0 +#define __FAIL__ 1 +#define __VERIFY__(x) if(x/=0) then; if(present(rc)) rc=x; return; endif +#define __VERIFY_NO_OPT__(x) if(x/=0) then; rc=x; return; endif +#define __RC__ rc=status); __VERIFY__(status +#define __RC_NO_OPT__ rc=status); __VERIFY_NO_OPT__(status +#define __STAT__ stat=status); __VERIFY__(status +#define __IOSTAT__ iostat=status); __VERIFY__(status +#define __RETURN__(x) if (present(rc)) rc=x; return +#define __ASSERT__(expr) if(.not. (expr)) then; if (present(rc)) rc=-1; return; endif