| 1 | %MATICE class definition
|
|---|
| 2 | %
|
|---|
| 3 | % Usage:
|
|---|
| 4 | % matice=matice();
|
|---|
| 5 |
|
|---|
| 6 | classdef matice
|
|---|
| 7 | properties (SetAccess=public)
|
|---|
| 8 | rho_ice = 0.;
|
|---|
| 9 | rho_water = 0.;
|
|---|
| 10 | rho_freshwater = 0.;
|
|---|
| 11 | mu_water = 0.;
|
|---|
| 12 | heatcapacity = 0.;
|
|---|
| 13 | latentheat = 0.;
|
|---|
| 14 | thermalconductivity = 0.;
|
|---|
| 15 | meltingpoint = 0.;
|
|---|
| 16 | beta = 0.;
|
|---|
| 17 | mixed_layer_capacity = 0.;
|
|---|
| 18 | thermal_exchange_velocity = 0.;
|
|---|
| 19 | rheology_B = NaN;
|
|---|
| 20 | rheology_n = NaN;
|
|---|
| 21 | rheology_law = '';
|
|---|
| 22 | end
|
|---|
| 23 | methods
|
|---|
| 24 | function obj = matice(varargin) % {{{
|
|---|
| 25 | switch nargin
|
|---|
| 26 | case 0
|
|---|
| 27 | obj=setdefaultparameters(obj);
|
|---|
| 28 | case 1
|
|---|
| 29 | inputstruct=varargin{1};
|
|---|
| 30 | list1 = properties('matice');
|
|---|
| 31 | list2 = fieldnames(inputstruct);
|
|---|
| 32 | for i=1:length(list1)
|
|---|
| 33 | fieldname = list1{i};
|
|---|
| 34 | if ismember(fieldname,list2),
|
|---|
| 35 | obj.(fieldname) = inputstruct.(fieldname);
|
|---|
| 36 | end
|
|---|
| 37 | end
|
|---|
| 38 | otherwise
|
|---|
| 39 | error('constructor not supported');
|
|---|
| 40 | end
|
|---|
| 41 | end % }}}
|
|---|
| 42 | function obj = setdefaultparameters(obj) % {{{
|
|---|
| 43 |
|
|---|
| 44 | %ice density (kg/m^3)
|
|---|
| 45 | obj.rho_ice=917.;
|
|---|
| 46 |
|
|---|
| 47 | %ocean water density (kg/m^3)
|
|---|
| 48 | obj.rho_water=1023.;
|
|---|
| 49 |
|
|---|
| 50 | %fresh water density (kg/m^3)
|
|---|
| 51 | obj.rho_freshwater=1000.;
|
|---|
| 52 |
|
|---|
| 53 | %water viscosity (N.s/m^2)
|
|---|
| 54 | obj.mu_water=0.001787;
|
|---|
| 55 |
|
|---|
| 56 | %ice heat capacity cp (J/kg/K)
|
|---|
| 57 | obj.heatcapacity=2093.;
|
|---|
| 58 |
|
|---|
| 59 | %ice latent heat of fusion L (J/kg)
|
|---|
| 60 | obj.latentheat=3.34*10^5;
|
|---|
| 61 |
|
|---|
| 62 | %ice thermal conductivity (W/m/K)
|
|---|
| 63 | obj.thermalconductivity=2.4;
|
|---|
| 64 |
|
|---|
| 65 | %the melting point of ice at 1 atmosphere of pressure in K
|
|---|
| 66 | obj.meltingpoint=273.15;
|
|---|
| 67 |
|
|---|
| 68 | %rate of change of melting point with pressure (K/Pa)
|
|---|
| 69 | obj.beta=9.8*10^-8;
|
|---|
| 70 |
|
|---|
| 71 | %mixed layer (ice-water interface) heat capacity (J/kg/K)
|
|---|
| 72 | obj.mixed_layer_capacity=3974.;
|
|---|
| 73 |
|
|---|
| 74 | %thermal exchange velocity (ice-water interface) (m/s)
|
|---|
| 75 | obj.thermal_exchange_velocity=1.00*10^-4;
|
|---|
| 76 |
|
|---|
| 77 | %Rheology law: what is the temperature dependence of B with T
|
|---|
| 78 | %available: none, paterson and arrhenius
|
|---|
| 79 | obj.rheology_law='Paterson';
|
|---|
| 80 | end % }}}
|
|---|
| 81 | function md = checkconsistency(obj,md,solution,analyses) % {{{
|
|---|
| 82 | md = checkfield(md,'materials.rho_ice','>',0);
|
|---|
| 83 | md = checkfield(md,'materials.rho_water','>',0);
|
|---|
| 84 | md = checkfield(md,'materials.rho_freshwater','>',0);
|
|---|
| 85 | md = checkfield(md,'materials.mu_water','>',0);
|
|---|
| 86 | md = checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
|
|---|
| 87 | md = checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
|
|---|
| 88 | md = checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'});
|
|---|
| 89 | end % }}}
|
|---|
| 90 | function disp(obj) % {{{
|
|---|
| 91 | disp(sprintf(' Materials:'));
|
|---|
| 92 |
|
|---|
| 93 | fielddisplay(obj,'rho_ice','ice density [kg/m^3]');
|
|---|
| 94 | fielddisplay(obj,'rho_water','ocean water density [kg/m^3]');
|
|---|
| 95 | fielddisplay(obj,'rho_freshwater','fresh water density [kg/m^3]');
|
|---|
| 96 | fielddisplay(obj,'mu_water','water viscosity [N s/m^2]');
|
|---|
| 97 | fielddisplay(obj,'heatcapacity','heat capacity [J/kg/K]');
|
|---|
| 98 | fielddisplay(obj,'thermalconductivity','ice thermal conductivity [W/m/K]');
|
|---|
| 99 | fielddisplay(obj,'meltingpoint','melting point of ice at 1atm in K');
|
|---|
| 100 | fielddisplay(obj,'latentheat','latent heat of fusion [J/m^3]');
|
|---|
| 101 | fielddisplay(obj,'beta','rate of change of melting point with pressure [K/Pa]');
|
|---|
| 102 | fielddisplay(obj,'mixed_layer_capacity','mixed layer capacity [W/kg/K]');
|
|---|
| 103 | fielddisplay(obj,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
|
|---|
| 104 | fielddisplay(obj,'rheology_B','flow law parameter [Pa/s^(1/n)]');
|
|---|
| 105 | fielddisplay(obj,'rheology_n','Glen''s flow law exponent');
|
|---|
| 106 | fielddisplay(obj,'rheology_law','law for the temperature dependance of the rheology: ''None'', ''Paterson'' or ''Arrhenius''');
|
|---|
| 107 | end % }}}
|
|---|
| 108 | function marshall(obj,fid) % {{{
|
|---|
| 109 | WriteData(fid,'enum',MaterialsEnum(),'data',MaticeEnum(),'format','Integer');
|
|---|
| 110 | WriteData(fid,'object',obj,'class','materials','fieldname','rho_ice','format','Double');
|
|---|
| 111 | WriteData(fid,'object',obj,'class','materials','fieldname','rho_water','format','Double');
|
|---|
| 112 | WriteData(fid,'object',obj,'class','materials','fieldname','rho_freshwater','format','Double');
|
|---|
| 113 | WriteData(fid,'object',obj,'class','materials','fieldname','mu_water','format','Double');
|
|---|
| 114 | WriteData(fid,'object',obj,'class','materials','fieldname','heatcapacity','format','Double');
|
|---|
| 115 | WriteData(fid,'object',obj,'class','materials','fieldname','latentheat','format','Double');
|
|---|
| 116 | WriteData(fid,'object',obj,'class','materials','fieldname','thermalconductivity','format','Double');
|
|---|
| 117 | WriteData(fid,'object',obj,'class','materials','fieldname','meltingpoint','format','Double');
|
|---|
| 118 | WriteData(fid,'object',obj,'class','materials','fieldname','beta','format','Double');
|
|---|
| 119 | WriteData(fid,'object',obj,'class','materials','fieldname','mixed_layer_capacity','format','Double');
|
|---|
| 120 | WriteData(fid,'object',obj,'class','materials','fieldname','thermal_exchange_velocity','format','Double');
|
|---|
| 121 | WriteData(fid,'object',obj,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1);
|
|---|
| 122 | WriteData(fid,'object',obj,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2);
|
|---|
| 123 | WriteData(fid,'data',StringToEnum(obj.rheology_law),'enum',MaterialsRheologyLawEnum(),'format','Integer');
|
|---|
| 124 | end % }}}
|
|---|
| 125 | end
|
|---|
| 126 | end
|
|---|