Skip to content

Commit 870f032

Browse files
authored
Merge pull request #222 from GEOS-ESM/feature/rtodling/bring_back_pr209
Feature/rtodling/bring back pr209
2 parents 9fc7174 + eb45823 commit 870f032

5 files changed

Lines changed: 145 additions & 106 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313

14+
28Jan2026:
15+
- bring back changes from PR #209
16+
17+
28Jan2026:
18+
- bug fix: add ABI tlapmean back (had lost them when backing out PR#209)
19+
- another miss (qcmod) wrt ABI and IR back out
20+
21+
12Jan2026:
22+
- bug fixes in interfacing GSI w/ libSP - these are zero-diff fixes
23+
24+
09Jan2026:
25+
- Back out changes from PR 209 (IR adjustments) since this is
26+
aimed at FPP and the update must be zero-diff.
27+
- optional write out in setupw
28+
1429
07Jan2026:
1530
- minor revisions of CG tolerance (consistency between pcgsoi and bicg)
1631

‎GEOSaana_GridComp/GSI_GridComp/general_specmod.f90‎

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ module general_specmod
77
! abstract: copy of specmod, introducing structure variable spec_vars, so
88
! spectral code can be used for arbitrary resolutions.
99
!
10-
! program history log:
10+
! program history log:
1111
! 2003-11-24 treadon
1212
! 2004-04-28 d. kokron, updated SGI's fft to use scsl
1313
! 2004-05-18 kleist, documentation
14-
! 2004-08-27 treadon - add/initialize variables/arrays needed by
15-
! splib routines for grid <---> spectral
14+
! 2004-08-27 treadon - add/initialize variables/arrays needed by
15+
! splib routines for grid <---> spectral
1616
! transforms
1717
! 2007-04-26 yang - based on idrt value xxxx descriptionxxx
1818
! 2010-02-18 parrish - copy specmod to general_specmod and add structure variable spec_vars.
19-
! remove all *_b variables, since now not necessary to have two
19+
! remove all *_b variables, since now not necessary to have two
2020
! resolutions. any number of resolutions can be now contained in
2121
! type(spec_vars) variables passed in through init_spec_vars. also
2222
! remove init_spec, since not really necessary.
@@ -127,7 +127,7 @@ subroutine general_init_spec_vars(sp,jcap,jcap_test,nlat_a,nlon_a,eqspace)
127127
! program history log:
128128
! 2003-11-24 treadon
129129
! 2004-05-18 kleist, new variables and documentation
130-
! 2004-08-27 treadon - add call to sptranf0 and associated arrays,
130+
! 2004-08-27 treadon - add call to sptranf0 and associated arrays,
131131
! remove del21 and other unused arrays/variables
132132
! 2006-04-06 middlecoff - remove jc=ncpus() since not used
133133
! 2008-04-11 safford - rm unused vars
@@ -137,7 +137,7 @@ subroutine general_init_spec_vars(sp,jcap,jcap_test,nlat_a,nlon_a,eqspace)
137137
! 2013-10-23 el akkraoui - initialize lats to zero (otherwise point is undefined)
138138
!
139139
! input argument list:
140-
! sp - type(spec_vars) variable
140+
! sp - type(spec_vars) variable
141141
! jcap - target resolution
142142
! jcap_test - test resolution, used to construct mask which will zero out coefs
143143
! with total wavenumber n in range jcap_test < n <= jcap
@@ -161,13 +161,15 @@ subroutine general_init_spec_vars(sp,jcap,jcap_test,nlat_a,nlon_a,eqspace)
161161
integer(i_kind) ,intent(in ) :: jcap,jcap_test,nlat_a,nlon_a
162162
logical,optional,intent(in ) :: eqspace
163163

164-
! Declare local variables
164+
! Declare local variables
165165
integer(i_kind) i,ii1,j,l,m,jhe,n
166166
integer(i_kind) :: ldafft
167167
real(r_kind) :: dlon_a,half_pi,two_pi
168168
real(r_kind),dimension(nlat_a-2) :: wlatx,slatx
169169
real(r_kind) :: epsi0(0:jcap) ! epsilon factor for m=0
170170
real(r_kind) :: fnum, fden
171+
real(r_kind), dimension(:, :), allocatable :: dummy_w
172+
real(r_kind), dimension(:, :), allocatable :: dummy_g
171173

172174
! Set constants used in transforms for analysis grid
173175
sp%jcap=jcap
@@ -191,7 +193,6 @@ subroutine general_init_spec_vars(sp,jcap,jcap_test,nlat_a,nlon_a,eqspace)
191193
sp%je=(sp%jmax+1)/2
192194

193195

194-
195196
! Allocate and initialize fact arrays
196197
if(sp%lallocated) then
197198
deallocate(sp%factsml,sp%factvml,sp%eps,sp%epstop,sp%enn1,sp%elonn1,sp%eon,sp%eontop)
@@ -229,11 +230,17 @@ subroutine general_init_spec_vars(sp,jcap,jcap_test,nlat_a,nlon_a,eqspace)
229230
ldafft=50000+4*sp%imax ! ldafft=256+imax would be sufficient at GMAO.
230231
allocate( sp%afft(ldafft))
231232
allocate( sp%clat(sp%jb:sp%je) )
232-
allocate( sp%slat(sp%jb:sp%je) )
233-
allocate( sp%wlat(sp%jb:sp%je) )
233+
allocate( sp%slat(sp%jb:sp%je) )
234+
allocate( sp%wlat(sp%jb:sp%je) )
234235
call spwget(sp%iromb,sp%jcap,sp%eps,sp%epstop,sp%enn1, &
235236
sp%elonn1,sp%eon,sp%eontop)
236-
call spffte(sp%imax,(sp%imax+2)/2,sp%imax,2,0.,0.,0,sp%afft)
237+
! Allocate dummy_w and dummy_g arrays for spffte (unused, but required by spffte)
238+
allocate(dummy_w((sp%imax+2)/2,2), dummy_g(sp%imax,2))
239+
dummy_w=zero
240+
dummy_g=zero
241+
call spffte(sp%imax,(sp%imax+2)/2,sp%imax,2,dummy_w,dummy_g,0,sp%afft)
242+
if(allocated(dummy_w)) deallocate(dummy_w)
243+
if(allocated(dummy_g)) deallocate(dummy_g)
237244
call splat(sp%idrt,sp%jmax,slatx,wlatx)
238245
jhe=(sp%jmax+1)/2
239246
if(jhe > sp%jmax/2)wlatx(jhe)=wlatx(jhe)/2
@@ -248,14 +255,14 @@ subroutine general_init_spec_vars(sp,jcap,jcap_test,nlat_a,nlon_a,eqspace)
248255
allocate( sp%plntop(sp%jcap+1,sp%jb:sp%je) )
249256
do j=sp%jb,sp%je
250257
call splegend(sp%iromb,sp%jcap,sp%slat(j),sp%clat(j),sp%eps, &
251-
sp%epstop,sp%pln(1,j),sp%plntop(1,j))
258+
sp%epstop,sp%pln(:,j),sp%plntop(:,j))
252259
end do
253260
else
254261
sp%precalc_pln=.false.
255262
allocate( sp%pln(sp%ncd2,1) )
256263
allocate( sp%plntop(sp%jcap+1,1) )
257264
end if
258-
265+
259266
! obtain rlats and rlons
260267
half_pi=half*pi
261268
two_pi=two*pi

0 commit comments

Comments
 (0)