source: issm/trunk-jpl/src/m/classes/mismipbasalforcings.py@ 19713

Last change on this file since 19713 was 19713, checked in by seroussi, 9 years ago

CHG: explanation for sign convention different from MISMIP+ description

File size: 5.2 KB
Line 
1from fielddisplay import fielddisplay
2from EnumDefinitions import *
3from checkfield import checkfield
4from WriteData import WriteData
5import numpy
6
7class mismipbasalforcings(object):
8 """
9 MISMIP Basal Forcings class definition
10
11 Usage:
12 mismipbasalforcings=mismipbasalforcings()
13 """
14
15 def __init__(self,md): # {{{
16
17 self.groundedice_melting_rate = float('NaN')
18 self.meltrate_factor = float('NaN')
19 self.threshold_thickness = float('NaN')
20 self.upperdepth_melt = float('NaN')
21 self.geothermalflux = float('NaN')
22
23 if numpy.all(numpy.isnan(self.groundedice_melting_rate)):
24 self.groundedice_melting_rate=numpy.zeros(md.mesh.numberofvertices)
25 print ' no basalforcings.groundedice_melting_rate specified: values set as zero'
26
27 self.setdefaultparameters()
28
29 #}}}
30 def __repr__(self): # {{{
31 string=" MISMIP+ basal melt parameterization\n"
32 string="%s\n%s"%(string,fielddisplay(self,"groundedice_melting_rate","basal melting rate (positive if melting) [m/yr]"))
33 string="%s\n%s"%(string,fielddisplay(self,"meltrate_factor","Melt-rate rate factor [1/yr] (sign is opposite to MISMIP+ benchmark to remain consistent with ISSM convention of positive values for melting)"))
34 string="%s\n%s"%(string,fielddisplay(self,"threshold_thickness","Threshold thickness for saturation of basal melting [m]"))
35 string="%s\n%s"%(string,fielddisplay(self,"upperdepth_melt","Depth above which melt rate is zero [m]"))
36 string="%s\n%s"%(string,fielddisplay(self,"geothermalflux","Geothermal heat flux [W/m^2]"))
37
38 return string
39 #}}}
40 def extrude(self,md): # {{{
41 self.coefficient=project3d(md,'vector',self.coefficient,'type','node','layer',1)
42 self.p=project3d(md,'vector',self.p,'type','element')
43 self.q=project3d(md,'vector',self.q,'type','element')
44 return self
45 #}}}
46 def setdefaultparameters(self): # {{{
47
48 # default values for melting parameterization
49 self.meltrate_factor = 0.2
50 self.threshold_thickness = 75.
51 self.upperdepth_melt = -100.
52
53 return self
54 #}}}
55 def checkconsistency(self,md,solution,analyses): # {{{
56
57 #Early return
58 if MasstransportAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and md.transient.ismasstransport==0):
59
60 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1)
61 md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'numel',1)
62 md = checkfield(md,'fieldname','basalforcings.threshold_thickness','>=',0,'numel',1)
63 md = checkfield(md,'fieldname','basalforcings.upperdepth_melt','<=',0,'numel',1)
64
65 if BalancethicknessAnalysisEnum() in analyses:
66
67 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'size',[md.mesh.numberofvertices])
68 md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'numel',1)
69 md = checkfield(md,'fieldname','basalforcings.threshold_thickness','>=',0,'numel',1)
70 md = checkfield(md,'fieldname','basalforcings.upperdepth_melt','<=',0,'numel',1)
71
72 if ThermalAnalysisEnum() in analyses and not (solution==TransientSolutionEnum() and md.transient.isthermal==0):
73
74 md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'timeseries',1)
75 md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'numel',1)
76 md = checkfield(md,'fieldname','basalforcings.threshold_thickness','>=',0,'numel',1)
77 md = checkfield(md,'fieldname','basalforcings.upperdepth_melt','<=',0,'numel',1)
78 md = checkfield(md,'fieldname','basalforcings.geothermal_flux','NaN',1,'timeseries',1,'>=',0)
79 return md
80 # }}}
81 def marshall(self,md,fid): # {{{
82
83 yts=md.constants.yts
84 if yts!=365.2422*24.*3600.:
85 print 'WARNING: value of yts for MISMIP+ runs different from ISSM default!'
86
87 floatingice_melting_rate = numpy.zeros((md.mesh.numberofvertices,1))
88 floatingice_melting_rate = md.basalforcings.meltrate_factor*numpy.tanh((md.geometry.base-md.geometry.bed)/md.basalforcings.threshold_thickness)*numpy.amax(md.basalforcings.upperdepth_melt-md.geometry.base,0)
89
90 WriteData(fid,'enum',BasalforcingsEnum(),'data',MismipFloatingMeltRateEnum(),'format','Integer')
91 WriteData(fid,'data',floatingice_melting_rate,'format','DoubleMat','enum',BasalforcingsFloatingiceMeltingRateEnum(),'mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
92 WriteData(fid,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','enum',BasalforcingsGroundediceMeltingRateEnum(),'mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1)
93 WriteData(fid,'object',self,'fieldname','geothermal_flux','enum',BasalforcingsGeothermalfluxEnum(),'format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1)
94 WriteData(fid,'object',self,'fieldname','meltrate_factor','format','Double','enum',BasalforcingsMeltrateFactorEnum(),'scale',1./yts)
95 WriteData(fid,'object',self,'fieldname','threshold_thickness','format','Double','enum',BasalforcingsThresholdThicknessEnum())
96 WriteData(fid,'object',self,'fieldname','upperdepth_melt','format','Double','enum',BasalforcingsUpperdepthMeltEnum())
97
98 # }}}
Note: See TracBrowser for help on using the repository browser.