MODULE opa !!============================================================================== !! *** MODULE opa *** !! Ocean system : OPA ocean dynamics (including on-line tracers and sea-ice) !!============================================================================== !!---------------------------------------------------------------------- !! opa_model : solve ocean dynamics, tracer and/or sea-ice !!---------------------------------------------------------------------- !! * Modules used USE dom_oce ! ocean space domain variables USE oce ! dynamics and tracers variables USE in_out_manager ! I/O manager USE lib_mpp ! distributed memory computing USE domcfg ! domain configuration (dom_cfg routine) USE mppini ! shared/distributed memory setting (mpp_init routine) USE domain ! domain initialization (dom_init routine) USE istate ! initial state setting (istate_init routine) USE eosbn2 ! equation of state (eos bn2 routine) ! ocean physics USE ldftra ! lateral diffusivity setting (ldftra_init routine) USE traqsr ! solar radiation penetration (tra_qsr_init routine) USE phycst ! physical constant (par_cst routine) USE dtadyn ! Lecture and Interpolation of the dynamical fields USE trcini ! Initilization of the passive tracers USE step ! OPA time-stepping (stp routine) USE iom #if defined key_iomput USE mod_ioclient #endif IMPLICIT NONE PRIVATE !! * Module variables CHARACTER (len=64) :: & cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing !! * Routine accessibility PUBLIC opa_model ! called by model.F90 PUBLIC opa_init !!---------------------------------------------------------------------- !! OPA 9.0 , LOCEAN-IPSL (2005) !! $Id$ !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt !!---------------------------------------------------------------------- CONTAINS SUBROUTINE opa_model !!---------------------------------------------------------------------- !! *** ROUTINE opa *** !! !! ** Purpose : opa solves the primitive equations on an orthogonal !! curvilinear mesh on the sphere. !! !! ** Method : - model general initialization !! - launch the time-stepping (stp routine) !! !! References : !! Madec, Delecluse,Imbard, and Levy, 1997: reference manual. !! internal report, IPSL. !!---------------------------------------------------------------------- INTEGER :: istp ! time step index !!---------------------------------------------------------------------- CALL opa_init ! Initializations IF( lk_mpp ) CALL mpp_max( nstop ) ! check that all process are still there... If some process have an error, ! they will never enter in step and other processes will wait until the end of the cpu time! IF( lk_mpp ) CALL mpp_max( nstop ) istp = nit000 ! DO WHILE ( istp <= nitend .AND. nstop == 0 ) CALL stp( istp ) istp = istp + 1 IF( lk_mpp ) CALL mpp_max( nstop ) END DO ! ! ========= ! ! ! Job end ! ! ! ========= ! IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA IF( nstop /= 0 .AND. lwp ) THEN ! error print WRITE(numout,cform_err) WRITE(numout,*) nstop, ' error have been found' ENDIF CALL opa_closefile IF( lk_mpp ) CALL mppstop ! Close all files (mpp) ! END SUBROUTINE opa_model SUBROUTINE opa_init !!---------------------------------------------------------------------- !! *** ROUTINE opa_init *** !! !! ** Purpose : opa solves the primitive equations on an orthogonal !! curvilinear mesh on the sphere. !! !! ** Method : - model general initialization !! !! References : !! Madec, Delecluse,Imbard, and Levy, 1997: reference manual. !! internal report, IPSL. !! !! History : !! 4.0 ! 90-10 (C. Levy, G. Madec) Original code !! 7.0 ! 91-11 (M. Imbard, C. Levy, G. Madec) !! 7.1 ! 93-03 (M. Imbard, C. Levy, G. Madec, O. Marti, !! M. Guyon, A. Lazar, P. Delecluse, C. Perigaud, !! G. Caniaux, B. Colot, C. Maes ) release 7.1 !! ! 92-06 (L.Terray) coupling implementation !! ! 93-11 (M.A. Filiberti) IGLOO sea-ice !! 8.0 ! 96-03 (M. Imbard, C. Levy, G. Madec, O. Marti, !! M. Guyon, A. Lazar, P. Delecluse, L.Terray, !! M.A. Filiberti, J. Vialar, A.M. Treguier, !! M. Levy) release 8.0 !! 8.1 ! 97-06 (M. Imbard, G. Madec) !! 8.2 ! 99-11 (M. Imbard, H. Goosse) LIM sea-ice model !! ! 99-12 (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols) OPEN-MP !! ! 00-07 (J-M Molines, M. Imbard) Open Boundary Conditions (CLIPPER) !! 9.0 ! 02-08 (G. Madec) F90: Free form and modules !!---------------------------------------------------------------------- !! * Local declarations #if defined key_iomput INTEGER :: localComm #endif CHARACTER (len=20) :: namelistname CHARACTER (len=28) :: file_out NAMELIST/namctl/ ln_ctl, nprint, nictls, nictle, & & isplt , jsplt , njctls, njctle, nbench !!---------------------------------------------------------------------- ! Initializations ! =============== file_out = 'ocean.output' ! open listing and namelist units CALL ctlopn( numout, file_out, 'UNKNOWN', 'FORMATTED', & & 'SEQUENTIAL', 1, 6, .FALSE., 1 ) namelistname = 'namelist' CALL ctlopn( numnam, namelistname, 'OLD', 'FORMATTED', 'SEQUENTIAL', & & 1, numout, .FALSE., 1 ) WRITE(numout,*) WRITE(numout,*) ' L O D Y C - I P S L' WRITE(numout,*) ' O P A model' WRITE(numout,*) ' Ocean General Circulation Model' WRITE(numout,*) ' version OPA 9.0 (2005) ' WRITE(numout,*) WRITE(numout,*) ! Namelist namctl : Control prints & Benchmark REWIND( numnam ) READ ( numnam, namctl ) #if defined key_iomput CALL init_ioclient(localcomm) narea = mynode(localComm) #else ! Nodes selection narea = mynode() #endif ! Nodes selection narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 ) lwp = narea == 1 ! open additionnal listing IF( ln_ctl ) THEN IF( narea-1 > 0 ) THEN WRITE(file_out,FMT="('ocean.output_',I4.4)") narea-1 CALL ctlopn( numout, file_out, 'UNKNOWN', 'FORMATTED', & & 'SEQUENTIAL', 1, numout, .FALSE., 1 ) lwp = .TRUE. ! WRITE(numout,*) WRITE(numout,*) ' L O D Y C - I P S L' WRITE(numout,*) ' O P A model' WRITE(numout,*) ' Ocean General Circulation Model' WRITE(numout,*) ' version OPA 9.0 (2005) ' WRITE(numout,*) ' MPI Ocean output ' WRITE(numout,*) WRITE(numout,*) ENDIF ENDIF CALL opa_flg ! Control prints & Benchmark ! ! ============================== ! ! ! Model general initialization ! ! ! ============================== ! IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA ! Domain decomposition IF( jpni * jpnj == jpnij ) THEN CALL mpp_init ! standard cutting out ELSE CALL mpp_init2 ! eliminate land processors ENDIF CALL phy_cst ! Physical constants CALL eos_init ! Equation of state CALL dom_cfg ! Domain configuration CALL dom_init ! Domain CALL istate_init ! ocean initial state (Dynamics and tracers) CALL trc_ini ! Passive tracers CALL dta_dyn( nit000 ) ! Initialization for the dynamics CALL tra_qsr_init ! Solar radiation penetration #if ! defined key_off_degrad CALL ldf_tra_init ! Lateral ocean tracer physics #endif CALL iom_init ! iom_put initialization IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA END SUBROUTINE opa_init SUBROUTINE opa_flg !!---------------------------------------------------------------------- !! *** ROUTINE opa *** !! !! ** Purpose : Initialize logical flags that control the choice of !! some algorithm or control print !! !! ** Method : Read in namilist namflg logical flags !! !! History : !! 9.0 ! 03-11 (G. Madec) Original code !!---------------------------------------------------------------------- !! * Local declarations ! Parameter control and print ! --------------------------- IF(lwp) THEN WRITE(numout,*) WRITE(numout,*) 'opa_flg: Control prints & Benchmark' WRITE(numout,*) '~~~~~~~ ' WRITE(numout,*) ' Namelist namctl' WRITE(numout,*) ' run control (for debugging) ln_ctl = ', ln_ctl WRITE(numout,*) ' level of print nprint = ', nprint WRITE(numout,*) ' Start i indice for SUM control nictls = ', nictls WRITE(numout,*) ' End i indice for SUM control nictle = ', nictle WRITE(numout,*) ' Start j indice for SUM control njctls = ', njctls WRITE(numout,*) ' End j indice for SUM control njctle = ', njctle WRITE(numout,*) ' number of proc. following i isplt = ', isplt WRITE(numout,*) ' number of proc. following j jsplt = ', jsplt WRITE(numout,*) ' benchmark parameter (0/1) nbench = ', nbench ENDIF ! ... Control the sub-domain area indices for the control prints IF( ln_ctl ) THEN IF( lk_mpp ) THEN ! the domain is forced to the real splitted domain in MPI isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ELSE IF( isplt == 1 .AND. jsplt == 1 ) THEN CALL ctl_warn( ' - isplt & jsplt are equal to 1', & & ' - the print control will be done over the whole domain' ) ENDIF ! compute the total number of processors ijsplt ijsplt = isplt*jsplt ENDIF IF(lwp) WRITE(numout,*)' - The total number of processors over which the' IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt ! Control the indices used for the SUM control IF( nictls+nictle+njctls+njctle == 0 ) THEN ! the print control is done over the default area lsp_area = .FALSE. ELSE ! the print control is done over a specific area lsp_area = .TRUE. IF( nictls < 1 .OR. nictls > jpiglo ) THEN CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) nictls = 1 ENDIF IF( nictle < 1 .OR. nictle > jpiglo ) THEN CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) nictle = jpiglo ENDIF IF( njctls < 1 .OR. njctls > jpjglo ) THEN CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) njctls = 1 ENDIF IF( njctle < 1 .OR. njctle > jpjglo ) THEN CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) njctle = jpjglo ENDIF ENDIF ! IF( nictls+nictle+njctls+njctle == 0 ) ENDIF ! IF(ln_ctl) IF( nbench == 1 ) THEN SELECT CASE ( cp_cfg ) CASE ( 'gyre' ) CALL ctl_warn( ' The Benchmark is activated ' ) CASE DEFAULT CALL ctl_stop( ' The Benchmark is based on the GYRE configuration: key_gyre must & & be used or set nbench = 0' ) END SELECT ENDIF END SUBROUTINE opa_flg SUBROUTINE opa_closefile !!---------------------------------------------------------------------- !! *** ROUTINE opa_closefile *** !! !! ** Purpose : Close the files !! !! ** Method : !! !! History : !! 9.0 ! 05-01 (O. Le Galloudec) Original code !!---------------------------------------------------------------------- !!---------------------------------------------------------------------- IF ( lk_mpp ) CALL mppsync ! 1. Unit close ! ------------- CLOSE( numnam ) ! namelist CLOSE( numout ) ! standard model output file IF(lwp) CLOSE( numstp ) ! time-step file CALL iom_close ! close all input/output files END SUBROUTINE opa_closefile !!====================================================================== END MODULE opa