41#if defined PIO_LIB && defined DISTRIBUTE
93 logical,
intent(inout) :: first
95 integer,
intent(in),
optional :: mpiCOMM
99 logical :: allocate_vars = .true.
102 integer :: MyError, MySize
104 integer :: chunk_size, ng, thread
106 integer :: my_threadnum
109 character (len=*),
parameter :: MyFile = &
110 & __FILE__//
", ROMS_initialize"
118 IF (
PRESENT(mpicomm))
THEN
169#elif defined DISTRIBUTE
187 10
FORMAT (/,
' Process Information:',/)
192 DO thread=thread_range
208#if defined MCT_LIB && (defined ATM_COUPLING || defined WAV_COUPLING)
216 CALL initialize_ocn2atm_coupling (ng,
myrank)
219 CALL initialize_ocn2wav_coupling (ng,
myrank)
352 real(dp),
intent(in) :: RunInterval
356 logical :: ITERATE, Lcomplex
361 integer :: Fcount, Is, Ie, i, icount, iter, ng, srec
362 integer :: NconvRitz(Ngrids)
366 real(r8),
dimension(2) :: my_norm, my_Ivalue, my_Rvalue
368 TYPE (T_GST),
allocatable :: state(:)
369 TYPE (T_GST),
allocatable :: tl_state(:)
371 character (len=55) :: string
373 character (len=*),
parameter :: MyFile = &
374 & __FILE__//
", ROMS_run"
383 IF (.not.
allocated(state))
THEN
384 allocate ( state(ngrids) )
386 IF (.not.
allocated(tl_state))
THEN
387 allocate ( tl_state(ngrids) )
399 iter_loop :
DO WHILE (iterate)
438 & (any(
ido.eq.99)))
THEN
456 IF (any(abs(
ido).eq.1))
THEN
459 tlm(ng)%Nrec(fcount)=0
467 IF (
ASSOCIATED(state(ng)%vector))
THEN
468 nullify (state(ng)%vector)
472 state(ng)%vector =>
storage(ng)%SworkD(is:ie)
474 IF (
ASSOCIATED(tl_state(ng)%vector))
THEN
475 nullify (tl_state(ng)%vector)
479 tl_state(ng)%vector =>
storage(ng)%SworkD(is:ie)
487 IF (any(
info.ne.0))
THEN
489 IF (
info(ng).ne.0)
THEN
492 WRITE (
stdout,10)
'DNAUPD', trim(string), &
493 &
', info = ',
info(ng)
505 nconvritz(ng)=
iparam(5,ng)
507 WRITE (
stdout,20)
'Number of converged Ritz values:', &
509 WRITE (
stdout,20)
'Number of Arnoldi iterations:', &
546 IF (any(
info.ne.0))
THEN
548 IF (
info(ng).ne.0)
THEN
551 WRITE (
stdout,10)
'DNEUPD', trim(string), &
552 &
', info = ',
info(ng)
570 DO i=1,maxval(nconvritz)
574 tlm(ng)%Nrec(fcount)=0
580 WRITE (
tlm(ng)%name,30) trim(
tlm(ng)%base), icount
586 IF (any(
rvaluei(i,:).eq.0.0_r8))
THEN
593 IF (
ASSOCIATED(state(ng)%vector))
THEN
594 nullify (state(ng)%vector)
597 IF (
ASSOCIATED(tl_state(ng)%vector))
THEN
598 nullify (tl_state(ng)%vector)
600 state(ng)%vector =>
storage(ng)%Rvector(is:ie,i)
601 tl_state(ng)%vector =>
sworkr(is:ie)
608 & __line__, myfile))
RETURN
613 & state(ng)%vector, &
614 & tl_state(ng)%vector, enorm)
618 ELSE IF (lcomplex)
THEN
625 IF (
ASSOCIATED(state(ng)%vector))
THEN
626 nullify (state(ng)%vector)
629 IF (
ASSOCIATED(tl_state(ng)%vector))
THEN
630 nullify (tl_state(ng)%vector)
632 state(ng)%vector =>
storage(ng)%Rvector(is:ie,i)
633 tl_state(ng)%vector =>
sworkr(is:ie)
640 & __line__, myfile))
RETURN
647 & tl_state(ng)%vector, enorm)
654 IF (
ASSOCIATED(state(ng)%vector))
THEN
655 nullify (state(ng)%vector)
658 IF (
ASSOCIATED(tl_state(ng)%vector))
THEN
659 nullify (tl_state(ng)%vector)
661 state(ng)%vector =>
storage(ng)%Rvector(is:ie,i+1)
662 tl_state(ng)%vector =>
sworkr(is:ie)
669 & __line__, myfile))
RETURN
676 & tl_state(ng)%vector, enorm)
699 my_norm(1)=
norm(i,ng)
700 my_norm(2)=my_norm(1)
702 my_rvalue(2)=my_rvalue(1)
704 my_ivalue(2)=my_ivalue(1)
706 IF (.not.lcomplex.or.(
rvaluei(i,ng).eq.0.0_r8))
THEN
716 SELECT CASE (
tlm(ng)%IOtype)
722 & start = (/srec/), &
724 & ncid =
tlm(ng)%ncid)
727 & __line__, myfile))
RETURN
733 & start = (/srec/), &
735 & ncid =
tlm(ng)%ncid)
738 & __line__, myfile))
RETURN
744 & start = (/srec/), &
746 & ncid =
tlm(ng)%ncid)
749 & __line__, myfile))
RETURN
751#if defined PIO_LIB && defined DISTRIBUTE
757 & start = (/srec/), &
759 & piofile =
tlm(ng)%pioFile)
762 & __line__, myfile))
RETURN
768 & start = (/srec/), &
770 & piofile =
tlm(ng)%pioFile)
773 & __line__, myfile))
RETURN
779 & start = (/srec/), &
781 & piofile =
tlm(ng)%pioFile)
784 & __line__, myfile))
RETURN
791 & __line__, myfile))
RETURN
803 10
FORMAT (/,1x,
'Error in ',a,1x,a,a,1x,i5,/)
804 20
FORMAT (/,a,1x,i2,/)
805 30
FORMAT (a,
'_',i3.3,
'.nc')
806 40
FORMAT (1x,i4.4,
'-th residual',1p,e14.6,0p, &
807 &
' Ritz values',1pe14.6,0p,1x,1pe14.6,2x,i4.4)
823 integer :: Fcount, ng, thread
825 character (len=*),
parameter :: MyFile = &
826 & __FILE__//
", ROMS_finalize"
838 10
FORMAT (/,
' Blowing-up: Saving latest model state into ', &
865 20
FORMAT (/,
'Elapsed wall CPU time for each process (seconds):',/)
870 DO thread=thread_range
904 integer,
intent(in) :: info, icall
906 character (len=*),
intent(out) :: string
913 string=
'Normal exit '
914 ELSE IF (info.eq.1)
THEN
916 string=
'Maximum number of iterations taken '
918 string=
'Could not reorder Schur vectors '
920 ELSE IF (info.eq.3)
THEN
921 string=
'No shifts could be applied during an IRAM cycle '
922 ELSE IF (info.eq.-1)
THEN
923 string=
'Nstate must be positive '
924 ELSE IF (info.eq.-2)
THEN
925 string=
'NEV must be positive '
926 ELSE IF (info.eq.-3)
THEN
927 string=
'NCV must be greater NEV and less than or equal Nstate '
928 ELSE IF (info.eq.-4)
THEN
929 string=
'Maximum number of iterations must be greater than zero '
930 ELSE IF (info.eq.-5)
THEN
931 string=
'WHICH must be one of LM, SM, LA, SA or BE '
932 ELSE IF (info.eq.-6)
THEN
933 string=
'BMAT must be one of I or G '
934 ELSE IF (info.eq.-7)
THEN
935 string=
'Length of private work array SworkL is not sufficient '
936 ELSE IF (info.eq.-8)
THEN
938 string=
'Error return from LAPACK eigenvalue calculation '
940 string=
'Error in DLAHQR in the Shurn vectors calculation '
942 ELSE IF (info.eq.-9)
THEN
944 string=
'Starting vector is zero'
946 string=
'Error in DTREVC in the eigenvectors calculation '
948 ELSE IF (info.eq.-10)
THEN
949 string=
'IPARAM(7) must be 1, 2, 3, 4, 5 '
950 ELSE IF (info.eq.-11)
THEN
951 string=
'IPARAM(7) = 1 and BMAT = G are incompatable '
952 ELSE IF (info.eq.-12)
THEN
954 string=
'IPARAM(1) must be equal to 0 or 1 '
956 string=
'HOWMANY = S not yet implemented '
958 ELSE IF (info.eq.-13)
THEN
959 string=
'HOWMANY must be one of A or P if Lrvec = .TRUE. '
960 ELSE IF (info.eq.-14)
THEN
961 string=
'Did not find any eigenvalues to sufficient accuaracy '
962 ELSE IF (info.eq.-15)
THEN
963 string=
'Different count of converge Ritz values in DNEUPD '
964 ELSE IF (info.eq.-9999)
THEN
965 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 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 lcycletlm
logical, dimension(:), allocatable lwrtper
logical, dimension(:), allocatable lwrttlm
logical, dimension(:), allocatable lwrtrst
logical, dimension(:), allocatable ldeftlm
logical, dimension(:), allocatable lreadfwd
logical, dimension(:), allocatable lcyclerst
logical, dimension(:), allocatable lreadblk
integer, dimension(8) iaup2
integer, dimension(:), allocatable ido
real(r8), dimension(:,:), allocatable rvaluei
real(r8), dimension(:,:), allocatable sworkl
integer, dimension(:,:), allocatable ipntr
real(r8), dimension(:,:), allocatable sworkev
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_fte(runinterval, state, tl_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 c_norm2(ng, model, mstr, mend, evaluer, evaluei, evectorr, evectori, state, norm2)
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)