Skip to content

Commit fa7e16b

Browse files
committed
pushing IC files for longer simulations
1 parent 73ff04e commit fa7e16b

File tree

4 files changed

+76
-29
lines changed

4 files changed

+76
-29
lines changed

RKLM_Python/data_assimilation/params.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ def __init__(self,N,da_type='rloc'):
1313

1414
self._da_times = np.arange(0.0,3.25,0.25)[1:]
1515
# self._da_times = np.arange(5.0,10.5,0.5)/10.0
16+
# self._da_times = [0.1]
1617
self._da_times = np.around(self.da_times,3)
1718

1819
self.obs_attributes = ['rho','rhou', 'rhov', 'rhoY', 'p2_nodes']
19-
# self.obs_attributes = ['rho']
20+
# self.obs_attributes = ['rhou','rhov']
2021

2122
# which attributes to inflate in ensemble inflation?
2223
self.attributes = ['rho', 'rhou', 'rhov']
@@ -45,7 +46,7 @@ def __init__(self,N,da_type='rloc'):
4546
if self.sparse_obs_by_attr:
4647
assert(0, "Not yet implemented.")
4748

48-
self.obs_frac = 0.10 # fraction of the observations to pick.
49+
self.obs_frac = 0.90 # fraction of the observations to pick.
4950
self.gen_obs_sparse()
5051

5152
############################################

RKLM_Python/inputs/travelling_vortex_2D.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ def __init__(self):
134134
if self.continuous_blending == True:
135135
self.output_suffix = "_%i_%i_%.1f" %(self.inx-1,self.iny-1,self.tout[-1])
136136

137-
aux = 'pos_debug'
137+
aux = 'analytical_truth'
138+
aux = 'debug_cov'
138139
self.aux = aux
139140

140141
self.output_suffix = "_%i_%i_%.1f_%s" %(self.inx-1,self.iny-1,self.tout[-1],aux)
@@ -166,11 +167,11 @@ def sol_init(Sol, mpv, elem, node, th, ud, seed=None):
166167

167168
# gradient wind eqn:
168169
# p = Int[( alpha_const * 1/2 * rho0 + alpha * 1/2 * rho(r)) * u^2 / r, r]
169-
# factors of 1/2 * rho(r)
170+
# factors of 1/2 * rho(r) * u^2 / r
170171
alpha = -1.0
171172
# factors of 1/2 rho0 * u^2 / r
172-
alpha_const = 3.0
173-
rho0 = 1.5
173+
alpha_const = 2.0
174+
rho0 = 1.0
174175
del_rho = -0.5
175176
R0 = 0.4
176177
fac = 1. * 1024.0
@@ -181,13 +182,13 @@ def sol_init(Sol, mpv, elem, node, th, ud, seed=None):
181182
np.random.seed(seed)
182183
xc += (np.random.random() - 0.5) / 5.0
183184
yc += (np.random.random() - 0.5) / 5.0
184-
print(seed, xc, yc)
185+
185186

186187
if 'truth' in ud.aux or 'obs' in ud.aux:
187188
np.random.seed(2233)
188189
xc += (np.random.random() - 0.5) / 5.0
189190
yc += (np.random.random() - 0.5) / 5.0
190-
print(seed, xc, yc)
191+
191192
ud.xc = xc
192193
ud.yc = yc
193194

RKLM_Python/results_gen.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
##########################################
4343
# generate initial blending for section 5a
4444
gen_5a1_euler = False
45-
gen_5a2_rb = False
45+
gen_5a2_rb = True
4646
# generate obs and truth for section 5b
4747
gen_5b_obs_truth_euler = False
4848
# generate Euler ensemble simulations for
@@ -60,7 +60,7 @@
6060
gen_5b_5c2_rb = False
6161

6262
gen_loc_errors_tv = False
63-
gen_loc_errors_rb = True
63+
gen_loc_errors_rb = False
6464

6565
# Otherwise, if gen_all = True, generate all
6666
# results
@@ -90,6 +90,8 @@
9090
# Do not output in between, but output
9191
# after each timestep.
9292
tout = [1.0]
93+
# tout = np.arange(0.0,1.005,0.005)[1:]
94+
# tout = tout.tolist()
9395

