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.
isfload.F90 in NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ISF – NEMO

source: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/ISF/isfload.F90 @ 12340

Last change on this file since 12340 was 12340, checked in by acc, 4 years ago

Branch 2019/dev_r11943_MERGE_2019. This commit introduces basic do loop macro
substitution to the 2019 option 1, merge branch. These changes have been SETTE
tested. The only addition is the do_loop_substitute.h90 file in the OCE directory but
the macros defined therein are used throughout the code to replace identifiable, 2D-
and 3D- nested loop opening and closing statements with single-line alternatives. Code
indents are also adjusted accordingly.

The following explanation is taken from comments in the new header file:

This header file contains preprocessor definitions and macros used in the do-loop
substitutions introduced between version 4.0 and 4.2. The primary aim of these macros
is to assist in future applications of tiling to improve performance. This is expected
to be achieved by alternative versions of these macros in selected locations. The
initial introduction of these macros simply replaces all identifiable nested 2D- and
3D-loops with single line statements (and adjusts indenting accordingly). Do loops
are identifiable if they comform to either:

DO jk = ....

DO jj = .... DO jj = ...

DO ji = .... DO ji = ...
. OR .
. .

END DO END DO

END DO END DO

END DO

and white-space variants thereof.

Additionally, only loops with recognised jj and ji loops limits are treated; these are:
Lower limits of 1, 2 or fs_2
Upper limits of jpi, jpim1 or fs_jpim1 (for ji) or jpj, jpjm1 or fs_jpjm1 (for jj)

The macro naming convention takes the form: DO_2D_BT_LR where:

B is the Bottom offset from the PE's inner domain;
T is the Top offset from the PE's inner domain;
L is the Left offset from the PE's inner domain;
R is the Right offset from the PE's inner domain

So, given an inner domain of 2,jpim1 and 2,jpjm1, a typical example would replace:

DO jj = 2, jpj

DO ji = 1, jpim1
.
.

END DO

END DO

with:

DO_2D_01_10
.
.
END_2D

similar conventions apply to the 3D loops macros. jk loop limits are retained
through macro arguments and are not restricted. This includes the possibility of
strides for which an extra set of DO_3DS macros are defined.

In the example definition below the inner PE domain is defined by start indices of
(kIs, kJs) and end indices of (kIe, KJe)

#define DO_2D_00_00 DO jj = kJs, kJe ; DO ji = kIs, kIe
#define END_2D END DO ; END DO

TO DO:


Only conventional nested loops have been identified and replaced by this step. There are constructs such as:

DO jk = 2, jpkm1

z2d(:,:) = z2d(:,:) + e3w(:,:,jk,Kmm) * z3d(:,:,jk) * wmask(:,:,jk)

END DO

which may need to be considered.

