SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_frzvtp_r.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !GLT_LIC The GELATO model is a seaice model used in stand-alone or embedded mode.
6 !GLT_LIC It has been developed by Meteo-France. The holder of GELATO is Meteo-France.
7 !GLT_LIC
8 !GLT_LIC This software is governed by the CeCILL-C license under French law and biding
9 !GLT_LIC by the rules of distribution of free software. See the CeCILL-C_V1-en.txt
10 !GLT_LIC (English) and CeCILL-C_V1-fr.txt (French) for details. The CeCILL is a free
11 !GLT_LIC software license, explicitly compatible with the GNU GPL
12 !GLT_LIC (see http://www.gnu.org/licenses/license-list.en.html#CeCILL)
13 !GLT_LIC
14 !GLT_LIC The CeCILL-C licence agreement grants users the right to modify and re-use the
15 !GLT_LIC software governed by this free software license. The exercising of this right
16 !GLT_LIC is conditional upon the obligation to make available to the community the
17 !GLT_LIC modifications made to the source code of the software so as to contribute to
18 !GLT_LIC its evolution.
19 !GLT_LIC
20 !GLT_LIC In consideration of access to the source code and the rights to copy, modify
21 !GLT_LIC and redistribute granted by the license, users are provided only with a limited
22 !GLT_LIC warranty and the software's author, the holder of the economic rights, and the
23 !GLT_LIC successive licensors only have limited liability. In this respect, the risks
24 !GLT_LIC associated with loading, using, modifying and/or developing or reproducing the
25 !GLT_LIC software by the user are brought to the user's attention, given its Free
26 !GLT_LIC Software status, which may make it complicated to use, with the result that its
27 !GLT_LIC use is reserved for developers and experienced professionals having in-depth
28 !GLT_LIC computer knowledge. Users are therefore encouraged to load and test the
29 !GLT_LIC suitability of the software as regards their requirements in conditions enabling
30 !GLT_LIC the security of their systems and/or data to be ensured and, more generally, to
31 !GLT_LIC use and operate it in the same conditions of security.
32 !GLT_LIC
33 !GLT_LIC The GELATO sofware is cureently distibuted with the SURFEX software, available at
34 !GLT_LIC http://www.cnrm.meteo.fr/surfex. The fact that you download the software deemed that
35 !GLT_LIC you had knowledge of the CeCILL-C license and that you accept its terms.
36 !GLT_LIC Attempts to use this software in a way not complying with CeCILL-C license
37 !GLT_LIC may lead to prosecution.
38 !GLT_LIC
39 ! =======================================================================
40 ! ======================== MODULE modi_glt_frzvtp_r =========================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module contains a subroutine that updates vertical tracer
46 ! profiles in sea ice, depending on whether bottom ablation or accretion
47 ! took place.
48 ! Note: here phsi is the sea ice thickness field before bottom freezing,
49 ! and pqfac represents the heat flux used to freeze sea ice at the
50 ! bottom of the slab.
51 !
52 ! Method:
53 ! -------
54 !
55 ! Created : 1996/10 (D. Salas y Melia)
56 ! Modified: 2009/10 (D. Salas y Melia) Reduced grid
57 ! Modified: 2009/12 (D. Salas y Melia) Replace temperature field with
58 ! an gltools_enthalpy field
59 !
60 ! ---------------------- BEGIN MODULE modi_glt_frzvtp_r ---------------------
61 !
62 !THXS_SFX!MODULE modi_glt_frzvtp_r
63 !THXS_SFX!INTERFACE
64 !THXS_SFX!!
65 !THXS_SFX!SUBROUTINE glt_frzvtp_r( tpmxl,tpsit,pqfac,phsi,pssi,tpsil )
66 !THXS_SFX! USE modd_types_glt
67 !THXS_SFX! USE modd_glt_param
68 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
69 !THXS_SFX! tpmxl
70 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
71 !THXS_SFX! tpsit
72 !THXS_SFX! REAL, DIMENSION(nt,np), INTENT(in) :: &
73 !THXS_SFX! pqfac
74 !THXS_SFX! REAL, DIMENSION(nt,np), INTENT(inout) :: &
75 !THXS_SFX! phsi
76 !THXS_SFX! REAL, DIMENSION(nt,np), INTENT(out) :: &
77 !THXS_SFX! pssi
78 !THXS_SFX! TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
79 !THXS_SFX! tpsil
80 !THXS_SFX!END SUBROUTINE glt_frzvtp_r
81 !THXS_SFX!!
82 !THXS_SFX!END INTERFACE
83 !THXS_SFX!END MODULE modi_glt_frzvtp_r
84 !
85 ! ----------------------- END MODULE modi_glt_frzvtp_r ----------------------
86 !
87 !
88 ! -----------------------------------------------------------------------
89 ! ------------------------ SUBROUTINE glt_frzvtp_r --------------------------
90 !
91 ! * Subroutine used to update sea ice vertical tracer profile, due
92 ! to sea ice thickness increase from the bottom of the slab.
93 !
94 ! * Note that in the list of arguments, phsi is sea ice new thickness,
95 ! not the thickness variation.
96 !
97 SUBROUTINE glt_frzvtp_r( tpmxl,tpsit,pqfac,phsi,pssi,tpsil )
98 !
100  USE modd_types_glt
101  USE modd_glt_param
104  USE modi_glt_saltrap_r
105 !
106  IMPLICIT NONE
107 !
108  TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
109  tpmxl
110  TYPE(t_sit), DIMENSION(nt,np), INTENT(inout) :: &
111  tpsit
112  REAL, DIMENSION(nt,np), INTENT(in) :: &
113  pqfac
114  REAL, DIMENSION(nt,np), INTENT(inout) :: &
115  phsi
116  REAL, DIMENSION(nt,np), INTENT(out) :: &
117  pssi
118  TYPE(t_vtp), DIMENSION(nl,nt,np), INTENT(inout) :: &
119  tpsil
120 !
121  INTEGER :: &
122  jp,jk,jl
123  LOGICAL, DIMENSION(np) :: &
124  yfreeze
125  REAL :: &
126  zavei,zavef,zdave,zhsinew
127  REAL, DIMENSION(nilay) :: &
128  zentn
129  REAL, DIMENSION(nilay+1) :: &
130  zsf3tinvo,zento
131  REAL, DIMENSION(nilay+2) :: &
132  zlevo
133  REAL, DIMENSION(np) :: &
134  zssib,zentb,zdhsib,ztem
135 !
136 !
137 !
138 ! 1. Update vertical temperature profile and mixed layer water flux
139 ! ==================================================================
140 !
141  DO jk=1,nt
142 !
143 ! Define where the salt trapping process should be applied
144  yfreeze(:) = ( pqfac(jk,:)<0. )
145 !
146 ! Compute the salinity, gltools_enthalpy and thickness of the new ice
147  ztem(:) = -2.
148  CALL glt_saltrap_r( yfreeze,pqfac(jk,:),ztem(:),tpmxl,zssib,zentb,zdhsib )
149 !
150  DO jp=1,np
151  IF ( pqfac(jk,jp)<0. ) THEN
152 !
153 ! The former vertical gltools_enthalpy profile consists in two parts:
154 ! a) Newly frozen ice at the bottom of the slab
155  zento(1)=zentb(jp)
156 ! b) Rest of the slab
157  zento(2:nilay+1)=tpsil(1:nilay,jk,jp)%ent
158 !
159 ! Normalized vertical level scale factors + level boundaries in an ice
160 ! slab that froze from the bottom:
161 ! - the nilay former layers + one new layer corresponding to the sea ice
162 ! thickness increase (this newly formed sea ice is at sea water freezing
163 ! point temperature).
164  zsf3tinvo(1)=zdhsib(jp)
165  zsf3tinvo(2:nilay+1)=sf3tinv(:)*phsi(jk,jp)
166  zsf3tinvo(:)=zsf3tinvo/sum(zsf3tinvo)
167  zlevo(1)=0.
168  DO jl=2,nilay+2
169  zlevo(jl)=zlevo(jl-1)+zsf3tinvo(jl-1)
170  END DO
171  zlevo(:)=zlevo/zlevo(nilay+2)
172 !
173 ! Interpolate
174  zentn=glt_interpz( height,zento,zlevo )
175  tpsil(1:nilay,jk,jp)%ent = zentn(:)
176 !
177 ! Compute initial average gltools_enthalpy in the ice slab
178  zavei = sum( zsf3tinvo*zento )
179 !
180 ! Compute final average gltools_enthalpy in the ice slab
181  zavef = sum( sf3tinv*tpsil(1:nilay,jk,jp)%ent )
182 !
183 ! Print out possible errors
184  zdave = abs( zavef-zavei )
185 !
186 ! In principle, this is now impossible...
187  IF (lp3) THEN
188  IF ( zdave>1.e-5 ) THEN
189  WRITE(noutlu,*) 'jp= ',jp,' jk= ',jk
190  WRITE(noutlu,*) &
191  ' Difference in av. vert. temp. =', &
192  ( zavef-zavei )
193  ENDIF
194  ENDIF
195 !
196 ! Update salinity and thickness
197  zhsinew = phsi(jk,jp)+zdhsib(jp)
198  tpsit(jk,jp)%ssi = &
199  ( tpsit(jk,jp)%ssi*phsi(jk,jp)+zssib(jp)*zdhsib(jp) ) / zhsinew
200  phsi(jk,jp) = zhsinew
201  pssi(jk,jp) = zssib(jp)
202 !
203  ELSE
204 ! It is important to define a salinity anyway here (else NaNs will occur in
205 ! glt_updhsi_r !) - since pssi is INTENT(out) - unlike phsi
206  pssi(jk,jp) = tpsit(jk,jp)%ssi
207  ENDIF
208  END DO
209  END DO
210 !
211 END SUBROUTINE glt_frzvtp_r
212 
213 ! ---------------------- END SUBROUTINE glt_frzvtp_r ------------------------
214 ! -----------------------------------------------------------------------
subroutine glt_saltrap_r(gfreeze, phef, ptem, tpmxl, psalt, pent, phsi)
subroutine glt_frzvtp_r(tpmxl, tpsit, pqfac, phsi, pssi, tpsil)