1 | //TIMESTEPPING class definition
|
---|
2 | //
|
---|
3 | // Usage:
|
---|
4 | // timestepping=new timestepping();
|
---|
5 |
|
---|
6 | function 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 | //time adaptation?
|
---|
16 | this.time_adapt=0;
|
---|
17 | this.cfl_coefficient=0.5;
|
---|
18 |
|
---|
19 | //should we interpolate forcings between timesteps?
|
---|
20 | this.interp_forcings=1;
|
---|
21 |
|
---|
22 | //In years by default
|
---|
23 | this.in_years = 1;
|
---|
24 |
|
---|
25 | }// }}}
|
---|
26 | this.disp= function(){// {{{
|
---|
27 | console.log(sprintf(' timestepping parameters:'));
|
---|
28 |
|
---|
29 | if(this.in_years) unit = 'yr';
|
---|
30 | else unit = 's';
|
---|
31 | fielddisplay(this,'start_time','simulation starting time ['+ unit + ']');
|
---|
32 | fielddisplay(this,'final_time','final time to stop the simulation ['+ unit + ']');
|
---|
33 | fielddisplay(this,'time_step','length of time steps [' +unit+ ']');
|
---|
34 | fielddisplay(this,'time_adapt','use cfl condition to define time step ? (0 or 1) ');
|
---|
35 | fielddisplay(this,'cfl_coefficient','coefficient applied to cfl condition');
|
---|
36 | fielddisplay(this,'interp_forcings','interpolate in time between requested forcing values ? (0 or 1)');
|
---|
37 | fielddisplay(this,'in_years','time unit, 1: years, 0: seconds');
|
---|
38 |
|
---|
39 |
|
---|
40 | }// }}}
|
---|
41 | //properties
|
---|
42 | // {{{
|
---|
43 | this.start_time = 0.;
|
---|
44 | this.final_time = 0.;
|
---|
45 | this.time_step = 0.;
|
---|
46 | this.time_adapt = 0;
|
---|
47 | this.cfl_coefficient = 0.;
|
---|
48 | this.interp_forcings = 1;
|
---|
49 | this.in_years = 1;
|
---|
50 |
|
---|
51 | this.setdefaultparameters();
|
---|
52 | //}}}
|
---|
53 | }
|
---|