New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
module_example in trunk/NEMO/OFF_SRC – NEMO

source: trunk/NEMO/OFF_SRC/module_example @ 1152

Last change on this file since 1152 was 1152, checked in by rblod, 16 years ago

Convert cvs header to svn Id, step II

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.7 KB
Line 
1MODULE exampl
2   !!======================================================================
3   !!                       ***  MODULE  example  ***
4   !! Ocean physics:  brief description of the purpose of the module
5   !!                 (please no more than 2 lines)
6   !!=====================================================================
7#if defined key_example
8   !!----------------------------------------------------------------------
9   !!   'key_example'  :                brief description of the key option
10   !!----------------------------------------------------------------------
11   !!   exa_mpl      : liste of module subroutine (caution, never use the
12   !!   exa_mpl_init : name of the module for a routine)
13   !!   exa_mpl_stp  : Please try to use 3 letter block for routine names
14   !!----------------------------------------------------------------------
15   !! * Modules used
16   USE module_name1            ! brief description of the used module
17   USE module_name2            ! ....
18
19   IMPLICIT NONE
20   PRIVATE
21
22   !! *  Routine accessibility
23   PUBLIC exa_mpl    ! routine called in xxx.F90 module
24
25   !! * Share Module variables
26   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &  !:
27      var1    ,   &  !: var1 description (CAUTION always use !: to describe a
28      !              !  PUBLIC variable simplify the search of where it is declared
29      var2           !: var2 description
30
31   !! * Module variables
32   INTEGER ::                 & !!! ** toto namelist (namtoto) **
33      nflag  =  1                ! default value of nflag
34   REAL(wp) ::                & !!! ** toto namlist (namtoto) **
35      var3  = 2._wp / 9._wp      ! default value of var3
36   REAL(wp) ::   & 
37      var4          ! var4 description (local permanent variable)
38   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   &
39      tab1          ! coefficient used for horizontal smoothing
40
41   !! * Substitutions
42#  include "exampl_substitute.h90"
43   !!----------------------------------------------------------------------
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   !! $Id$
48   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
49   !!----------------------------------------------------------------------
50
51CONTAINS
52
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 )
65      !!----------------------------------------------------------------------
66      !!                    ***  ROUTINE exa_mpl  ***
67      !!
68      !! ** Purpose :   Brief description of the routine
69      !!
70      !! ** Method  :   description of the methodoloy used to achieve the
71      !!      objectives of the routine. Be as clear as possible!
72      !!
73      !! ** Action  : - first action (share memory array/varible modified
74      !!                in this routine
75      !!              - second action .....
76      !!              - .....
77      !!
78      !! References :
79      !!   Give references if exist otherwise suppress these lines
80      !!
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
105      !!--------------------------------------------------------------------
106
107
108
109      IF( kt == nit000  )   CALL exa_mpl_init    ! Initialization (first time-step only)
110
111      ! Local constant initialization
112      zmlmin = 1.e-8
113      zbbrau =  .5 * ebb / rau0
114      zfact1 = -.5 * rdt * efave
115      zfact2 = 1.5 * rdt * ediss
116      zfact3 = 0.5 * rdt * ediss
117
118
119      SELECT CASE ( npdl )
120
121      CASE ( 0 )           ! describe case 1
122         DO jk = 2, jpkm1
123            DO jj = 2, jpjm1
124               DO ji = fs_2, fs_jpim1   ! vector opt.
125                  avmv(ji,jj,jk) = ....
126               END DO
127            END DO
128         END DO
129
130      CASE ( 1 )           ! describe case 2
131         DO jk = 2, jpkm1
132            DO jj = 2, jpjm1
133               DO ji = fs_2, fs_jpim1   ! vector opt.
134                  avmv(ji,jj,jk) = ...
135               END DO
136            END DO
137         END DO
138
139      END SELECT
140
141      ! Lateral boundary conditions (avmu)   (unchanged sign)
142      CALL mpplnk2( avmu, 'U', 1. )
143
144   END SUBROUTINE exa_mpl
145
146# endif
147
148   SUBROUTINE exa_mpl_init
149      !!----------------------------------------------------------------------
150      !!                  ***  ROUTINE exa_mpl_init  ***
151      !!                   
152      !! ** Purpose :   initialization of ....
153      !!
154      !! ** Method  :   blah blah blah ...
155      !!
156      !! ** input   :   Namlist namexa
157      !!
158      !! ** Action  :   ... 
159      !!
160      !! history :
161      !!   9.0  !  03-08  (Autor Names)  Original code
162      !!----------------------------------------------------------------------
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 )
171      READ   ( numnam, namexa )
172
173
174      ! Control print
175      IF(lwp) THEN
176         WRITE(numout,*)
177         WRITE(numout,*) 'exa_mpl_init : example '
178         WRITE(numout,*) '~~~~~~~~~~~~'
179         WRITE(numout,*) '          Namelist namexa : set example parameters'
180         WRITE(numout,*) '             brief desciption               exa_v1  = ', exa_v1
181         WRITE(numout,*) '             brief desciption               exa_v1  = ', exa_v1
182         WRITE(numout,*) '             brief desciption               nexa_0  = ', nexa_0
183      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
197      ENDIF
198
199   END SUBROUTINE exa_mpl_init
200
201#else
202   !!----------------------------------------------------------------------
203   !!   Default option :                                       Empty module
204   !!----------------------------------------------------------------------
205CONTAINS
206   SUBROUTINE exa_mpl              ! Empty routine
207   END SUBROUTINE exa_mpl
208#endif
209
210   !!======================================================================
211END MODULE exampl
Note: See TracBrowser for help on using the repository browser.