[22296] | 1 | %ISSMSETTINGS class definition
|
---|
| 2 | %
|
---|
| 3 | % Usage:
|
---|
| 4 | % issmsettings=issmsettings();
|
---|
| 5 |
|
---|
| 6 | classdef issmsettings
|
---|
| 7 | properties (SetAccess=public)
|
---|
[25637] | 8 | results_on_nodes = {};
|
---|
| 9 | io_gather = 0;
|
---|
| 10 | lowmem = 0;
|
---|
| 11 | output_frequency = 0;
|
---|
| 12 | sb_coupling_frequency = 0;
|
---|
| 13 | checkpoint_frequency = 0;
|
---|
| 14 | waitonlock = 0;
|
---|
| 15 | upload_server = '';
|
---|
| 16 | upload_path = '';
|
---|
| 17 | upload_login = '';
|
---|
| 18 | upload_port = 0;
|
---|
| 19 | upload_filename = '';
|
---|
[22296] | 20 | solver_residue_threshold = 0;
|
---|
| 21 | end
|
---|
[25637] | 22 | methods (Static)
|
---|
| 23 | function self = loadobj(self) % {{{
|
---|
| 24 | % This function is directly called by matlab when a model object is
|
---|
| 25 | % loaded. Update old properties here
|
---|
| 26 |
|
---|
| 27 | %2020 Oct 6
|
---|
| 28 | if isstruct(self)
|
---|
| 29 | objstruct = self;
|
---|
| 30 | self = structtoobj(issmsettings(),objstruct);
|
---|
| 31 | if isfield(objstruct,'recording_frequency')
|
---|
[25668] | 32 | self.checkpoint_frequency = objstruct.recording_frequency;
|
---|
[25637] | 33 | end
|
---|
| 34 | end
|
---|
| 35 | end % }}}
|
---|
| 36 | end
|
---|
[22296] | 37 | methods
|
---|
| 38 | function self = issmsettings(varargin) % {{{
|
---|
| 39 | switch nargin
|
---|
| 40 | case 0
|
---|
| 41 | self=setdefaultparameters(self);
|
---|
| 42 | otherwise
|
---|
| 43 | error('constructor not supported');
|
---|
| 44 | end
|
---|
| 45 | end % }}}
|
---|
| 46 | function self = setdefaultparameters(self) % {{{
|
---|
| 47 |
|
---|
| 48 | %are we short in memory ? (0 faster but requires more memory)
|
---|
| 49 | self.lowmem=0;
|
---|
| 50 |
|
---|
| 51 | %i/o:
|
---|
| 52 | self.io_gather=1;
|
---|
| 53 |
|
---|
| 54 | %results frequency by default every step
|
---|
| 55 | self.output_frequency=1;
|
---|
| 56 |
|
---|
[23474] | 57 | %coupling frequency of the stress balance solver by default every step
|
---|
| 58 | self.sb_coupling_frequency=1;
|
---|
| 59 |
|
---|
[22296] | 60 | %checkpoints frequency, by default never:
|
---|
[25637] | 61 | self.checkpoint_frequency=0;
|
---|
[22296] | 62 |
|
---|
| 63 | %this option can be activated to load automatically the results
|
---|
| 64 | %onto the model after a parallel run by waiting for the lock file
|
---|
| 65 | %N minutes that is generated once the solution has converged
|
---|
| 66 | %0 to deactivate
|
---|
| 67 | self.waitonlock=Inf;
|
---|
| 68 |
|
---|
| 69 | %upload options:
|
---|
| 70 | self.upload_port = 0;
|
---|
| 71 |
|
---|
| 72 | %throw an error if solver residue exceeds this value
|
---|
| 73 | self.solver_residue_threshold = 1e-6;
|
---|
| 74 |
|
---|
| 75 | end % }}}
|
---|
| 76 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 77 |
|
---|
[23758] | 78 | md = checkfield(md,'fieldname','settings.results_on_nodes','stringrow',1);
|
---|
[22297] | 79 | md = checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0 1]);
|
---|
| 80 | md = checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0 1]);
|
---|
| 81 | md = checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
|
---|
[23474] | 82 | md = checkfield(md,'fieldname','settings.sb_coupling_frequency','numel',[1],'>=',1);
|
---|
[25637] | 83 | md = checkfield(md,'fieldname','settings.checkpoint_frequency','numel',[1],'>=',0);
|
---|
[22297] | 84 | md = checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
|
---|
| 85 | md = checkfield(md,'fieldname','settings.solver_residue_threshold','numel',[1],'>',0);
|
---|
[22296] | 86 |
|
---|
| 87 | end % }}}
|
---|
| 88 | function disp(self) % {{{
|
---|
| 89 | disp(sprintf(' general issmsettings parameters:'));
|
---|
| 90 |
|
---|
[23758] | 91 | fielddisplay(self,'results_on_nodes','list of output for which results will be output for all the nodes of each element, Use ''all'' for all output on nodes.');
|
---|
[22296] | 92 | fielddisplay(self,'io_gather','I/O gathering strategy for result outputs (default 1)');
|
---|
| 93 | fielddisplay(self,'lowmem','is the memory limited ? (0 or 1)');
|
---|
[27775] | 94 | fielddisplay(self,'output_frequency','number of time steps between two saves (e.g., 5 means that results are only saved every 5 time steps)');
|
---|
[23474] | 95 | fielddisplay(self,'sb_coupling_frequency','frequency at which StressBalance solver is coupled (default 1)');
|
---|
[25637] | 96 | fielddisplay(self,'checkpoint_frequency','frequency at which the runs are being recorded, allowing for a restart');
|
---|
[22296] | 97 | fielddisplay(self,'waitonlock','maximum number of minutes to wait for batch results (NaN to deactivate)');
|
---|
| 98 | fielddisplay(self,'upload_server','server hostname where model should be uploaded');
|
---|
| 99 | fielddisplay(self,'upload_path','path on server where model should be uploaded');
|
---|
| 100 | fielddisplay(self,'upload_login','server login');
|
---|
| 101 | fielddisplay(self,'upload_port','port login (default is 0)');
|
---|
| 102 | fielddisplay(self,'upload_filename','unique id generated when uploading the file to server');
|
---|
| 103 | fielddisplay(self,'solver_residue_threshold','throw an error if solver residue exceeds this value (NaN to deactivate)');
|
---|
| 104 |
|
---|
| 105 | end % }}}
|
---|
| 106 | function marshall(self,prefix,md,fid) % {{{
|
---|
[23758] | 107 | WriteData(fid,prefix,'data',self.results_on_nodes,'name','md.settings.results_on_nodes','format','StringArray');
|
---|
[22297] | 108 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','io_gather','format','Boolean');
|
---|
| 109 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','lowmem','format','Boolean');
|
---|
| 110 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','output_frequency','format','Integer');
|
---|
[23474] | 111 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','sb_coupling_frequency','format','Integer');
|
---|
[25637] | 112 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','checkpoint_frequency','format','Integer');
|
---|
[22297] | 113 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','waitonlock','data',self.waitonlock>0,'format','Boolean');
|
---|
| 114 | WriteData(fid,prefix,'object',self,'class','settings','fieldname','solver_residue_threshold','format','Double');
|
---|
[22296] | 115 | end % }}}
|
---|
| 116 | function savemodeljs(self,fid,modelname) % {{{
|
---|
| 117 |
|
---|
[23758] | 118 | writejscellstring(fid,[modelname '.settings.results_on_nodes'],self.results_on_nodes);
|
---|
[22297] | 119 | writejsdouble(fid,[modelname '.settings.io_gather'],self.io_gather);
|
---|
| 120 | writejsdouble(fid,[modelname '.settings.lowmem'],self.lowmem);
|
---|
| 121 | writejsdouble(fid,[modelname '.settings.output_frequency'],self.output_frequency);
|
---|
[23474] | 122 | writejsdouble(fid,[modelname '.settings.sb_coupling_frequency'],self.sb_coupling_frequency);
|
---|
[25637] | 123 | writejsdouble(fid,[modelname '.settings.checkpoint_frequency'],self.checkpoint_frequency);
|
---|
[22297] | 124 | writejsdouble(fid,[modelname '.settings.waitonlock'],self.waitonlock);
|
---|
| 125 | writejsstring(fid,[modelname '.settings.upload_server'],self.upload_server);
|
---|
| 126 | writejsstring(fid,[modelname '.settings.upload_path'],self.upload_path);
|
---|
| 127 | writejsstring(fid,[modelname '.settings.upload_login'],self.upload_login);
|
---|
| 128 | writejsdouble(fid,[modelname '.settings.upload_port'],self.upload_port);
|
---|
| 129 | writejsstring(fid,[modelname '.settings.upload_filename'],self.upload_filename);
|
---|
| 130 | writejsstring(fid,[modelname '.settings.solver_residue_threshold'],self.solver_residue_threshold);
|
---|
[22296] | 131 | end % }}}
|
---|
| 132 | end
|
---|
| 133 | end
|
---|