64#if defined PIO_LIB && defined DISTRIBUTE
107#if defined BALANCE_OPERATOR && defined ZETA_ELLIPTIC
131 logical,
intent(inout) :: first
133 integer,
intent(in),
optional :: mpiCOMM
137 logical :: allocate_vars = .true.
140 integer :: MyError, MySize
142 integer :: STDrec, Tindex
143 integer :: chunk_size, ng, thread
145 integer :: my_threadnum
148 character (len=*),
parameter :: MyFile = &
149 & __FILE__//
", ROMS_initialize"
157 IF (
PRESENT(mpicomm))
THEN
207#elif defined DISTRIBUTE
224 10
FORMAT (/,
' Process Information:',/)
228 DO thread=thread_range
241#if defined MCT_LIB && (defined ATM_COUPLING || defined WAV_COUPLING)
249 CALL initialize_ocn2atm_coupling (ng,
myrank)
252 CALL initialize_ocn2wav_coupling (ng,
myrank)
267 SELECT CASE (
lcz(ng)%IOtype)
307 & start = (/1,1,1/), &
313 &
'TLmodVal_S', tlmodval_s, &
314 & start = (/1,1,1/), &
316 & broadcast = .false.)
319# if defined RPCG && !defined OBS_IMPACT
335 & start = (/1,1,1/), &
341# if defined PIO_LIB && defined DISTRIBUTE
381 & start = (/1,1,1/), &
387 &
'TLmodVal_S', tlmodval_s, &
388 & start = (/1,1,1/), &
393# if defined RPCG && !defined OBS_IMPACT
408 & start = (/1,1,1/), &
425 SELECT CASE (
lcz(ng)%IOtype)
431# if defined PIO_LIB && defined DISTRIBUTE
467#ifdef ADJUST_BOUNDARY
478#if defined ADJUST_WSTRESS || defined ADJUST_STFLUX
504 real(dp),
intent(inout) :: runinterval
508 logical :: lcgini, linner, lposterior, add
510 integer :: my_inner, my_outer
511 integer :: lbck, lini, rec1, rec2, impord
512 integer :: i, lstr, ng, status, tile
513 integer :: fcount, nrmrec
515 integer,
dimension(Ngrids) :: indxsave
516 integer,
dimension(Ngrids) :: nrec
518 real(r8) :: str_day, end_day,
dstarts, rtime
520 character (len=1) :: chara, charb
522 character (len=1) :: charc
524 character (len=25) :: driver
525 character (len=20) :: string
527 character (len=*),
parameter :: myfile = &
528 & __FILE__//
", ROMS_run"
537#if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
541#ifdef ADJUST_BOUNDARY
557 driver=
'obs_sen_rbl4dvar_forecast'
636 ini(ng)%Nrec(fcount)=1
677#ifdef ADJUST_BOUNDARY
682#if defined ADJUST_WSTRESS || defined ADJUST_STFLUX
703#ifdef ADJUST_BOUNDARY
708#if defined ADJUST_WSTRESS || defined ADJUST_STFLUX
715#if defined BALANCE_OPERATOR && defined ZETA_ELLIPTIC
766 SELECT CASE (
dav(ng)%IOtype)
771 & ncid =
dav(ng)%ncid)
774# if defined PIO_LIB && defined DISTRIBUTE
779 & piofile =
dav(ng)%pioFile)
796 IF ((
dstrs(ng).eq.0.0_r8).and.(
dends(ng).eq.0.0_r8))
THEN
819 IF (impord.ne.2)
THEN
820 WRITE (
obs(ng)%name,90) trim(
oifb(ng)%head)
822 WRITE (
obs(ng)%name,90) trim(
oifa(ng)%head)
828 IF (impord.ne.2)
THEN
829 WRITE (
ads(ng)%name,90) trim(foib(ng)%head)
831 WRITE (
ads(ng)%name,90) trim(foia(ng)%head)
902 adm(ng)%Nrec(fcount)=0
957 IF (impord.gt.1)
THEN
964 IF (impord.eq.2)
THEN
965 WRITE (
obs(ng)%name,90) trim(
oifb(ng)%head)
967 WRITE (
obs(ng)%name,90) trim(
oifa(ng)%head)
973 IF (impord.eq.2)
THEN
974 WRITE (
ads(ng)%name,90) trim(foib(ng)%head)
976 WRITE (
ads(ng)%name,90) trim(foia(ng)%head)
1038 adm(ng)%Nrec(fcount)=0
1114 IF ((
dstrs(ng).eq.0.0_r8).and.(
dends(ng).eq.0.0_r8))
THEN
1149#if defined ADJUST_WSTRESS || defined ADJUST_STFLUX || \
1150 defined adjust_boundary
1166 WRITE (
fwd(ng)%name,10) trim(
his(ng)%head),
outer-1
1181#ifdef FORWARD_FLUXES
1241#if defined ADJUST_WSTRESS || defined ADJUST_STFLUX
1244#ifdef ADJUST_BOUNDARY
1251#if defined ADJUST_WSTRESS || defined ADJUST_STFLUX || \
1252 defined adjust_boundary
1259# ifdef ADJUST_BOUNDARY
1273 adm(ng)%Nrec(fcount)=0
1325 & rec1, rec2, lposterior)
1363 WRITE (
obs(ng)%name,80) trim(
obs(ng)%head), charc
1377 SELECT CASE (
lcz(ng)%IOtype)
1382 & __line__, myfile))
RETURN
1387 & __line__, myfile))
RETURN
1392 & __line__, myfile))
RETURN
1397 & __line__, myfile))
RETURN
1402 & __line__, myfile))
RETURN
1407 & __line__, myfile))
RETURN
1412 & __line__, myfile))
RETURN
1415 &
'TLmodVal_S', tlmodval_s, &
1416 & broadcast = .false.)
1418 & __line__, myfile))
RETURN
1424 & __line__, myfile))
RETURN
1429 & __line__, myfile))
RETURN
1434 & __line__, myfile))
RETURN
1437# if defined PIO_LIB && defined DISTRIBUTE
1442 & __line__, myfile))
RETURN
1447 & __line__, myfile))
RETURN
1452 & __line__, myfile))
RETURN
1457 & __line__, myfile))
RETURN
1462 & __line__, myfile))
RETURN
1467 & __line__, myfile))
RETURN
1472 & __line__, myfile))
RETURN
1475 &
'TLmodVal_S', tlmodval_s)
1477 & __line__, myfile))
RETURN
1483 & __line__, myfile))
RETURN
1488 & __line__, myfile))
RETURN
1493 & __line__, myfile))
RETURN
1507 SELECT CASE (
lcz(ng)%IOtype)
1512 &
noerror, __line__, myfile))
RETURN
1514# if defined PIO_LIB && defined DISTRIBUTE
1519 &
noerror, __line__, myfile))
RETURN
1532#endif /* OBS_SPACE */
1546#ifdef ADJUST_BOUNDARY
1555 WRITE (
fwd(ng)%name,10) trim(
his(ng)%head),
outer-1
1556 lstr=len_trim(
fwd(ng)%name)
1557 fwd(ng)%base=
fwd(ng)%name(1:lstr-3)
1564 IF (
frcrec(ng).gt.3)
THEN
1618 WRITE (
fwd(ng)%name,10) trim(
his(ng)%head),
outer-1
1619 lstr=len_trim(
fwd(ng)%name)
1620 fwd(ng)%base=
fwd(ng)%name(1:lstr-3)
1628# ifdef ADJUST_BOUNDARY
1635 ad_inner_loop :
DO my_inner=
ninner,0,-1
1637 ad_inner_loop :
DO my_inner=
ninner,1,-1
1645 IF (
inner.eq.0)
THEN
1647 SELECT CASE (
dav(ng)%IOtype)
1652 & __line__, myfile))
RETURN
1654# if defined PIO_LIB && defined DISTRIBUTE
1659 & __line__, myfile))
RETURN
1676 inner_compute :
IF (linner)
THEN
1715 adm(ng)%Nrec(fcount)=0
1766 & rec1, rec2, lposterior)
1807 IF (
frcrec(ng).gt.3)
THEN
1829 tlm(ng)%Nrec(fcount)=0
1854 END IF inner_compute
1862 END DO ad_inner_loop
1874#endif /* !OBS_IMPACT */
1882 SELECT CASE (
dav(ng)%IOtype)
1889 & (/1/), (/
mobs/), &
1891 & ncid =
dav(ng)%ncid)
1893 & __line__, myfile))
RETURN
1897 & __line__, myfile))
RETURN
1899# if defined PIO_LIB && defined DISTRIBUTE
1906 & (/1/), (/
mobs/), &
1908 & piofile =
dav(ng)%pioFile)
1910 & __line__, myfile))
RETURN
1915 & __line__, myfile))
RETURN
1925 SELECT CASE (
dav(ng)%IOtype)
1932 & (/1/), (/
mobs/), &
1934 & ncid =
dav(ng)%ncid)
1936 & __line__, myfile))
RETURN
1940 & __line__, myfile))
RETURN
1942# if defined PIO_LIB && defined DISTRIBUTE
1949 & (/1/), (/
mobs/), &
1951 & piofile =
dav(ng)%pioFile)
1953 & __line__, myfile))
RETURN
1958 & __line__, myfile))
RETURN
1972#if defined OBS_IMPACT && defined OBS_IMPACT_SPLIT
1994# ifdef ADJUST_BOUNDARY
2003 WRITE (
fwd(ng)%name,10) trim(
his(ng)%head),
outer-1
2004 lstr=len_trim(
fwd(ng)%name)
2005 fwd(ng)%base=
fwd(ng)%name(1:lstr-3)
2012 IF (
frcrec(ng).gt.3)
THEN
2034# ifdef ADJUST_BOUNDARY
2076 SELECT CASE (
dav(ng)%IOtype)
2083 & (/1/), (/
mobs/), &
2085 & ncid =
dav(ng)%ncid)
2087 & __line__, myfile))
RETURN
2091 & __line__, myfile))
RETURN
2093# if defined PIO_LIB && defined DISTRIBUTE
2100 & (/1/), (/
mobs/), &
2102 & piofile =
dav(ng)%pioFile)
2104 & __line__, myfile))
RETURN
2109 & __line__, myfile))
RETURN
2114# if defined ADJUST_WSTRESS || defined ADJUST_STFLUX
2136# ifdef ADJUST_BOUNDARY
2145 WRITE (
fwd(ng)%name,10) trim(
his(ng)%head),
outer-1
2146 lstr=len_trim(
fwd(ng)%name)
2147 fwd(ng)%base=
fwd(ng)%name(1:lstr-3)
2154 IF (
frcrec(ng).gt.3)
THEN
2176# ifdef ADJUST_BOUNDARY
2218 SELECT CASE (
dav(ng)%IOtype)
2225 & (/1/), (/
mobs/), &
2227 & ncid =
dav(ng)%ncid)
2229 & __line__, myfile))
RETURN
2233 & __line__, myfile))
RETURN
2235# if defined PIO_LIB && defined DISTRIBUTE
2242 & (/1/), (/
mobs/), &
2244 & piofile =
dav(ng)%pioFile)
2246 & __line__, myfile))
RETURN
2251 & __line__, myfile))
RETURN
2257# if defined ADJUST_BOUNDARY
2279# ifdef ADJUST_BOUNDARY
2288 WRITE (
fwd(ng)%name,10) trim(
his(ng)%head),
outer-1
2289 lstr=len_trim(
fwd(ng)%name)
2290 fwd(ng)%base=
fwd(ng)%name(1:lstr-3)
2297 IF (
frcrec(ng).gt.3)
THEN
2359 SELECT CASE (
dav(ng)%IOtype)
2366 & (/1/), (/
mobs/), &
2368 & ncid =
dav(ng)%ncid)
2370 & __line__, myfile))
RETURN
2374 & __line__, myfile))
RETURN
2376# if defined PIO_LIB && defined DISTRIBUTE
2383 & (/1/), (/
mobs/), &
2385 & piofile =
dav(ng)%pioFile)
2387 & __line__, myfile))
RETURN
2392 & __line__, myfile))
RETURN
2397#endif /* OBS_IMPACT_SPLIT */
2408#if defined PIO_LIB && defined DISTRIBUTE
2410 his(ng)%pioFile%fh=-1
2415 END DO ad_outer_loop
2417 10
FORMAT (a,
'_outer',i0,
'.nc')
2418 20
FORMAT (/,1x,a,1x,
'ROMS: started time-stepping:', &
2419 &
' (Grid: ',i2.2,
' TimeSteps: ',i8.8,
' - ',i8.8,
')',/)
2420 30
FORMAT (
' (',i3.3,
',',i3.3,
'): ',a,
' data penalty, Jdata = ', &
2421 & 1p,e17.10,0p,t68,a)
2422 40
FORMAT (/,
' Converting Convolved Adjoint Trajectory to', &
2423 &
' Impulses: Outer = ',i3.3,
' Inner = ',i3.3,/)
2424 50
FORMAT (/,
'ROMS: Started adjoint Sensitivity calculation', &
2426 60
FORMAT (/,
'ROMS: ',a,1x,a,
', Outer = ',i3.3, &
2427 &
' Inner = ',i3.3,/)
2428 70
FORMAT (/,1x,a,1x,
'ROMS: adjoint forcing time range: ', &
2429 & f12.4,
' - ',f12.4 ,/)
2430 80
FORMAT (a,
'_',a,
'.nc')
2447 integer :: fcount, ng, thread
2449 character (len=*),
parameter :: myfile = &
2450 & __FILE__//
", ROMS_finalize"
2474 10
FORMAT (/,
' Blowing-up: Saving latest model state into ', &
2475 &
' RESTART file',/)
2477 IF (
lcyclerst(ng).and.(
rst(ng)%Nrec(fcount).ge.2))
THEN
2500 20
FORMAT (/,
'Elapsed wall CPU time for each process (seconds):',/)
2504 DO thread=thread_range
subroutine ad_initial(ng)
subroutine ad_main3d(runinterval)
subroutine edit_multifile(task)
subroutine, public ad_wrt_his(ng, tile)
subroutine, public close_out
subroutine, public close_file(ng, model, s, ncname, lupdate)
subroutine, public close_inp(ng, model)
subroutine, public congrad(ng, model, outloop, innloop, ninnloop, lcgini)
subroutine, public error_covariance(model, driver, outloop, innloop, rbck, rini, rold, rnew, rec1, rec2, lposterior)
subroutine, public def_impulse(ng)
subroutine, public def_mod(ng)
subroutine, public def_norm(ng, model, ifile)
subroutine, public get_state(ng, model, msg, s, inirec, tindex)
subroutine, public load_adtotl(ng, tile, linp, lout, add)
subroutine, public load_tltoad(ng, tile, linp, lout, add)
subroutine, public inp_par(model)
subroutine, public roms_initialize_arrays
subroutine, public roms_allocate_arrays(allocate_vars)
subroutine, public initialize_boundary(ng, tile, model)
subroutine, public initialize_forces(ng, tile, model)
real(dp), dimension(:), allocatable cg_gnorm_v
real(r8), dimension(:,:,:), allocatable vcglwk
real(dp), dimension(:,:), allocatable cg_beta
subroutine, public deallocate_fourdvar
integer, dimension(:), allocatable ndatum
real(r8), dimension(:,:), allocatable cg_dla
real(dp), dimension(:,:), allocatable cg_qg
logical, dimension(:), allocatable wrtmisfit
integer, dimension(:), allocatable ntimes_fct
logical, dimension(:), allocatable wrtrpmod
logical, dimension(:), allocatable lsenfct
logical, dimension(:), allocatable lsen4dvar
real(r8), dimension(:,:), allocatable ad_obsval
logical, dimension(:), allocatable wrttlmod
logical, dimension(:), allocatable wrtnlmod
logical, dimension(:), allocatable wrtforce
real(r8), dimension(:), allocatable obsscale
real(r8), dimension(:), allocatable jb0
subroutine, public initialize_fourdvar
real(r8), dimension(:,:,:), allocatable zcglwk
logical, dimension(:), allocatable wrtobsscale
real(r8), dimension(:), allocatable nlmodval
real(dp), dimension(:,:), allocatable cg_delta
logical, dimension(:), allocatable lobspace
integer, dimension(:), allocatable ntimes_ana
logical, dimension(:), allocatable wrtzetaref
real(r8), dimension(:,:), allocatable zgrad0
type(t_io), dimension(:), allocatable ads
type(t_io), dimension(:), allocatable lcz
type(t_io), dimension(:,:), allocatable std
type(t_io), dimension(:), allocatable his
type(t_io), dimension(:), allocatable oifa
type(t_io), dimension(:,:), allocatable nrm
type(t_io), dimension(:), allocatable adm
type(t_io), dimension(:), allocatable obs
type(t_io), dimension(:), allocatable oifb
type(t_io), dimension(:), allocatable tlm
type(t_io), dimension(:), allocatable itl
type(t_io), dimension(:), allocatable dav
type(t_io), dimension(:), allocatable fwd
type(t_io), dimension(:), allocatable rst
type(t_io), dimension(:), allocatable ini
character(len=256) sourcefile
integer, parameter io_nf90
integer, parameter io_pio
character(len=maxlen), dimension(6, 0:nv) vname
subroutine, public netcdf_sync(ng, model, ncname, ncid)
subroutine, public initialize_ocean(ng, tile, model)
subroutine, public initialize_parallel
integer, dimension(:), allocatable first_tile
integer, dimension(:), allocatable last_tile
integer, dimension(:), allocatable ntilex
integer, dimension(:), allocatable ntilee
subroutine, public pio_netcdf_sync(ng, model, ncname, piofile)
logical, dimension(:,:), allocatable lwrtnrm
logical, dimension(:), allocatable lreadqck
integer, dimension(:), allocatable ntimes
logical, dimension(:), allocatable ldefitl
real(dp), dimension(:), allocatable dt
logical, dimension(:), allocatable balance
logical, dimension(:), allocatable ldeftlf
integer, dimension(:), allocatable frcrec
logical, dimension(:), allocatable lreadfrc
real(dp), dimension(:), allocatable tdays
real(r8), dimension(:), allocatable dends
logical, dimension(:), allocatable ldefadj
logical, dimension(:), allocatable frequentimpulse
real(dp), parameter sec2day
integer, dimension(:), allocatable ntend
logical, dimension(:), allocatable ldefmod
logical, dimension(:,:), allocatable ldefnrm
logical, dimension(:), allocatable lwrtstate2d
real(r8), dimension(:), allocatable dstrs
logical, dimension(:), allocatable lwrttlm
logical, dimension(:), allocatable lwrtrst
logical, dimension(:), allocatable ldeftlm
integer, dimension(:), allocatable ntstart
logical, dimension(:), allocatable lreadfwd
logical, dimension(:), allocatable lcyclerst
logical, dimension(:), allocatable lreadblk
integer, dimension(:), allocatable lold
integer, dimension(:), allocatable lbout
integer, dimension(:), allocatable lfinp
integer, dimension(:), allocatable lbinp
integer, dimension(:), allocatable lnew
integer, dimension(:), allocatable lfout
subroutine, public normalization(ng, tile, ifac)
subroutine, public roms_finalize
subroutine, public roms_run(runinterval)
subroutine, public roms_initialize(first, mpicomm)
subroutine, public rpcg_lanczos(ng, model, outloop, innloop, ninnloop, lcgini)
subroutine, public stats_modobs(ng, tile)
integer function, public stdout_unit(mymaster)
logical, save set_stdoutunit
character(len(sinp)) function, public uppercase(sinp)
logical function, public founderror(flag, noerr, line, routine)
subroutine, public tl_def_ini(ng)
subroutine, public wrt_ini(ng, tile, tindex, outrec)
subroutine, public wrt_rst(ng, tile)
subroutine, public biconj(ng, tile, model, lbck)
subroutine, public balance_ref(ng, tile, lbck)
subroutine rep_matrix(ng, model, outloop, ninnloop)
recursive subroutine wclock_off(ng, model, region, line, routine)
recursive subroutine wclock_on(ng, model, region, line, routine)
subroutine tl_initial(ng)
subroutine tl_main3d(runinterval)