Skip to content

Commit

Permalink
update to cam6_3_156
Browse files Browse the repository at this point in the history
  • Loading branch information
jtruesdal committed Apr 17, 2024
2 parents faa4c3b + a564e8c commit 8225d8e
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 423 deletions.
5 changes: 5 additions & 0 deletions bld/namelist_files/use_cases/sd_waccmx_ma_cam6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,9 @@
<history_aerosol>.false.</history_aerosol>
<history_aero_optics>.false.</history_aero_optics>

<rxn_rate_sums chem="waccm_mad_mam5">
'SolIonRate_Tot = jeuv_1 + jeuv_2 + jeuv_3 + jeuv_4 + jeuv_5 + jeuv_6 + jeuv_7 + jeuv_8 + jeuv_9 + jeuv_10 + jeuv_11 + jeuv_14 + jeuv_15 + jeuv_16 +',
'jeuv_17 + jeuv_18 + jeuv_19 + jeuv_20 + jeuv_21 + jeuv_22 + jeuv_23',
</rxn_rate_sums>

</namelist_defaults>
70 changes: 70 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,76 @@ izumi/gnu/aux_cam:

===============================================================

Tag name: cam6_3_156
Originator(s): fvitt
Date: 16 Apr 2024
One-line Summary: Misc code clean up for WACCM
Github PR URL: https://github.com/ESCOMP/CAM/pull/1001

Purpose of changes (include the issue number and title text for each relevant GitHub issue):

