Changeset 19466


Ignore:
Timestamp:
07/30/15 00:32:51 (10 years ago)
Author:
cborstad
Message:

CHG: working on better handling of damage-dependent mechanical properties calculation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/mech/mechanicalproperties.py

    r19386 r19466  
    44from averaging import averaging
    55
    6 def mechanicalproperties(md,vx,vy):
     6def mechanicalproperties(md,vx,vy,**kwargs):
    77        """
    88        MECHANICALPROPERTIES - compute stress and strain rate for a goven velocity
     
    2929        if npy.any(md.flowequation.element_equation!=2):
    3030                print 'Warning: the model has some non SSA elements. These will be treated like SSA elements'
     31
     32        #unpack kwargs
     33        if 'damage' in kwargs:
     34            damage=kwargs.pop('damage')
     35            if len(damage)!=md.mesh.numberofvertices:
     36                raise ValueError('if damage is supplied it should be of size ' + md.mesh.numberofvertices)
     37            if npy.ndim(damage)==2:
     38                damage=damage.reshape(-1,)
     39        else: damage=None
    3140
    3241        if npy.ndim(vx)==2:
     
    7584                location=npy.nonzero(npy.logical_and(second_inv==0,power!=0))
    7685                nu[location]=10^18
    77         elif 'matdamageice' in md.materials.__module__:
     86        elif 'matdamageice' in md.materials.__module__ and damage is not None:
    7887                print 'computing damage-dependent properties!'
    79                 # FIXME might be using damage from a solution, not the initial md.damage.D
    80                 Zinv=npy.dot(1-md.damage.D[index-1],summation/3.).reshape(-1,)
     88                Zinv=npy.dot(1-damage[index-1],summation/3.).reshape(-1,)
    8189                location=npy.nonzero(second_inv)
    8290                nu[location]=Zinv[location]*B_bar[location]/npy.power(second_inv[location],power[location])
Note: See TracChangeset for help on using the changeset viewer.