Changeset 20891


Ignore:
Timestamp:
07/13/16 10:54:51 (9 years ago)
Author:
Mathieu Morlighem
Message:

CHG: reordering fields to have the same marshalls

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/damage.py

    r20690 r20891  
    171171                        outputscopy=outputs[0:max(0,indices[0]-1)]+self.defaultoutputs(md)+outputs[indices[0]+1:]
    172172                        outputs    =outputscopy
    173                 WriteData(fid,prefix,'data',outputs,'name','md.damage.requested_outputs','format','StringArray')
     173                if self.isdamage:
     174                        WriteData(fid,prefix,'data',outputs,'name','md.damage.requested_outputs','format','StringArray')
    174175        # }}}
  • issm/trunk-jpl/src/m/classes/initialization.py

    r20690 r20891  
    117117                WriteData(fid,prefix,'object',self,'fieldname','temperature','format','DoubleMat','mattype',1)
    118118                WriteData(fid,prefix,'object',self,'fieldname','waterfraction','format','DoubleMat','mattype',1)
    119                 WriteData(fid,prefix,'object',self,'fieldname','watercolumn','format','DoubleMat','mattype',1)
    120119                WriteData(fid,prefix,'object',self,'fieldname','sediment_head','format','DoubleMat','mattype',1)
    121120                WriteData(fid,prefix,'object',self,'fieldname','epl_head','format','DoubleMat','mattype',1)
    122121                WriteData(fid,prefix,'object',self,'fieldname','epl_thickness','format','DoubleMat','mattype',1)
    123 
     122                WriteData(fid,prefix,'object',self,'fieldname','watercolumn','format','DoubleMat','mattype',1)
    124123               
    125124                if md.thermal.isenthalpy:
  • issm/trunk-jpl/src/m/classes/matice.py

    r20690 r20891  
    160160                WriteData(fid,prefix,'object',self,'class','materials','fieldname','thermal_exchange_velocity','format','Double')
    161161                WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
    162                 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1)
    163162                WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2)
    164163                WriteData(fid,prefix,'data',StringToEnum(self.rheology_law)[0],'name','md.materials.rheology_law','format','Integer')
  • issm/trunk-jpl/src/m/classes/slr.m

    r20690 r20891  
    121121                        WriteData(fid,prefix,'object',self,'fieldname','love_h','format','DoubleMat','mattype',1);
    122122                        WriteData(fid,prefix,'object',self,'fieldname','love_k','format','DoubleMat','mattype',1);
     123                        WriteData(fid,prefix,'object',self,'fieldname','tide_love_h','format','Double');
    123124                        WriteData(fid,prefix,'object',self,'fieldname','tide_love_k','format','Double');
    124                         WriteData(fid,prefix,'object',self,'fieldname','tide_love_h','format','Double');
    125125                        WriteData(fid,prefix,'object',self,'fieldname','rigid','format','Boolean');
    126126                        WriteData(fid,prefix,'object',self,'fieldname','elastic','format','Boolean');
  • issm/trunk-jpl/src/m/classes/stressbalance.js

    r20826 r20891  
    7676                return "stressbalance";
    7777        }// }}}
    78     this.extrude = function(md) {//{{{
    79         this.spcvx=project3d(md,'vector',this.spcvx,'type','node');
    80         this.spcvy=project3d(md,'vector',this.spcvy,'type','node');
    81         this.spcvz=project3d(md,'vector',this.spcvz,'type','node');
    82         this.referential=project3d(md,'vector',this.referential,'type','node');
    83         this.loadingforce=project3d(md,'vector',this.loadingforce,'type','node');
    84         return this;
    85     }//}}}
    86                 this.checkconsistency = function(md,solution,analyses) { //{{{
    87 
    88                         //Early return
    89                         if(ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),0))return;
    90 
    91                         checkfield(md,'fieldname','stressbalance.spcvx','Inf',1,'timeseries',1);
    92                         checkfield(md,'fieldname','stressbalance.spcvy','Inf',1,'timeseries',1);
    93                         checkfield(md,'fieldname','stressbalance.spcvz','Inf',1,'timeseries',1);
    94                         checkfield(md,'fieldname','stressbalance.restol','size',[1, 1],'>',0,'NaN',1,'Inf',1);
    95                         checkfield(md,'fieldname','stressbalance.reltol','size',[1, 1]);
    96                         checkfield(md,'fieldname','stressbalance.abstol','size',[1, 1]);
    97                         checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0, 1, 2]);
    98                         checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1, 1],'NaN',1,'Inf',1);
    99                         checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1, 1],'NaN',1,'Inf',1);
    100                         checkfield(md,'fieldname','stressbalance.maxiter','size',[1, 1],'>=',1);
    101                         checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices, 6]);
    102                         checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices, 3]);
    103                         checkfield(md,'fieldname','stressbalance.requested_outputs','stringrow',1);
    104 
    105                         //singular solution
    106                         if(!ArrayAnyNaN(md.stressbalance.spcvx) | !ArrayAnyNaN(md.stressbalance.spcvy) |  !ArrayAnyAboveStrict(md.mask.groundedice_levelset,0)){
    107                                 md = checkmessage(md,'model is not well posed (singular). You need at least one node with fixed velocity!');
    108                                 console.log(sprintf('\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n'));
    109                         }
    110                         //CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
    111                         for(var i=0;i<md.stressbalance.referential.length;i++){
    112                                 var sum=0;
    113                                 for(j=0;j<md.stressbalance.referential[0].length;j++)sum+=md.stressbalance.referential[i][j];
    114                                 if (sum!=0 & sum!=6){
    115                                         md = checkmessage(md,'Each line of stressbalance.referential should contain either only NaN values or no NaN values');
     78        this.extrude = function(md) {//{{{
     79                this.spcvx=project3d(md,'vector',this.spcvx,'type','node');
     80                this.spcvy=project3d(md,'vector',this.spcvy,'type','node');
     81                this.spcvz=project3d(md,'vector',this.spcvz,'type','node');
     82                this.referential=project3d(md,'vector',this.referential,'type','node');
     83                this.loadingforce=project3d(md,'vector',this.loadingforce,'type','node');
     84                return this;
     85        }//}}}
     86        this.checkconsistency = function(md,solution,analyses) { //{{{
     87
     88                //Early return
     89                if(ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),0))return;
     90
     91                checkfield(md,'fieldname','stressbalance.spcvx','Inf',1,'timeseries',1);
     92                checkfield(md,'fieldname','stressbalance.spcvy','Inf',1,'timeseries',1);
     93                checkfield(md,'fieldname','stressbalance.spcvz','Inf',1,'timeseries',1);
     94                checkfield(md,'fieldname','stressbalance.restol','size',[1, 1],'>',0,'NaN',1,'Inf',1);
     95                checkfield(md,'fieldname','stressbalance.reltol','size',[1, 1]);
     96                checkfield(md,'fieldname','stressbalance.abstol','size',[1, 1]);
     97                checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0, 1, 2]);
     98                checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1, 1],'NaN',1,'Inf',1);
     99                checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1, 1],'NaN',1,'Inf',1);
     100                checkfield(md,'fieldname','stressbalance.maxiter','size',[1, 1],'>=',1);
     101                checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices, 6]);
     102                checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices, 3]);
     103                checkfield(md,'fieldname','stressbalance.requested_outputs','stringrow',1);
     104
     105                //singular solution
     106                if(!ArrayAnyNaN(md.stressbalance.spcvx) | !ArrayAnyNaN(md.stressbalance.spcvy) |  !ArrayAnyAboveStrict(md.mask.groundedice_levelset,0)){
     107                        md = checkmessage(md,'model is not well posed (singular). You need at least one node with fixed velocity!');
     108                        console.log(sprintf('\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n'));
     109                }
     110                //CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
     111                for(var i=0;i<md.stressbalance.referential.length;i++){
     112                        var sum=0;
     113                        for(j=0;j<md.stressbalance.referential[0].length;j++)sum+=md.stressbalance.referential[i][j];
     114                        if (sum!=0 & sum!=6){
     115                                md = checkmessage(md,'Each line of stressbalance.referential should contain either only NaN values or no NaN values');
     116                                break;
     117                        }
     118                }
     119                //CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
     120                for(var i=0;i<md.stressbalance.referential.length;i++){
     121                        var sum=0;
     122                        for(j=0;j<md.stressbalance.referential[0].length;j++)sum+=md.stressbalance.referential[i][j];
     123                        if(sum==0){
     124                                var dot=0;
     125                                for(j=0;j<3;j++)dot+=md.stressbalance.referential[i][j]*md.stressbalance.referential[i][j+3];
     126                                dot=Math.abs(dot);
     127                                if(dot>Math.pow(10,-18)){
     128                                        md.checkmessage('Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal');
    116129                                        break;
    117130                                }
    118131                        }
    119                         //CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
    120                         for(var i=0;i<md.stressbalance.referential.length;i++){
    121                                 var sum=0;
    122                                 for(j=0;j<md.stressbalance.referential[0].length;j++)sum+=md.stressbalance.referential[i][j];
    123                                 if(sum==0){
    124                                         var dot=0;
    125                                         for(j=0;j<3;j++)dot+=md.stressbalance.referential[i][j]*md.stressbalance.referential[i][j+3];
    126                                         dot=Math.abs(dot);
    127                                         if(dot>Math.pow(10,-18)){
    128                                                 md.checkmessage('Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal');
     132                }
     133                //CHECK THAT NO rotation specified for FS Grounded ice at base
     134                if (md.mesh.domaintype() == '3D' & md.flowequation.isFS){
     135                        for(var i=0;i<md.mask.groundedice_levelset.length;i++){
     136                                if(md.mask.groundedice_levelset[i]>0 & md.mesh.vertexonbase[i]){
     137                                        if(!ArrayIsNan(md.stressbalance.referential[i])){
     138                                                md.checkmessage('no referential should be specified for basal vertices of grounded ice');
    129139                                                break;
    130140                                        }
    131141                                }
    132142                        }
    133                         //CHECK THAT NO rotation specified for FS Grounded ice at base
    134                         if (md.mesh.domaintype() == '3D' & md.flowequation.isFS){
    135                                 for(var i=0;i<md.mask.groundedice_levelset.length;i++){
    136                                         if(md.mask.groundedice_levelset[i]>0 & md.mesh.vertexonbase[i]){
    137                                                 if(!ArrayIsNan(md.stressbalance.referential[i])){
    138                                                         md.checkmessage('no referential should be specified for basal vertices of grounded ice');
    139                                                         break;
    140                                                 }
    141                                         }
    142                                 }
    143                                 checkfield(md,'fieldname','stressbalance.FSreconditioning','>',0);
    144                         }
    145                 } // }}}
    146                 this.marshall=function(md,prefix,fid) { //{{{
    147 
    148                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','vertex_pairing','format','DoubleMat','mattype',3);
    149 
    150                         var yts=365.0*24.0*3600.0;
    151 
    152                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','spcvx','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
    153                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','spcvy','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
    154                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','spcvz','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
    155                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','restol','format','Double');
    156                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','reltol','format','Double');
    157                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','abstol','format','Double','scale',1./yts);
    158                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','isnewton','format','Integer');
    159                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','FSreconditioning','format','Double');
    160                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','viscosity_overshoot','format','Double');
    161                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','maxiter','format','Integer');
    162                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','shelf_dampening','format','Integer');
    163                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','penalty_factor','format','Double');
    164                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','rift_penalty_lock','format','Integer');
    165                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','rift_penalty_threshold','format','Integer');
    166                         WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','referential','format','DoubleMat','mattype',1);
    167 
    168                         var lx=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)lx[i]=this.loadingforce[i][0];
    169                         var ly=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)ly[i]=this.loadingforce[i][1];
    170                         var lz=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)lz[i]=this.loadingforce[i][2];
    171 
    172                         WriteData(fid,prefix,'data',lx,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcex');
    173                         WriteData(fid,prefix,'data',ly,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcey');
    174                         WriteData(fid,prefix,'data',lz,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcez');
    175 
    176                         //process requested outputs
    177                         var outputs = this.requested_outputs;
    178                         for (var i=0;i<outputs.length;i++){
    179                                 if (outputs[i] == 'default') {
    180                                         outputs.splice(i,1);
    181                                         var newoutputs=this.defaultoutputs(md);
    182                                         for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
    183                                 }
    184                         }
    185                         WriteData(fid,prefix,'data',outputs,'name','md.stressbalance.requested_outputs','format','StringArray');
    186                 }//}}}
    187                 this.defaultoutputs = function(md){ // {{{
    188 
    189                         var list;
    190                         if (md.mesh.dimension() == 3) list = ['Vx','Vy','Vz','Vel','Pressure'];
    191                         else if (md.mesh.dimension()==2) list = ['Vx','Vy','Vel','Pressure'];
    192                         else throw Error('mesh type not supported yet');
    193                         return list;
    194 
    195                 }//}}}
    196                 this.fix=function() { //{{{
    197                         this.abstol=NullFix(this.abstol,NaN);
    198                         this.rift_penalty_lock=NullFix(this.rift_penalty_lock,NaN);
    199                         this.referential=NullFix(this.referential,NaN);
    200                         this.loadingforce=NullFix(this.loadingforce,NaN);
    201                         this.spcvx=NullFix(this.spcvx,NaN);
    202                         this.spcvy=NullFix(this.spcvy,NaN);
    203                         this.spcvz=NullFix(this.spcvz,NaN);
    204                         if(this.vertex_pairing=[])this.vertex_pairing=NaN;
    205                 }//}}}
     143                        checkfield(md,'fieldname','stressbalance.FSreconditioning','>',0);
     144                }
     145        } // }}}
     146        this.marshall=function(md,prefix,fid) { //{{{
     147
     148                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','vertex_pairing','format','DoubleMat','mattype',3);
     149
     150                var yts=365.0*24.0*3600.0;
     151
     152                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','spcvx','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
     153                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','spcvy','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
     154                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','spcvz','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1);
     155                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','restol','format','Double');
     156                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','reltol','format','Double');
     157                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','abstol','format','Double','scale',1./yts);
     158                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','isnewton','format','Integer');
     159                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','FSreconditioning','format','Double');
     160                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','viscosity_overshoot','format','Double');
     161                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','maxiter','format','Integer');
     162                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','shelf_dampening','format','Integer');
     163                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','penalty_factor','format','Double');
     164                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','rift_penalty_lock','format','Integer');
     165                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','rift_penalty_threshold','format','Integer');
     166                WriteData(fid,prefix,'object',this,'class','stressbalance','fieldname','referential','format','DoubleMat','mattype',1);
     167
     168                var lx=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)lx[i]=this.loadingforce[i][0];
     169                var ly=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)ly[i]=this.loadingforce[i][1];
     170                var lz=NewArrayFill(this.loadingforce.length,0); for(var i=0;i<lx.length;i++)lz[i]=this.loadingforce[i][2];
     171
     172                WriteData(fid,prefix,'data',lx,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcex');
     173                WriteData(fid,prefix,'data',ly,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcey');
     174                WriteData(fid,prefix,'data',lz,'format','DoubleMat','mattype',1,'name','md.stressbalance.loadingforcez');
     175
     176                //process requested outputs
     177                var outputs = this.requested_outputs;
     178                for (var i=0;i<outputs.length;i++){
     179                        if (outputs[i] == 'default') {
     180                                outputs.splice(i,1);
     181                                var newoutputs=this.defaultoutputs(md);
     182                                for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
     183                        }
     184                }
     185                WriteData(fid,prefix,'data',outputs,'name','md.stressbalance.requested_outputs','format','StringArray');
     186        }//}}}
     187        this.defaultoutputs = function(md){ // {{{
     188
     189                var list;
     190                if (md.mesh.dimension() == 3) list = ['Vx','Vy','Vz','Vel','Pressure'];
     191                else if (md.mesh.dimension()==2) list = ['Vx','Vy','Vel','Pressure'];
     192                else throw Error('mesh type not supported yet');
     193                return list;
     194
     195        }//}}}
     196        this.fix=function() { //{{{
     197                this.abstol=NullFix(this.abstol,NaN);
     198                this.rift_penalty_lock=NullFix(this.rift_penalty_lock,NaN);
     199                this.referential=NullFix(this.referential,NaN);
     200                this.loadingforce=NullFix(this.loadingforce,NaN);
     201                this.spcvx=NullFix(this.spcvx,NaN);
     202                this.spcvy=NullFix(this.spcvy,NaN);
     203                this.spcvz=NullFix(this.spcvz,NaN);
     204                if(this.vertex_pairing=[])this.vertex_pairing=NaN;
     205        }//}}}
    206206        //properties
    207207        // {{{
  • issm/trunk-jpl/src/m/classes/stressbalance.py

    r20690 r20891  
    176176        def marshall(self,prefix,md,fid):    # {{{
    177177
     178                WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','vertex_pairing','format','DoubleMat','mattype',3)
     179
    178180                yts=365.0*24.0*3600.0
    179181
     
    189191                WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','maxiter','format','Integer')
    190192                WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','shelf_dampening','format','Integer')
    191                 WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','vertex_pairing','format','DoubleMat','mattype',3)
    192193                WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','penalty_factor','format','Double')
    193194                WriteData(fid,prefix,'object',self,'class','stressbalance','fieldname','rift_penalty_lock','format','Integer')
Note: See TracChangeset for help on using the changeset viewer.