Changeset 17766


Ignore:
Timestamp:
04/18/14 09:32:00 (11 years ago)
Author:
cborstad
Message:

CHG: reverting change to postpone python handling of vectors/arrays for now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py

    r17763 r17766  
    3232        else:
    3333                #Guess where the ice front is
    34                 vertexonfloatingice=numpy.zeros((md.mesh.numberofvertices,))
    35                 pos=numpy.nonzero(numpy.sum(md.mask.groundedice_levelset[md.mesh.elements-1]<0,axis=1) > 0)[0]
    36                 #vertexonfloatingice[md.mesh.elements[pos].astype(int)-1]=1.
    37                 vertexonfloatingice[md.mesh.elements[pos]-1]=1.
    38                 vertexonicefront=numpy.logical_and(md.mesh.vertexonboundary,vertexonfloatingice>0.)
     34                vertexonfloatingice=numpy.zeros((md.mesh.numberofvertices,1))
     35                pos=numpy.nonzero(numpy.sum(md.mask.groundedice_levelset[md.mesh.elements-1]<0.,axis=1) >0.)[0]
     36                vertexonfloatingice[md.mesh.elements[pos].astype(int)-1]=1.
     37                vertexonicefront=numpy.logical_and(numpy.reshape(md.mesh.vertexonboundary,(-1,1)),vertexonfloatingice>0.)
    3938
    4039#       pos=find(md.mesh.vertexonboundary & ~vertexonicefront);
     
    4342                print "SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually."
    4443
    45         md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,))
    46         md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,))
    47         md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,))
     44        md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
     45        md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
     46        md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
    4847        md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
    4948        md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
     
    6968        else:
    7069                pos=numpy.nonzero(md.mesh.vertexonboundary)[0]
    71         md.stressbalance.spcvx[pos]=0
    72         md.stressbalance.spcvy[pos]=0
    73         md.stressbalance.spcvz[pos]=0
     70        md.stressbalance.spcvx[pos[:]]=0
     71        md.stressbalance.spcvy[pos[:]]=0
     72        md.stressbalance.spcvz[pos[:]]=0
    7473
    7574        #Dirichlet Values
     
    9190        #Deal with other boundary conditions
    9291        if numpy.all(numpy.isnan(md.balancethickness.thickening_rate)):
    93                 md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,))
     92                md.balancethickness.thickening_rate=numpy.zeros((md.mesh.numberofvertices,1))
    9493                print "      no balancethickness.thickening_rate specified: values set as zero"
    9594
    96         md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,))
    97         md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,))
    98         md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,))
     95        md.masstransport.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
     96        md.balancethickness.spcthickness=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
     97        md.damage.spcdamage=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
    9998
    10099        if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
    101                 md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,))
     100                md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
    102101                if hasattr(md.mesh,'vertexonsurface'):
    103102                        pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
    104103                        md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
    105104                if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux,axis=0)==md.mesh.numberofvertices:
    106                         md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,))
    107                         md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)[0]]=50.*10.**-3    #50mW/m2
     105                        md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,1))
     106                        md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)]=50.*10.**-3    #50mW/m2
    108107        else:
    109108                print "      no thermal boundary conditions created: no observed temperature found"
    110109
    111110        return md
     111
Note: See TracChangeset for help on using the changeset viewer.