[27032] | 1 | Index: ../trunk-jpl/src/m/classes/calvingtest.m
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/classes/calvingtest.m (nonexistent)
|
---|
| 4 | +++ ../trunk-jpl/src/m/classes/calvingtest.m (revision 27020)
|
---|
| 5 | @@ -0,0 +1,49 @@
|
---|
| 6 | +%CALVINGTEST class definition
|
---|
| 7 | +% For testing calving laws and coefficients
|
---|
| 8 | +% Usage:
|
---|
| 9 | +% calvingtest=calvingtest();
|
---|
| 10 | +
|
---|
| 11 | +classdef calvingtest
|
---|
| 12 | + properties (SetAccess=public)
|
---|
| 13 | + speedfactor = 1;
|
---|
| 14 | + end
|
---|
| 15 | + methods
|
---|
| 16 | + function self = calvingtest(varargin) % {{{
|
---|
| 17 | + switch nargin
|
---|
| 18 | + case 0
|
---|
| 19 | + self=setdefaultparameters(self);
|
---|
| 20 | + case 1
|
---|
| 21 | + inputstruct=varargin{1};
|
---|
| 22 | + list1 = properties('calvingtest');
|
---|
| 23 | + list2 = fieldnames(inputstruct);
|
---|
| 24 | + for i=1:length(list1)
|
---|
| 25 | + fieldname = list1{i};
|
---|
| 26 | + if ismember(fieldname,list2),
|
---|
| 27 | + self.(fieldname) = inputstruct.(fieldname);
|
---|
| 28 | + end
|
---|
| 29 | + end
|
---|
| 30 | + otherwise
|
---|
| 31 | + error('constructor not supported');
|
---|
| 32 | + end
|
---|
| 33 | + end % }}}
|
---|
| 34 | + function self = extrude(self,md) % {{{
|
---|
| 35 | + end % }}}
|
---|
| 36 | + function self = setdefaultparameters(self) % {{{
|
---|
| 37 | + self.speedfactor = 1;
|
---|
| 38 | + end % }}}
|
---|
| 39 | + function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
| 40 | + %Early return
|
---|
| 41 | + if (~strcmp(solution,'TransientSolution') | md.transient.ismovingfront==0), return; end
|
---|
| 42 | + md = checkfield(md,'fieldname','calving.speedfactor','NaN',1,'Inf',1, 'singletimeseries', 1);
|
---|
| 43 | + end % }}}
|
---|
| 44 | + function disp(self) % {{{
|
---|
| 45 | + disp(sprintf(' Calving test parameters:'));
|
---|
| 46 | + fielddisplay(self,'speedfactor','calving rate is proportional to the ice velocity.');
|
---|
| 47 | + end % }}}
|
---|
| 48 | + function marshall(self,prefix,md,fid) % {{{
|
---|
| 49 | + yts=md.constants.yts;
|
---|
| 50 | + WriteData(fid,prefix,'name','md.calving.law','data',8,'format','Integer');
|
---|
| 51 | + WriteData(fid,prefix,'object',self,'fieldname','speedfactor','format','DoubleMat','mattype',1,'timeserieslength',2,'yts',md.constants.yts);
|
---|
| 52 | + end % }}}
|
---|
| 53 | + end
|
---|
| 54 | +end
|
---|
| 55 | Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
|
---|
| 56 | ===================================================================
|
---|
| 57 | --- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp (revision 27019)
|
---|
| 58 | +++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp (revision 27020)
|
---|
| 59 | @@ -170,6 +170,11 @@
|
---|
| 60 | parameters->AddObject(iomodel->CopyConstantObject("md.levelset.migration_max",MigrationMaxEnum));
|
---|
| 61 |
|
---|
| 62 | int calvinglaw;
|
---|
| 63 | + IssmDouble *transparam = NULL;
|
---|
| 64 | + IssmDouble yts;
|
---|
| 65 | + int N,M;
|
---|
| 66 | + bool interp,cycle;
|
---|
| 67 | +
|
---|
| 68 | iomodel->FindConstant(&calvinglaw,"md.calving.law");
|
---|
| 69 | switch(calvinglaw){
|
---|
| 70 | case DefaultCalvingEnum:
|
---|
| 71 | @@ -191,7 +196,18 @@
|
---|
| 72 | parameters->AddObject(iomodel->CopyConstantObject("md.calving.height_above_floatation",CalvingHeightAboveFloatationEnum));
|
---|
| 73 | break;
|
---|
| 74 | case CalvingTestEnum:
|
---|
| 75 | - parameters->AddObject(iomodel->CopyConstantObject("md.calving.speedfactor",CalvingTestSpeedfactorEnum));
|
---|
| 76 | + iomodel->FetchData(&transparam,&N,&M,"md.calving.speedfactor");
|
---|
| 77 | + iomodel->FindConstant(&interp,"md.timestepping.interp_forcing");
|
---|
| 78 | + iomodel->FindConstant(&cycle,"md.timestepping.cycle_forcing");
|
---|
| 79 | + if(N==1){
|
---|
| 80 | + _assert_(M==1);
|
---|
| 81 | + parameters->AddObject(new DoubleParam(CalvingTestSpeedfactorEnum,transparam[0]));
|
---|
| 82 | + }
|
---|
| 83 | + else{
|
---|
| 84 | + _assert_(N==2);
|
---|
| 85 | + parameters->AddObject(new TransientParam(CalvingTestSpeedfactorEnum,&transparam[0],&transparam[M],interp,cycle,M));
|
---|
| 86 | + }
|
---|
| 87 | + xDelete<IssmDouble>(transparam);
|
---|
| 88 | break;
|
---|
| 89 | case CalvingParameterizationEnum:
|
---|
| 90 | parameters->AddObject(iomodel->CopyConstantObject("md.calving.min_thickness",CalvingMinthicknessEnum));
|
---|
| 91 | @@ -208,8 +224,6 @@
|
---|
| 92 | /*Get frontal melt parameters*/
|
---|
| 93 | int melt_parameterization;
|
---|
| 94 | iomodel->FindConstant(&melt_parameterization,"md.frontalforcings.parameterization");
|
---|
| 95 | - int M,N;
|
---|
| 96 | - IssmDouble* transparam = NULL;
|
---|
| 97 | switch(melt_parameterization){
|
---|
| 98 | case FrontalForcingsDefaultEnum:
|
---|
| 99 | break;
|
---|
| 100 | Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
|
---|
| 101 | ===================================================================
|
---|
| 102 | --- ../trunk-jpl/src/c/classes/Elements/Element.cpp (revision 27019)
|
---|
| 103 | +++ ../trunk-jpl/src/c/classes/Elements/Element.cpp (revision 27020)
|
---|
| 104 | @@ -3556,6 +3556,9 @@
|
---|
| 105 | case CalvingParameterizationEnum:
|
---|
| 106 | this->CalvingRateParameterization();
|
---|
| 107 | break;
|
---|
| 108 | + case CalvingTestEnum:
|
---|
| 109 | + this->CalvingRateTest();
|
---|
| 110 | + break;
|
---|
| 111 | default:
|
---|
| 112 | _error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
|
---|
| 113 | }
|
---|
| 114 | Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
|
---|
| 115 | ===================================================================
|
---|
| 116 | --- ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 27019)
|
---|
| 117 | +++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 27020)
|
---|
| 118 | @@ -372,9 +372,13 @@
|
---|
| 119 | IssmDouble calvingratey[NUMVERTICES];
|
---|
| 120 | IssmDouble calvingrate[NUMVERTICES];
|
---|
| 121 | IssmDouble vx,vy;
|
---|
| 122 | + IssmDouble time;
|
---|
| 123 | + IssmDouble coeff;
|
---|
| 124 |
|
---|
| 125 | /*Retrieve all inputs and parameters we will need*/
|
---|
| 126 | - IssmDouble coeff = parameters->FindParam(CalvingTestSpeedfactorEnum);
|
---|
| 127 | + parameters->FindParam(&time,TimeEnum);
|
---|
| 128 | + parameters->FindParam(&coeff,CalvingTestSpeedfactorEnum,time);
|
---|
| 129 | +
|
---|
| 130 | Input* vx_input = this->GetInput(VxEnum); _assert_(vx_input);
|
---|
| 131 | Input* vy_input = this->GetInput(VyEnum); _assert_(vy_input);
|
---|
| 132 |
|
---|