[19759] | 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 | }// }}}
|
---|
[19791] | 30 | this.classname= function(){// {{{
|
---|
| 31 | return "steadystate";
|
---|
| 32 |
|
---|
| 33 | }// }}}
|
---|
[19787] | 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 | } // }}}
|
---|
[19791] | 48 | this.marshall=function(md,fid) { //{{{
|
---|
| 49 | WriteData(fid,'object',this,'fieldname','reltol','format','Double');
|
---|
| 50 | WriteData(fid,'object',this,'fieldname','maxiter','format','Integer');
|
---|
| 51 |
|
---|
| 52 | //process requested outputs
|
---|
| 53 | outputs = this.requested_outputs;
|
---|
| 54 | for (var i=0;i<outputs;i++){
|
---|
| 55 | if (outputs[i] == 'default') {
|
---|
| 56 | outputs.splice(i,1);
|
---|
| 57 | outputs.push(this.defaultoutputs());
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 | WriteData(fid,'data',outputs,'enum',SteadystateRequestedOutputsEnum,'format','StringArray');
|
---|
| 61 | }//}}}
|
---|
| 62 | this.defaultoutputs = function(md) { //{{{
|
---|
| 63 |
|
---|
| 64 | var list=[];
|
---|
| 65 |
|
---|
| 66 | for (var i=0;i<md.stressbalance.defaultoutputs().length;i++)list.push(md.stressbalance.defaultoutputs()[i]);
|
---|
| 67 | for (var i=0;i<md.thermal.defaultoutputs().length;i++)list.push(md.thermal.defaultoutputs()[i]);
|
---|
| 68 |
|
---|
| 69 | return list;
|
---|
| 70 |
|
---|
| 71 | }//}}}
|
---|
[19759] | 72 | //properties
|
---|
| 73 | // {{{
|
---|
| 74 |
|
---|
| 75 | this.reltol = 0;
|
---|
| 76 | this.maxiter = 0;
|
---|
| 77 | this.requested_outputs = [];
|
---|
| 78 |
|
---|
| 79 | this.setdefaultparameters();
|
---|
| 80 | //}}}
|
---|
| 81 | }
|
---|