33#if defined PIO_LIB && defined DISTRIBUTE
84 logical,
intent(inout) :: first
86 integer,
intent(in),
optional :: mpiCOMM
90 logical :: allocate_vars = .true.
93 integer :: MyError, MySize
95 integer :: chunk_size, ng, thread
97 integer :: my_threadnum
100 character (len=*),
parameter :: MyFile = &
101 & __FILE__//
", ROMS_initialize"
109 IF (
PRESENT(mpicomm))
THEN
159#elif defined DISTRIBUTE
176 10
FORMAT (/,
' Process Information:',/)
180 DO thread=thread_range
193#if defined MCT_LIB && (defined ATM_COUPLING || defined WAV_COUPLING)
201 CALL initialize_ocn2atm_coupling (ng,
myrank)
204 CALL initialize_ocn2wav_coupling (ng,
myrank)
347 real(dp),
intent(in) :: RunInterval
357 integer :: i, iter, ng, tile
358 integer :: NconvRitz(Ngrids)
362 TYPE (T_GST),
allocatable :: ad_state(:)
363 TYPE (T_GST),
allocatable :: state(:)
365 character (len=55) :: string
367 character (len=*),
parameter :: MyFile = &
368 & __FILE__//
", ROMS_run"
377 IF (.not.
allocated(ad_state))
THEN
378 allocate ( ad_state(ngrids) )
380 IF (.not.
allocated(state))
THEN
381 allocate ( state(ngrids) )
393 iter_loop :
DO WHILE (iterate)
432 & (any(
ido.eq.99)))
THEN
450 IF (any(abs(
ido).eq.1))
THEN
456 IF (
ASSOCIATED(state(ng)%vector))
THEN
457 nullify (state(ng)%vector)
461 state(ng)%vector =>
storage(ng)%SworkD(is:ie)
463 IF (
ASSOCIATED(ad_state(ng)%vector))
THEN
464 nullify (ad_state(ng)%vector)
468 ad_state(ng)%vector =>
storage(ng)%SworkD(is:ie)
474 IF (any(
info.ne.0))
THEN
476 IF (
info(ng).ne.0)
THEN
479 WRITE (
stdout,10)
'DSAUPD', trim(string), &
480 &
', info = ',
info(ng)
492 nconvritz(ng)=
iparam(5,ng)
494 WRITE (
stdout,20)
'Number of converged Ritz values:', &
496 WRITE (
stdout,20)
'Number of Arnoldi iterations:', &
530 IF (any(
info.ne.0))
THEN
532 IF (
info(ng).ne.0)
THEN
535 WRITE (
stdout,10)
'DSEUPD', trim(string), &
536 &
', info = ',
info(ng)
548 DO i=1,maxval(nconvritz)
551 WRITE (
tlm(ng)%name,30) trim(
tlm(ng)%base), i
560 IF (
ASSOCIATED(state(ng)%vector))
THEN
561 nullify (state(ng)%vector)
564 IF (
ASSOCIATED(ad_state(ng)%vector))
THEN
565 nullify (ad_state(ng)%vector)
567 state(ng)%vector =>
storage(ng)%Rvector(is:ie,i)
568 ad_state(ng)%vector =>
sworkr(is:ie)
573 & __line__, myfile))
RETURN
578 & state(ng)%vector, &
579 & ad_state(ng)%vector, enorm)
593 SELECT CASE (
tlm(ng)%IOtype)
599 & start = (/
tlm(ng)%Rindex/), &
601 & ncid =
tlm(ng)%ncid)
604 & __line__, myfile))
RETURN
610 & start = (/
tlm(ng)%Rindex/), &
612 & ncid =
tlm(ng)%ncid)
615 & __line__, myfile))
RETURN
617#if defined PIO_LIB && defined DISTRIBUTE
623 & start = (/
tlm(ng)%Rindex/), &
625 & piofile =
tlm(ng)%pioFile)
628 & __line__, myfile))
RETURN
634 & start = (/
tlm(ng)%Rindex/), &
636 & piofile =
tlm(ng)%pioFile)
639 & __line__, myfile))
RETURN
646 & __line__, myfile))
RETURN
649 SELECT CASE (
adm(ng)%IOtype)
655 & start = (/
adm(ng)%Rindex/), &
657 & ncid =
adm(ng)%ncid)
660 & __line__, myfile))
RETURN
666 & start = (/
adm(ng)%Rindex/), &
668 & ncid =
adm(ng)%ncid)
671 & __line__, myfile))
RETURN
673#if defined PIO_LIB && defined DISTRIBUTE
679 & start = (/
adm(ng)%Rindex/), &
681 & piofile =
adm(ng)%pioFile)
684 & __line__, myfile))
RETURN
690 & start = (/
adm(ng)%Rindex/), &
692 & piofile =
adm(ng)%pioFile)
695 & __line__, myfile))
RETURN
707 10
FORMAT (/,1x,
'Error in ',a,1x,a,a,1x,i5,/)
708 20
FORMAT (/,a,1x,i2,/)
709 30
FORMAT (a,
'_',i3.3,
'.nc')
710 40
FORMAT (1x,i4.4,
'-th residual',1p,e14.6,0p, &
711 &
' Ritz value',1pe14.6,0p,2x,i4.4)
727 integer :: Fcount, ng, thread
729 character (len=*),
parameter :: MyFile = &
730 & __FILE__//
", ROMS_finalize"
742 10
FORMAT (/,
' Blowing-up: Saving latest model state into ', &
769 20
FORMAT (/,
'Elapsed wall CPU time for each process (seconds):',/)
773 DO thread=thread_range
804 integer,
intent(in) :: info
806 character (len=*),
intent(out) :: string
813 string=
'Normal exit '
814 ELSE IF (info.eq.1)
THEN
815 string=
'Maximum number of iterations taken '
816 ELSE IF (info.eq.3)
THEN
817 string=
'No shifts could be applied during an IRAM cycle '
818 ELSE IF (info.eq.-1)
THEN
819 string=
'Nstate must be positive '
820 ELSE IF (info.eq.-2)
THEN
821 string=
'NEV must be positive '
822 ELSE IF (info.eq.-3)
THEN
823 string=
'NCV must be greater NEV and less than or equal Nstate '
824 ELSE IF (info.eq.-4)
THEN
825 string=
'Maximum number of iterations must be greater than zero '
826 ELSE IF (info.eq.-5)
THEN
827 string=
'WHICH must be one of LM, SM, LA, SA or BE '
828 ELSE IF (info.eq.-6)
THEN
829 string=
'BMAT must be one of I or G '
830 ELSE IF (info.eq.-7)
THEN
831 string=
'Length of private work array SworkL is not sufficient '
832 ELSE IF (info.eq.-8)
THEN
833 string=
'Error in DSTEQR in the eigenvalue calculation '
834 ELSE IF (info.eq.-9)
THEN
835 string=
'Starting vector is zero '
836 ELSE IF (info.eq.-10)
THEN
837 string=
'IPARAM(7) must be 1, 2, 3, 4, 5 '
838 ELSE IF (info.eq.-11)
THEN
839 string=
'IPARAM(7) = 1 and BMAT = G are incompatable '
840 ELSE IF (info.eq.-12)
THEN
841 string=
'IPARAM(1) must be equal to 0 or 1 '
842 ELSE IF (info.eq.-13)
THEN
843 string=
'NEV and WHICH = BE are incompatable '
844 ELSE IF (info.eq.-14)
THEN
845 string=
'Did not find any eigenvalues to sufficient accuaracy '
846 ELSE IF (info.eq.-15)
THEN
847 string=
'HOWMANY must be one of A or S if RVEC = .TRUE. '
848 ELSE IF (info.eq.-16)
THEN
849 string=
'HOWMANY = S not yet implemented '
850 ELSE IF (info.eq.-17)
THEN
851 string=
'Different count of converge Ritz values in DSEUPD '
852 ELSE IF (info.eq.-9999)
THEN
853 string=
'Could not build and Arnoldi factorization '
subroutine edit_multifile(task)
subroutine, public close_out
subroutine, public close_file(ng, model, s, ncname, lupdate)
subroutine, public close_inp(ng, model)
subroutine, public def_gst(ng, model)
subroutine, public get_gst(ng, model)
subroutine, public inp_par(model)
subroutine, public roms_initialize_arrays
subroutine, public roms_allocate_arrays(allocate_vars)
type(t_io), dimension(:), allocatable adm
type(t_io), dimension(:), allocatable tlm
type(t_io), dimension(:), allocatable rst
character(len=256) sourcefile
integer, parameter io_nf90
integer, parameter io_pio
subroutine, public initialize_parallel
integer, dimension(:), allocatable first_tile
integer, dimension(:), allocatable last_tile
integer, dimension(:), allocatable nstr
integer, dimension(:), allocatable ntilex
integer, dimension(:), allocatable nsize
integer, dimension(:), allocatable ntilee
integer, dimension(:), allocatable nend
integer, dimension(:), allocatable ntimes
integer, dimension(:), allocatable ntlm
integer, dimension(:), allocatable nconv
logical, dimension(:), allocatable lreadfrc
logical, dimension(:), allocatable lcycleadj
logical, dimension(:), allocatable lwrtadj
logical, dimension(:), allocatable lcycletlm
logical, dimension(:), allocatable lwrtper
logical, dimension(:), allocatable lwrthis
logical, dimension(:), allocatable lwrttlm
logical, dimension(:), allocatable lwrtrst
integer, dimension(:), allocatable nadj
logical, dimension(:), allocatable lreadfwd
logical, dimension(:), allocatable lcyclerst
logical, dimension(:), allocatable lreadblk
integer, dimension(8) iaup2
integer, dimension(:), allocatable ido
real(r8), dimension(:,:), allocatable sworkl
integer, dimension(:,:), allocatable ipntr
logical, dimension(5) laup2
type(t_storage), dimension(:), allocatable storage
real(r8), dimension(:,:), allocatable norm
integer, dimension(:), allocatable info
subroutine, public allocate_storage
integer, dimension(:,:), allocatable iparam
logical, dimension(:,:), allocatable pick
real(r8), dimension(:), pointer sworkr
real(r8), dimension(:,:), allocatable rvaluer
subroutine, public propagator_so(runinterval, iter, state, ad_state)
subroutine, public roms_finalize
subroutine, public roms_run(runinterval)
subroutine, private iram_error(info, icall, string)
subroutine, public roms_initialize(first, mpicomm)
integer function, public stdout_unit(mymaster)
logical, save set_stdoutunit
logical function, public founderror(flag, noerr, line, routine)
subroutine, public wrt_gst(ng, model)
subroutine, public wrt_rst(ng, tile)
subroutine r_norm2(ng, model, mstr, mend, evalue, evector, state, norm2)
recursive subroutine wclock_off(ng, model, region, line, routine)
recursive subroutine wclock_on(ng, model, region, line, routine)
subroutine tl_initial(ng)