9496
# JSON dumping does not accept ndarrays.
9597
# tout = tout.tolist()
@@ -289,6 +291,8 @@
289291
rp.N = 1
290292
rp.tc = 'rb'
291293
tout = [1.0]
294+
# tout = np.arange(0.05,1.05,0.05)
295+
# tout = list(tout)
292296
# No data assimilation.
293297
dap = {
294298
'None' : None,
@@ -447,7 +451,7 @@
447451
# run simulation
448452
rp.ud = json.dumps(ud)
449453
rp.dap = json.dumps(dap)
450-
# rp.queue_run()
454+
rp.queue_run()
451455

452456
##########################################
453457

@@ -467,7 +471,7 @@
467471
# run simulation
468472
rp.ud = json.dumps(ud)
469473
rp.dap = json.dumps(dap)
470-
# rp.queue_run()
474+
rp.queue_run()
471475

472476

473477
if gen_5c1_euler_full or gen_all:
@@ -480,8 +484,8 @@
480484

481485
# da_times = np.arange(5.0,10.5,0.5)/10.0
482486
# da_times = np.array([0.25,10.0])
483-
da_times = np.arange(0.0,10.25,0.25)[1:]
484-
# da_times = np.arange(0.0,3.25,0.25)[1:]
487+
# da_times = np.arange(0.0,10.25,0.25)[1:]
488+
da_times = np.arange(0.0,3.25,0.25)[1:]
485489
da_times = np.around(da_times,3)
486490
da_times = da_times.tolist()
487491

@@ -501,7 +505,7 @@
501505
# Assimilate all fields
502506
'obs_attrs' : ['rho', 'rhou', 'rhov', 'rhoY', 'p2_nodes'],
503507
# Path to the generated observation
504-
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_10.0_obs.h5',
508+
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_3.0_obs.h5',
505509
'loc_setter' : (11,11)
506510
}
507511

RKLM_Python/tv_enda_tests.py

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@
4646
# section 5c1 with assimilation of all
4747
# fields
4848
generate_noda = False
49-
gen_5c1_euler_full = False
49+
generate_oneda = False
50+
gen_5c1_euler_full = True
5051
gen_5c1_euler_momenta = False
51-
gen_loc_errors_tv = True
52+
gen_loc_errors_tv = False
5253

5354
# Otherwise, if gen_all = True, generate all
5455
# results
@@ -58,7 +59,9 @@
5859
# path_to_obs = '/srv/public/ray/'
5960
path_to_obs = './'
6061

61-
enda_sfx = 'wda_varcov'
62+
enda_sfx = 'wda_obsconv'
63+
noda_sfx = ''
64+
ref_aux = '_truthgen'
6265

6366
if gen_5b_obs_truth_euler or gen_all:
6467
##########################################
@@ -76,7 +79,8 @@
7679

7780
# simulation parameters for the observation
7881
ud = {
79-
'aux' : 'obs',
82+
'aux' : 'obs%s' %ref_aux,
83+
'initial_blending' : False
8084
}
8185

8286
# data assimilation parameters for the
@@ -94,7 +98,7 @@
9498

9599
# simulation parameters for the truth
96100
ud = {
97-
'aux' : 'truth',
101+
'aux' : 'truth%s' %ref_aux,
98102
# Do blending for the initial time-step
99103
'initial_blending' : True
100104
}
@@ -113,8 +117,8 @@
113117
#
114118
##########################################
115119

116-
da_times = np.arange(0.0,10.25,0.25)[1:]
117-
da_times = np.arange(0.0,3.25,0.25)[1:]
120+
da_times = np.arange(0.0,10.05,0.05)[1:]
121+
# da_times = np.arange(0.0,3.25,0.25)[1:]
118122
da_times = np.around(da_times,3)
119123
da_times = da_times.tolist()
120124

@@ -125,7 +129,7 @@
125129

