[14555] | 1 | %HYDROLOGYSHREVE class definition
|
---|
[9617] | 2 | %
|
---|
| 3 | % Usage:
|
---|
[14555] | 4 | % hydrologyshreve=hydrologyshreve();
|
---|
[9617] | 5 |
|
---|
[14555] | 6 | classdef hydrologyshreve
|
---|
[9617] | 7 | properties (SetAccess=public)
|
---|
[10969] | 8 | spcwatercolumn = NaN;
|
---|
| 9 | stabilization = 0;
|
---|
[9617] | 10 | end
|
---|
| 11 | methods
|
---|
[17720] | 12 | function createxml(obj,fid) % {{{
|
---|
| 13 | fprintf(fid, '\n\n');
|
---|
| 14 | fprintf(fid, '%s\n', '<!-- Hydrology -->');
|
---|
| 15 |
|
---|
| 16 | % Convergence criteria
|
---|
| 17 | fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Hydrologyshreve solution parameters">','<section name="hydrologyshreve" />');
|
---|
| 18 |
|
---|
| 19 | fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n', '<parameter key ="spcwatercolumn" type="', class(obj.spcwatercolumn),'" default="', convert2str(obj.spcwatercolumn),'">', ' <section name="hydrologyshreve" />',' <help> water thickness constraints (NaN means no constraint) [m] </help>','</parameter>');
|
---|
| 20 | fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n', '<parameter key ="stabilization" type="', class(obj.stabilization),'" default="', convert2str(obj.stabilization),'">', ' <section name="hydrologyshreve" />',' <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>','</parameter>');
|
---|
| 21 | fprintf(fid,'%s\n%s\n','</frame>');
|
---|
| 22 | end % }}}
|
---|
[14555] | 23 | function obj = hydrologyshreve(varargin) % {{{
|
---|
[9617] | 24 | switch nargin
|
---|
| 25 | case 0
|
---|
| 26 | obj=setdefaultparameters(obj);
|
---|
[14618] | 27 | case 1
|
---|
| 28 | obj=structtoobj(obj,varargin{1});
|
---|
[9617] | 29 | otherwise
|
---|
| 30 | error('constructor not supported');
|
---|
| 31 | end
|
---|
| 32 | end % }}}
|
---|
| 33 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 34 |
|
---|
[9646] | 35 | %Type of stabilization to use 0:nothing 1:artificial_diffusivity
|
---|
| 36 | obj.stabilization=1;
|
---|
[9617] | 37 | end % }}}
|
---|
[12663] | 38 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
[9739] | 39 |
|
---|
[9854] | 40 | %Early return
|
---|
[14771] | 41 | if ~ismember(HydrologyShreveAnalysisEnum(),analyses)
|
---|
| 42 | return;
|
---|
| 43 | end
|
---|
[9854] | 44 |
|
---|
[16764] | 45 | md = checkfield(md,'fieldname','hydrology.spcwatercolumn','forcing',1);
|
---|
| 46 | md = checkfield(md,'fieldname','hydrology.stabilization','>=',0);
|
---|
[9739] | 47 | end % }}}
|
---|
[9820] | 48 | function disp(obj) % {{{
|
---|
[14555] | 49 | disp(sprintf(' hydrologyshreve solution parameters:'));
|
---|
[14640] | 50 | fielddisplay(obj,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
|
---|
[10538] | 51 | fielddisplay(obj,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
|
---|
[9820] | 52 |
|
---|
| 53 | end % }}}
|
---|
[15131] | 54 | function marshall(obj,md,fid) % {{{
|
---|
[14838] | 55 | WriteData(fid,'enum',HydrologyModelEnum(),'data',HydrologyshreveEnum(),'format','Integer');
|
---|
[15133] | 56 | WriteData(fid,'object',obj,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
|
---|
[10969] | 57 | WriteData(fid,'object',obj,'fieldname','stabilization','format','Double');
|
---|
| 58 | end % }}}
|
---|
[9617] | 59 | end
|
---|
| 60 | end
|
---|
[17881] | 61 |
|
---|