| 1 | //SMBforcing Class definition
|
|---|
| 2 | //
|
|---|
| 3 | // Usage:
|
|---|
| 4 | // SMB=SMBforcing();
|
|---|
| 5 |
|
|---|
| 6 | function SMBforcing(){
|
|---|
| 7 | //methods
|
|---|
| 8 | this.setdefaultparameters = function(){// {{{
|
|---|
| 9 | } // }}}
|
|---|
| 10 | this.disp = function(){ // {{{
|
|---|
| 11 | console.log(sprintf(' surface forcings parameters:'));
|
|---|
| 12 | fielddisplay(this,'mass_balance','surface mass balance [m/yr ice eq]');
|
|---|
| 13 | fielddisplay(this,'requested_outputs','additional outputs requested');
|
|---|
| 14 | } // }}}
|
|---|
| 15 | this.initialize = function(md) {// {{{
|
|---|
| 16 |
|
|---|
| 17 | if (self.mass_balance === NaN){
|
|---|
| 18 | self.mass_balance=NewArrayFill(md.mesh.numberofvertices,0);
|
|---|
| 19 | console.log(' no smb.mass_balance specified: values set as zero');
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | } // }}}
|
|---|
| 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 | } // }}}
|
|---|
| 34 | //properties
|
|---|
| 35 | this.mass_balance = NaN;
|
|---|
| 36 | this.requested_outputs = [''];
|
|---|
| 37 | this.setdefaultparameters();
|
|---|
| 38 | }
|
|---|