source: issm/trunk-jpl/src/m/classes/timestepping.js@ 22459

Last change on this file since 22459 was 22459, checked in by seroussi, 7 years ago

ADD: adding coupling_time for ice/ocean coupling

File size: 2.5 KB
Line 
1//TIMESTEPPING class definition
2//
3// Usage:
4// timestepping=new timestepping();
5
6function timestepping (){
7 //methods
8 this.setdefaultparameters = function(){// {{{
9 //time between 2 time steps
10 this.time_step=1./2.;
11
12 //final time
13 this.final_time=10.*this.time_step;
14
15 //should we interpolate forcings between timesteps?
16 this.interp_forcings=1;
17 }// }}}
18 this.disp= function(){// {{{
19
20 var unit;
21 console.log(sprintf(' timestepping parameters:'));
22 unit = 'yr';
23 fielddisplay(this,'start_time','simulation starting time ['+ unit + ']');
24 fielddisplay(this,'final_time','final time to stop the simulation ['+ unit + ']');
25 fielddisplay(this,'time_step','length of time steps [' +unit+ ']');
26 fielddisplay(this,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
27 fielddisplay(this,'coupling_time','length of coupling time steps with ocean model [' +unit+ ']');
28
29 }// }}}
30 this.classname= function(){// {{{
31 return "timestepping";
32
33 }// }}}
34 this.checkconsistency = function(md,solution,analyses) { //{{{
35
36 checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1,'Inf',1);
37 checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1,'Inf',1);
38 checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1,'Inf',1);
39 checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0,1]);
40 checkfield(md,'fieldname','timestepping.coupling_time','numel',[1],'>=',0,'NaN',1,'Inf',1);
41 if (this.final_time-this.start_time<0){
42 md.checkmessage('timestepping.final_time should be larger than timestepping.start_time');
43 }
44 } // }}}
45 this.marshall=function(md,prefix,fid) { //{{{
46
47 var scale;
48 scale = md.constants.yts;
49
50 WriteData(fid,prefix,'name','md.timestepping.type','data',1,'format','Integer');
51 WriteData(fid,prefix,'object',this,'fieldname','start_time','format','Double','scale',scale);
52 WriteData(fid,prefix,'object',this,'fieldname','final_time','format','Double','scale',scale);
53 WriteData(fid,prefix,'object',this,'fieldname','time_step','format','Double','scale',scale);
54 WriteData(fid,prefix,'object',this,'fieldname','interp_forcings','format','Boolean');
55 WriteData(fid,prefix,'object',this,'fieldname','coupling_time','format','Double','scale',scale);
56
57 }//}}}
58 this.fix=function() { //{{{
59 }//}}}
60 //properties
61 // {{{
62 this.start_time = 0.;
63 this.final_time = 0.;
64 this.time_step = 0.;
65 this.interp_forcings = 1;
66 this.coupling_time = 0.;
67
68 this.setdefaultparameters();
69 //}}}
70}
Note: See TracBrowser for help on using the repository browser.