source:
issm/oecreview/Archive/24684-25833/ISSM-24793-24794.diff@
25834
Last change on this file since 25834 was 25834, checked in by , 4 years ago | |
---|---|
File size: 3.9 KB |
-
../trunk-jpl/src/m/materials/nye.py
1 1 import numpy as np 2 from warnings import warn 2 3 4 3 5 def nye(temperature, ice_type): 4 5 NYE - figure out the rigidity of ice (either CO2 or H2O) for a given temperature6 7 6 """ 7 NYE - figure out the rigidity of ice (either CO2 or H2O) for a given temperature 8 rigidity (in s^(1/n)Pa) is the flow law parameter in the flow law sigma=B*e(1/n) (Nye, p2000). 9 temperature is in Kelvin degrees 8 10 9 11 Usage: 10 11 12 rigidity=nye(temperature,ice_type) % ice_type = 1: CO2 ice // ice_type = 2: H2O ice 13 """ 12 14 13 14 if np.ndim(temperature)==2:15 T=temperature.flatten()16 elif isinstance(temperature,float) or isinstance(temperature,int):17 T=np.array([temperature])18 19 T=temperature20 rigidity=np.zeros_like(T)15 # Declaring temperature and rigidity arrays 16 if np.ndim(temperature) == 2: 17 T = temperature.flatten() 18 elif isinstance(temperature, float) or isinstance(temperature, int): 19 T = np.array([temperature]) 20 else: 21 T = temperature 22 rigidity = np.zeros_like(T) 21 23 22 23 if (ice_type==1):24 25 if (200<T[i]<220):26 warnings.warn('CO2 ICE - POSSIBLE MELTING. Some temperature values are between 200K and 220K.')27 28 if ((T>=220).any()):29 warnings.warn('CO2 ICE - GUARANTEED MELTING. Some temperature values are beyond 220K.')30 elif (ice_type==2) and ((T>273.15).any()):31 warnings.warn('H2O ICE - GUARANTEED MELTING. Some temperature values are beyond 273.15K.')24 # Beyond-melting-point cases 25 if (ice_type == 1): 26 for i in range(len(T)): 27 if (200 < T[i] < 220): 28 warn('CO2 ICE - POSSIBLE MELTING. Some temperature values are between 200K and 220K.') 29 break 30 if ((T >= 220).any()): 31 warn('CO2 ICE - GUARANTEED MELTING. Some temperature values are beyond 220K.') 32 elif (ice_type == 2) and ((T > 273.15).any()): 33 warn('H2O ICE - GUARANTEED MELTING. Some temperature values are beyond 273.15K.') 32 34 33 35 Rg = 8.3144598 # J mol^-1 K^-1 34 36 35 36 A_const = 10**(13.0)# s^-1 MPa37 38 39 40 A_const = 9*10**4 # s^-1 MPa41 42 43 44 37 if ice_type == 1: # CO2 ice 38 A_const = 1.0e13 # s^-1 MPa 39 Q = 66900. # J mol^-1 40 n = 8. # Glen's exponent 41 elif ice_type == 2: # H2O ice 42 A_const = 9 * 1.0e4 # s^-1 MPa 43 Q = 60000. # J mol^-1 44 n = 3. # Glen's exponent 45 else: 46 raise RuntimeError('Ice type not supported') 45 47 46 47 A=A_const*np.exp(-1*Q/(T*Rg))# s^-1 MPa48 rigidity=A**(-1/n)*10**6# s^(1/n) Pa48 # Arrhenius Law 49 A = A_const * np.exp(-1 * Q / (T * Rg)) # s^-1 MPa 50 rigidity = A**(-1 / n) * 1.0e6 # s^(1/n) Pa 49 51 50 51 52 # Return output 53 return rigidity
Note:
See TracBrowser
for help on using the repository browser.