SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_saltrap_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_saltrap_r ========================
41 ! =======================================================================
42 !
43 ! Goal:
44 ! -----
45 ! This module allows to compute initial sea ice salinity as a function
46 ! of the input heat flux.
47 !
48 ! Method:
49 ! -------
50 ! From an initial guess of salinity, we compute gltools_enthalpy of the newly
51 ! formed ice, then deduce the thickness variation during the time-step
52 ! (i.e. accretion rate in m.s-1).
53 ! From the accretion rate, we compute the brine fraction that is
54 ! retained by the new ice, following Cox and Weeks, JGR (1988), and
55 ! iteration until convergence is effective (in many cases, much less
56 ! than 10 iterations)
57 !
58 ! Inputs:
59 ! -------
60 ! - a boolean indicating where the marine surface is at freezing point
61 ! (gfreeze)
62 ! - a heat flux, that will freeze new ice (phef)
63 ! - the surface marine conditions (tpmxl)
64 !
65 ! Outputs:
66 ! --------
67 ! - new sea ice salinity (psalt)
68 ! - new sea ice gltools_enthalpy (pent)
69 ! - new sea ice thickness (phsi)
70 !
71 ! Created : 2010/03 (D. Salas y Melia)
72 !
73 ! -------------------- BEGIN MODULE modi_glt_saltrap_r ----------------------
74 !
75 !THXS_SFX!MODULE modi_glt_saltrap_r
76 !THXS_SFX!INTERFACE
77 !THXS_SFX!!
78 !THXS_SFX!SUBROUTINE glt_saltrap_r &
79 !THXS_SFX! ( gfreeze,phef,ptem,tpmxl,psalt,pent,phsi )
80 !THXS_SFX! USE modd_types_glt
81 !THXS_SFX! USE modd_glt_param
82 !THXS_SFX! LOGICAL, DIMENSION(np), INTENT(in) :: &
83 !THXS_SFX! gfreeze
84 !THXS_SFX! REAL, DIMENSION(np), INTENT(in) :: &
85 !THXS_SFX! phef,ptem
86 !THXS_SFX! TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
87 !THXS_SFX! tpmxl
88 !THXS_SFX! REAL, DIMENSION(np), INTENT(inout) :: &
89 !THXS_SFX! psalt,pent,phsi
90 !THXS_SFX!END SUBROUTINE glt_saltrap_r
91 !THXS_SFX!!
92 !THXS_SFX!END INTERFACE
93 !THXS_SFX!END MODULE modi_glt_saltrap_r
94 !
95 ! --------------------- END MODULE modi_glt_saltrap_r -----------------------
96 !
97 !
98 !
99 ! -----------------------------------------------------------------------
100 ! ----------------------- SUBROUTINE glt_saltrap_r --------------------------
101 !
102 SUBROUTINE glt_saltrap_r &
103  ( gfreeze,phef,ptem,tpmxl,psalt,pent,phsi )
104 !
105  USE modd_types_glt
106  USE modd_glt_param
110 !
111  IMPLICIT NONE
112 !
113  LOGICAL, DIMENSION(np), INTENT(in) :: &
114  gfreeze
115  REAL, DIMENSION(np), INTENT(in) :: &
116  phef,ptem
117  TYPE(t_mxl), DIMENSION(np), INTENT(in) :: &
118  tpmxl
119  REAL, DIMENSION(np), INTENT(inout) :: &
120  psalt,pent,phsi
121 !
122  INTEGER, PARAMETER :: &
123  nit=100 ! Maximum number of iterations
124  REAL, PARAMETER :: &
125  ppssinew=10. ! First guess for new sea ice salinity
126  REAL, PARAMETER :: &
127  ppsmax=16. ! Maximum sea ice salinity
128  REAL, PARAMETER :: &
129  ppdssi=0.1 ! Tolerance on sea ice salinity convergence
130  INTEGER :: &
131  jit,jp
132 real:: x
133  LOGICAL, DIMENSION(np) :: &
134  ycont
135  REAL, DIMENSION(np) :: &
136  psaltb
137 !
138 !
139 !
140 ! 1. Initialize the algorithm
141 ! ============================
142 !
143 ! .. Points where at least one more iteration is needed
144 !
145  ycont(:) = ( gfreeze(:) .AND. phef(:)<0. )
146 !
147 ! .. Initial salinity guess
148 !
149  WHERE( ycont(:) )
150  psaltb(:) = ppssinew / ssw0 * tpmxl(:)%sml
151  ENDWHERE
152 !
153 !
154 !
155 ! 2. Loop
156 ! ========
157 !
158 ! DO WHILE ( ANY(ycont(:)) .AND. jit<=nit )
159 !
160 ! Enthalpy of new sea ice
161 do jp=1,np
162  jit = 1
163  do while( ycont(jp) .AND. jit<=nit )
164  pent(jp) = &
165  glt_enthalpy0d( ptem(jp),psaltb(jp) ) + &
166  cpsw*mu*tpmxl(jp)%sml
167 !
168 ! Rate of formation of new ice in m.s-1
169  IF( ycont(jp) ) phsi(jp) = phef(jp)/( pent(jp)*rhoice )
170 !
171 ! Compute new ice salinity
172  IF ( ycont(jp) ) &
173  psalt(jp) = tpmxl(jp)%sml * amin1( ppsmax/ssw0,glt_salfrac( phsi(jp) ) )
174 !
175 ! Stop convergence where convergence criterion is met
176  IF( ycont(jp) ) THEN
177  IF( abs(psalt(jp)-psaltb(jp))<ppdssi ) THEN
178  ycont(jp) = .false.
179  ELSE
180  psaltb(jp) = psalt(jp)
181  ENDIF
182  ENDIF
183 !
184  jit = jit + 1
185 !
186 end do
187  END DO
188 !
189 !
190 !
191 ! 3. Compute final quantities for all points
192 ! ===========================================
193 !
194  ycont(:) = ( gfreeze(:) .AND. phef(:)<0. )
195 !
196  WHERE( .NOT. ycont(:) )
197  psalt(:) = 0.
198  ENDWHERE
199 !
200 ! Enthalpy
201  pent(:) = glt_enthalpy1d( ycont(:),ptem(:),psalt(:) )
202 !
203 ! Thickness
204  WHERE( ycont(:) )
205  phsi(:) = phef(:)*dtt/( pent(:)*rhoice )
206  ELSEWHERE
207  phsi(:) = 0.
208  ENDWHERE
209 !
210 END SUBROUTINE glt_saltrap_r
211 
212 ! ---------------------- END SUBROUTINE glt_saltrap_r -----------------------
213 ! -----------------------------------------------------------------------
subroutine glt_saltrap_r(gfreeze, phef, ptem, tpmxl, psalt, pent, phsi)