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

Last change on this file since 26195 was 26195, checked in by Mathieu Morlighem, 4 years ago

CHG: added cycle through forcing field, not implemented in C++ yet

File size: 2.8 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 this.cycle_forcing=0;
18 }// }}}
19 this.disp= function(){// {{{
20
21 var unit;
22 console.log(sprintf(' timestepping parameters:'));
23 unit = 'yr';
24 fielddisplay(this,'start_time','simulation starting time ['+ unit + ']');
25 fielddisplay(this,'final_time','final time to stop the simulation ['+ unit + ']');
26 fielddisplay(this,'time_step','length of time steps [' +unit+ ']');
27 fielddisplay(this,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
28 fielddisplay(this,'cycle_forcing','cycle through forcing ? (0 or 1)');
29 fielddisplay(this,'coupling_time','length of coupling time steps with ocean model [' +unit+ ']');
30
31 }// }}}
32 this.classname= function(){// {{{
33 return "timestepping";
34
35 }// }}}
36 this.checkconsistency = function(md,solution,analyses) { //{{{
37
38 checkfield(md,'fieldname','timestepping.start_time','numel',[1],'NaN',1,'Inf',1);
39 checkfield(md,'fieldname','timestepping.final_time','numel',[1],'NaN',1,'Inf',1);
40 checkfield(md,'fieldname','timestepping.time_step','numel',[1],'>=',0,'NaN',1,'Inf',1);
41 checkfield(md,'fieldname','timestepping.interp_forcings','numel',[1],'values',[0,1]);
42 checkfield(md,'fieldname','timestepping.cycle_forcing','numel',[1],'values',[0,1]);
43 checkfield(md,'fieldname','timestepping.coupling_time','numel',[1],'>=',0,'NaN',1,'Inf',1);
44 if (this.final_time-this.start_time<0){
45 md.checkmessage('timestepping.final_time should be larger than timestepping.start_time');
46 }
47 } // }}}
48 this.marshall=function(md,prefix,fid) { //{{{
49
50 var scale;
51 scale = md.constants.yts;
52
53 WriteData(fid,prefix,'name','md.timestepping.type','data',1,'format','Integer');
54 WriteData(fid,prefix,'object',this,'fieldname','start_time','format','Double','scale',scale);
55 WriteData(fid,prefix,'object',this,'fieldname','final_time','format','Double','scale',scale);
56 WriteData(fid,prefix,'object',this,'fieldname','time_step','format','Double','scale',scale);
57 WriteData(fid,prefix,'object',this,'fieldname','interp_forcings','format','Boolean');
58 WriteData(fid,prefix,'object',this,'fieldname','cycle_forcing','format','Boolean');
59 WriteData(fid,prefix,'object',this,'fieldname','coupling_time','format','Double','scale',scale);
60
61 }//}}}
62 this.fix=function() { //{{{
63 }//}}}
64 //properties
65 // {{{
66 this.start_time = 0.;
67 this.final_time = 0.;
68 this.time_step = 0.;
69 this.interp_forcings = 1;
70 this.cycle_forcing = 0;
71 this.coupling_time = 0.;
72
73 this.setdefaultparameters();
74 //}}}
75}
Note: See TracBrowser for help on using the repository browser.