Skip to content

Commit 6386a98

Browse files
committed
New inputs DA:total_steps and DA:tstartcycle
Option to set `total_steps` and `tstartcycle` directly. Before / by default, they are set through `PF:simtime` and `PF:starttime`, respectively.
1 parent 595912a commit 6386a98

File tree

2 files changed

+74
-12
lines changed

2 files changed

+74
-12
lines changed

bldsva/intf_DA/pdaf/model/common/read_enkfpar.c

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ void read_enkfpar(char *parname)
9696
strcpy(outdir,string);
9797
nreal = iniparser_getint(pardict,"DA:nreal",0);
9898
startreal = iniparser_getint(pardict,"DA:startreal",0);
99+
total_steps = iniparser_getint(pardict,"DA:total_steps",-1);
100+
tstartcycle = iniparser_getint(pardict,"DA:tstartcycle",-1);
99101
da_interval = iniparser_getdouble(pardict,"DA:da_interval",1);
100102
da_interval_final = iniparser_getdouble(pardict,"DA:da_interval_final",1);
101103
flexible_da_interval = iniparser_getint(pardict,"DA:flexible_da_interval",0);
@@ -107,15 +109,38 @@ void read_enkfpar(char *parname)
107109
da_crns_depth_tol = iniparser_getdouble(pardict,"DA:da_crns_depth_tol",0.01);
108110
clmcrns_bd = iniparser_getdouble(pardict, "DA:crns_bd", -1.0);
109111
da_print_obs_index = iniparser_getint(pardict,"DA:print_obs_index",0);
110-
total_steps = (int) (t_sim/da_interval);
111-
tstartcycle = (int) (t_start/da_interval);
112112

113-
/* print inputs / debug output for data assimilation settings */
113+
/* Debug output */
114114
if (mype_world == 0) {
115115
if (screen_wrapper > 0) {
116116
printf("TSMP-PDAF-WRAPPER mype(w)=%5d read_enkfpar: [DA]\n",mype_world);
117117
printf("TSMP-PDAF-WRAPPER mype(w)=%5d ------------------\n",mype_world);
118-
printf("TSMP-PDAF-WRAPPER mype(w)=%5d t_sim = %lf | da_interval = %lf | total_steps = %d\n",mype_world,t_sim,da_interval,total_steps);
118+
}
119+
}
120+
121+
/* Set total_steps from PF:simtime if it has not been set
122+
directly */
123+
if (total_steps == -1) {
124+
total_steps = (int) (t_sim/da_interval);
125+
126+
/* Debug output */
127+
if (mype_world == 0) {
128+
if (screen_wrapper > 0) {
129+
printf("TSMP-PDAF-WRAPPER mype(w)=%5d total_steps set based on t_sim = %lf\n",mype_world,t_sim);
130+
}
131+
}
132+
}
133+
134+
/* Set tstartcycle from PF:starttime if it has not been set
135+
directly */
136+
if (tstartcycle == -1) {
137+
tstartcycle = (int) (t_start/da_interval);
138+
}
139+
140+
/* Debug output */
141+
if (mype_world == 0) {
142+
if (screen_wrapper > 0) {
143+
printf("TSMP-PDAF-WRAPPER mype(w)=%5d da_interval = %lf | total_steps = %d\n",mype_world,da_interval,total_steps);
119144
printf("TSMP-PDAF-WRAPPER mype(w)=%5d nreal = %d | n_modeltasks = %d\n",mype_world,nreal,n_modeltasks);
120145
}
121146
}

doc/content/setup_tsmp/input_enkfpf.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ dtmult =
7070
outdir = ""
7171
nreal =
7272
startreal =
73+
total_steps =
74+
tstartcycle =
7375
da_interval =
7476
da_interval_final =
7577
flexible_da_interval =
@@ -99,8 +101,12 @@ available in a single `COMM_model`. Each `COMM_model` contains
99101

100102
### PF:starttime ###
101103

102-
`PF:starttime`: (real) ParFlow start time. Must match with the
103-
specifications in the `*.pfidb` input (`TimingInfo.StartTime`).
104+
`PF:starttime`: (real) ParFlow start time.
105+
106+
Not used if `DA:tstartcycle` is set.
107+
108+
If used: Must match with the specifications in the `*.pfidb` input
109+
(`TimingInfo.StartTime`).
104110

105111
### PF:dt ###
106112

@@ -167,11 +173,14 @@ Deprecated. Sets `PF:simtime`.
167173
`PF:simtime`: (real) Total simulation time (in terms of ParFlow
168174
timing).
169175

170-
For all simulations (including CLMSA): `PF:simtime` is used in
171-
conjunction with `DA:da_interval` to determine `total_steps`, the
172-
total number of iterations of the main data assimilation loop. Each
173-
iteration of the main data assimilation loop consists of one forward
174-
simulation and one data assimilation step.
176+
Not used if `DA:total_steps` is set.
177+
178+
If `DA:total_steps` is not set, the following holds for all
179+
simulations (including CLMSA): `PF:simtime` is used in conjunction
180+
with `DA:da_interval` to determine `total_steps`, the total number of
181+
iterations of the main data assimilation loop. Each iteration of the
182+
main data assimilation loop consists of one forward simulation and one
183+
data assimilation step.
175184

176185
\begin{align*}
177186
\mathtt{total\_steps} &= \frac{\mathtt{PF:simtime}}{\mathtt{DA:da\_interval}}
@@ -619,6 +628,32 @@ errors. Recommendation: Use at least an ensemble size of 4.
619628
`DA:startreal`: (integer) Added to suffix-numbers for input file
620629
creation.
621630

631+
### DA:total_steps ###
632+
633+
`DA:total_steps`: (integer) Number of observation Intervals.
634+
635+
Together with `DA:da_interval` and `DA:startcycle`, `DA:total_steps`
636+
determines the simulation time.
637+
638+
If not set directly, `DA:total_steps` is determined from `PF:simtime`.
639+
640+
`DA:total_steps` must be in sync with timing information from
641+
component models.
642+
643+
- ParFlow: `DA:total_steps` times `DA:da_interval` should be
644+
`TimingInfo.StopTime` minus `TimingInfo.StartTime` (from `*.pfidb`).
645+
646+
- CLM: `DA:total_steps` times `DA:da_interval` should be the number of
647+
CLM time steps in `stop_ymd` minus `start_ymd start_tod`. To be
648+
safe, CLM's stoptime can be chosen later, such that it will be
649+
stopped by the TSMP-PDAF stop alarm.
650+
651+
### DA:tstartcycle ###
652+
653+
`DA:tstartcycle`: (integer) First observation cycle (file) to use.
654+
655+
This should be zero. Other values are currently not supported.
656+
622657
### DA:da_interval ###
623658

624659
`DA:da_interval`: (double) Time interval (units of ParFlow timing,
@@ -637,7 +672,9 @@ assimilation.
637672

638673
For CLM simulations, `DA:da_interval` determines the number of
639674
CLM-time-steps between two assimilations together with `PF:dt`. See
640-
the section of `PF:dt` for more detail.
675+
the section of `PF:dt` for more detail. In particular, for CLM
676+
simulations and `PF:dt==1.0`, `DA:da_interval` is in units of CLM time
677+
steps.
641678

642679
One exception is that the observation file is empty at a data
643680
assimilation step. Then, no data assimilation takes place and the next

0 commit comments

Comments
 (0)