1 | //STEADYSTATE class definition
|
---|
2 | //
|
---|
3 | // Usage:
|
---|
4 | // steadystate=new steadystate();
|
---|
5 |
|
---|
6 | function steadystate (){
|
---|
7 | //methods
|
---|
8 | this.setdefaultparameters = function(){// {{{
|
---|
9 |
|
---|
10 | //maximum of steady state iterations
|
---|
11 | this.maxiter=100;
|
---|
12 |
|
---|
13 | //Relative tolerance for the steadystate convertgence
|
---|
14 | this.reltol=0.01;
|
---|
15 |
|
---|
16 | //default output
|
---|
17 | this.requested_outputs=['default'];
|
---|
18 |
|
---|
19 |
|
---|
20 | }// }}}
|
---|
21 | this.disp= function(){// {{{
|
---|
22 |
|
---|
23 | console.log(sprintf(' steadystate solution parameters:'));
|
---|
24 |
|
---|
25 | fielddisplay(this,'reltol','relative tolerance criterion');
|
---|
26 | fielddisplay(this,'maxiter','maximum number of iterations');
|
---|
27 | fielddisplay(this,'requested_outputs','additional requested outputs');
|
---|
28 |
|
---|
29 | }// }}}
|
---|
30 | this.classname= function(){// {{{
|
---|
31 | return "steadystate";
|
---|
32 |
|
---|
33 | }// }}}
|
---|
34 | this.checkconsistency = function(md,solution,analyses) {// {{{
|
---|
35 |
|
---|
36 | //Early return
|
---|
37 | if (solution!=SteadystateSolutionEnum()) return;
|
---|
38 |
|
---|
39 | if (md.timestepping.time_step!=0){
|
---|
40 | md.checkmessage('for a steadystate computation, timestepping.time_step must be zero.');
|
---|
41 | }
|
---|
42 | checkfield(md,'fieldname','steadystate.requested_outputs','stringrow',1);
|
---|
43 |
|
---|
44 | if (isNaN(md.stressbalance.reltol)){
|
---|
45 | md.checkmessage('for a steadystate computation, stressbalance.reltol (relative convergence criterion) must be defined!');
|
---|
46 | }
|
---|
47 | } // }}}
|
---|
48 | this.marshall=function(md,prefix,fid) { //{{{
|
---|
49 | WriteData(fid,prefix,'object',this,'fieldname','reltol','format','Double');
|
---|
50 | WriteData(fid,prefix,'object',this,'fieldname','maxiter','format','Integer');
|
---|
51 |
|
---|
52 | //process requested outputs
|
---|
53 | var outputs = this.requested_outputs;
|
---|
54 | for (var i=0;i<outputs.length;i++){
|
---|
55 | if (outputs[i] == 'default') {
|
---|
56 | outputs.splice(i,1);
|
---|
57 | var newoutputs=this.defaultoutputs(md);
|
---|
58 | for (var j=0;j<newoutputs.length;j++) outputs.push(newoutputs[j]);
|
---|
59 | }
|
---|
60 | }
|
---|
61 | WriteData(fid,prefix,'data',outputs,'name','md.steadystate.requested_outputs','format','StringArray');
|
---|
62 | }//}}}
|
---|
63 | this.defaultoutputs = function(md) { //{{{
|
---|
64 |
|
---|
65 | var list=[];
|
---|
66 |
|
---|
67 | for (var i=0;i<md.stressbalance.defaultoutputs(md).length;i++)list.push(md.stressbalance.defaultoutputs(md)[i]);
|
---|
68 | for (var i=0;i<md.thermal.defaultoutputs(md).length;i++)list.push(md.thermal.defaultoutputs(md)[i]);
|
---|
69 |
|
---|
70 | return list;
|
---|
71 |
|
---|
72 | }//}}}
|
---|
73 | this.fix=function() { //{{{
|
---|
74 | }//}}}
|
---|
75 | //properties
|
---|
76 | // {{{
|
---|
77 |
|
---|
78 | this.reltol = 0;
|
---|
79 | this.maxiter = 0;
|
---|
80 | this.requested_outputs = [];
|
---|
81 |
|
---|
82 | this.setdefaultparameters();
|
---|
83 | //}}}
|
---|
84 | }
|
---|