7 !! Ice viscosity as a function of the effective strain rate and the temperature
 
    8 !! (in cold ice) or the water content (in temperate ice).
 
   12 !! Copyright 2009-2013 Ralf Greve
 
   16 !! This file is part of SICOPOLIS.
 
   18 !! SICOPOLIS is free software: you can redistribute it and/or modify
 
   19 !! it under the terms of the GNU General Public License as published by
 
   20 !! the Free Software Foundation, either version 3 of the License, or
 
   21 !! (at your option) any later version.
 
   23 !! SICOPOLIS is distributed in the hope that it will be useful,
 
   24 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
 
   25 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
   26 !! GNU General Public License for more details.
 
   28 !! You should have received a copy of the GNU General Public License
 
   29 !! along with SICOPOLIS.  If not, see <http://www.gnu.org/licenses/>.
 
   31 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
   34 !> Ice viscosity as a function of the effective strain rate and the temperature
 
   35 !! (in cold ice) or the water content (in temperate ice).
 
   36 !<------------------------------------------------------------------------------
 
   37 function viscosity(de_val, temp_val, temp_m_val, omega_val, enh_val, &
 
   46 real(dp), 
intent(in) :: de_val
 
   47 real(dp), 
intent(in) :: temp_val, temp_m_val
 
   48 real(dp), 
intent(in) :: omega_val
 
   49 real(dp), 
intent(in) :: enh_val
 
   50 logical,  
intent(in) :: flag_cold_temp
 
   53 real(dp) :: visc_iter, visc_iter_sm
 
   54 real(dp) :: ratefac_val
 
   57 real(dp) :: n_power_law, inv_n_power_law, n_grain_size
 
   59 real(dp), 
parameter :: de_min = 1.0e-30_dp   
 
   63 real(dp), 
parameter :: sm_coeff_1 = 8.5112e-15_dp, &   
 
   64                        sm_coeff_2 = 8.1643e-25_dp, &   
 
   65                        sm_coeff_3 = 9.2594e-12_dp      
 
   70 if (flag_cold_temp) 
then    
   71    ratefac_val = 
ratefac(temp_val,temp_m_val)
 
   76 de_val_m = max(de_val, de_min)
 
   84 inv_n_power_law = 0.333333333333333_dp   
 
   86 viscosity = 0.5_dp * de_val_m**(inv_n_power_law-1.0_dp) &
 
   87                    * (enh_val*ratefac_val)**(-inv_n_power_law)
 
   93 inv_n_power_law = 0.555555555555555_dp   
 
   96 viscosity = 0.5_dp * de_val_m**(inv_n_power_law-1.0_dp) &
 
   97                    * gr_size**(n_grain_size*inv_n_power_law) &
 
   98                    * (enh_val*ratefac_val)**(-inv_n_power_law)
 
  104 inv_n_power_law = 0.25_dp   
 
  106 viscosity = 0.5_dp * de_val_m**(inv_n_power_law-1.0_dp) &
 
  107                    * (enh_val*ratefac_val)**(-inv_n_power_law)
 
  119 viscosity = visc_iter(de_val_m, ratefac_val, enh_val, n_power_law, sigma_res)
 
  127 n_grain_size = 1.4_dp
 
  129 write(6,
'(a)') 
' viscosity: Computation of the viscosity as a function' 
  130 write(6,
'(a)') 
'            of the effective strain rate not yet implemented' 
  131 write(6,
'(a)') 
'        for grain-size-dependent finite viscosity flow laws!' 
  140 viscosity = visc_iter(de_val_m, ratefac_val, enh_val, n_power_law, sigma_res)
 
  150 viscosity = visc_iter_sm(de_val_m, ratefac_val, enh_val, &
 
  151                          sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  160 !> Iterative computation of the viscosity by solving equation (4.28)
 
  161 !! by Greve and Blatter (Springer, 2009).
 
  162 !<------------------------------------------------------------------------------
 
  163 function visc_iter(de_val_m, ratefac_val, enh_val, n_power_law, sigma_res)
 
  169 real(dp)             :: visc_iter
 
  170 real(dp), 
intent(in) :: de_val_m
 
  171 real(dp), 
intent(in) :: ratefac_val, enh_val
 
  172 real(dp), 
intent(in) :: n_power_law, sigma_res
 
  174 real(dp) :: visc_val, res
 
  175 real(dp) :: fct_visc, fct_visc_deriv
 
  177 real(dp), 
parameter :: eps = 1.0e-05_dp   
 
  181 visc_val = 1.0e+10_dp   
 
  185    res = fct_visc(de_val_m, ratefac_val, enh_val, visc_val, &
 
  186                   n_power_law, sigma_res)
 
  188    if (res < 0.0_dp) 
then 
  189       visc_val = 10.0_dp*visc_val
 
  200    visc_val = visc_val &
 
  202                 /fct_visc_deriv(de_val_m, ratefac_val, enh_val, visc_val, &
 
  203                                 n_power_law, sigma_res)
 
  205    res = fct_visc(de_val_m, ratefac_val, enh_val, visc_val, &
 
  206                   n_power_law, sigma_res)
 
  208    if (abs(res) < eps) exit
 
  214 end function visc_iter
 
  217 !> Viscosity polynomial
 
  218 !! [equation (4.28) by Greve and Blatter (Springer, 2009)].
 
  219 !<------------------------------------------------------------------------------
 
  220 function fct_visc(de_val_m, ratefac_val, enh_val, visc_val, &
 
  221                   n_power_law, sigma_res)
 
  228 real(dp), 
intent(in) :: de_val_m
 
  229 real(dp), 
intent(in) :: ratefac_val, enh_val
 
  230 real(dp), 
intent(in) :: visc_val
 
  231 real(dp), 
intent(in) :: n_power_law, sigma_res
 
  233 fct_visc = 2.0_dp**n_power_law &
 
  234              *enh_val*ratefac_val &
 
  235              *de_val_m**(n_power_law-1.0_dp) &
 
  236              *visc_val**n_power_law &
 
  237           + 2.0_dp*enh_val*ratefac_val &
 
  238              *sigma_res**(n_power_law-1.0_dp) &
 
  242 end function fct_visc
 
  245 !> Derivative of the viscosity polynomial
 
  246 !! [equation (4.28) by Greve and Blatter (Springer, 2009)].
 
  247 !<------------------------------------------------------------------------------
 
  248 function fct_visc_deriv(de_val_m, ratefac_val, enh_val, visc_val, &
 
  249                         n_power_law, sigma_res)
 
  255 real(dp)             :: fct_visc_deriv
 
  256 real(dp), 
intent(in) :: de_val_m
 
  257 real(dp), 
intent(in) :: ratefac_val, enh_val
 
  258 real(dp), 
intent(in) :: visc_val
 
  259 real(dp), 
intent(in) :: n_power_law, sigma_res
 
  261 fct_visc_deriv = 2.0_dp**n_power_law*n_power_law &
 
  262                    *enh_val*ratefac_val &
 
  263                    *de_val_m**(n_power_law-1.0_dp) &
 
  264                    *visc_val**(n_power_law-1.0_dp) &
 
  265                  + 2.0_dp*enh_val*ratefac_val &
 
  266                    *sigma_res**(n_power_law-1.0_dp)
 
  268 end function fct_visc_deriv
 
  275 !> Iterative computation of the viscosity by solving equation (4.33)
 
  276 !! [analogous to (4.28)] by Greve and Blatter (Springer, 2009).
 
  277 !<------------------------------------------------------------------------------
 
  278 function visc_iter_sm(de_val_m, ratefac_val, enh_val, &
 
  279                       sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  285 real(dp)             :: visc_iter_sm
 
  286 real(dp), 
intent(in) :: de_val_m
 
  287 real(dp), 
intent(in) :: ratefac_val, enh_val
 
  288 real(dp), 
intent(in) :: sm_coeff_1, sm_coeff_2, sm_coeff_3
 
  290 real(dp) :: visc_val, res
 
  291 real(dp) :: fct_visc_sm, fct_visc_sm_deriv
 
  293 real(dp), 
parameter :: eps = 1.0e-05_dp   
 
  297 visc_val = 1.0e+10_dp   
 
  301    res = fct_visc_sm(de_val_m, ratefac_val, enh_val, visc_val, &
 
  302                      sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  304    if (res < 0.0_dp) 
then 
  305       visc_val = 10.0_dp*visc_val
 
  316    visc_val = visc_val &
 
  318                 /fct_visc_sm_deriv(de_val_m, ratefac_val, enh_val, visc_val, &
 
  319                                    sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  321    res = fct_visc_sm(de_val_m, ratefac_val, enh_val, visc_val, &
 
  322                      sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  324    if (abs(res) < eps) exit
 
  328 visc_iter_sm = visc_val
 
  330 end function visc_iter_sm
 
  333 !> Viscosity polynomial
 
  334 !! [equation (4.33) by Greve and Blatter (Springer, 2009)].
 
  335 !<------------------------------------------------------------------------------
 
  336 function fct_visc_sm(de_val_m, ratefac_val, enh_val, visc_val, &
 
  337                      sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  343 real(dp)             :: fct_visc_sm
 
  344 real(dp), 
intent(in) :: de_val_m
 
  345 real(dp), 
intent(in) :: ratefac_val, enh_val
 
  346 real(dp), 
intent(in) :: visc_val
 
  347 real(dp), 
intent(in) :: sm_coeff_1, sm_coeff_2, sm_coeff_3
 
  349 real(dp) :: de_visc_factor
 
  351 de_visc_factor = de_val_m*de_val_m*visc_val*visc_val
 
  353 fct_visc_sm = 2.0_dp*enh_val*ratefac_val*visc_val &
 
  355                   + 4.0_dp*sm_coeff_2*de_visc_factor &
 
  356                     * ( 1.0_dp + 4.0_dp*sm_coeff_3*de_visc_factor ) ) &
 
  359 end function fct_visc_sm
 
  362 !> Derivative of the viscosity polynomial
 
  363 !! [equation (4.33) by Greve and Blatter (Springer, 2009)].
 
  364 !<------------------------------------------------------------------------------
 
  365 function fct_visc_sm_deriv(de_val_m, ratefac_val, enh_val, visc_val, &
 
  366                            sm_coeff_1, sm_coeff_2, sm_coeff_3)
 
  372 real(dp)             :: fct_visc_sm_deriv
 
  373 real(dp), 
intent(in) :: de_val_m
 
  374 real(dp), 
intent(in) :: ratefac_val, enh_val
 
  375 real(dp), 
intent(in) :: visc_val
 
  376 real(dp), 
intent(in) :: sm_coeff_1, sm_coeff_2, sm_coeff_3
 
  378 real(dp) :: de_visc_factor
 
  380 real(dp), 
parameter :: twenty_over_three = 6.666666666666667_dp
 
  382 de_visc_factor = de_val_m*de_val_m*visc_val*visc_val
 
  384 fct_visc_sm_deriv = 2.0_dp*sm_coeff_1*enh_val*ratefac_val &
 
  385                    + 24.0_dp*sm_coeff_2*enh_val*ratefac_val*de_visc_factor &
 
  386                      * ( 1.0_dp + twenty_over_three*sm_coeff_3*de_visc_factor )
 
  388 end function fct_visc_sm_deriv