39#if defined PIO_LIB && defined DISTRIBUTE
90 logical,
intent(inout) :: first
92 integer,
intent(in),
optional :: mpiCOMM
96 logical :: allocate_vars = .true.
99 integer :: MyError, MySize
101 integer :: chunk_size, ng, thread
103 integer :: my_threadnum
106 character (len=*),
parameter :: MyFile = &
107 & __FILE__//
", ROMS_initialize"
115 IF (
PRESENT(mpicomm))
THEN
165#elif defined DISTRIBUTE
182 10
FORMAT (/,
' Process Information:',/)
186 DO thread=thread_range
199#if defined MCT_LIB && (defined ATM_COUPLING || defined WAV_COUPLING)
207 CALL initialize_ocn2atm_coupling (ng,
myrank)
210 CALL initialize_ocn2wav_coupling (ng,
myrank)
354 real(dp),
intent(in) :: RunInterval
363 integer :: Fcount, Is, Ie, i, iter, ng
364 integer :: NconvRitz(Ngrids)
368 real(r8),
dimension(2) :: my_norm, my_value
370 TYPE (T_GST),
allocatable :: ad_state(:)
371 TYPE (T_GST),
allocatable :: state(:)
373 character (len=55) :: string
375 character (len=*),
parameter :: MyFile = &
376 & __FILE__//
", ROMS_run"
385 IF (.not.
allocated(ad_state))
THEN
386 allocate ( ad_state(ngrids) )
388 IF (.not.
allocated(state))
THEN
389 allocate ( state(ngrids) )
401 iter_loop :
DO WHILE (iterate)
440 & (any(
ido.eq.99)))
THEN
458 IF (any(abs(
ido).eq.1))
THEN
461 adm(ng)%Nrec(fcount)=0
463 tlm(ng)%Nrec(fcount)=0
472 IF (
ASSOCIATED(state(ng)%vector))
THEN
473 nullify (state(ng)%vector)
477 state(ng)%vector =>
storage(ng)%SworkD(is:ie)
479 IF (
ASSOCIATED(ad_state(ng)%vector))
THEN
480 nullify (ad_state(ng)%vector)
484 ad_state(ng)%vector =>
storage(ng)%SworkD(is:ie)
490 IF (any(
info.ne.0))
THEN
492 IF (
info(ng).ne.0)
THEN
495 WRITE (
stdout,10)
'DSAUPD', trim(string), &
496 &
', info = ',
info(ng)
508 nconvritz(ng)=
iparam(5,ng)
510 WRITE (
stdout,20)
'Number of converged Ritz values:', &
512 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)
'DSEUPD', trim(string), &
552 &
', info = ',
info(ng)
565 DO i=1,maxval(nconvritz)
569 adm(ng)%Nrec(fcount)=0
571 tlm(ng)%Nrec(fcount)=0
578 WRITE (
adm(ng)%name,30) trim(
adm(ng)%base), i
579 WRITE (
tlm(ng)%name,30) trim(
tlm(ng)%base), i
588 IF (
ASSOCIATED(state(ng)%vector))
THEN
589 nullify (state(ng)%vector)
592 IF (
ASSOCIATED(ad_state(ng)%vector))
THEN
593 nullify (ad_state(ng)%vector)
595 state(ng)%vector =>
storage(ng)%Rvector(is:ie,i)
596 ad_state(ng)%vector =>
sworkr(is:ie)
601 & __line__, myfile))
RETURN
606 & state(ng)%vector, &
607 & ad_state(ng)%vector, enorm)
621 my_norm(1)=
norm(i,ng)
622 my_norm(2)=my_norm(1)
624 my_value(2)=my_value(1)
627 SELECT CASE (
tlm(ng)%IOtype)
633 & start = (/
tlm(ng)%Rindex-1/), &
635 & ncid =
tlm(ng)%ncid)
638 & __line__, myfile))
RETURN
644 & start = (/
tlm(ng)%Rindex-1/), &
646 & ncid =
tlm(ng)%ncid)
649 & __line__, myfile))
RETURN
651#if defined PIO_LIB && defined DISTRIBUTE
657 & start = (/
tlm(ng)%Rindex-1/), &
659 & piofile =
tlm(ng)%pioFile)
662 & __line__, myfile))
RETURN
668 & start = (/
tlm(ng)%Rindex-1/), &
670 & piofile =
tlm(ng)%pioFile)
673 & __line__, myfile))
RETURN
680 & __line__, myfile))
RETURN
685 SELECT CASE (
adm(ng)%IOtype)
691 & start = (/
adm(ng)%Rindex/), &
693 & ncid =
adm(ng)%ncid)
696 & __line__, myfile))
RETURN
702 & start = (/
adm(ng)%Rindex/), &
704 & ncid =
adm(ng)%ncid)
707 & __line__, myfile))
RETURN
709#if defined PIO_LIB && defined DISTRIBUTE
715 & start = (/
adm(ng)%Rindex/), &
717 & piofile =
adm(ng)%pioFile)
720 & __line__, myfile))
RETURN
726 & start = (/
adm(ng)%Rindex/), &
728 & piofile =
adm(ng)%pioFile)
731 & __line__, myfile))
RETURN
738 & __line__, myfile))
RETURN
750 10
FORMAT (/,1x,
'Error in ',a,1x,a,a,1x,i5,/)
751 20
FORMAT (/,a,1x,i2,/)
752 30
FORMAT (a,
'_',i3.3,
'.nc')
753 40
FORMAT (1x,i4.4,
'-th residual',1p,e14.6,0p, &
754 &
' Ritz value',1pe14.6,0p,2x,i4.4)
770 integer :: Fcount, ng, thread
772 character (len=*),
parameter :: MyFile = &
773 & __FILE__//
", ROMS_finalize"
785 10
FORMAT (/,
' Blowing-up: Saving latest model state into ', &
812 20
FORMAT (/,
'Elapsed wall CPU time for each process (seconds):',/)
816 DO thread=thread_range
847 integer,
intent(in) :: info
849 character (len=*),
intent(out) :: string
856 string=
'Normal exit '
857 ELSE IF (info.eq.1)
THEN
858 string=
'Maximum number of iterations taken '
859 ELSE IF (info.eq.3)
THEN
860 string=
'No shifts could be applied during an IRAM cycle '
861 ELSE IF (info.eq.-1)
THEN
862 string=
'Nstate must be positive '
863 ELSE IF (info.eq.-2)
THEN
864 string=
'NEV must be positive '
865 ELSE IF (info.eq.-3)
THEN
866 string=
'NCV must be greater NEV and less than or equal Nstate '
867 ELSE IF (info.eq.-4)
THEN
868 string=
'Maximum number of iterations must be greater than zero '
869 ELSE IF (info.eq.-5)
THEN
870 string=
'WHICH must be one of LM, SM, LA, SA or BE '
871 ELSE IF (info.eq.-6)
THEN
872 string=
'BMAT must be one of I or G '
873 ELSE IF (info.eq.-7)
THEN
874 string=
'Length of private work array SworkL is not sufficient '
875 ELSE IF (info.eq.-8)
THEN
876 string=
'Error in DSTEQR in the eigenvalue calculation '
877 ELSE IF (info.eq.-9)
THEN
878 string=
'Starting vector is zero '
879 ELSE IF (info.eq.-10)
THEN
880 string=
'IPARAM(7) must be 1, 2, 3, 4, 5 '
881 ELSE IF (info.eq.-11)
THEN
882 string=
'IPARAM(7) = 1 and BMAT = G are incompatable '
883 ELSE IF (info.eq.-12)
THEN
884 string=
'IPARAM(1) must be equal to 0 or 1 '
885 ELSE IF (info.eq.-13)
THEN
886 string=
'NEV and WHICH = BE are incompatable '
887 ELSE IF (info.eq.-14)
THEN
888 string=
'Did not find any eigenvalues to sufficient accuaracy '
889 ELSE IF (info.eq.-15)
THEN
890 string=
'HOWMANY must be one of A or S if RVEC = .TRUE. '
891 ELSE IF (info.eq.-16)
THEN
892 string=
'HOWMANY = S not yet implemented '
893 ELSE IF (info.eq.-17)
THEN
894 string=
'Different count of converge Ritz values in DSEUPD '
895 ELSE IF (info.eq.-9999)
THEN
896 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 ldefadj
logical, dimension(:), allocatable lcycleadj
logical, dimension(:), allocatable lwrtadj
logical, dimension(:), allocatable lcycletlm
logical, dimension(:), allocatable lwrtper
logical, dimension(:), allocatable lwrttlm
logical, dimension(:), allocatable lwrtrst
logical, dimension(:), allocatable ldeftlm
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_op(runinterval, 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)