Skip to content

Commit 1c0a977

Browse files
authored
Merge pull request #1313 from fvitt/steady_state_TiTe
Fix issue with WACCMX ion / electron temperature solver
2 parents 514ab5b + dd5f7e6 commit 1c0a977

6 files changed

Lines changed: 134 additions & 67 deletions

File tree

cime_config/testdefs/testmods_dirs/cam/outfrq1d_amie/user_nl_cam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mfilt=1,1,1,1,1,1,1,1,1
22
ndens=1,1,1,1,1,1,1,1,1
33
nhtfrq=-24,-24,-24,-24,-24,-24,-24,-24,-24
44
avgflag_pertape = 'A', 'I', 'I', 'A', 'A', 'I', 'A'
5-
steady_state_ion_elec_temp=.false.
5+
steady_state_ion_elec_temp = .true.
66
ionos_epotential_amie=.true.
77
amienh_files = '$DIN_LOC_ROOT/atm/waccm/amie_data/oct27_31_2003_nh.nc'
88
amiesh_files = '$DIN_LOC_ROOT/atm/waccm/amie_data/oct27_31_2003_sh.nc'

cime_config/testdefs/testmods_dirs/cam/outfrq9s_amie/user_nl_cam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ amiesh_files = '$DIN_LOC_ROOT/atm/waccm/amie_data/oct27_31_2003_sh.nc'
99
fincl6 = 'prescr_phihm','prescr_efxm','prescr_kevm','prescr_efxp','prescr_kevp','amie_efx_phys','amie_kev_phys'
1010
oplus_grid = 144,96
1111
ionos_npes = 120
12+
steady_state_ion_elec_temp = .true.

doc/ChangeLog

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,74 @@
11
===============================================================
22

3+
Tag name: cam6_4_094
4+
Originator(s): fvitt
5+
Date: 27 May 2025
6+
One-line Summary: Fix issue with WACCMX ion and electron temperature solver
7+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1313
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
11+
Fix Issue with steady state ion / electron temperature solver #1311
12+
13+
The auroral module was not overwriting ionization rates initialized to NaN in
14+
chunks of physics columns that did not have some columns near the auroral oval
15+
which occurred in some configurations (e.g., when SE dycore is used). Consequently,
16+
NaNs were passed to the steady state ion / electron temperature solver.
17+
18+
Describe any changes made to build system: N/A
19+
20+
Describe any changes made to the namelist: N/A
21+
22+
List any changes to the defaults for the boundary datasets: N/A
23+
24+
Describe any substantial timing or memory changes: N/A
25+
26+
Code reviewed by: cacraigucar
27+
28+
List all files eliminated: N/A
29+
30+
List all files added and what they do: N/A
31+
32+
List all existing files that have been modified, and describe the changes:
33+
M cime_config/testdefs/testmods_dirs/cam/outfrq1d_amie/user_nl_cam
34+
M cime_config/testdefs/testmods_dirs/cam/outfrq9s_amie/user_nl_cam
35+
- turn on steady state solver in these tests
36+
37+
M src/ionosphere/waccmx/ionosphere_interface.F90
38+
- add checks for NaN values in ion and electron temperature
39+
- improve error messages when NaNs are found
40+
41+
M src/physics/waccm/mo_aurora.F90
42+
- initialize pbuf fields to zero since some chunks of columns not near the
43+
auroral oval will not get set to real values
44+
45+
M src/physics/waccmx/steady_state_tei.F90
46+
- remove initialization to NaNs of auroral fields (see above)
47+
48+
If there were any failures reported from running test_driver.sh on any test
49+
platform, and checkin with these failures has been OK'd by the gatekeeper,
50+
then copy the lines from the td.*.status files for the failed tests to the
51+
appropriate machine below. All failed tests must be justified.
52+
53+
derecho/intel/aux_cam:
54+
55+
SMS_D_Ln9.ne16_ne16_mg17.QPX2000.derecho_intel.cam-outfrq9s_amie (Overall: DIFF) details:
56+
- expected baseline failure due to setting "steady_state_ion_elec_temp = .true."
57+
58+
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
59+
- pre-existing failure due to CLM build-namelist error
60+
61+
derecho/nvhpc/aux_cam: All PASS
62+
63+
izumi/nag/aux_cam: All PASS
64+
65+
izumi/gnu/aux_cam: All PASS
66+
67+
Summarize any changes to answers: bit-for-bit unchanged
68+
69+
===============================================================
70+
===============================================================
71+
372
Tag name: cam6_4_093
473
Originator(s): eaton
574
Date: 19 May 2025
@@ -49,7 +118,7 @@ List all files added and what they do:
49118
. cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/shell_commands
50119
. cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/user_nl_cam
51120
- add analytic_ic_type='moist_baroclinic_wave_dcmip2016' to the outfrq9s
52-
testmods
121+
testmods
53122

