Changeset 19780


Ignore:
Timestamp:
11/21/15 11:48:06 (9 years ago)
Author:
Eric.Larour
Message:

NEW,CHG: going through consistency check for classes.

Location:
issm/trunk-jpl/src/m
Files:
4 added
16 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/array/arrayoperations.js

    r19768 r19780  
    9292        return matrix;
    9393} //}}}
    94 function MatrixToList(matrix) { //{{{
    95        
    96         var width = matrix[0].length;
    97         var length = matrix.length;
    98         var list= new Array(width*length);
    99 
    100         for(var i=0;i<length;i++){
    101                 for(var j=0;j<width;j++){
    102                         list[i*width+j]=matrix[i][j];
    103                 }
    104         }
    105                
    106         return list;
     94function MatrixToList(matrixin) { //{{{
     95
     96        var matrix=matrixin;
     97
     98        if (!IsArray(matrix[0])) return matrix;
     99        else{
     100                var width = matrix[0].length;
     101                var length = matrix.length;
     102                var list= new Array(width*length);
     103
     104                for(var i=0;i<length;i++){
     105                        for(var j=0;j<width;j++){
     106                                list[i*width+j]=matrix[i][j];
     107                        }
     108                }
     109                return list;
     110        }
    107111} //}}}
    108112function IsArray(object) { //{{{
     
    120124        return notarray;
    121125} //}}}
     126function ArrayCopy(array) { //{{{
     127
     128        var copy=[];
     129        for(var i=0;i<array.length;i++)copy[i]=array[i];
     130        return copy;
     131} //}}}
    122132function ArrayPow(array,coefficient) { //{{{
    123133
     
    145155        return 0;
    146156} //}}}
     157function ArrayUnique(arr) { //{{{
     158
     159        return arr.reverse().filter(function (e, i, arr) {
     160                    return arr.indexOf(e, i+1) === -1;
     161        }).reverse();
     162} //}}}
     163function ArraySort(array) { //{{{
     164
     165        return array.sort(function(a, b) {
     166                return a - b;
     167        });
     168
     169} //}}}
    147170function ArrayAnyEqual(array,value) { //{{{
    148 
    149         for(var i=0;i<array.length;i++){
    150                 if (array[i]==value)return 1;
     171       
     172        if(!isNaN(value)){
     173                for(var i=0;i<array.length;i++){
     174                        if (array[i]==value)return 1;
     175                }
     176        }
     177        else{
     178                for(var i=0;i<array.length;i++){
     179                        if (isNaN(array[i]))return 1;
     180                }
    151181        }
    152182        return 0;
     
    186216        return array;
    187217} //}}}
     218function ArrayIsMember(array1,array2) { //{{{
     219
     220        var array=NewArrayFill(array1.length,0);
     221        for (i=0;i<array1.length;i++){
     222                for(j=0;j<array2.length;j++){
     223                        if (array1[i] == array2[j]){
     224                                array[i]=1;
     225                                break;
     226                        }
     227                }
     228        }
     229        return array;
     230} //}}}
    188231function NewArrayFill(size,value) { //{{{
    189232
    190233        return new Array(size).fill(value);
     234} //}}}
     235function NewArrayFillIncrement(size,start,increment) { //{{{
     236
     237        var array=new Array(size);
     238
     239        for(var i=0;i<size;i++){
     240                array[i]=start+i*increment;
     241        }
     242
     243        return array;
    191244} //}}}
    192245function ArrayFind(array,value) { //{{{
  • issm/trunk-jpl/src/m/classes/SMBforcing.js

    r19759 r19780  
    2121
    2222                } // }}}
     23                this.checkconsistency = function(md,solution,analyses) { //{{{
     24
     25                        if(ArrayAnyEqual(ArrayIsMember(MasstransportAnalysisEnum(),analyses),1)){
     26                                checkfield(md,'fieldname','smb.mass_balance','timeseries',1,'NaN',1);
     27                        }
     28                        if(ArrayAnyEqual(ArrayIsMember(BalancethicknessAnalysisEnum(),analyses),1)){
     29                                checkfield(md,'fieldname','smb.mass_balance','size',[md.mesh.numberofvertices,1],'NaN',1);
     30                        }
     31                        checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);
     32
     33                } // }}}
    2334        //properties
    2435        this.mass_balance = NaN;
  • issm/trunk-jpl/src/m/classes/basalforcings.js

    r19759 r19780  
    3030
    3131                } // }}}
    32         //properties
     32                this.checkconsistency = function(md,solution,analyses) { //{{{
     33
     34                        if(ArrayAnyEqual(ArrayIsMember(MasstransportAnalysisEnum(),analyses),1)){
     35                                if (!(solution==TransientSolutionEnum() & md.transient.ismasstransport==0)){
     36                                        checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1);
     37                                        checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'timeseries',1);
     38                                }
     39                        }
     40
     41                        if(ArrayAnyEqual(ArrayIsMember(BalancethicknessAnalysisEnum(),analyses),1)){
     42                                checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     43                                checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     44                        }
     45                        if(ArrayAnyEqual(ArrayIsMember(ThermalAnalysisEnum(),analyses),1)){
     46                                if (!(solution==TransientSolutionEnum() & md.transient.isthermal==0)){
     47                                        checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1);
     48                                        checkfield(md,'fieldname','basalforcings.floatingice_melting_rate','NaN',1,'timeseries',1);
     49                                        checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'timeseries',1,'>=',0);
     50                                }
     51                        }
     52                } // }}}
     53        //properties
    3354        //{{{
    3455        this.groundedice_melting_rate  = NaN;
  • issm/trunk-jpl/src/m/classes/constants.js

    r19719 r19780  
    2929
    3030                } //}}}
     31                this.checkconsistency = function(md,solution,analyses) {//% {{{
     32
     33                        checkfield(md,'fieldname','constants.g','>=',0,'size',[1,1]); //We allow 0 for validation tests
     34                        checkfield(md,'fieldname','constants.omega','>=',0,'size',[1,1]);
     35                        checkfield(md,'fieldname','constants.yts','>',0,'size',[1,1]);
     36                        checkfield(md,'fieldname','constants.referencetemperature','size',[1,1]);
     37
     38                } // }}}
    3139        //properties
    3240        // {{{
  • issm/trunk-jpl/src/m/classes/damage.js

    r19753 r19780  
    6262                }
    6363        }// }}}
     64                this.checkconsistency = function(md,solution,analyses) { //{{{
     65                       
     66                        checkfield(md,'fieldname','damage.isdamage','values',[1,0]);
     67                        if (this.isdamage){
     68                                checkfield(md,'fieldname','damage.law','numel',[1],'values',[0,1,2]);
     69                                checkfield(md,'fieldname','damage.D','>=',0,'<=',self.max_damage,'size',[md.mesh.numberofvertices ,1]);
     70                                checkfield(md,'fieldname','damage.spcdamage','timeseries',1);
     71                                checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
     72                                checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0, 1, 2, 4]);
     73                                checkfield(md,'fieldname','damage.maxiter','>=0',0);
     74                                checkfield(md,'fieldname','damage.elementinterp','values',['P1','P2']);
     75                                checkfield(md,'fieldname','damage.stress_threshold','>=',0);
     76                                checkfield(md,'fieldname','damage.kappa','>',1);
     77                                checkfield(md,'fieldname','damage.healing','>=',0);
     78                                checkfield(md,'fieldname','damage.c1','>=',0);
     79                                checkfield(md,'fieldname','damage.c2','>=',0);
     80                                checkfield(md,'fieldname','damage.c3','>=',0);
     81                                checkfield(md,'fieldname','damage.c4','>=',0);
     82                                checkfield(md,'fieldname','damage.equiv_stress','numel',[1],'values',[0, 1]);
     83                                checkfield(md,'fieldname','damage.requested_outputs','stringrow',1);
     84                        }
     85                        else if (this.law!=0){
     86                                if (solution==DamageEvolutionSolutionEnum){
     87                                        throw Error('Invalid evolution law (md.damage.law) for a damage solution');
     88                                }
     89                        }
     90                } //}}}
    6491        //properties
    6592        // {{{
  • issm/trunk-jpl/src/m/classes/flowequation.js

    r19753 r19780  
    3434
    3535        }// }}}
     36                this.checkconsistency = function(md,solution,analyses) {//{{{
     37
     38                        //Early return
     39                        if ( ((!ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),1)) & (!ArrayAnyEqual(ArrayIsMember(StressbalanceSIAAnalysisEnum(),analyses),1))) |
     40                                        (solution==TransientSolutionEnum() & md.transient.isstressbalance==0)
     41                           ) return ;
     42
     43                        checkfield(md,'fieldname','flowequation.isSIA','numel',[1],'values',[0, 1]);
     44                        checkfield(md,'fieldname','flowequation.isSSA','numel',[1],'values',[0, 1]);
     45                        checkfield(md,'fieldname','flowequation.isL1L2','numel',[1],'values',[0, 1]);
     46                        checkfield(md,'fieldname','flowequation.isHO','numel',[1],'values',[0, 1]);
     47                        checkfield(md,'fieldname','flowequation.isFS','numel',[1],'values',[0, 1]);
     48                        checkfield(md,'fieldname','flowequation.fe_SSA','values',['P1','P1bubble','P1bubblecondensed','P2','P2bubble']);
     49                        checkfield(md,'fieldname','flowequation.fe_HO' ,'values',['P1','P1bubble','P1bubblecondensed','P1xP2','P2xP1','P2','P2bubble','P1xP3','P2xP4']);
     50                        checkfield(md,'fieldname','flowequation.fe_FS' ,'values',['P1P1','P1P1GLS','MINIcondensed','MINI','TaylorHood','LATaylorHood','XTaylorHood','OneLayerP4z','CrouzeixRaviart','LACrouzeixRaviart']);
     51                        checkfield(md,'fieldname','flowequation.augmented_lagrangian_r','numel',[1],'>=',0.);
     52                        checkfield(md,'fieldname','flowequation.augmented_lagrangian_rlambda','numel',[1],'>=',0.);
     53                        checkfield(md,'fieldname','flowequation.augmented_lagrangian_rhop','numel',[1],'>=',0.);
     54                        checkfield(md,'fieldname','flowequation.augmented_lagrangian_rholambda','numel',[1],'>=',0.);
     55                        checkfield(md,'fieldname','flowequation.XTH_theta','numel',[1],'>=',0.,'<',0.5);
     56                        checkfield(md,'fieldname','flowequation.borderSSA','size',[md.mesh.numberofvertices, 1],'values',[0, 1]);
     57                        checkfield(md,'fieldname','flowequation.borderHO','size',[md.mesh.numberofvertices, 1],'values',[0, 1]);
     58                        checkfield(md,'fieldname','flowequation.borderFS','size',[md.mesh.numberofvertices, 1],'values',[0, 1]);
     59                        if (md.mesh.domaintype() == '2Dhorizontal'){
     60                                checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[1,2]);
     61                                checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[1,2]);
     62                        }
     63                        else if (md.mesh.domaintype() == '3Dsurface'){
     64                                checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[1,2]);
     65                                checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[1,2]);
     66                        }
     67                        else if (md.mesh.domaintype() =='2Dvertical'){
     68                                checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[2,4,5]);
     69                                checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[2,4,5]);
     70                        }
     71                        else if (md.mesh.domaintype() =='3D'){
     72                                checkfield(md,'fieldname','flowequation.vertex_equation','size',[md.mesh.numberofvertices, 1],'values',[0,1,2,3,4,5,6,7,8]);
     73                                checkfield(md,'fieldname','flowequation.element_equation','size',[md.mesh.numberofelements, 1],'values',[0,1,2,3,4,5,6,7,8]);
     74                        }
     75                        else throw Error('Case not supported yet');
     76                       
     77                        if (!(this.isSIA | this.isSSA | this.isL1L2 | this.isHO | this.isFS)){
     78                                md = checkmessage(md,['no element types set for this model']);
     79                        }
     80                        if(ArrayAnyEqual(ArrayIsMember(StressbalanceSIAAnalysisEnum(), analyses),1)){
     81                                if (ArrayAnyEqual(this.element_equation,1)){
     82                                        if(this.vertex_equation & ArrayAnyBelowStrict(md.mask.groundedice_levelset)){
     83                                                console.log(sprintf("\n !!! Warning: SIA's model is not consistent on ice shelves !!!\n"));
     84                                        }
     85                                }
     86                        }
     87                } // }}}
    3688        //properties
    3789        // {{{
  • issm/trunk-jpl/src/m/classes/friction.js

    r19753 r19780  
    1515                fielddisplay(this,'q','q exponent');
    1616        } // }}}
     17                this.checkconsistency = function(md,solution,analyses){ //{{{
     18
     19                        //Early return
     20                        if ((!ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),1)) & (!ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),1))){
     21                                return;
     22                        }
     23                        md = checkfield(md,'fieldname','friction.coefficient','timeseries',1,'NaN',1);
     24                        md = checkfield(md,'fieldname','friction.q','NaN',1,'size',[md.mesh.numberofelements ,1]);
     25                        md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements ,1]);
     26
     27                } // }}}
    1728        //properties
    1829        //{{{
  • issm/trunk-jpl/src/m/classes/geometry.js

    r19719 r19780  
    1616                        fielddisplay(this,'bed','bed elevation [m]');
    1717                } //}}}
     18                this.checkconsistency = function(md,solution,analyses) { //{{{
     19
     20                        if ((solution==TransientSolutionEnum() & md.transient.isgia) | (solution==GiaSolutionEnum())){
     21                                checkfield(md,'fieldname','geometry.thickness','timeseries',1,'NaN',1,'>=',0);
     22                        }
     23                        else{
     24                                checkfield(md,'fieldname','geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices, 1]);
     25                                checkfield(md,'fieldname','geometry.base'      ,'NaN',1,'size',[md.mesh.numberofvertices, 1]);
     26                                checkfield(md,'fieldname','geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices, 1],'>',0);
     27                                for(var i=0;i<md.mesh.numberofvertices;i++){
     28                                        if (Math.abs(md.geometry.thickness.thickness-md.geometry.surface+md.geometry.base)>Math.pow(10,9)){
     29                                                md = checkmessage(md,'equality thickness=surface-base violated');
     30                                                break;
     31                                        }
     32                                }
     33                                if (solution==TransientSolutionEnum() & md.transient.isgroundingline){
     34                                        checkfield(md,'fieldname','geometry.bed','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     35                                }
     36                        }
     37                } // }}}
    1838        //properties
    1939        // {{{
  • issm/trunk-jpl/src/m/classes/hydrologyshreve.js

    r19759 r19780  
    1919
    2020        }// }}}
     21        this.type= function(){// {{{
     22
     23                return "hydrologyshreve";
     24        }// }}}
    2125        //properties
    2226        // {{{
  • issm/trunk-jpl/src/m/classes/initialization.js

    r19753 r19780  
    2424
    2525        }// }}}
     26                this.checkconsistency = function(md,solution,analyses) { //{{{
     27                        if(ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),1)){
     28                                if (!(isNaN(md.initialization.vx) | isNaN(md.initialization.vy))){
     29                                        checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     30                                        checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     31                                }
     32                        }
     33                        if(ArrayAnyEqual(ArrayIsMember(MasstransportAnalysisEnum(),analyses),1)){
     34                                checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     35                                checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     36                        }
     37                        if(ArrayAnyEqual(ArrayIsMember(BalancethicknessSolutionEnum(),analyses),1) & (solution==BalancethicknessSolutionEnum)){
     38                                checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     39                                checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     40                                //Triangle with zero velocity
     41                                for(var i=0;i<md.mesh.numberofelements;i++){
     42                                        var sum=0;
     43                                        for(var j=0;j<md.mesh.elements[0].length;j++){
     44                                                if  ((md.initialization.vx[md.mesh.elements[i][j]-1]==0) & (md.initialization.vy[md.mesh.elements[i][j]-1]==0)) sum+=1;
     45                                        }
     46                                        if (sum==md.mesh.elements[0].length){
     47                                                md.checkmessage('at least one triangle has all its vertices with a zero velocity');
     48                                        }
     49                                }
     50                        }
     51                        if(ArrayAnyEqual(ArrayIsMember(ThermalAnalysisEnum(),analyses),1)){
     52                                checkfield(md,'fieldname','initialization.vx','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     53                                checkfield(md,'fieldname','initialization.vy','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     54                                if (md.mesh.dimension() == 3){
     55                                        checkfield(md,'fieldname','initialization.vz','NaN',1,'size',[md.mesh.numberofvertices ,1]);
     56                                }
     57                                checkfield(md,'fieldname','initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices ,1]);
     58                                checkfield(md,'fieldname','initialization.temperature','NaN',1,'size',[md.mesh.numberofvertices ,1]);
     59                        }
     60                        if( ArrayAnyEqual(ArrayIsMember(EnthalpyAnalysisEnum(),analyses),1) & md.thermal.isenthalpy){
     61                                checkfield(md,'fieldname','initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices, 1]);
     62                                checkfield(md,'fieldname','initialization.watercolumn'  ,'>=',0,'size',[md.mesh.numberofvertices, 1]);
     63                        }
     64                        if(ArrayAnyEqual(ArrayIsMember(HydrologyShreveAnalysisEnum(),analyses),1)){
     65                                if (md.hydrology.type() == 'hydrologyshreve'){
     66                                        checkfield(md,'fieldname','initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices ,1]);
     67                                }
     68                        }
     69                        if(ArrayAnyEqual(ArrayIsMember(HydrologyDCInefficientAnalysisEnum(),analyses),1)){
     70                                if (md.hydrology.type() == 'hydrologydc'){
     71                                        checkfield(md,'fieldname','initialization.sediment_head','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     72                                }
     73                        }
     74                        if(ArrayAnyEqual(ArrayIsMember(HydrologyDCEfficientAnalysisEnum(),analyses),1)){
     75                                if (md.hydrology.type() == 'hydrologydc'){
     76                                        if (md.hydrology.isefficientlayer==1){
     77                                                checkfield(md,'fieldname','initialization.epl_head','NaN',1,'size',[md.mesh.numberofvertices ,1]);
     78                                                checkfield(md,'fieldname','initialization.epl_thickness','NaN',1,'size',[md.mesh.numberofvertices ,1]);
     79                                        }
     80                                }
     81                        }
     82                } //}}}
    2683        //properties
    2784        // {{{
  • issm/trunk-jpl/src/m/classes/mask.js

    r19719 r19780  
    1919                        fielddisplay(this,"ice_levelset","presence of ice if < 0, icefront position if = 0, no ice if > 0");
    2020                } //}}}
     21                this.checkconsistency = function(md,solution,analyses){ //{{{
    2122
     23                        checkfield(md,'fieldname','mask.groundedice_levelset','size',[md.mesh.numberofvertices, 1]);
     24                        checkfield(md,'fieldname','mask.ice_levelset'        ,'size',[md.mesh.numberofvertices, 1]);
     25                        isice=NewArrayFill(md.mesh.numberofvertices,0);
     26                        for(var i=0;i<md.mesh.numberofvertices;i++)if(md.mask.ice_levelset[i]<=0)isice[i]=1;
     27                        if (ArraySum(isice)==0){
     28                                console.log('no ice present in the domain');
     29                        }
     30                        if (ArrayMax(md.mask.ice_levelset)<0){
     31                                console.log('no ice front provided');
     32                        }
     33                               
     34                        icefront=NewArrayFill(md.mesh.numberofelements,0);
     35                        for(var i=0;i<md.mesh.numberofelements;i++){
     36                                for(var j=0;j<md.mesh.elements[0].length;j++){
     37                                        icefront[i]+=(md.mask.ice_levelset[md.mesh.elements[i][j]-1]==0);
     38                                }
     39                        }
     40                        if ((ArrayMax(icefront)==3 & (md.mesh.elementtype() == 'Tria')) | (ArrayMax(icefront)==6 & md.mesh.elementtype() == 'Penta')){
     41                                if (md.mesh.elementtype()=='Tria'){
     42                                        pos=ArrayFindEqual(icefront,3); numberemptyelements=pos.length;
     43                                }
     44                                else if (md.mesh.elementtype() == 'Penta'){
     45                                        pos=ArrayFindEqual(icefront,6); numberemptyelements=pos.length;
     46                                }
     47                                throw Error(sprintf(" %i have all nodes on ice front, change md.mask.ice_levelset to fix it",numberemptyelements));
     48                        }
     49                } // }}}
    2250}
  • issm/trunk-jpl/src/m/classes/matice.js

    r19753 r19780  
    7878                        fielddisplay(this,'mantle_density','Mantle density [g/cm^-3]');
    7979                } // }}}
     80                this.checkconsistency = function(md,solution,analyses) { // {{{
     81                        checkfield(md,'fieldname','materials.rho_ice','>',0);
     82                        checkfield(md,'fieldname','materials.rho_water','>',0);
     83                        checkfield(md,'fieldname','materials.rho_freshwater','>',0);
     84                        checkfield(md,'fieldname','materials.mu_water','>',0);
     85                        checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1);
     86                        checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements,1]);
     87                        checkfield(md,'fieldname','materials.rheology_law','values',['None','Cuffey','Paterson','Arrhenius','LliboutryDuval']);
     88
     89                        if(ArrayAnyEqual(ArrayIsMember(GiaAnalysisEnum(),analyses),1)){
     90                                checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
     91                                checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
     92                                checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
     93                                checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
     94                        }
     95
     96                } // }}}
    8097        //properties
    8198        // {{{
  • issm/trunk-jpl/src/m/classes/mesh2d.js

    r19721 r19780  
    5353                        return 'Tria';
    5454                } // }}}
     55                this.checkconsistency = function(md,solution,analyses){ //{{{
     56
     57                        checkfield(md,'fieldname','mesh.x','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     58                        checkfield(md,'fieldname','mesh.y','NaN',1,'size',[md.mesh.numberofvertices, 1]);
     59                        checkfield(md,'fieldname','mesh.elements','NaN',1,'>',0,'values',NewArrayFillIncrement(md.mesh.numberofvertices,1,1));
     60                        checkfield(md,'fieldname','mesh.elements','size',[md.mesh.numberofelements, 3]);
     61                        if(ArrayAnyEqual(ArrayIsMember(NewArrayFillIncrement(md.mesh.numberofvertices,1,1),ArraySort(ArrayUnique(MatrixToList(md.mesh.elements)))),0)){
     62                                md.checkmessage('orphan nodes have been found. Check the mesh outline');
     63                        }
     64                        checkfield(md,'fieldname','mesh.numberofelements','>',0);
     65                        checkfield(md,'fieldname','mesh.numberofvertices','>',0);
     66                        checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',9,'message',"'mesh.average_vertex_connectivity' should be at least 9 in 2d");
     67                        checkfield(md,'fieldname','mesh.segments','NaN',1,'>',0,'size',[NaN, 3]);
     68
     69                        switch(solution){
     70                        case ThermalSolutionEnum():
     71                                checkmessage(md,'thermal not supported for 2d mesh');
     72                                break;
     73                        default:
     74                                break
     75                        }
     76                } // }}}
    5577        //properties
    5678        // {{{
  • issm/trunk-jpl/src/m/classes/model.js

    r19759 r19780  
    8686                        this.private          = new private();
    8787                } //}}}
     88                this.checkmessage = function(string){ //{{{
     89                        console.log('model not consistent: ' + string);
     90                        md.private.isconsistent=false;
     91                } //}}}
    8892        //properties
    8993        // {{{
  • issm/trunk-jpl/src/m/classes/timestepping.js

    r19753 r19780  
    3939
    4040        }// }}}
     41                this.checkconsistency = function(md,solution,analyses) { //{{{
     42                       
     43                        checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1);
     44                        checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1);
     45                        checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1);
     46                        checkfield(md,'fieldname','timestepping.time_adapt','numel',[1],'values',[0,1]);
     47                        checkfield(md,'fieldname','timestepping.cfl_coefficient','numel',[1],'>',0,'<=',1);
     48                        checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0,1]);
     49                        if (this.final_time-this.start_time<0){
     50                                md.checkmessage('timestepping.final_time should be larger than timestepping.start_time');
     51                        }
     52                } // }}}
    4153        //properties
    4254        // {{{
  • issm/trunk-jpl/src/m/parameterization/setmask.js

    r19721 r19780  
    4242       
    4343        //Get assigned fields
    44         x=md.mesh.x;
    45         y=md.mesh.y;
    46         elements=md.mesh.elements;
     44        var x=md.mesh.x;
     45        var y=md.mesh.y;
     46        var elements=md.mesh.elements;
    4747
    4848        //Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice.
Note: See TracChangeset for help on using the changeset viewer.