source: issm/trunk-jpl/src/m/classes/hydrologyshreve.m@ 16764

Last change on this file since 16764 was 16764, checked in by Eric.Larour, 11 years ago

CHG: checkfield could not run for massatfluggate or misfit classes, because these classes do not
have access to their own fields through the model! So we modified checkfield.m and checkfield.py to accept
either directly a field, or indirectly a fieldname which then is used to retrieve from the model.

File size: 2.5 KB
Line 
1%HYDROLOGYSHREVE class definition
2%
3% Usage:
4% hydrologyshreve=hydrologyshreve();
5
6classdef hydrologyshreve
7 properties (SetAccess=public)
8 spcwatercolumn = NaN;
9 n = 0;
10 CR = 0;
11 p = 0;
12 q = 0;
13 kn = 0;
14 stabilization = 0;
15 end
16 methods
17 function obj = hydrologyshreve(varargin) % {{{
18 switch nargin
19 case 0
20 obj=setdefaultparameters(obj);
21 case 1
22 obj=structtoobj(obj,varargin{1});
23 otherwise
24 error('constructor not supported');
25 end
26 end % }}}
27 function obj = setdefaultparameters(obj) % {{{
28
29 %Parameters from Johnson's 2002 thesis, section 3.5.4
30 obj.n = .02;
31 obj.CR = .01;
32 obj.p = 2;
33 obj.q = 1;
34 obj.kn = 0;
35
36 %Type of stabilization to use 0:nothing 1:artificial_diffusivity
37 obj.stabilization=1;
38 end % }}}
39 function md = checkconsistency(obj,md,solution,analyses) % {{{
40
41 %Early return
42 if ~ismember(HydrologyShreveAnalysisEnum(),analyses)
43 return;
44 end
45
46 md = checkfield(md,'fieldname','hydrology.spcwatercolumn','forcing',1);
47 md = checkfield(md,'fieldname','hydrology.stabilization','>=',0);
48 end % }}}
49 function disp(obj) % {{{
50 disp(sprintf(' hydrologyshreve solution parameters:'));
51
52 fielddisplay(obj,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
53 fielddisplay(obj,'n','Manning roughness coefficient');
54 fielddisplay(obj,'CR','tortuosity parameter');
55 fielddisplay(obj,'p','dimensionless exponent in Manning velocity formula');
56 fielddisplay(obj,'q','dimensionless exponent in Manning velocity formula');
57 fielddisplay(obj,'kn','parameter in effective pressure formula');
58 fielddisplay(obj,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
59
60 end % }}}
61 function marshall(obj,md,fid) % {{{
62 WriteData(fid,'enum',HydrologyModelEnum(),'data',HydrologyshreveEnum(),'format','Integer');
63 WriteData(fid,'object',obj,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
64 WriteData(fid,'object',obj,'fieldname','n','format','Double');
65 WriteData(fid,'object',obj,'fieldname','CR','format','Double');
66 WriteData(fid,'object',obj,'fieldname','p','format','Double');
67 WriteData(fid,'object',obj,'fieldname','q','format','Double');
68 WriteData(fid,'object',obj,'fieldname','kn','format','Double');
69 WriteData(fid,'object',obj,'fieldname','stabilization','format','Double');
70 end % }}}
71 end
72end
Note: See TracBrowser for help on using the repository browser.