File size: 5.4 KB
Line 
1MODULE isfload
2   !!======================================================================
3   !!                       ***  MODULE  isfload  ***
4   !! isfload module :  compute ice shelf load (needed for the hpg)
5   !!======================================================================
6   !! History :  4.1  !  2019-09  (P. Mathiot) original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   isfload      : compute ice shelf load
11   !!----------------------------------------------------------------------
12
13   USE isf_oce, ONLY: cn_isfload, rn_isfload_T, rn_isfload_S ! ice shelf variables
14
15   USE dom_oce, ONLY: e3w, gdept, risfdep, mikt     ! vertical scale factor
16   USE eosbn2 , ONLY: eos                           ! eos routine
17
18   USE lib_mpp, ONLY: ctl_stop                               ! ctl_stop routine
19   USE in_out_manager                                        !
20
21   IMPLICIT NONE
22
23   PRIVATE
24
25   PUBLIC isf_load
26   !! * Substitutions
27#  include "do_loop_substitute.h90"
28
29CONTAINS
30
31   SUBROUTINE isf_load ( Kmm, pisfload )
32      !!--------------------------------------------------------------------
33      !!                  ***  SUBROUTINE isf_load  ***
34      !!
35      !! ** Purpose : compute the ice shelf load
36      !!
37      !!--------------------------------------------------------------------
38      !!-------------------------- OUT -------------------------------------
39      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pisfload
40      !!-------------------------- IN  -------------------------------------
41      INTEGER,                      INTENT(in)    :: Kmm           ! ocean time level index
42      !!----------------------------------------------------------------------
43      !
44      ! quality test: ice shelf in a stratify/uniform ocean should not drive any flow.
45      !               the smaller the residual flow is, the better it is.
46      !
47      ! ice shelf cavity
48      SELECT CASE ( cn_isfload )
49      CASE ( 'uniform' )
50         CALL isf_load_uniform ( Kmm, pisfload )
51      CASE DEFAULT
52         CALL ctl_stop('STOP','method cn_isfload to compute ice shelf load does not exist (isomip), check your namelist')
53      END SELECT
54      !
55   END SUBROUTINE isf_load
56
57   SUBROUTINE isf_load_uniform( Kmm, pisfload )
58      !!--------------------------------------------------------------------
59      !!                  ***  SUBROUTINE isf_load  ***
60      !!
61      !! ** Purpose : compute the ice shelf load
62      !!
63      !! ** Method  : The ice shelf is assumed to be in hydro static equilibrium
64      !!              in water at -1.9 C and 34.4 PSU. Weight of the ice shelf is
65      !!              integrated from top to bottom.
66      !!
67      !!--------------------------------------------------------------------
68      !!-------------------------- OUT -------------------------------------
69      REAL(wp), DIMENSION(jpi,jpj), INTENT(  out) :: pisfload
70      !!-------------------------- IN  -------------------------------------
71      INTEGER,                      INTENT(in)    :: Kmm           ! ocean time level index
72      !!--------------------------------------------------------------------
73      INTEGER  :: ji, jj, jk
74      INTEGER  :: ikt
75      REAL(wp)                          :: znad        !
76      REAL(wp), DIMENSION(jpi,jpj)      :: zrhdtop_isf ! water density    displaced by the ice shelf (at the interface)
77      REAL(wp), DIMENSION(jpi,jpj,jpts) :: zts_top     ! water properties displaced by the ice shelf   
78      REAL(wp), DIMENSION(jpi,jpj,jpk)  :: zrhd        ! water density    displaced by the ice shelf
79      !!----------------------------------------------------------------------
80      !
81      znad = 1._wp                     !- To use density and not density anomaly
82      !
83      !                                !- assume water displaced by the ice shelf is at T=rn_isfload_T and S=rn_isfload_S (rude)
84      zts_top(:,:,jp_tem) = rn_isfload_T   ;   zts_top(:,:,jp_sal) = rn_isfload_S
85      !
86      DO jk = 1, jpk                   !- compute density of the water displaced by the ice shelf
87         CALL eos( zts_top(:,:,:), gdept(:,:,jk,Kmm), zrhd(:,:,jk) )
88      END DO
89      !
90      !                                !- compute rhd at the ice/oce interface (ice shelf side)
91      CALL eos( zts_top , risfdep, zrhdtop_isf )
92      !
93      !                                !- Surface value + ice shelf gradient
94      pisfload(:,:) = 0._wp                       ! compute pressure due to ice shelf load
95      DO_2D_11_11
96         ikt = mikt(ji,jj)
97         !
98         IF ( ikt > 1 ) THEN
99            !
100            ! top layer of the ice shelf
101            pisfload(ji,jj) = pisfload(ji,jj) + (znad + zrhd(ji,jj,1) ) * e3w(ji,jj,1,Kmm)
102            !
103            ! core layers of the ice shelf
104            DO jk = 2, ikt-1
105               pisfload(ji,jj) = pisfload(ji,jj) + (2._wp * znad + zrhd(ji,jj,jk-1) + zrhd(ji,jj,jk)) * e3w(ji,jj,jk,Kmm)
106            END DO
107            !
108            ! deepest part of the ice shelf (between deepest T point and ice/ocean interface
109            pisfload(ji,jj) = pisfload(ji,jj) + (2._wp * znad + zrhdtop_isf(ji,jj) + zrhd(ji,jj,ikt-1)) &
110               &                                              * ( risfdep(ji,jj) - gdept(ji,jj,ikt-1,Kmm) )
111            !
112         END IF
113      END_2D
114      !
115   END SUBROUTINE isf_load_uniform
116
117END MODULE isfload
Note: See TracBrowser for help on using the repository browser.