33 real(kind=kind(1.0D0)),
allocatable,
dimension(:) :: weight
35 integer :: time_bwn_obs
36 real(kind=kind(1.0D0)) :: nudgefac
41 real(kind=kind(1.0D0)),
allocatable,
dimension(:,:) :: psi
42 real(kind=kind(1.0D0)),
allocatable,
dimension(:) :: mean
43 real(kind=kind(1.0D0)) :: nfac
44 real(kind=kind(1.0D0)) :: ufac
45 real(kind=kind(1.0D0)) :: efac
46 real(kind=kind(1.0D0)) :: keep
47 real(kind=kind(1.0D0)) :: time
48 real(kind=kind(1.0D0)) :: qscale
50 real(kind=kind(1.0d0)) :: rho
53 real(kind=kind(1.0d0)) :: len
59 integer :: couple_root
60 logical :: use_talagrand
63 logical :: output_weights
68 logical :: use_variance
70 logical :: use_spatial_rmse
72 logical :: use_ens_rmse
75 character(250) :: rmse_filename
77 character(250) :: forecast_path
79 character(50) :: relaxation_type
91 real(kind=kind(1.0d0)) :: relaxation_freetime
93 real(kind=kind(1.0d0)) :: power_law_p
96 integer,
dimension(:,:),
allocatable :: talagrand
98 integer,
allocatable,
dimension(:) :: particles
99 character(2) :: filter
149 write(emp_o,
'(A)')
'Opening empire namelist file:'
153 pf%efac = 0.001/pf%nens
154 write(emp_o,
'(A)')
'empire namelist successfully read to control pf code.'
222 integer :: time_obs=-1
223 integer :: time_bwn_obs=-1
224 real(kind=kind(1.0D0)) :: nudgefac=-1.0d0
225 logical :: gen_data,gen_Q
226 real(kind=kind(1.0D0)) :: nfac=-1.0d0
227 real(kind=kind(1.0D0)) :: ufac=-1.0d0
228 real(kind=kind(1.0D0)) :: Qscale=-1.0d0
229 real(kind=kind(1.0D0)) :: rho=0.0d0
230 real(kind=kind(1.0d0)) :: len=-1.0d0
231 real(kind=kind(1.0D0)) :: keep
232 logical :: use_talagrand,use_mean,use_variance,use_traj&
233 &,use_spatial_rmse,use_ens_rmse,output_weights,output_forecast
234 character(2) :: filter=
'++'
235 character(1) :: init=
'+'
236 character(250) :: rmse_filename=
'rmse'
237 character(250) :: forecast_path=
'forecast/'
238 character(50) :: relaxation_type=
'zero_linear'
239 real(kind=kind(1.0d0)) :: power_law_p=1.0d0
240 real(kind=kind(1.0d0)) :: relaxation_freetime=0.6d0
242 logical :: file_exists
244 namelist/pf_params/time_obs,time_bwn_obs,&
253 &use_talagrand,use_mean,use_variance,use_traj,use_spatial_rmse,use_ens_rmse,&
260 &relaxation_type,power_law_p,relaxation_freetime
265 use_talagrand = .false.
267 use_variance = .false.
269 use_spatial_rmse = .false.
270 use_ens_rmse = .false.
271 output_weights=.false.
275 inquire(file=
'pf_parameters.dat',exist=file_exists)
277 open(unit_nml,file=
'pf_parameters.dat',iostat=ios,action=
'read'&
280 write(emp_e,*)
'Cannot open pf_parameters.dat'
284 inquire(file=
'empire.nml',exist=file_exists)
286 open(unit_nml,file=
'empire.nml',iostat=ios,action=
'read'&
288 if(ios .ne. 0) stop
'Cannot open empire.nml'
290 write(emp_e,*)
'ERROR: cannot find pf_parameters.dat or empire.nml'
295 read(unit_nml,nml=pf_params)
298 if(time_obs .gt. -1)
then
299 print*,
'read time_obs = ',time_obs
300 pf%time_obs = time_obs
302 if(time_bwn_obs .gt. -1)
then
303 print*,
'read time_bwn_obs = ',time_bwn_obs
304 pf%time_bwn_obs = time_bwn_obs
306 if(nudgefac .gt. -1.0d0)
then
307 print*,
'read nudgefac = ',nudgefac
308 pf%nudgefac = nudgefac
311 if(nfac .gt. -1.0d0)
then
312 print*,
'read nfac = ',nfac
316 if(keep .gt. -1.0d0)
then
317 print*,
'read keep = ',keep
321 if(ufac .gt. -1.0d0)
then
322 print*,
'read ufac = ',ufac
327 if(qscale .gt. -1.0d0)
then
328 print*,
'read Qscale = ',qscale
333 if(rho .gt. 0.0d0)
then
334 print*,
'read rho = ',rho
336 elseif(rho .lt. 0.0d0)
then
337 print*,
'read rho = ',rho,
' WARNING ABOUT THAT ONE! rho is nor&
345 if(len .ge. 0.0d0)
then
346 print*,
'read len = ',len
352 if(relaxation_type .ne.
'zero_linear')
then
353 print*,
'read relaxation_type = ',relaxation_type
354 pf%relaxation_type = relaxation_type
356 pf%relaxation_type = relaxation_type
359 if(relaxation_freetime .ne. 0.6d0)
then
360 print*,
'read relaxation_freetime = ',relaxation_freetime
361 pf%relaxation_freetime = relaxation_freetime
363 pf%relaxation_freetime = relaxation_freetime
366 if(power_law_p .ne. 1.0d0)
then
367 print*,
'read power_law_p = ',power_law_p
368 pf%power_law_p = power_law_p
370 pf%power_law_p = power_law_p
377 if(use_spatial_rmse)
then
378 print*,
'going to output spatial Root mean squared errors'
381 if(use_ens_rmse)
then
382 print*,
'going to output field of Root mean squared errors'
386 print*,
'going to output ensemble mean'
389 if(use_variance)
then
390 print*,
'going to output ensemble variance'
393 if(output_weights)
then
394 print*,
'going to output ensemble weights'
398 print*,
'going to output ensemble forecasts'
403 print*,
'going to output trajectories'
407 if(rmse_filename .ne.
'rmse')
then
408 print*,
'read rmse_filename = ',rmse_filename
410 pf%rmse_filename = rmse_filename
412 if(forecast_path .ne.
'forecast/')
then
413 print*,
'read forecast_path = ',forecast_path
415 pf%forecast_path = forecast_path
418 if(filter .ne.
'++')
then
419 print*,
'read filter = ',filter
432 select case(pf%filter)
434 print*,
'Running the equivalent weights particle filter'
436 print*,
'Running the Zhu equal weights particle filter'
438 print*,
'Running a stochastic ensemble'
440 print*,
'Running a deterministic ensemble'
442 print*,
'Running the SIR particle filter'
444 print*,
'filter read as ET. This is depreciated. Changing to L&
447 print*,
'Running the Local Ensemble Transform Kalman Filter'
448 print*,
'With random noise'
449 print*,
'For LETKF without random noise set filter="LD"'
451 print*,
'Running the Ensemble Adjustment Kalman Filter'
452 write(emp_e,*)
'Error: The EAKF is not implemented here yet'
455 print*,
'Running the Local Ensemble Transform Kalman Filter'
456 print*,
'With random noise'
458 print*,
'Running the Local Ensemble Transform Kalman Smoother'
459 print*,
'With random noise'
461 print*,
'Running the Local Ensemble Transform Kalman Filter'
462 print*,
'With NO random noise'
464 print*,
'Running a stochastic ensemble and 3DVar at observatio&
468 write(emp_e,*)
'Error: Incorrect filter type selected:', pf%filter
469 write(emp_e,*)
'Please ensure that pf%filter in empire.nml is either:'
470 write(emp_e,*)
'EW the equivalent weights particle f&
472 write(emp_e,*)
'EZ the Zhu equal weights particle f&
474 write(emp_e,*)
'SE a stochastic ensemble'
475 write(emp_e,*)
'DE a deterministic ensemble'
476 write(emp_e,*)
'SI the SIR particle filter'
477 write(emp_e,*)
'LE the Local Ensemble Transform Kalman Filter'
478 write(emp_e,*)
' with random noise'
479 write(emp_e,*)
'LD the Local Ensemble Transform Kalman Filter'
480 write(emp_e,*)
' without random noise'
481 write(emp_e,*)
'LS the Local Ensemble Transform Kalman Smoother'
482 write(emp_e,*)
' with random noise'
483 write(emp_e,*)
'3D 3DVar'
488 if(init .ne.
'+')
then
489 print*,
'read init = ',init
493 pf%gen_data = gen_data
495 pf%use_talagrand = use_talagrand
496 pf%use_mean = use_mean
497 pf%use_variance = use_variance
498 pf%use_traj = use_traj
499 pf%use_spatial_rmse = use_spatial_rmse
500 pf%use_ens_rmse = use_ens_rmse
501 pf%output_weights = output_weights
507 pf%use_talagrand=.false.
508 pf%use_spatial_rmse = .false.
509 pf%use_ens_rmse = .false.
510 pf%output_forecast = .false.
520 deallocate(pf%weight)
522 if(
allocated(pf%talagrand))
deallocate(pf%talagrand)
523 deallocate(pf%particles)
subroutine parse_pf_parameters
subroutine to read the namelist file and save it to pf datatype Here we read pf_parameters.dat or empire.nml
subroutine deallocate_pf
subroutine to deallocate space for the filtering code
Module that stores the information about the outputting from empire.
subroutine set_pf_controls
subroutine to ensure pf_control data is ok
module pf_control holds all the information to control the the main program
subroutine set_var_controls
subroutine to ensure vardata is ok
module holding data for variational problems
subroutine output_forecast
subroutine to output forecast ensemble to forecast_path