Use supported lapack library routine to solve a matrix equation in WACCM physics
efield module (issue #999)

Misc code clean up in calculations of effective cross section of O2

Fix for sd_waccmx_ma_cam6 use case file for waccm_mad_mam5 chemistry

Minor change to APEX module needed for when NAG compiler '-nan' option is used

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by: cacraigucar nusbaume

List all files eliminated:
D src/chemistry/mozart/sv_decomp.F90
- remove deprecated matrix solve routines -- replaced by LAPACK DGESV routine

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
M bld/namelist_files/use_cases/sd_waccmx_ma_cam6.xml
- fix for waccm_mad_mam5 chem

M src/chemistry/mozart/mo_jshort.F90
- code clean up in calculations of effective cross section of O2

M src/chemistry/utils/apex.F90
- minor changes for NAG compiler '-nan' option is used

M src/physics/waccm/efield.F90
- use LAPACK DGESV routine to solve matrix equation

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:
PEND ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3
FAIL SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d
- pre-existing failures

FAIL ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s
- pre-existing failure -- should be fixed with an external cime update

izumi/nag/aux_cam:
FAIL DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae
- pre-existing failure

izumi/gnu/aux_cam: All PASS

Summarize any changes to answers: bit-for-bit unchanged

===============================================================
===============================================================

Tag name: cam6_3_155
Originator(s): katec,vlarson,bstephens82,huebleruwm,zarzycki,JulioTBacmeister
Date: April 11, 2024
Expand Down
85 changes: 40 additions & 45 deletions src/chemistry/mozart/mo_jshort.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ module mo_jshort
real(r8), allocatable :: xs_o3b(:)
real(r8), allocatable :: xs_wl(:,:)

real(r8), parameter :: lno2_llimit = 38._r8 ! ln(NO2) lower limit
real(r8), parameter :: lno2_ulimit = 56._r8 ! ln(NO2) upper limit

contains

subroutine jshort_init( xs_coef_file, xs_short_file, sht_indexer )
Expand Down Expand Up @@ -1492,13 +1495,13 @@ subroutine calc_o2srb( nlev, nid, o2col, tlev, tsrb, xscho2 )

do k = 1,nlev
x = log( o2col(k) )
if( x >= 38._r8 .and. x <= 56._r8 ) then
if( x >= lno2_llimit .and. x <= lno2_ulimit ) then
call effxs( x, tlev(k), xs )
xscho2(k,:) = xs(:)
else if( x < 38._r8 ) then
else if( x < lno2_llimit ) then
ktop1 = k-1
ktop = min( ktop1,ktop )
else if( x > 56._r8 ) then
else if( x > lno2_ulimit ) then
kbot = k
end if
end do
Expand Down Expand Up @@ -1601,9 +1604,9 @@ subroutine effxs( x, t, xs )
! method:
! ln(xs) = A(X)[T-220]+B(X)
! X = log of slant column of O2
! A,B calculated from chebyshev polynomial coeffs
! AC and BC using NR routine chebev. Assume interval
! is 38<ln(NO2)<56.
! A,B are calculated from Chebyshev polynomial coeffs
! AC and BC using Clenshaw summation algorithm within
! the interval 38<ln(NO2)<56.
!
! Revision History:
!
Expand Down Expand Up @@ -1639,8 +1642,6 @@ subroutine calc_params( x, a, b )
! Wavelength intervals are defined in WMO1985
!-------------------------------------------------------------

implicit none

!-------------------------------------------------------------
! ... Dummy arguments
!-------------------------------------------------------------
Expand All @@ -1652,56 +1653,50 @@ subroutine calc_params( x, a, b )
!-------------------------------------------------------------
integer :: i

if (x<lno2_llimit .or. x>lno2_ulimit) then
call endrun('mo_jshort::calc_params of O2 abs xs: x is not in the valid range. ')
end if

!-------------------------------------------------------------
! ... call chebyshev evaluation routine to calc a and b from
! set of 20 coeficients for each wavelength
! ... evaluate at each wavelength
! for a set of 20 Chebyshev coeficients
!-------------------------------------------------------------
do i = 1,nsrbtuv
a(i) = jchebev( 38._r8, 56._r8, ac(1,i), 20, x )
b(i) = jchebev( 38._r8, 56._r8, bc(1,i), 20, x )
a(i) = evalchebpoly( ac(:,i), x )
b(i) = evalchebpoly( bc(:,i), x )
end do

contains

function jchebev( a, b, c, m, x )
!-------------------------------------------------------------
! Chebyshev evaluation algorithm
! See Numerical recipes p193
!-------------------------------------------------------------
! Use Clenshaw summation algorithm to evaluate Chebyshev polynomial at point
! [pnt - (lno2_ulimit + lno2_llimit)/2]/[(lno2_ulimit - lno2_llimit)/2]
! given coefficients coefs within limits lim1 and lim2
pure function evalchebpoly( coefs, pnt ) result(cval)
real(r8), intent(in) :: coefs(:)
real(r8), intent(in) :: pnt

!-------------------------------------------------------------
! ... Dummy arguments
!-------------------------------------------------------------
integer, intent(in) :: m
real(r8), intent(in) :: a, b, x
real(r8), intent(in) :: c(m)
real(r8) :: cval
real(r8) :: fac(2)
real(r8) :: csum(2) ! Clenshaw summation
integer :: ndx
integer :: ncoef

real(r8) :: jchebev
!-------------------------------------------------------------
! ... Local variables
!-------------------------------------------------------------
integer :: j
real(r8) :: d, dd, sv, y, y2
ncoef = size(coefs)

if( (x - a)*(x - b) > 0._r8 ) then
write(iulog,*) 'x not in range in chebev', x
jchebev = 0._r8
return
end if
fac(1) = (2._r8*pnt-lno2_llimit-lno2_ulimit)/(lno2_ulimit-lno2_llimit)
fac(2) = 2._r8*fac(1)

d = 0._r8
dd = 0._r8
y = (2._r8*x - a - b)/(b - a)
y2 = 2._r8*y
do j = m,2,-1
sv = d
d = y2*d - dd + c(j)
dd = sv
end do
! Clenshaw recurrence summation
csum(:) = 0.0_r8
do ndx = ncoef, 2, -1
cval = csum(1)
csum(1) = fac(2)*csum(1) - csum(2) + coefs(ndx)
csum(2) = cval
end do

jchebev = y*d - dd + .5_r8*c(1)
cval = fac(1)*csum(1) - csum(2) + 0.5_r8*coefs(1)

end function jchebev
end function evalchebpoly

end subroutine calc_params

Expand Down
Loading

0 comments on commit 8225d8e

Please sign in to comment.