Ignore:
Timestamp:
12/22/21 10:39:44 (3 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 26742

Location:
issm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/src

  • issm/trunk/src/m/classes/dsl.js

    r24686 r26744  
    1 //dsl Class definition
    2 //
    3 //   Usage:
    4 //      dsl=dsl();
     1class dsl {//{{{
     2        /**
     3         * DSL class definition
     4         *
     5         * Usage:
     6         *     dsl=dsl();
     7         *
     8         * TODO:
     9         * - Implement from struct constructor (see dsl.m)?
     10         */
     11        constructor() {//{{{
     12                this.global_average_thermosteric_sea_level; // Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m)
     13                this.sea_surface_height_above_geoid; // Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m)
     14                this.sea_water_pressure_at_sea_floor; // Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!)
    515
    6 function dsl(){
    7         //methods
    8         this.setdefaultparameters = function(){// {{{
    9                 this.requested_outputs=['default'];
    10         } // }}}
    11         this.disp = function(){ // {{{
    12                 console.log(sprintf('   dsl parameters:'));
    13                 fielddisplay(this,'global_average_thermosteric_sea_level_change','corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable global rate (mm/yr)');
    14                 fielddisplay(this,'sea_surface_height_change_above_geoid','corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable rate (mm/yr)');
    15                 fielddisplay(this,'sea_water_pressure_change_at_sea_floor','corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable rate (in Pa/yr)');
     16                let nargs = arguments.length;
     17                if (nargs == 0) {
     18                        this.setdefaultparameters();
     19                } else {
     20                        error('constructor not supported');
     21                }
     22        } //}}}
    1623
     24        setdefaultparameters() {//{{{
     25                this.global_average_thermosteric_sea_level = NaN;
     26                this.sea_surface_height_above_geoid = NaN;
     27                this.sea_water_pressure_at_sea_floor = NaN;
     28        } //}}}
    1729
    18         } // }}}
    19         this.defaultoutputs = function(){ // {{{
    20                 return '';
    21         }//}}}
    22     this.classname = function(){ // {{{
    23         return "dsl";
    24     } // }}}
    25     this.extrude = function(md) {//{{{
    26         this.sea_surface_height_change_above_geoid=project3d(md,'vector',this.sea_surface_height_change_above_geoid,'type','node');
    27         this.sea_water_pressure_change_at_sea_floor=project3d(md,'vector',this.sea_water_pressure_change_at_sea_floor,'type','node');
    28         return this;
    29     }//}}}
    30     this.checkconsistency = function(md,solution,analyses) { //{{{
     30        checkconsistency(md, solution, analyses) {//{{{
     31                if (!analyses.includes('SealevelchangeAnalysis') || (solution === 'TransientSolution' && !md.transient.isslc) || !md.transient.isoceantransport) {
     32                        return md;
     33                }
    3134
    32         if(ArrayAnyEqual(ArrayIsMember('SealevelriseAnalysis',analyses),1)){
    33             checkfield(md,'fieldname','dsl.sea_surface_height_change_above_geoid','timeseries',1,'NaN',1,'Inf',1);
    34             checkfield(md,'fieldname','dsl.sea_water_pressure_change_at_sea_floor','timeseries',1,'NaN',1,'Inf',1);
    35         }
     35                md = checkfield(md, 'fieldname', 'dsl.global_average_thermosteric_sea_level', 'NaN', 1, 'Inf', 1);
     36                md = checkfield(md, 'fieldname', 'dsl.sea_surface_height_above_geoid', 'NaN', 1, 'Inf', 1, 'timeseries', 1);
     37                md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_at_sea_floor', 'NaN', 1, 'Inf', 1, 'timeseries', 1);
    3638
    37     } // }}}
    38     this.marshall=function(md,prefix,fid) { //{{{
     39                if (md.solidearth.settings.compute_bp_grd) {
     40                        md = checkfield(md, 'fieldname', 'dsl.sea_water_pressure_at_sea_floor', 'empty', 1);
     41                }
    3942
    40         var yts=md.constants.yts;
     43                return md;
     44        } //}}}
    4145
    42                 WriteData(fid,prefix,'name','md.dsl.model','data',1,'format','Integer');
    43                 WriteData(fid,prefix,'object',this,'class','dsl','fieldname','global_average_thermosteric_sea_level_change','format','DoubleMat','mattype',1,'timeserieslength',1+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
    44                         WriteData(fid,prefix,'object',this,'class','dsl','fieldname','sea_water_pressure_change_at_sea_floor','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts,'scale',1e-3/md.constants.yts);
    45                         WriteData(fid,prefix,'object',this,'class',dsl,'fieldname','sea_surface_height_change_above_geoid','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
    46     }//}}}
    47     this.fix=function() { //{{{
    48     }//}}}
    49         //properties
    50     // {{{
    51         this.global_average_thermosteric_sea_level_change = NaN;
    52         this.sea_surface_height_change_above_geoid = NaN;
    53         this.sea_water_pressure_change_at_sea_floor = NaN;
    54     // }}}
    55 }
     46        disp() {//{{{
     47                console.log('WARNING: dsl::disp is not yet implemented');
     48        } //}}}
     49
     50        marshall(md, prefix, fid) {//{{{
     51                WriteData(fid, prefix, 'name', 'md.dsl.model', 'data', 1, 'format', 'Integer');
     52                WriteData(fid, prefix, 'object', this, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, 'timeserieslength', 2, 'yts', md.constants.yts); // mattype 2, because we are sending a GMSL value identical everywhere on each element
     53                WriteData(fid, prefix, 'object', this, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts); // mattype 1 because we specify DSL at vertex locations
     54                WriteData(fid, prefix, 'object', this, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts); // mattype 1 because we specify bottom pressure at vertex locations
     55        } //}}}
     56
     57        extrude(md) {//{{{
     58                this.sea_surface_height_above_geoid = project3d(md, 'vector', this.sea_surface_height_above_geoid, 'type', 'node', 'layer', 1);
     59                this.sea_water_pressure_at_sea_floor = project3d(md, 'vector', this.sea_water_pressure_at_sea_floor, 'type', 'node', 'layer', 1);
     60        } //}}}
     61} //}}}
Note: See TracChangeset for help on using the changeset viewer.