Changeset 22865


Ignore:
Timestamp:
06/22/18 01:03:19 (7 years ago)
Author:
bdef
Message:

BUG: random fixes in nightlies

Location:
issm/trunk-jpl/src/m
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/consistency/checkfield.py

    r22267 r22865  
    99
    1010           Used to check model consistency.,
    11            Requires: 
    12            'field' or 'fieldname' option. If 'fieldname' is provided, it will retrieve it from the model md. (md.(fieldname)) 
     11           Requires:
     12           'field' or 'fieldname' option. If 'fieldname' is provided, it will retrieve it from the model md. (md.(fieldname))
    1313             If 'field' is provided, it will assume the argument following 'field' is a numeric array.
    1414
     
    4040                fieldname=options.getfieldvalue('fieldname','no fieldname')
    4141        else:
    42                 fieldname=options.getfieldvalue('fieldname') 
     42                fieldname=options.getfieldvalue('fieldname')
    4343                exec("field=md.{}".format(fieldname))
    4444
     
    8080                                if (not np.size(field,0)==fieldsize[0]) or (not np.size(field,1)==fieldsize[1]):
    8181                                        md = md.checkmessage(options.getfieldvalue('message',"field '%s' size should be %d x %d" % (fieldname,fieldsize[0],fieldsize[1])))
    82        
     82
    8383        #Check numel
    8484        if options.exist('numel'):
     
    164164
    165165                if options.getfieldvalue('singletimeseries',0):
    166                         field2 = np.reshape(field[0],np.prod(np.shape(field[0])),1)
     166                        field2 = np.reshape(field[0],int(np.prod(np.shape(field[0]))),1)
    167167
    168168                if np.any(field2>upperbound):
     
    176176
    177177                if options.getfieldvalue('singletimeseries',0):
    178                         field2 = np.reshape(field[0],np.prod(np.shape(field[0])),1)
     178                        field2 = np.reshape(field[0],int(np.prod(np.shape(field[0]))),1)
    179179
    180180                if np.any(field2>=upperbound):
     
    228228
    229229        return md
    230 
    231 
  • issm/trunk-jpl/src/m/mesh/ComputeHessian.py

    r21303 r22865  
    3333        linesize=3*numberofelements
    3434
    35         #get areas and nodal functions coefficients N(x,y)=alpha x + beta y + gamma 
     35        #get areas and nodal functions coefficients N(x,y)=alpha x + beta y + gamma
    3636        [alpha,beta,dum]=GetNodalFunctionsCoeff(index,x,y)
    3737        areas=GetAreas(index,x,y)
    3838
    3939        #compute weights that hold the volume of all the element holding the node i
    40         weights=m.sparse(line,np.ones((linesize,1)),np.tile(areas.reshape(-1,),(3,1)),numberofnodes,1)
     40        weights=m.sparse(line,np.ones((linesize,1),dtype=int),np.tile(areas,(3,1)),numberofnodes,1)
    4141
    4242        #compute field on nodes if on elements
    4343        if np.size(field,axis=0)==numberofelements:
    44                 field=m.sparse(line,np.ones((linesize,1)),np.tile(areas*field,(3,1)),numberofnodes,1)/weights
     44                field=m.sparse(line,np.ones((linesize,1),dtype=int),np.tile(areas*field,(3,1)),numberofnodes,1)/weights
    4545
    4646        #Compute gradient for each element
    47         grad_elx=np.sum(field[index-1,0]*alpha,axis=1)
    48         grad_ely=np.sum(field[index-1,0]*beta,axis=1)
     47        grad_elx=np.sum(field[index-1]*alpha,axis=1)
     48        grad_ely=np.sum(field[index-1]*beta,axis=1)
    4949
    5050        #Compute gradient for each node (average of the elements around)
    51         gradx=m.sparse(line,np.ones((linesize,1)),np.tile((areas*grad_elx).reshape(-1,),(3,1)),numberofnodes,1)
    52         grady=m.sparse(line,np.ones((linesize,1)),np.tile((areas*grad_ely).reshape(-1,),(3,1)),numberofnodes,1)
     51        gradx=m.sparse(line,np.ones((linesize,1),dtype=int),np.tile((areas*grad_elx),(3,1)),numberofnodes,1)
     52        grady=m.sparse(line,np.ones((linesize,1),dtype=int),np.tile((areas*grad_ely),(3,1)),numberofnodes,1)
    5353        gradx=gradx/weights
    5454        grady=grady/weights
    5555
    5656        #Compute hessian for each element
    57         hessian=np.vstack((np.sum(gradx[index-1,0]*alpha,axis=1).reshape(-1,),np.sum(grady[index-1,0]*alpha,axis=1).reshape(-1,),np.sum(grady[index-1,0]*beta,axis=1).reshape(-1,))).T
     57        hessian=np.vstack((np.sum(gradx[index-1,0]*alpha,axis=1),np.sum(grady[index-1,0]*alpha,axis=1),np.sum(grady[index-1,0]*beta,axis=1))).T
    5858
    5959        if m.strcmpi(type,'node'):
    6060                #Compute Hessian on the nodes (average of the elements around)
    61                 hessian=np.hstack((m.sparse(line,np.ones((linesize,1)),np.tile((areas*hessian[:,0]).reshape(-1,),(3,1)),numberofnodes,1)/weights,
    62                                                                                          m.sparse(line,np.ones((linesize,1)),np.tile((areas*hessian[:,1]).reshape(-1,),(3,1)),numberofnodes,1)/weights,
    63                                                                                          m.sparse(line,np.ones((linesize,1)),np.tile((areas*hessian[:,2]).reshape(-1,),(3,1)),numberofnodes,1)/weights ))
     61                hessian=np.hstack((m.sparse(line,np.ones((linesize,1),dtype=int),np.tile((areas*hessian[:,0]),(3,1)),numberofnodes,1)/weights,
     62                                                                                         m.sparse(line,np.ones((linesize,1),dtype=int),np.tile((areas*hessian[:,1]),(3,1)),numberofnodes,1)/weights,
     63                                                                                         m.sparse(line,np.ones((linesize,1),dtype=int),np.tile((areas*hessian[:,2]),(3,1)),numberofnodes,1)/weights ))
    6464
    6565        return hessian
    66 
  • issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py

    r21303 r22865  
    105105
    106106        return y
    107 
Note: See TracChangeset for help on using the changeset viewer.