54123
. cime_config/testdefs/testmods_dirs/cam/pc7_ne3pg3/user_nl_cam
55124
namelist settings to test PORT w/ cam7-LT
@@ -102,7 +171,7 @@ cime_config/testdefs/testlist_cam.xml
102171
- the ERR test was added to make sure the CIME resubmit functionality
103172
works. This test moved from izumi to derecho where resubmit is most
104173
likely to be used.
105-
. remove
174+
. remove
106175
PLB_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-ttrac_loadbal0
107176
PLB_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-ttrac_loadbal1
108177
PLB_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-ttrac_loadbal3
@@ -112,7 +181,7 @@ cime_config/testdefs/testlist_cam.xml
112181
- physics load balancing only works with the FV dycore. These tests
113182
aren't doing anything.
114183
. add comments to simple model tests
115-
184+
116185

117186
src/physics/cam/physpkg.F90
118187
src/physics/cam7/physpkg.F90

src/ionosphere/waccmx/ionosphere_interface.F90

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,11 @@ subroutine ionosphere_run2(phys_state, pbuf2d)
840840
end do
841841
end do
842842

843+
if (state_debug_checks) then
844+
call shr_assert_in_domain(te_blck, is_nan=.false., varname="te_blck", msg="NaN found in te_blck in ionosphere_run2")
845+
call shr_assert_in_domain(ti_blck, is_nan=.false., varname="ti_blck", msg="NaN found in ti_blck in ionosphere_run2")
846+
end if
847+
843848
call t_startf('d_pie_coupling')
844849

845850
! Compute geometric height and some diagnostic fields needed by
@@ -861,10 +866,10 @@ subroutine ionosphere_run2(phys_state, pbuf2d)
861866
call t_stopf ('d_pie_coupling')
862867

863868
if (state_debug_checks) then
864-
call shr_assert_in_domain(ui_blck, is_nan=.false., varname="ui_blck", msg="NaN found in ionosphere_run2")
865-
call shr_assert_in_domain(vi_blck, is_nan=.false., varname="vi_blck", msg="NaN found in ionosphere_run2")
866-
call shr_assert_in_domain(wi_blck, is_nan=.false., varname="wi_blck", msg="NaN found in ionosphere_run2")
867-
call shr_assert_in_domain(opmmr_blck, is_nan=.false., varname="opmmr_blck", msg="NaN found in ionosphere_run2")
869+
call shr_assert_in_domain(ui_blck, is_nan=.false., varname="ui_blck", msg="NaN found in ui_blck in ionosphere_run2")
870+
call shr_assert_in_domain(vi_blck, is_nan=.false., varname="vi_blck", msg="NaN found in vi_blck in ionosphere_run2")
871+
call shr_assert_in_domain(wi_blck, is_nan=.false., varname="wi_blck", msg="NaN found in wi_blck in ionosphere_run2")
872+
call shr_assert_in_domain(opmmr_blck, is_nan=.false., varname="opmmr_blck", msg="NaN found in opmmr_blck in ionosphere_run2")
868873
end if
869874

870875
!

src/physics/waccm/mo_aurora.F90

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module mo_aurora
55
! Auroral oval parameterization. See reference:
66
! R.G. Roble, E.C. Ridley
77
! An auroral model for the NCAR thermospheric general circulation model (TGCM)
8-
! Annales Geophysicae,5A, (6), 369-382, 1987.
8+
! Annales Geophysicae,5A, (6), 369-382, 1987.
99
!
1010
! The aurora oval is a circle in auroral circle coordinates. Auroral circle
1111
! coordinates are offset from magnetic coordinates by offa degrees (radians)
@@ -46,7 +46,7 @@ module mo_aurora
4646
! 1) sub aurora_cons called once per time step from advance.
4747
! 2) sub aurora called from dynamics, inside parallel latitude scan.
4848
! 3) subs aurora_cusp and aurora_heat called from sub aurora.
49-
! 4) sub aurora_ions called from sub aurora.
49+
! 4) sub aurora_ions called from sub aurora.
5050
!
5151
!-----------------------------------------------------------------------
5252

