1 | %HYDROLOGYSHREVE class definition
|
---|
2 | %
|
---|
3 | % Usage:
|
---|
4 | % hydrologyshreve=hydrologyshreve();
|
---|
5 |
|
---|
6 | classdef hydrologyshreve
|
---|
7 | properties (SetAccess=public)
|
---|
8 | spcwatercolumn = NaN;
|
---|
9 | stabilization = 0;
|
---|
10 | end
|
---|
11 | methods
|
---|
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 % }}}
|
---|
23 | function obj = hydrologyshreve(varargin) % {{{
|
---|
24 | switch nargin
|
---|
25 | case 0
|
---|
26 | obj=setdefaultparameters(obj);
|
---|
27 | case 1
|
---|
28 | obj=structtoobj(obj,varargin{1});
|
---|
29 | otherwise
|
---|
30 | error('constructor not supported');
|
---|
31 | end
|
---|
32 | end % }}}
|
---|
33 | function obj = setdefaultparameters(obj) % {{{
|
---|
34 |
|
---|
35 | %Type of stabilization to use 0:nothing 1:artificial_diffusivity
|
---|
36 | obj.stabilization=1;
|
---|
37 | end % }}}
|
---|
38 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
---|
39 |
|
---|
40 | %Early return
|
---|
41 | if ~ismember(HydrologyShreveAnalysisEnum(),analyses)
|
---|
42 | return;
|
---|
43 | end
|
---|
44 |
|
---|
45 | md = checkfield(md,'fieldname','hydrology.spcwatercolumn','forcing',1);
|
---|
46 | md = checkfield(md,'fieldname','hydrology.stabilization','>=',0);
|
---|
47 | end % }}}
|
---|
48 | function disp(obj) % {{{
|
---|
49 | disp(sprintf(' hydrologyshreve solution parameters:'));
|
---|
50 | fielddisplay(obj,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
|
---|
51 | fielddisplay(obj,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
|
---|
52 |
|
---|
53 | end % }}}
|
---|
54 | function marshall(obj,md,fid) % {{{
|
---|
55 | WriteData(fid,'enum',HydrologyModelEnum(),'data',HydrologyshreveEnum(),'format','Integer');
|
---|
56 | WriteData(fid,'object',obj,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
|
---|
57 | WriteData(fid,'object',obj,'fieldname','stabilization','format','Double');
|
---|
58 | end % }}}
|
---|
59 | end
|
---|
60 | end
|
---|
61 |
|
---|