1 | import numpy as np
|
---|
2 |
|
---|
3 | def damagefrominversion(md):
|
---|
4 | '''
|
---|
5 | compute ice shelf damage from inversion results
|
---|
6 |
|
---|
7 | This routine computes damage based on the analytical formalism of Borstad et
|
---|
8 | al. (2013, The Cryosphere). The model must contain inversion results for
|
---|
9 | ice rigidity. Ice rigidity B is assumed to be parameterized by the ice
|
---|
10 | temperature in md.materials.rheology_B.
|
---|
11 |
|
---|
12 | Usage:
|
---|
13 | damage=damagefrominversion(md)
|
---|
14 |
|
---|
15 | Example:
|
---|
16 | damage=damagefrominversion(md)
|
---|
17 | '''
|
---|
18 |
|
---|
19 | # check inputs
|
---|
20 | if not hasattr(md.results,'strainrate'):
|
---|
21 | raise Exception('md.results.strainrate is not present. Calculate using md=mechanicalproperties(md,vx,vy)')
|
---|
22 | if not '2d' in md.mesh.__doc__:
|
---|
23 | raise Exception('only 2d (planview) model supported currently')
|
---|
24 | if any(md.flowequation.element_equation!=2):
|
---|
25 | raise Exception('Warning: the model has some non-SSA elements. These will be treated like SSA elements')
|
---|
26 | if np.ndim(md.results.StressbalanceSolution.MaterialsRheologyBbar)==2:
|
---|
27 | Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar.reshape(-1,)
|
---|
28 | else:
|
---|
29 | Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar
|
---|
30 | if np.ndim(md.materials.rheology_B)==2:
|
---|
31 | BT=md.materials.rheology_B.reshape(-1,)
|
---|
32 | else:
|
---|
33 | BT=md.materials.rheology_B
|
---|
34 |
|
---|
35 | damage=np.zeros_like(Bi)
|
---|
36 |
|
---|
37 | # Damage where Bi softer than B(T)
|
---|
38 | pos=np.nonzero(Bi<BT)[0]
|
---|
39 | damage[pos]=1.-Bi[pos]/BT[pos]
|
---|
40 |
|
---|
41 | pos=np.nonzero(damage<0)
|
---|
42 | damage[pos]=0
|
---|
43 |
|
---|
44 | return damage
|
---|