[16134] | 1 | Index: ../trunk-jpl/src/m/mech/steadystateiceshelftemp.py
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/mech/steadystateiceshelftemp.py (revision 0)
|
---|
| 4 | +++ ../trunk-jpl/src/m/mech/steadystateiceshelftemp.py (revision 15832)
|
---|
| 5 | @@ -0,0 +1,65 @@
|
---|
| 6 | +import numpy as npy
|
---|
| 7 | +
|
---|
| 8 | +def steadystateiceshelftemp(md,surfacetemp,basaltemp):
|
---|
| 9 | + """
|
---|
| 10 | + Compute the depth-averaged steady-state temperature of an ice shelf
|
---|
| 11 | + This routine computes the depth-averaged temperature accounting for vertical advection
|
---|
| 12 | + and diffusion of heat into the base of the ice shelf as a function of surface and basal
|
---|
| 13 | + temperature and the basal melting rate. Horizontal advection is ignored.
|
---|
| 14 | + The solution is a depth-averaged version of Equation 25 in Holland and Jenkins (1999).
|
---|
| 15 | +
|
---|
| 16 | + In addition to supplying md, the surface and basal temperatures of the ice shelf must be supplied in degrees Kelvin.
|
---|
| 17 | +
|
---|
| 18 | + The model md must also contain the fields:
|
---|
| 19 | + md.geometry.thickness
|
---|
| 20 | + md.basalforcings.melting_rate (positive for melting, negative for freezing)
|
---|
| 21 | +
|
---|
| 22 | + Usage:
|
---|
| 23 | + temperature=steadystateiceshelftemp(md,surfacetemp,basaltemp)
|
---|
| 24 | + """
|
---|
| 25 | +
|
---|
| 26 | + if len(md.geometry.thickness)!=md.mesh.numberofvertices:
|
---|
| 27 | + raise ValueError('steadystateiceshelftemp error message: thickness should have a length of ' + md.mesh.numberofvertices)
|
---|
| 28 | +
|
---|
| 29 | + #surface and basal temperatures in degrees C
|
---|
| 30 | + if len(surfacetemp)!=md.mesh.numberofvertices:
|
---|
| 31 | + raise ValueError('steadystateiceshelftemp error message: surfacetemp should have a length of ' + md.mesh.numberofvertices)
|
---|
| 32 | +
|
---|
| 33 | + if len(basaltemp)!=md.mesh.numberofvertices:
|
---|
| 34 | + raise ValueError('steadystateiceshelftemp error message: basaltemp should have a length of ' +md.mesh.numberofvertices)
|
---|
| 35 | +
|
---|
| 36 | + # Convert temps to Celsius for Holland and Jenkins (1999) equation
|
---|
| 37 | + Ts=-273.15+surfacetemp
|
---|
| 38 | + Tb=-273.15+basaltemp
|
---|
| 39 | +
|
---|
| 40 | + Hi=md.geometry.thickness
|
---|
| 41 | + ki=1.14e-6*md.constants.yts # ice shelf thermal diffusivity from Holland and Jenkins (1999) converted to m^2/yr
|
---|
| 42 | +
|
---|
| 43 | + #vertical velocity of ice shelf, calculated from melting rate
|
---|
| 44 | + wi=md.materials.rho_water/md.materials.rho_ice*md.basalforcings.melting_rate
|
---|
| 45 | +
|
---|
| 46 | + #temperature profile is linear if melting rate is zero, depth-averaged temp is simple average in this case
|
---|
| 47 | + temperature=(Ts+Tb)/2 # where wi~=0
|
---|
| 48 | +
|
---|
| 49 | + pos=npy.nonzero(abs(wi)>=1e-4) # to avoid division by zero
|
---|
| 50 | +
|
---|
| 51 | + npy.seterr(over='raise',divide='raise') # raise errors if floating point exceptions are encountered in following calculation
|
---|
| 52 | + #calculate depth-averaged temperature (in Celsius)
|
---|
| 53 | + try:
|
---|
| 54 | + temperature[pos]=-( (Tb[pos]-Ts[pos])*ki/wi[pos] + Hi[pos]*Tb[pos] - (Hi[pos]*Ts[pos] + (Tb[pos]-Ts[pos])*ki/wi[pos])*npy.exp(Hi[pos]*wi[pos]/ki) )/( Hi[pos]*(npy.exp(Hi[pos]*wi[pos]/ki)-1))
|
---|
| 55 | + except FloatingPointError:
|
---|
| 56 | + print 'steadystateiceshelf warning: overflow encountered in multipy/divide/exp, trying another formulation.'
|
---|
| 57 | + temperature[pos]=-( ((Tb[pos]-Ts[pos])*ki/wi[pos] + Hi[pos]*Tb[pos])/npy.exp(Hi[pos]*wi[pos]/ki) - Hi[pos]*Ts[pos] + (Tb[pos]-Ts[pos])*ki/wi[pos])/( Hi[pos]*(1-npy.exp(-Hi[pos]*wi[pos]/ki)))
|
---|
| 58 | +
|
---|
| 59 | + #temperature should not be less than surface temp
|
---|
| 60 | + pos=npy.nonzero(temperature<Ts)
|
---|
| 61 | + temperature[pos]=Ts[pos]
|
---|
| 62 | +
|
---|
| 63 | + # NaN where melt rates are too high (infinity/infinity in exponential)
|
---|
| 64 | + pos=npy.nonzero(npy.isnan(temperature))
|
---|
| 65 | + temperature[pos]=Ts[pos]
|
---|
| 66 | +
|
---|
| 67 | + #convert to Kelvin
|
---|
| 68 | + temperature=temperature+273.15
|
---|
| 69 | +
|
---|
| 70 | + return temperature
|
---|
| 71 | Index: ../trunk-jpl/src/m/mech/steadystateiceshelftemp.m
|
---|
| 72 | ===================================================================
|
---|
| 73 | --- ../trunk-jpl/src/m/mech/steadystateiceshelftemp.m (revision 15831)
|
---|
| 74 | +++ ../trunk-jpl/src/m/mech/steadystateiceshelftemp.m (revision 15832)
|
---|
| 75 | @@ -45,8 +45,8 @@
|
---|
| 76 | pos=find(abs(wi)>=1e-4); % to avoid division by zero
|
---|
| 77 |
|
---|
| 78 | %calculate depth-averaged temperature (in Celsius)
|
---|
| 79 | -temperature(pos)=-( (Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos) - (Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos)).*exp(Hi(pos).*wi(pos)/ki) )./( Hi(pos).*(exp(Hi(pos).*wi(pos)/ki)-1));
|
---|
| 80 | -%temperature(pos)=-( ((Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos))./exp(Hi(pos).*wi(pos)/ki) - Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos))./( Hi(pos).*(1-exp(-Hi(pos).*wi(pos)/ki)));
|
---|
| 81 | +%temperature(pos)=-( (Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos) - (Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos)).*exp(Hi(pos).*wi(pos)/ki) )./( Hi(pos).*(exp(Hi(pos).*wi(pos)/ki)-1));
|
---|
| 82 | +temperature(pos)=-( ((Tb(pos)-Ts(pos))*ki./wi(pos) + Hi(pos).*Tb(pos))./exp(Hi(pos).*wi(pos)/ki) - Hi(pos).*Ts(pos) + (Tb(pos)-Ts(pos))*ki./wi(pos))./( Hi(pos).*(1-exp(-Hi(pos).*wi(pos)/ki)));
|
---|
| 83 |
|
---|
| 84 | %temperature should not be less than surface temp
|
---|
| 85 | pos=find(temperature<Ts);
|
---|