@@ -71,7 +71,7 @@ module mo_aurora
7171
private
7272
public :: aurora_inti, aurora_timestep_init, aurora
7373
public :: aurora_register
74-
74+
7575
integer, parameter :: isouth = 1
7676
integer, parameter :: inorth = 2
7777

@@ -143,7 +143,6 @@ module mo_aurora
143143

144144
contains
145145

146-
147146
!----------------------------------------------------------------------
148147
!----------------------------------------------------------------------
149148
subroutine aurora_register
@@ -197,9 +196,14 @@ subroutine aurora_inti(pbuf2d)
197196
call pbuf_set_field(pbuf2d, indxKev, x_nan)
198197
endif
199198

199+
! initialize these fields to zero here since some chunks of colunms not near
200+
! the poles will not get set to real values
200201
if (indxAIPRS>0) then
201202
call pbuf_set_field(pbuf2d, indxAIPRS, 0._r8)
202203
endif
204+
if (indxQTe>0) then
205+
call pbuf_set_field(pbuf2d, indxQTe, 0._r8)
206+
endif
203207

204208
theta0(:) = nan
205209
offa(:) = nan
@@ -347,9 +351,9 @@ subroutine aurora_timestep_init( )
347351
!-----------------------------------------------------------------------
348352

349353
rh = (h2 - h1) / (h1 + h2)
350-
h0 = 0.5_r8 * (h1 + h2) * d2r
351-
352-
354+
h0 = 0.5_r8 * (h1 + h2) * d2r
355+
356+
353357
! roth = MLT of max width of aurora in hours
354358
! rote = MLT of max energy flux of aurora in hours
355359

