1 # 1 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/bump_main.fypp"
2 # 1 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/../../src/saber/instrumentation.fypp" 1
3 # 1 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/../../src/saber/subr_list.fypp" 1
12 # 726 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/../../src/saber/subr_list.fypp"
13 # 2 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/../../src/saber/instrumentation.fypp" 2
22 # 112 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/../../src/saber/instrumentation.fypp"
23 # 2 "/Users/miesch/JEDI/code/working_copy/public/fv3-bundle/saber/test/mains/bump_main.fypp" 2
31 subroutine bump_main(n1,arg1,n2,arg2) bind (c,name='bump_main_f90')
33 use fckit_configuration_module,
only: fckit_configuration,fckit_yamlconfiguration
34 use fckit_mpi_module,
only: fckit_mpi_comm
35 use fckit_pathname_module,
only: fckit_pathname
36 use iso_c_binding,
only: c_int,c_char
37 use iso_fortran_env,
only: output_unit
47 integer(c_int),
intent(in) :: n1
48 character(c_char),
intent(in) :: arg1(n1)
49 integer(c_int),
intent(in) :: n2
50 character(c_char),
intent(in) :: arg2(n2)
53 integer :: i,ppos,iproc,ie,ifileunit
54 character(len=1024) :: inputfile,logdir,ext,filename
55 type(fckit_configuration) :: conf
57 type(fckit_mpi_comm) :: f_comm
62 f_comm = fckit_mpi_comm()
67 inputfile(i:i) = arg1(i)
76 mpl%msv%valr = -999.0_kind_real
85 call bump%nam%init(mpl%nproc)
88 ppos = scan(inputfile,
".",back=.true.)
89 ext = inputfile(ppos+1:)
90 select case (trim(ext))
93 call bump%nam%read(mpl,inputfile)
98 conf = fckit_yamlconfiguration(fckit_pathname(inputfile))
101 call bump%nam%from_conf(f_comm,conf)
105 write(output_unit,
'(a)')
'Error: input file has a wrong extension (should be .nam or .yaml)'
106 call flush(output_unit)
111 call bump%nam%bcast(mpl)
115 if ((trim(bump%nam%verbosity)==
'all').or.((trim(bump%nam%verbosity)==
'main').and.(iproc==mpl%rootproc)))
then
116 if (iproc==mpl%myproc)
then
118 call mpl%newunit(mpl%lunit)
121 write(filename,
'(a,i6.6,a)') trim(bump%nam%prefix)//
'.',mpl%myproc-1,
'.out'
122 inquire(file=filename,number=ifileunit)
123 if (ifileunit<0)
then
124 open(unit=mpl%lunit,file=trim(logdir)//
'/'//trim(filename),action=
'write',status=
'replace')
127 open(unit=mpl%lunit,file=trim(logdir)//
'/'//trim(filename),action=
'write',status=
'replace')
130 call mpl%f_comm%barrier
135 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
137 write(mpl%info,
'(a)')
'--- You are running the BUMP main program -------------------------'
141 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
143 write(mpl%info,
'(a)')
'--- Setup model'
145 call model%setup(mpl,bump%nam)
148 if (bump%nam%ens1_ne>0)
then
149 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
151 write(mpl%info,
'(a)')
'--- Load ensemble 1'
153 call model%load_ens(mpl,bump%nam,
'ens1')
155 if (bump%nam%ens2_ne>0)
then
156 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
158 write(mpl%info,
'(a)')
'--- Load ensemble 2'
160 call model%load_ens(mpl,bump%nam,
'ens2')
164 call bump%setup(f_comm,model%afunctionspace,model%fieldset,lunit=mpl%lunit,msvali=mpl%msv%vali,msvalr=mpl%msv%valr)
167 if (bump%nam%ens1_ne>0)
then
168 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
170 write(mpl%info,
'(a)')
'--- Add members of ensemble 1'
172 do ie=1,bump%nam%ens1_ne
173 write(mpl%info,
'(a7,a,i4,a,i4)')
'',
'Member ',ie,
' / ',bump%nam%ens1_ne
175 call bump%add_member(model%ens1(ie),ie,1)
178 if (bump%nam%ens2_ne>0)
then
179 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
181 write(mpl%info,
'(a)')
'--- Add members of ensemble 2'
183 do ie=1,bump%nam%ens2_ne
184 write(mpl%info,
'(a7,a,i4,a,i4)')
'',
'Member ',ie,
' / ',bump%nam%ens2_ne
186 call bump%add_member(model%ens2(ie),ie,2)
191 if (bump%nam%check_set_param_cor.or.bump%nam%check_set_param_hyb.or.bump%nam%check_set_param_lct)
then
192 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------'
194 write(bump%mpl%info,
'(a)')
'--- Test set_parameters interfaces'
195 call bump%mpl%flush()
196 call bump%test_set_parameter
197 if (bump%nam%default_seed)
call bump%rng%reseed(mpl)
201 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
203 write(mpl%info,
'(a)')
'--- Run drivers'
205 call bump%run_drivers
208 if (bump%nam%check_get_param_cor.or.bump%nam%check_get_param_hyb.or.bump%nam%check_get_param_Dloc &
209 & .or.bump%nam%check_get_param_lct)
then
210 write(bump%mpl%info,
'(a)')
'-------------------------------------------------------------------'
212 write(bump%mpl%info,
'(a)')
'--- Test get_parameter interfaces'
213 call bump%mpl%flush()
214 call bump%test_get_parameter
215 if (bump%nam%default_seed)
call bump%rng%reseed(mpl)
219 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
221 write(mpl%info,
'(a)')
'--- Release memory (partial)'
223 call bump%partial_dealloc
226 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
228 write(mpl%info,
'(a)')
'--- Test apply interfaces'
230 call bump%test_apply_interfaces
244 if ((trim(bump%nam%verbosity)==
'all').or.((trim(bump%nam%verbosity)==
'main').and.mpl%main))
then
246 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
248 write(mpl%info,
'(a)')
'--- Close listings'
250 write(mpl%info,
'(a)')
'-------------------------------------------------------------------'
252 close(unit=mpl%lunit)
subroutine bump_main(n1, arg1, n2, arg2)
Subroutines/functions list.
Subroutines/functions list.
Subroutines/functions list.
Generic ranks, dimensions and types.