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.
depth_e3.F90 in branches/2017/dev_merge_2017/NEMOGCM/NEMO/OCE_SRC/DOM – NEMO

source: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OCE_SRC/DOM/depth_e3.F90 @ 9570

Last change on this file since 9570 was 9570, checked in by nicolasmartin, 6 years ago

Global renaming for core routines (./NEMO)

  • Folders
    • LIM_SRC_3 -> ICE_SRC
    • OPA_SRC -> OCE_SRC
  • CPP key: key_lim3 -> key_si3
  • Modules, (sub)routines and variables names
    • MPI: mpi_comm_opa -> mpi_comm_oce, MPI_COMM_OPA -> MPI_COMM_OCE, mpi_init_opa -> mpi_init_oce
    • AGRIF: agrif_opa_* -> agrif_oce_*, agrif_lim3_* -> agrif_si3_* and few more
    • TOP-PISCES: p.zlim -> p.zice, namp.zlim -> namp.zice
  • Comments
    • NEMO/OPA -> NEMO/OCE
    • ESIM|LIM3 -> SI3
File size: 7.4 KB
Line 
1MODULE depth_e3
2   !!======================================================================
3   !!                       ***  MODULE  depth_e3  ***
4   !!
5   !! zgr : vertical coordinate system
6   !!======================================================================
7   !! History :  4.0  ! 2016-11  (S. Flavoni, G. Madec)  Original code
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   depth_to_e3   : use the depth of t- and w-points to calculate e3t & e3w
12   !!                   (generic interface for 1D and 3D fields)
13   !!   e3_to_depth   : use e3t & e3w to calculate the depth of t- and w-points
14   !!                   (generic interface for 1D and 3D fields)
15   !!---------------------------------------------------------------------
16   USE oce               ! ocean variables
17   USE dom_oce           ! ocean domain
18   !
19   USE in_out_manager    ! I/O manager
20   USE lbclnk            ! ocean lateral boundary conditions (or mpp link)
21   USE lib_mpp           ! distributed memory computing library
22   USE timing            ! Timing
23
24   IMPLICIT NONE
25   PRIVATE
26 
27   INTERFACE depth_to_e3
28      MODULE PROCEDURE depth_to_e3_1d, depth_to_e3_3d
29   END INTERFACE
30
31   INTERFACE e3_to_depth
32      MODULE PROCEDURE e3_to_depth_1d, e3_to_depth_3d
33   END INTERFACE
34
35   PUBLIC   depth_to_e3        ! called by usrdef_zgr
36   PUBLIC   e3_to_depth        ! called by domzgr.F90
37     
38   !! * Substitutions
39#  include "vectopt_loop_substitute.h90"
40   !!----------------------------------------------------------------------
41   !! NEMO/OCE 4.0 , NEMO Consortium (2016)
42   !! $Id$
43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS             
46
47   SUBROUTINE depth_to_e3_1d( pdept_1d, pdepw_1d, pe3t_1d, pe3w_1d )
48      !!---------------------------------------------------------------------
49      !!              ***  ROUTINE depth_to_e3_1d  ***
50      !!
51      !! ** Purpose :   compute e3t & e3w scale factors from t- & w-depths of model levels
52      !!
53      !! ** Method  :   The scale factors are given by the discrete derivative
54      !!              of the depth:
55      !!                               e3w(jk) = dk[ dept_1d ]
56      !!                               e3t(jk) = dk[ depw_1d ]
57      !!              with, at top and bottom :
58      !!                      e3w( 1 ) = 2 * ( dept( 1 ) - depw( 1 ) )
59      !!                      e3t(jpk) = 2 * ( dept(jpk) - depw(jpk) )   
60      !!
61      !! ** Action  : - pe3t_1d , pe3w_1d  : scale factors at T- and W-levels (m)
62      !!----------------------------------------------------------------------
63      REAL(wp), DIMENSION(:), INTENT(in   ) ::   pdept_1d, pdepw_1d   ! depths          [m]
64      REAL(wp), DIMENSION(:), INTENT(  out) ::   pe3t_1d , pe3w_1d    ! e3.=dk[depth]   [m]
65      !
66      INTEGER  ::   jk           ! dummy loop indices
67      !!----------------------------------------------------------------------
68      !
69      ! use pdep. at w- and t-points to compute e3. (e3. = dk[depth])
70      !
71      pe3w_1d( 1 ) = 2._wp * ( pdept_1d(1) - pdepw_1d(1) ) 
72      DO jk = 1, jpkm1
73         pe3w_1d(jk+1) = pdept_1d(jk+1) - pdept_1d(jk) 
74         pe3t_1d(jk  ) = pdepw_1d(jk+1) - pdepw_1d(jk) 
75      END DO
76      pe3t_1d(jpk) = 2._wp * ( pdept_1d(jpk) - pdepw_1d(jpk) )
77      !
78   END SUBROUTINE depth_to_e3_1d
79   
80     
81   SUBROUTINE depth_to_e3_3d( pdept_3d, pdepw_3d, pe3t_3d, pe3w_3d )
82      !!---------------------------------------------------------------------
83      !!              ***  ROUTINE depth_to_e3_3d  ***
84      !!
85      !! ** Purpose :   compute e3t & e3w scale factors from t- & w-depths of model levels
86      !!
87      !! ** Method  :   The scale factors are given by the discrete derivative
88      !!              of the depth:
89      !!                               e3w(jk) = dk[ dept_1d ]
90      !!                               e3t(jk) = dk[ depw_1d ]
91      !!              with, at top and bottom :
92      !!                      e3w( 1 ) = 2 * ( dept( 1 ) - depw( 1 ) )
93      !!                      e3t(jpk) = 2 * ( dept(jpk) - depw(jpk) )   
94      !!
95      !! ** Action  : - pe3t_1d , pe3w_1d  : scale factors at T- and W-levels (m)
96      !!----------------------------------------------------------------------
97      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdept_3d, pdepw_3d   ! depth           [m]
98      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pe3t_3d , pe3w_3d    ! e3.=dk[depth]   [m]
99      !
100      INTEGER  ::   jk           ! dummy loop indices
101      !!----------------------------------------------------------------------     
102      pe3w_3d(:,:, 1 ) = 2._wp * ( pdept_3d(:,:,1) - pdepw_3d(:,:,1) ) 
103      DO jk = 1, jpkm1
104         pe3w_3d(:,:,jk+1) = pdept_3d(:,:,jk+1) - pdept_3d(:,:,jk) 
105         pe3t_3d(:,:,jk  ) = pdepw_3d(:,:,jk+1) - pdepw_3d(:,:,jk) 
106      END DO
107      pe3t_3d(:,:,jpk) = 2._wp * ( pdept_3d(:,:,jpk) - pdepw_3d(:,:,jpk) )   
108      !
109   END SUBROUTINE depth_to_e3_3d
110
111
112   SUBROUTINE e3_to_depth_1d( pe3t_1d, pe3w_1d, pdept_1d, pdepw_1d )
113      !!---------------------------------------------------------------------
114      !!              ***  ROUTINE e3_to_depth_1d  ***
115      !!
116      !! ** Purpose :   compute t- & w-depths of model levels from e3t & e3w scale factors
117      !!
118      !! ** Method  :   The t- & w-depth are given by the summation of e3w & e3t, resp.
119      !!
120      !! ** Action  : - pe3t_1d, pe3w_1d : scale factor of t- and w-point (m)
121      !!----------------------------------------------------------------------
122      REAL(wp), DIMENSION(:), INTENT(in   ) ::   pe3t_1d , pe3w_1d    ! vert. scale factors   [m]
123      REAL(wp), DIMENSION(:), INTENT(  out) ::   pdept_1d, pdepw_1d   ! depth = SUM( e3 )     [m]
124      !
125      INTEGER  ::   jk           ! dummy loop indices
126      !!----------------------------------------------------------------------
127      !
128      pdepw_1d(1) = 0.0_wp
129      pdept_1d(1) = 0.5_wp * pe3w_1d(1)
130      DO jk = 2, jpk
131         pdepw_1d(jk) = pdepw_1d(jk-1) + pe3t_1d(jk-1) 
132         pdept_1d(jk) = pdept_1d(jk-1) + pe3w_1d(jk  ) 
133      END DO
134      !
135   END SUBROUTINE e3_to_depth_1d
136   
137     
138   SUBROUTINE e3_to_depth_3d( pe3t_3d, pe3w_3d, pdept_3d, pdepw_3d )
139      !!---------------------------------------------------------------------
140      !!              ***  ROUTINE e3_to_depth_3d  ***
141      !!
142      !! ** Purpose :   compute t- & w-depths of model levels from e3t & e3w scale factors
143      !!
144      !! ** Method  :   The t- & w-depth are given by the summation of e3w & e3t, resp.
145      !!
146      !! ** Action  : - pe3t_1d, pe3w_1d : scale factor of t- and w-point (m)
147      !!----------------------------------------------------------------------
148      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pe3t_3d , pe3w_3d    ! vert. scale factors   [m]
149      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pdept_3d, pdepw_3d   ! depth = SUM( e3 )     [m]
150      !
151      INTEGER  ::   jk           ! dummy loop indices
152      !!----------------------------------------------------------------------     
153      !
154      pdepw_3d(:,:,1) = 0.0_wp
155      pdept_3d(:,:,1) = 0.5_wp * pe3w_3d(:,:,1)
156      DO jk = 2, jpk
157         pdepw_3d(:,:,jk) = pdepw_3d(:,:,jk-1) + pe3t_3d(:,:,jk-1) 
158         pdept_3d(:,:,jk) = pdept_3d(:,:,jk-1) + pe3w_3d(:,:,jk  ) 
159      END DO
160      !
161   END SUBROUTINE e3_to_depth_3d
162
163   !!======================================================================
164END MODULE depth_e3
Note: See TracBrowser for help on using the repository browser.