@@ -459,7 +463,6 @@ subroutine aurora_prod( tn, o2, o1, mbar, rlats, &
459463
logical :: do_aurora(ncol)
460464

461465
real(r8) :: dayfrac, rotation
462-
real(r8), pointer :: qteaur(:) ! for electron temperature
463466

464467
if (.not. aurora_active) return
465468

@@ -479,11 +482,6 @@ subroutine aurora_prod( tn, o2, o1, mbar, rlats, &
479482
call outfld( 'ALONM', r2d*alonm(:ncol,lchnk), ncol, lchnk )
480483
call outfld( 'ALATM', r2d*alatm(:ncol,lchnk), ncol, lchnk )
481484

482-
if (indxQTe>0) then
483-
call pbuf_get_field(pbuf, indxQTe, qteaur)
484-
qteaur(:) = 0._r8
485-
endif
486-
487485
!-----------------------------------------------------------------------
488486
! aurora is active for columns poleward of 30 deg
489487
!-----------------------------------------------------------------------
@@ -501,7 +499,7 @@ subroutine aurora_prod( tn, o2, o1, mbar, rlats, &
501499
do i = 1,ncol
502500
if( do_aurora(i) ) then
503501
dlat_aur(i) = alatm(i,lchnk)
504-
dlon_aur(i) = alonm(i,lchnk) + rotation ! rotate it
502+
dlon_aur(i) = alonm(i,lchnk) + rotation ! rotate it
505503
if( dlon_aur(i) > pi ) then
506504
dlon_aur(i) = dlon_aur(i) - twopi
507505
else if( dlon_aur(i) < -pi ) then
@@ -659,7 +657,7 @@ subroutine aurora_hrate( tn, mbar, rlats, &
659657
do i = 1,ncol
660658
if( do_aurora(i) ) then
661659
dlat_aur(i) = alatm(i,lchnk)
662-
dlon_aur(i) = alonm(i,lchnk) + rotation ! rotate it
660+
dlon_aur(i) = alonm(i,lchnk) + rotation ! rotate it
663661
if( dlon_aur(i) > pi ) then
664662
dlon_aur(i) = dlon_aur(i) - twopi
665663
else if( dlon_aur(i) < -pi ) then
@@ -714,7 +712,7 @@ subroutine aurora_hrate( tn, mbar, rlats, &
714712
call aurora_heat( flux, flux2, alfa, alfa2, &
715713
drizl, do_aurora, hemis, &
716714
alon, colat, ncol, pbuf )
717-
715+
718716
!-----------------------------------------------------------------------
719717
! ... auroral additions to ionization rates
720718
!-----------------------------------------------------------------------
@@ -763,7 +761,7 @@ subroutine aurora_cusp( cusp, do_aurora, hemis, colat, alon, ncol )
763761
cusp(:) = 0._r8
764762
endwhere
765763

766-
end subroutine aurora_cusp
764+
end subroutine aurora_cusp
767765

768766
subroutine aurora_heat( flux, flux2, alfa, alfa2, &
769767
drizl, do_aurora, hemis, &
@@ -772,7 +770,7 @@ subroutine aurora_heat( flux, flux2, alfa, alfa2, &
772770
! ... calculate alfa, flux, and drizzle
773771
!-----------------------------------------------------------------------
774772
use physics_buffer,only: physics_buffer_desc,pbuf_get_field
775-
773+
776774
implicit none
777775

778776
!-----------------------------------------------------------------------
@@ -798,12 +796,12 @@ subroutine aurora_heat( flux, flux2, alfa, alfa2, &
798796
halfwidth, & ! oval half-width
799797
wrk, & ! temp wrk array
800798
dtheta ! latitudinal variation (Gaussian)
801-
real(r8) :: ekev
799+
real(r8) :: ekev
802800
real(r8), pointer :: pr_efx(:) ! Pointer to pbuf prescribed energy flux (mW m-2)
803801
real(r8), pointer :: pr_kev(:) ! Pointer to pbuf prescribed mean energy (keV)
804802
real(r8), pointer :: qteaur(:) ! for electron temperature
805803
integer :: n
806-
804+
807805
!-----------------------------------------------------------------------
808806
! Low-energy protons:
809807
!
@@ -850,7 +848,7 @@ subroutine aurora_heat( flux, flux2, alfa, alfa2, &
850848
endwhere
851849

852850
!-----------------------------------------------------------------------
853-
! ... for electron temperature (used in settei):
851+
! ... for electron temperature (used in settei):
854852
!-----------------------------------------------------------------------
855853
if (indxQTe>0) then
856854
call pbuf_get_field(pbuf, indxQTe, qteaur)
@@ -954,14 +952,14 @@ subroutine aurora_ions( drizl, cusp, alfa1, alfa2, &
954952
real(r8) :: wrk(ncol,pver)
955953

956954
real(r8), pointer :: aurIPRateSum(:,:) ! Pointer to pbuf auroral ion production sum for O2+,O+,N2+ (s-1 cm-3)
957-
955+
958956
qia(:) = 0._r8
959957
wrk(:,:) = 0._r8
960958

961959
!-----------------------------------------------------------
962-
! Point to production rates array in physics buffer where
963-
! rates will be stored for ionosphere module access. Also,
964-
! initialize rates to zero before column loop since only
960+
! Point to production rates array in physics buffer where
961+
! rates will be stored for ionosphere module access. Also,
962+
! initialize rates to zero before column loop since only
965963
! daylight values are filled
966964
!-----------------------------------------------------------
967965
if (indxAIPRS>0) then
@@ -1041,15 +1039,15 @@ subroutine aurora_ions( drizl, cusp, alfa1, alfa2, &
10411039
end do level_loop
10421040

10431041
!----------------------------------------------------------------
1044-
! Store the sum of the ion production rates in pbuf to be used
1045-
! in the ionosx module
1042+
! Store the sum of the ion production rates in pbuf to be used
1043+
! in the ionosx module
10461044
!----------------------------------------------------------------
10471045
if (indxAIPRS>0) then
1048-
1049-
aurIPRateSum(1:ncol,1:pver) = wrk(1:ncol,1:pver)
1050-
1046+
1047+
aurIPRateSum(1:ncol,1:pver) = wrk(1:ncol,1:pver)
1048+
10511049
endif
1052-
1050+
10531051
call outfld( 'QSUM', wrk, ncol, lchnk )
10541052

10551053
end subroutine aurora_ions
@@ -1165,9 +1163,9 @@ subroutine aion( si, so, do_aurora, ncol )
11651163
!-----------------------------------------------------------------------
11661164
! Calculates integrated f(x) needed for total auroral ionization.
11671165
! See equations (10-12) in Roble,1987.
1168-
! Coefficients for equation (12) of Roble,1987 are in variable cc
1166+
! Coefficients for equation (12) of Roble,1987 are in variable cc
11691167
! (revised since 1987):
1170-
! Uses the identity x**y = exp(y*ln(x)) for performance
1168+
! Uses the identity x**y = exp(y*ln(x)) for performance
11711169
! (fewer (1/2) trancendental functions are required).
11721170
!------------------------------------------------------------------------
11731171

0 commit comments

Comments
 (0)