Changeset 1041
- Timestamp:
- 2008-05-31T18:42:52+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMO/OPA_SRC/module_example
r247 r1041 1 1 MODULE exampl 2 2 !!====================================================================== 3 !! *** MODULE exampl e***3 !! *** MODULE exampl *** 4 4 !! Ocean physics: brief description of the purpose of the module 5 5 !! (please no more than 2 lines) 6 !!===================================================================== 6 !!====================================================================== 7 !! History : 3.0 ! 2008-06 (Author Names) Original code 8 !! - ! 2008-08 (Author names) brief description of modifications 9 !! 3.1 ! 2008-12 (Author names) - - 10 !!---------------------------------------------------------------------- 11 7 12 #if defined key_example 8 13 !!---------------------------------------------------------------------- 9 14 !! 'key_example' : brief description of the key option 10 15 !!---------------------------------------------------------------------- 11 !! exa_mpl : liste of module subroutine (caution, never use the12 !! exa_mpl_init : name of the module for a routine)13 !! exa_mpl_stp : Please try to use 3 letter block for routine names16 !! exa_mpl : liste of module subroutine (caution, never use the 17 !! exa_mpl_init : name of the module for a routine) 18 !! exa_mpl_stp : Please try to use 3 letter block for routine names 14 19 !!---------------------------------------------------------------------- 15 !! * Modules used 16 USE module_name1 ! brief description of the used module 17 USE module_name2 ! .... 20 USE module_name1 ! brief description of the used module 21 USE module_name2 ! .... 18 22 19 23 IMPLICIT NONE 20 24 PRIVATE 21 25 22 !! * Routine accessibility 23 PUBLIC exa_mpl ! routine called in xxx.F90 module 26 PUBLIC exa_mpl ! routine called in xxx.F90 module 24 27 25 !! * Share Module variables26 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) :: & !:27 var1 , & !: var1 description (CAUTION always use !: to describe a28 ! ! PUBLIC variable simplify the search of where it is declared29 var2 !: var2 description28 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) :: var1 !: var1 description. CAUTION always use !: to describe 29 ! ! a PUBLIC variable: simplify its search : 30 ! ! grep var1 *90 | grep '!:' 31 REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) :: var2, var2 !: several variable on a same line OK, but 32 ! ! DO NOT use continuation lines in declaration 30 33 31 ! ! * Module variables32 INTEGER :: & !!! ** toto namelist (namtoto) **33 nflag = 1 ! default value of nflag34 REAL(wp) :: & !!! ** toto namlist (namtoto) **35 var3 = 2._wp / 9._wp ! default value of var336 REAL(wp) :: & 37 var4 ! var4description (local permanent variable)38 REAL(wp) , DIMENSION(jpi,jpj,jpk) :: &39 tab1 ! coefficient used for horizontal smoothing34 ! !!! ** namelist nam_xxx ** 35 LOGICAL :: ln_opt = 1 ! give the default value of each namelist parameter 36 CHARACTER:: cn_tex = 'T' ! short description of the variable 37 INTEGER :: nn_opt = 1 ! please respect the DOCTOR norm for namelist variable 38 REAL(wp) :: rn_var = 2._wp ! (it becomes easy to identify them in the code) 39 40 INTEGER :: nint ! nint description (local permanent variable) 41 REAL(wp) :: var ! var - - 42 REAL(wp), DIMENSION(jpi,jpj,jpk) :: array ! array - - 40 43 41 44 !! * Substitutions 42 45 # include "exampl_substitute.h90" 43 46 !!---------------------------------------------------------------------- 44 !! OPA 9.0 , LOCEAN-IPSL (2005) 45 !! or LIM 2.0 , UCL-LOCEAN-IPSL (2005) 46 !! or TOP 1.0 , LOCEAN-IPSL (2005) 47 !! $Header$ 48 !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 47 !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) 48 !! $Id:$ 49 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 49 50 !!---------------------------------------------------------------------- 50 51 51 52 CONTAINS 52 53 53 # if defined key_autotasking 54 !!---------------------------------------------------------------------- 55 !! 'key_autotasking' autotasking (j-slab) 56 !!---------------------------------------------------------------------- 57 # include "exampl_autotsk.h90" 58 59 # else 60 !!---------------------------------------------------------------------- 61 !! Default option : vector opt. (k-j-i loop) 62 !!---------------------------------------------------------------------- 63 64 SUBROUTINE exa_mpl( kt ) 54 SUBROUTINE exa_mpl( kt, pvar1, pvar2, ptab ) 65 55 !!---------------------------------------------------------------------- 66 56 !! *** ROUTINE exa_mpl *** … … 69 59 !! 70 60 !! ** Method : description of the methodoloy used to achieve the 71 !! objectives of the routine. Be as clear as possible!61 !! objectives of the routine. Be as clear as possible! 72 62 !! 73 63 !! ** Action : - first action (share memory array/varible modified … … 76 66 !! - ..... 77 67 !! 78 !! References : 79 !! Give references if exist otherwise suppress these lines 68 !! References : Author et al., Short_name_review, Year 69 !! Give references if exist otherwise suppress these lines 70 !!---------------------------------------------------------------------- 71 USE toto_module ! description od the module 80 72 !! 81 !! History : 82 !! 9.0 ! 03-08 (Autor Names) Original code 83 !! ! 02-08 (Author names) brief description of modifications 84 !!---------------------------------------------------------------------- 85 !! * Modules used 86 USE toto_module ! description od the module 87 88 !! * arguments 89 INTEGER, INTENT( in ) :: & 90 kt ! describe it!!! 91 92 !! * local declarations 93 INTEGER :: ji, jj, jk ! dummy loop arguments 94 INTEGER :: & 95 itoto, itata, & ! temporary integers 96 ititi ! please do not forget the DOCTOR rule: 97 ! ! local integer: name start with i 98 REAL(wp) :: & 99 zmlmin, zbbrau, & ! temporary scalars 100 zfact1, zfact2, zfact3, & ! " " 101 zbn2, zesurf, & ! local scalar: name start with z 102 zemxl ! 103 REAL(wp), DIMENSION(jpi,jpk) :: & 104 ztoto ! temporary workspace 73 INTEGER , INTENT(in ) :: kt ! short description 74 INTEGER , INTENT(inout) :: pvar1 ! - - 75 REAL(wp), INTENT( out) :: pvar2 ! - - 76 REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: pvar2 ! - - 77 !! 78 INTEGER :: ji, jj, jk ! dummy loop arguments (DOCTOR : start with j, but not jp) 79 INTEGER :: itoto, itata ! temporary integers (DOCTOR : start with i 80 REAL(wp) :: zmlmin, zbbrau ! temporary scalars (DOCTOR : start with z) 81 REAL(wp) :: zfact1, zfact2 ! do not use continuation lines in declaration 82 REAL(wp), DIMENSION(jpi,jpk) :: ztoto ! 2D workspace 105 83 !!-------------------------------------------------------------------- 106 107 108 84 109 85 IF( kt == nit000 ) CALL exa_mpl_init ! Initialization (first time-step only) 110 86 111 ! Local constant initialization 112 zmlmin = 1.e-8 87 zmlmin = 1.e-8 ! Local constant initialization 113 88 zbbrau = .5 * ebb / rau0 114 89 zfact1 = -.5 * rdt * efave 115 90 zfact2 = 1.5 * rdt * ediss 116 zfact3 = 0.5 * rdt * ediss117 91 118 119 SELECT CASE ( npdl ) 120 121 CASE ( 0 ) ! describe case 1 92 SELECT CASE ( npdl ) ! short description of the action 93 ! 94 CASE ( 0 ) ! describe case 1 122 95 DO jk = 2, jpkm1 123 96 DO jj = 2, jpjm1 … … 127 100 END DO 128 101 END DO 129 130 CASE ( 1 ) ! describe case 2102 ! 103 CASE ( 1 ) ! describe case 2 131 104 DO jk = 2, jpkm1 132 105 DO jj = 2, jpjm1 … … 136 109 END DO 137 110 END DO 138 111 ! 139 112 END SELECT 140 113 141 ! Lateral boundary conditions (avmu) (unchanged sign) 142 CALL mpplnk2( avmu, 'U', 1. ) 143 114 CALL mpplnk2( avmu, 'U', 1. ) ! Lateral boundary conditions (avmu) (unchanged sign) 115 ! 144 116 END SUBROUTINE exa_mpl 145 117 146 # endif147 118 148 119 SUBROUTINE exa_mpl_init … … 157 128 !! 158 129 !! ** Action : ... 130 !!---------------------------------------------------------------------- 131 INTEGER :: ji, jj, jk, jit ! dummy loop indices 159 132 !! 160 !! history : 161 !! 9.0 ! 03-08 (Autor Names) Original code 133 NAMELIST/namexa/ exa_v1, exa_v2, nexa_0 162 134 !!---------------------------------------------------------------------- 163 !! * local declarations 164 INTEGER :: ji, jj, jk, jit ! dummy loop indices 165 166 NAMELIST/namexa/ exa_v1, exa_v2, nexa_0 167 !!---------------------------------------------------------------------- 168 169 ! Read Namelist namexa : example parameters 170 REWIND ( numnam ) 135 ! 136 REWIND ( numnam ) ! Read Namelist namexa : example parameters 171 137 READ ( numnam, namexa ) 172 173 174 ! Control print 175 IF(lwp) THEN 138 ! 139 IF(lwp) THEN ! Control print 176 140 WRITE(numout,*) 177 141 WRITE(numout,*) 'exa_mpl_init : example ' … … 182 146 WRITE(numout,*) ' brief desciption nexa_0 = ', nexa_0 183 147 ENDIF 184 185 ! Parameter control 186 #if defined key_toto 187 IF(lwp) WRITE(numout,cform_err) 188 IF(lwp) WRITE(numout,*) ' this part and key_toto are incompatible' 189 nstop = nstop + 1 190 #endif 191 192 ! Check nexa_0 values 193 IF( nexa_0 < 0 ) THEN 194 IF(lwp) WRITE(numout,cform_err) 195 IF(lwp) WRITE(numout,*) ' bad flag: nmxl is < 0 or > 3 ' 196 nstop = nstop + 1 148 ! 149 ! ! Parameter control 150 IF( ln_opt ) CALL ctl_stop( 'this work and option xxx are incompatible' ) 151 IF( ln_opt2 ) CALL ctl_warn( 'this work and option yyy may cause problems' ) 197 152 ENDIF 198 153 ! 199 154 END SUBROUTINE exa_mpl_init 200 155 201 156 #else 202 157 !!---------------------------------------------------------------------- 203 !! Default option : Empty module158 !! Default option : NO example 204 159 !!---------------------------------------------------------------------- 205 160 CONTAINS 206 SUBROUTINE exa_mpl ! Empty routine 161 SUBROUTINE exa_mpl( kt, pvar1, pvar2, ptab ) ! Empty routine 162 REAL:: ptab(:,:) 163 WRITE(*,*) 'exa_mpl: You should not have seen this print! error?', kt, pvar1, pvar2, ptab(1,1) 207 164 END SUBROUTINE exa_mpl 208 165 #endif
Note: See TracChangeset
for help on using the changeset viewer.