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.
Changeset 2433 for branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/module_example – NEMO

Ignore:
Timestamp:
2010-11-25T15:44:47+01:00 (13 years ago)
Author:
gm
Message:

v3.3beta: #672 update the module example (see branches/DEV_1821_example)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/module_example

    r2281 r2433  
    77   !! History : 3.0  !  2008-06  (Author Names)  Original code 
    88   !!            -   !  2008-08  (Author names)  brief description of modifications 
    9    !!           3.1  !  2008-12  (Author names)        -              - 
     9   !!           3.3  !  2010-11  (Author names)        -              - 
    1010   !!---------------------------------------------------------------------- 
    11  
    1211#if defined key_example 
    1312   !!---------------------------------------------------------------------- 
     
    2625   PUBLIC   exa_mpl   ! routine called in xxx.F90 module 
    2726 
     27   TYPE ::   FLD_E                !: Structure type definition 
     28      CHARACTER(len = 256) ::   clname      ! clname description  
     29      INTEGER              ::   nfreqh      ! nfreqh description  
     30   END TYPE FLD_E  
     31 
    2832   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   var1         !: var1 description. CAUTION always use !: to describe 
    2933   !                                                          !  a PUBLIC variable: simplify its search :  
     
    3236   !                                                          !  DO NOT use continuation lines in declaration 
    3337 
    34    !                             !!! ** 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) 
     38   !                               !!* namelist nam_xxx * 
     39   LOGICAL   ::   ln_opt = .TRUE.   ! give the default value of each namelist parameter 
     40   CHARACTER ::   cn_tex = 'T'      ! short description  of the variable 
     41   INTEGER   ::   nn_opt = 1        ! please respect the DOCTOR norm for namelist variable 
     42   REAL(wp)  ::   rn_var = 2._wp    ! (it becomes easy to identify them in the code) 
     43   TYPE(FLD) ::   sn_ex             ! structure 
    3944 
    4045   INTEGER                          ::   nint    ! nint  description (local permanent variable) 
     
    4550#  include "exampl_substitute.h90" 
    4651   !!---------------------------------------------------------------------- 
    47    !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008)  
     52   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    4853   !! $Id$  
    49    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     54   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    5055   !!---------------------------------------------------------------------- 
    51  
    5256CONTAINS 
    5357 
     
    111115         ! 
    112116      END SELECT 
    113  
    114       CALL mpplnk2( avmu, 'U', 1. )              ! Lateral boundary conditions (avmu)   (unchanged sign) 
     117      ! 
     118      CALL mpplnk2( avmu, 'U', 1. )              ! Lateral boundary conditions (unchanged sign) 
    115119      ! 
    116120   END SUBROUTINE exa_mpl 
     
    131135      INTEGER ::   ji, jj, jk, jit   ! dummy loop indices 
    132136      !! 
    133       NAMELIST/namexa/ exa_v1, exa_v2, nexa_0        
     137      NAMELIST/namexa/ exa_v1, exa_v2, nexa_0, sn_ex      
    134138      !!---------------------------------------------------------------------- 
    135139      ! 
    136       REWIND ( numnam )                          ! Read Namelist namexa : example parameters 
    137       READ   ( numnam, namexa ) 
     140      sn_ex%clname ='toto'                      ! set default namelist values 
     141      sn_ex%nfreqh = 2  
    138142      ! 
    139       IF(lwp) THEN                               ! Control print 
     143      REWIND( numnam )                          ! Read Namelist namexa : example parameters 
     144      READ  ( numnam, namexa ) 
     145      ! 
     146      IF(lwp) THEN                              ! Control print 
    140147         WRITE(numout,*) 
    141148         WRITE(numout,*) 'exa_mpl_init : example ' 
    142149         WRITE(numout,*) '~~~~~~~~~~~~' 
    143          WRITE(numout,*) '          Namelist namexa : set example parameters' 
    144          WRITE(numout,*) '             brief desciption               exa_v1  = ', exa_v1 
    145          WRITE(numout,*) '             brief desciption               exa_v1  = ', exa_v1 
    146          WRITE(numout,*) '             brief desciption               nexa_0  = ', nexa_0 
     150         WRITE(numout,*) '   Namelist namexa : set example parameters' 
     151         WRITE(numout,*) '      brief desciption               exa_v1  = ', exa_v1 
     152         WRITE(numout,*) '      brief desciption               exa_v1  = ', exa_v1 
     153         WRITE(numout,*) '      brief desciption               nexa_0  = ', nexa_0 
     154         WRITE(numout,*) '      brief desciption          sn_ex%clname = ', sn_ex%clname 
     155         WRITE(numout,*) '      brief desciption          sn_ex%nfreqh = ', sn_ex%nfreqh 
    147156      ENDIF 
    148157      ! 
    149158      !                                          ! 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' ) 
    152       ENDIF 
     159      IF( ln_opt      )   CALL ctl_stop( 'exa_mpl_init: this work and option xxx are incompatible'   ) 
     160      IF( nn_opt == 2 )   CALL ctl_warn( 'exa_mpl_init: this work and option yyy may cause problems' ) 
    153161      ! 
    154162   END SUBROUTINE exa_mpl_init 
Note: See TracChangeset for help on using the changeset viewer.