[825] | 1 | MODULE limthd_ent |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE limthd_ent *** |
---|
| 4 | !! Redistribution of Enthalpy in the ice |
---|
| 5 | !! on the new vertical grid |
---|
| 6 | !! after vertical growth/decay |
---|
| 7 | !!====================================================================== |
---|
[2715] | 8 | !! History : LIM ! 2003-05 (M. Vancoppenolle) Original code in 1D |
---|
| 9 | !! ! 2005-07 (M. Vancoppenolle) 3D version |
---|
| 10 | !! ! 2006-11 (X. Fettweis) Vectorized |
---|
| 11 | !! 3.0 ! 2008-03 (M. Vancoppenolle) Energy conservation and clean code |
---|
[4688] | 12 | !! 3.4 ! 2011-02 (G. Madec) dynamical allocation |
---|
| 13 | !! - ! 2014-05 (C. Rousset) complete rewriting |
---|
[2715] | 14 | !!---------------------------------------------------------------------- |
---|
[2528] | 15 | #if defined key_lim3 |
---|
| 16 | !!---------------------------------------------------------------------- |
---|
| 17 | !! 'key_lim3' LIM3 sea-ice model |
---|
| 18 | !!---------------------------------------------------------------------- |
---|
[3625] | 19 | !! lim_thd_ent : ice redistribution of enthalpy |
---|
[2528] | 20 | !!---------------------------------------------------------------------- |
---|
[3625] | 21 | USE par_oce ! ocean parameters |
---|
| 22 | USE dom_oce ! domain variables |
---|
| 23 | USE domain ! |
---|
| 24 | USE phycst ! physical constants |
---|
| 25 | USE ice ! LIM variables |
---|
| 26 | USE thd_ice ! LIM thermodynamics |
---|
| 27 | USE limvar ! LIM variables |
---|
| 28 | USE in_out_manager ! I/O manager |
---|
| 29 | USE lib_mpp ! MPP library |
---|
| 30 | USE wrk_nemo ! work arrays |
---|
| 31 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[825] | 32 | |
---|
| 33 | IMPLICIT NONE |
---|
| 34 | PRIVATE |
---|
| 35 | |
---|
[4688] | 36 | PUBLIC lim_thd_ent ! called by limthd and limthd_lac |
---|
[825] | 37 | |
---|
| 38 | !!---------------------------------------------------------------------- |
---|
[4161] | 39 | !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011) |
---|
[1156] | 40 | !! $Id$ |
---|
[2528] | 41 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[825] | 42 | !!---------------------------------------------------------------------- |
---|
| 43 | CONTAINS |
---|
[3294] | 44 | |
---|
[4688] | 45 | SUBROUTINE lim_thd_ent( kideb, kiut, qnew ) |
---|
[825] | 46 | !!------------------------------------------------------------------- |
---|
| 47 | !! *** ROUTINE lim_thd_ent *** |
---|
| 48 | !! |
---|
| 49 | !! ** Purpose : |
---|
[4688] | 50 | !! This routine computes new vertical grids in the ice, |
---|
| 51 | !! and consistently redistributes temperatures. |
---|
[825] | 52 | !! Redistribution is made so as to ensure to energy conservation |
---|
| 53 | !! |
---|
| 54 | !! |
---|
| 55 | !! ** Method : linear conservative remapping |
---|
| 56 | !! |
---|
[4688] | 57 | !! ** Steps : 1) cumulative integrals of old enthalpies/thicknesses |
---|
| 58 | !! 2) linear remapping on the new layers |
---|
[825] | 59 | !! |
---|
[4688] | 60 | !! ------------ cum0(0) ------------- cum1(0) |
---|
| 61 | !! NEW ------------- |
---|
| 62 | !! ------------ cum0(1) ==> ------------- |
---|
| 63 | !! ... ------------- |
---|
| 64 | !! ------------ ------------- |
---|
| 65 | !! ------------ cum0(nlay_i+2) ------------- cum1(nlay_i) |
---|
| 66 | !! |
---|
| 67 | !! |
---|
[2715] | 68 | !! References : Bitz & Lipscomb, JGR 99; Vancoppenolle et al., GRL, 2005 |
---|
| 69 | !!------------------------------------------------------------------- |
---|
| 70 | INTEGER , INTENT(in) :: kideb, kiut ! Start/End point on which the the computation is applied |
---|
[825] | 71 | |
---|
[4688] | 72 | REAL(wp), INTENT(inout), DIMENSION(:,:) :: qnew ! new enthlapies (J.m-3, remapped) |
---|
[825] | 73 | |
---|
[4688] | 74 | INTEGER :: ji ! dummy loop indices |
---|
| 75 | INTEGER :: jk0, jk1 ! old/new layer indices |
---|
[2715] | 76 | ! |
---|
[8325] | 77 | REAL(wp), POINTER, DIMENSION(:,:) :: zeh_cum0, zh_cum0 ! old cumulative enthlapies and layers interfaces |
---|
| 78 | REAL(wp), POINTER, DIMENSION(:,:) :: zeh_cum1, zh_cum1 ! new cumulative enthlapies and layers interfaces |
---|
[4688] | 79 | REAL(wp), POINTER, DIMENSION(:) :: zhnew ! new layers thicknesses |
---|
[2715] | 80 | !!------------------------------------------------------------------- |
---|
[825] | 81 | |
---|
[8325] | 82 | CALL wrk_alloc( jpij, nlay_i+3, zeh_cum0, zh_cum0, kjstart = 0 ) |
---|
| 83 | CALL wrk_alloc( jpij, nlay_i+1, zeh_cum1, zh_cum1, kjstart = 0 ) |
---|
[4688] | 84 | CALL wrk_alloc( jpij, zhnew ) |
---|
[825] | 85 | |
---|
[4688] | 86 | !-------------------------------------------------------------------------- |
---|
[5123] | 87 | ! 1) Cumulative integral of old enthalpy * thickness and layers interfaces |
---|
[4688] | 88 | !-------------------------------------------------------------------------- |
---|
[8325] | 89 | zeh_cum0(:,0:nlay_i+2) = 0._wp |
---|
[4688] | 90 | zh_cum0 (:,0:nlay_i+2) = 0._wp |
---|
| 91 | DO jk0 = 1, nlay_i+2 |
---|
[921] | 92 | DO ji = kideb, kiut |
---|
[8325] | 93 | zeh_cum0(ji,jk0) = zeh_cum0(ji,jk0-1) + eh_i_old(ji,jk0-1) |
---|
[4688] | 94 | zh_cum0 (ji,jk0) = zh_cum0 (ji,jk0-1) + h_i_old (ji,jk0-1) |
---|
| 95 | ENDDO |
---|
[825] | 96 | ENDDO |
---|
| 97 | |
---|
[4688] | 98 | !------------------------------------ |
---|
| 99 | ! 2) Interpolation on the new layers |
---|
| 100 | !------------------------------------ |
---|
| 101 | ! new layer thickesses |
---|
[825] | 102 | DO ji = kideb, kiut |
---|
[5123] | 103 | zhnew(ji) = SUM( h_i_old(ji,0:nlay_i+1) ) * r1_nlay_i |
---|
[825] | 104 | ENDDO |
---|
| 105 | |
---|
[4688] | 106 | ! new layers interfaces |
---|
| 107 | zh_cum1(:,0:nlay_i) = 0._wp |
---|
| 108 | DO jk1 = 1, nlay_i |
---|
[921] | 109 | DO ji = kideb, kiut |
---|
[4688] | 110 | zh_cum1(ji,jk1) = zh_cum1(ji,jk1-1) + zhnew(ji) |
---|
| 111 | ENDDO |
---|
[825] | 112 | ENDDO |
---|
| 113 | |
---|
[8325] | 114 | zeh_cum1(:,0:nlay_i) = 0._wp |
---|
[4688] | 115 | ! new cumulative q*h => linear interpolation |
---|
| 116 | DO jk0 = 1, nlay_i+1 |
---|
| 117 | DO jk1 = 1, nlay_i-1 |
---|
[921] | 118 | DO ji = kideb, kiut |
---|
[4688] | 119 | IF( zh_cum1(ji,jk1) <= zh_cum0(ji,jk0) .AND. zh_cum1(ji,jk1) > zh_cum0(ji,jk0-1) ) THEN |
---|
[8325] | 120 | zeh_cum1(ji,jk1) = ( zeh_cum0(ji,jk0-1) * ( zh_cum0(ji,jk0) - zh_cum1(ji,jk1 ) ) + & |
---|
| 121 | & zeh_cum0(ji,jk0 ) * ( zh_cum1(ji,jk1) - zh_cum0(ji,jk0-1) ) ) & |
---|
[4688] | 122 | & / ( zh_cum0(ji,jk0) - zh_cum0(ji,jk0-1) ) |
---|
| 123 | ENDIF |
---|
| 124 | ENDDO |
---|
| 125 | ENDDO |
---|
| 126 | ENDDO |
---|
| 127 | ! to ensure that total heat content is strictly conserved, set: |
---|
[8325] | 128 | zeh_cum1(:,nlay_i) = zeh_cum0(:,nlay_i+2) |
---|
[825] | 129 | |
---|
[4688] | 130 | ! new enthalpies |
---|
| 131 | DO jk1 = 1, nlay_i |
---|
[825] | 132 | DO ji = kideb, kiut |
---|
[5134] | 133 | rswitch = MAX( 0._wp , SIGN( 1._wp , zhnew(ji) - epsi20 ) ) |
---|
[8325] | 134 | qnew(ji,jk1) = rswitch * ( zeh_cum1(ji,jk1) - zeh_cum1(ji,jk1-1) ) / MAX( zhnew(ji), epsi20 ) |
---|
[4688] | 135 | ENDDO |
---|
| 136 | ENDDO |
---|
[825] | 137 | |
---|
[4688] | 138 | ! --- diag error on heat remapping --- ! |
---|
[8325] | 139 | ! comment: if input h_i_old and eh_i_old are already multiplied by a_i (as in limthd_lac), |
---|
[4688] | 140 | ! then we should not (* a_i) again but not important since this is just to check that remap error is ~0 |
---|
[825] | 141 | DO ji = kideb, kiut |
---|
[4872] | 142 | hfx_err_rem_1d(ji) = hfx_err_rem_1d(ji) + a_i_1d(ji) * r1_rdtice * & |
---|
[8325] | 143 | & ( SUM( qnew(ji,1:nlay_i) ) * zhnew(ji) - SUM( eh_i_old(ji,0:nlay_i+1) ) ) |
---|
[2715] | 144 | END DO |
---|
[4688] | 145 | |
---|
[921] | 146 | ! |
---|
[8325] | 147 | CALL wrk_dealloc( jpij, nlay_i+3, zeh_cum0, zh_cum0, kjstart = 0 ) |
---|
| 148 | CALL wrk_dealloc( jpij, nlay_i+1, zeh_cum1, zh_cum1, kjstart = 0 ) |
---|
[4688] | 149 | CALL wrk_dealloc( jpij, zhnew ) |
---|
[921] | 150 | ! |
---|
| 151 | END SUBROUTINE lim_thd_ent |
---|
[825] | 152 | |
---|
| 153 | #else |
---|
[2715] | 154 | !!---------------------------------------------------------------------- |
---|
| 155 | !! Default option NO LIM3 sea-ice model |
---|
| 156 | !!---------------------------------------------------------------------- |
---|
[825] | 157 | CONTAINS |
---|
| 158 | SUBROUTINE lim_thd_ent ! Empty routine |
---|
| 159 | END SUBROUTINE lim_thd_ent |
---|
| 160 | #endif |
---|
[2715] | 161 | |
---|
| 162 | !!====================================================================== |
---|
[921] | 163 | END MODULE limthd_ent |
---|