[23670] | 1 | import numpy as np
|
---|
[19895] | 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')
|
---|
[21255] | 26 | if np.ndim(md.results.StressbalanceSolution.MaterialsRheologyBbar)==2:
|
---|
[19895] | 27 | Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar.reshape(-1,)
|
---|
| 28 | else:
|
---|
| 29 | Bi=md.results.StressbalanceSolution.MaterialsRheologyBbar
|
---|
[21255] | 30 | if np.ndim(md.materials.rheology_B)==2:
|
---|
[19895] | 31 | BT=md.materials.rheology_B.reshape(-1,)
|
---|
| 32 | else:
|
---|
| 33 | BT=md.materials.rheology_B
|
---|
| 34 |
|
---|
[21255] | 35 | damage=np.zeros_like(Bi)
|
---|
[19895] | 36 |
|
---|
| 37 | # Damage where Bi softer than B(T)
|
---|
[21255] | 38 | pos=np.nonzero(Bi<BT)[0]
|
---|
[19895] | 39 | damage[pos]=1.-Bi[pos]/BT[pos]
|
---|
| 40 |
|
---|
[21255] | 41 | pos=np.nonzero(damage<0)
|
---|
[19895] | 42 | damage[pos]=0
|
---|
| 43 |
|
---|
| 44 | return damage
|
---|