Changeset 17395


Ignore:
Timestamp:
03/08/14 15:01:19 (11 years ago)
Author:
cborstad
Message:

CHG: fixing array size for python calcs

File:
1 edited

Legend:

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

    r15844 r17395  
    22from GetNodalFunctionsCoeff import GetNodalFunctionsCoeff
    33from results import results
     4from averaging import averaging
    45
    56def mechanicalproperties(md,vx,vy):
     
    2829        if npy.any(md.flowequation.element_equation!=2):
    2930                print 'Warning: the model has some non SSA elements. These will be treated like SSA elements'
     31
     32        if npy.ndim(vx)==2:
     33                vx=vx.reshape(-1,)
     34        if npy.ndim(vy)==2:
     35                vy=vy.reshape(-1,)
    3036       
    3137        #initialization
    3238        numberofelements=md.mesh.numberofelements
     39        numberofvertices=md.mesh.numberofvertices
    3340        index=md.mesh.elements
    3441        summation=npy.array([[1],[1],[1]])
     
    5461        nu=npy.zeros((numberofelements,))
    5562        B_bar=npy.dot(md.materials.rheology_B[index-1],summation/3.).reshape(-1,)
    56         power=(md.materials.rheology_n-1.)/(2.*md.materials.rheology_n)
     63        power=((md.materials.rheology_n-1.)/(2.*md.materials.rheology_n)).reshape(-1,)
    5764        second_inv=(ux**2.+vy**2.+((uy+vx)**2.)/4.+ux*vy).reshape(-1,)
    5865       
     
    6673                location=npy.nonzero(npy.logical_and(second_inv==0,power==0))
    6774                nu[location]=B_bar[location]
     75                location=npy.nonzero(npy.logical_and(second_inv==0,power!=0))
     76                nu[location]=10^18
    6877        elif 'matdamageice' in md.materials.__module__:
    6978                Zinv=npy.dot(md.materials.rheology_Z[index-1],summation/3.).reshape(-1,)
Note: See TracChangeset for help on using the changeset viewer.