126130
# Generate ensemble with no DA
127131
ud = {
128-
'aux' : 'noda',
132+
'aux' : 'noda%s' %noda_sfx,
129133
# Do blending for initial time-step
130134
'initial_blending' : True
131135
}
@@ -137,7 +141,7 @@
137141
'obs_attrs' : ['rho', 'rhou', 'rhov', 'rhoY', 'p2_nodes'],
138142
'loc_setter' : (11, 11),
139143
# Path to the generated observation
140-
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_3.0_obs.h5'
144+
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_10.0_obs%s.h5' %ref_aux
141145
}
142146

143147
# run simulation
@@ -146,6 +150,32 @@
146150
if generate_noda:
147151
rp.queue_run()
148152

153+
154+
# Generate ensemble with one DA
155+
ud = {
156+
'aux' : 'oneda%s' %noda_sfx,
157+
# Do blending for initial time-step
158+
'initial_blending' : True
159+
}
160+
161+
# For the data assimilation parameters,
162+
# do not do DA at any time-point.
163+
dap = {
164+
'da_times' : [0.25],
165+
'obs_attrs' : ['rho', 'rhou', 'rhov', 'rhoY', 'p2_nodes'],
166+
'loc_setter' : (11, 11),
167+
# Path to the generated observation
168+
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_10.0_obs%s.h5' %ref_aux
169+
}
170+
171+
# run simulation
172+
rp.ud = json.dumps(ud)
173+
rp.dap = json.dumps(dap)
174+
if generate_oneda:
175+
rp.queue_run()
176+
177+
178+
# Generate ensemble EnDA
149179
ud = {
150180
'aux' : '%s' %enda_sfx,
151181
# Do blending for initial time-step
@@ -162,15 +192,26 @@
162192
pi = p**0.4
163193
v = 4.0 / u_ref
164194

195+
196+
sd_rho = 0.025
197+
sd_rhou = 0.0325
198+
sd_rhov = 0.0325
199+
sd_rhoY = 0.00025
200+
sd_pi = 0.0004
201+
sds = np.array([sd_rho, sd_rhou, sd_rhov, sd_rhoY, sd_pi])
202+
sds *= 2.0 # let's make it 10%
203+
sds = np.sqrt(sds)
165204
dap = {
166205
'da_times' : da_times,
167206
# Assimilate all fields
168207
'obs_attrs' : ['rho', 'rhou', 'rhov', 'rhoY', 'p2_nodes'],
169208
# Path to the generated observation
170-
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_3.0_obs.h5',
171-
'loc_setter' : (11, 11),
209+
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_10.0_obs%s.h5' %ref_aux,
210+
'loc_setter' : (21, 21),
172211
# using variance: 1K for temperature, 4ms^-1 for velocity, 50Pa for pressure
173212
# 'sd_setter' : [rho**0.5, (rho*v)**0.5, (rho*v)**0.5, p**0.5, pi**0.5],
213+
# 'sd_setter' : [0.05**2, 0.05**2, 0.05**2, 0.1, 0.0004],
214+
# 'sd_setter' : list(sds),
174215
}
175216

176217
# run simulation
@@ -222,7 +263,7 @@
222263
# Assimilate the momentum fields
223264
'obs_attrs' : ['rhou', 'rhov'],
224265
# Path to the generated observation
225-
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_3.0_obs.h5'
266+
'obs_path' : path_to_obs + 'output_travelling_vortex/output_travelling_vortex_ensemble=1_64_64_3.0_obs%s.h5' %ref_aux
226267
}
227268

228269
# run simulation
@@ -382,7 +423,7 @@
382423
# run simulation
383424
rp.ud = json.dumps(ud)
384425
rp.dap = json.dumps(dap)
385-
# rp.queue_run()
426+
rp.queue_run()
386427

387428
ud = {
388429
'aux' : 'wda_7',
@@ -394,7 +435,7 @@
394435
# run simulation
395436
rp.ud = json.dumps(ud)
396437
rp.dap = json.dumps(dap)
397-
# rp.queue_run()
438+
rp.queue_run()
398439

399440

400441

0 commit comments

Comments
 (0)