John,
Thanks for checking the code on your side. I appreciate your help (always).
As for your comments, I still want to run long-simulation (1+ year) and for the purpose, keeping the file splitting function is necessary as without it, the history file created would be huge.... (FYI. the total size of one-year run is close to 1 TB).
So I ended up with modifying the source code to fulfill my need.
A good thing is that now I can change if I want to include initial fields or not only by changing a parameter I created (NHISSTR) in ocean.in.
Details of what I did are below.
Three files needed to be modified.
Nonlinear/output.F
Utility/read_phypar.F
Modules/mod_scalars.F
In
Utility/read_phypar.F, I added the following lines
Code: Select all
685 CASE ('NHISSTR')
686 Npts=load_i(Nval, Rval, Ngrids, nHISstr)
In
Modules/mod_scalars.F, I added two lines as follow
Code: Select all
1008 integer, allocatable :: nHISstr(:) ! select to add initial
1009 ! fields to history
1010 ! file. 0:include,
1011 ! 1:exclude
and
In
Nonlinear/output.F
I changed the follwoing lines
Code: Select all
144 IF (iic(ng).eq.ntstart(ng)) THEN
145 CALL def_his (ng, ldefout(ng))
146 IF (FoundError(exit_flag, NoError, __LINE__, &
147 & __FILE__)) RETURN
148 LwrtHIS(ng)=.TRUE.
149 LdefHIS(ng)=.FALSE.
150 END IF
to the following lines
Code: Select all
145 ! ---- added by DJ@TAMU
146 IF (nHISstr(ng).eq.0) THEN
147 ! include initial fields to history file(Original version)
148 IF (iic(ng).eq.ntstart(ng)) THEN
149 CALL def_his (ng, ldefout(ng))
150 IF (FoundError(exit_flag, NoError, __LINE__, &
151 & __FILE__)) RETURN
152 LwrtHIS(ng)=.TRUE.
153 LdefHIS(ng)=.FALSE.
154 END IF
155
156 ELSE IF (nHISstr(ng).eq.1) THEN
157 ! exclude initail fields to history file (modified version)
158 IF (iic(ng).eq.ntstart(ng).and.(nrrec(ng).ne.0)) THEN
159 ! IF (iic(ng).eq.ntstart(ng)) THEN
160 LwrtHIS(ng)=.False.
161 LdefHIS(ng)=.True.
162 ELSE
163 LwrtHIS(ng)=.True.
164 LdefHIS(ng)=.FALSE.
165 CALL def_his (ng, ldefout(ng))
166 IF (FoundError(exit_flag, NoError, __LINE__, &
167 & __FILE__)) RETURN
168 END IF
169 END IF
170 ! --------------------------
Lastly, in ocean.in, I added the following line below NDEFHIS == 0
Code: Select all
248 NHISSTR == 0 ! 0 to include inital fields, 1 to exclude
That's it. With this modification, if you want to use a non-zero value of NDEFHIS, the modification won't do anything, but if you set NDEFHIS == 0, depending on NHISSTR, initial fields are included or excluded depending on user choice. Hope I did not do anything (terribly) wrong.
I added two ncview snapshots and see the 1st on includes initial fields (NHISSTR==0), and the other doesn't (NHISSTR==1). It seems to be working. It's a subtle thing and possibly nobody cares, but it is kind of important to me as I need to aggregate nowcast and hindcast with NCO/CDO and on THREDDS. And Python Xarray hates duplications...
Cheers,
-DJ