[13131] | 1 | %MATICE class definition
|
---|
[9636] | 2 | %
|
---|
| 3 | % Usage:
|
---|
[13131] | 4 | % matice=matice();
|
---|
[9636] | 5 |
|
---|
[13131] | 6 | classdef matice
|
---|
[9636] | 7 | properties (SetAccess=public)
|
---|
[13094] | 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.;
|
---|
[10969] | 19 | rheology_B = NaN;
|
---|
| 20 | rheology_n = NaN;
|
---|
| 21 | rheology_law = '';
|
---|
[9636] | 22 | end
|
---|
| 23 | methods
|
---|
[13131] | 24 | function obj = matice(varargin) % {{{
|
---|
[9636] | 25 | switch nargin
|
---|
| 26 | case 0
|
---|
| 27 | obj=setdefaultparameters(obj);
|
---|
[13240] | 28 | case 1
|
---|
| 29 | inputstruct=varargin{1};
|
---|
[13254] | 30 | list1 = properties('matice');
|
---|
[13240] | 31 | list2 = fieldnames(inputstruct);
|
---|
[13254] | 32 | for i=1:length(list1)
|
---|
[13240] | 33 | fieldname = list1{i};
|
---|
| 34 | if ismember(fieldname,list2),
|
---|
[13254] | 35 | obj.(fieldname) = inputstruct.(fieldname);
|
---|
[13240] | 36 | end
|
---|
| 37 | end
|
---|
[9636] | 38 | otherwise
|
---|
| 39 | error('constructor not supported');
|
---|
| 40 | end
|
---|
| 41 | end % }}}
|
---|
| 42 | function obj = setdefaultparameters(obj) % {{{
|
---|
| 43 |
|
---|
| 44 | %ice density (kg/m^3)
|
---|
[13094] | 45 | obj.rho_ice=917.;
|
---|
[9636] | 46 |
|
---|
[12326] | 47 | %ocean water density (kg/m^3)
|
---|
[13094] | 48 | obj.rho_water=1023.;
|
---|
[9636] | 49 |
|
---|
[12326] | 50 | %fresh water density (kg/m^3)
|
---|
[13094] | 51 | obj.rho_freshwater=1000.;
|
---|
[12326] | 52 |
|
---|
[10565] | 53 | %water viscosity (N.s/m^2)
|
---|
| 54 | obj.mu_water=0.001787;
|
---|
| 55 |
|
---|
[9636] | 56 | %ice heat capacity cp (J/kg/K)
|
---|
[13094] | 57 | obj.heatcapacity=2093.;
|
---|
[9636] | 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)
|
---|
[13094] | 72 | obj.mixed_layer_capacity=3974.;
|
---|
[9636] | 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 % }}}
|
---|
[12663] | 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'});
|
---|
[9739] | 89 | end % }}}
|
---|
[9636] | 90 | function disp(obj) % {{{
|
---|
[14310] | 91 | disp(sprintf(' Materials:'));
|
---|
[9636] | 92 |
|
---|
| 93 | fielddisplay(obj,'rho_ice','ice density [kg/m^3]');
|
---|
[12326] | 94 | fielddisplay(obj,'rho_water','ocean water density [kg/m^3]');
|
---|
[12361] | 95 | fielddisplay(obj,'rho_freshwater','fresh water density [kg/m^3]');
|
---|
[10565] | 96 | fielddisplay(obj,'mu_water','water viscosity [N s/m^2]');
|
---|
[9636] | 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 % }}}
|
---|
[10969] | 108 | function marshall(obj,fid) % {{{
|
---|
[13131] | 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);
|
---|
[13020] | 123 | WriteData(fid,'data',StringToEnum(obj.rheology_law),'enum',MaterialsRheologyLawEnum(),'format','Integer');
|
---|
[10969] | 124 | end % }}}
|
---|
[9636] | 125 | end
|
---|
| 126 | end
|
---|