Changeset 16318


Ignore:
Timestamp:
10/07/13 16:03:10 (11 years ago)
Author:
Mathieu Morlighem
Message:

CHG: getting rid of meshdimension

Location:
issm/trunk-jpl/src/m/boundaryconditions
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.m

    r16187 r16318  
    5353if (length(md.initialization.temperature)==md.mesh.numberofvertices),
    5454        md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
    55         pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     55        if isprop(md.mesh,'vertexonsurface')
     56                pos=find(md.mesh.vertexonsurface);
     57                md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     58        end
    5659        if (length(md.basalforcings.geothermalflux)~=md.mesh.numberofvertices),
    5760                md.basalforcings.geothermalflux=50.*10^-3*ones(md.mesh.numberofvertices,1); %50 mW/m^2
  • TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py

    r16187 r16318  
    5454        if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
    5555                md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
    56 #               pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
    57                 pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
    58                 md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
     56                if hasattr(md.mesh,'vertexonsurface'):
     57                        pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
     58                        md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
    5959                if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux)==md.mesh.numberofvertices:
    6060                        md.basalforcings.geothermalflux=50.*10**-3*numpy.ones((md.mesh.numberofvertices,1))    #50 mW/m^2
  • TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m

    r16187 r16318  
    3838
    3939%First find segments that are not completely on the front
    40 if(md.mesh.dimension==2),
     40if strcmp(meshtype(md.mesh),'3D'),
     41        numbernodesfront=4;
     42elseif strcmp(meshtype(md.mesh),'2Dhorizontal'),
    4143        numbernodesfront=2;
    42 else 
    43         numbernodesfront=4;
     44else
     45        error('mesh type not supported yet');
    4446end
    4547segmentsfront=md.mask.ice_levelset(md.mesh.segments(:,1:numbernodesfront))==0;
     
    8486if (length(md.initialization.temperature)==md.mesh.numberofvertices),
    8587        md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
    86         pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     88        if isprop(md.mesh,'vertexonsurface'),
     89                pos=find(md.mesh.vertexonsurface);
     90                md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     91        end
    8792        if (length(md.basalforcings.geothermalflux)~=md.mesh.numberofvertices),
    8893                md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
  • TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py

    r16187 r16318  
    22import numpy
    33from ContourToMesh import *
     4from MatlabFuncs import *
    45
    56def SetIceShelfBC(md,icefrontfile=''):
     
    4344
    4445        #First find segments that are not completely on the front
    45         if md.mesh.dimension==2:
    46                 numbernodesfront=2
     46        if strcmp(md.mesh.meshtype(),'3D'):
     47                numbernodesfront=4;
     48        elif strcmp(md.mesh.meshtype(),'2Dhorizontal'):
     49                numbernodesfront=2;
    4750        else:
    48                 numbernodesfront=4
     51                raise   error('mesh type not supported yet')
    4952        if any(md.mask.ice_levelset<=0):
    5053                values=md.mask.ice_levelset[md.mesh.segments[:,0:-1]-1]
     
    9396        if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
    9497                md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
    95 #               pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
    96                 pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
    97                 md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
     98                if hasattr(md.mesh,'vertexonsurface'):
     99                        pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
     100                        md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
    98101                if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux,axis=0)==md.mesh.numberofvertices:
    99102                        md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,1))
  • TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m

    r16269 r16318  
    102102if (length(md.initialization.temperature)==md.mesh.numberofvertices),
    103103        md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
    104         pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     104        if isprop(md.mesh,'vertexonsurface'),
     105                pos=find(md.mesh.vertexonsurface);
     106                md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
     107        end
    105108        if (length(md.basalforcings.geothermalflux)~=md.mesh.numberofvertices),
    106109                md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
  • TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py

    r16187 r16318  
    101101        if isinstance(md.initialization.temperature,numpy.ndarray) and numpy.size(md.initialization.temperature,axis=0)==md.mesh.numberofvertices:
    102102                md.thermal.spctemperature=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
    103 #               pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
    104                 pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
    105                 md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
     103                if hasattr(md.mesh,'vertexonsurface'):
     104                        pos=numpy.nonzero(md.mesh.vertexonsurface)[0]
     105                        md.thermal.spctemperature[pos]=md.initialization.temperature[pos]    #impose observed temperature on surface
    106106                if not isinstance(md.basalforcings.geothermalflux,numpy.ndarray) or not numpy.size(md.basalforcings.geothermalflux,axis=0)==md.mesh.numberofvertices:
    107107                        md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices,1))
Note: See TracChangeset for help on using the changeset viewer.