Changeset 27460
- Timestamp:
- 12/10/22 00:44:18 (2 years ago)
- Location:
- issm/trunk-jpl/src/m/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/calvingparameterization.m
r27458 r27460 41 41 self.min_thickness = 0.; 42 42 43 % parameters for the spatial temporal seperation43 %Parameters for the spatial temporal separation 44 44 %The coefficient follows: gamma= f(x) 45 45 % 0 - f(x) = y_{o} + \alpha (x+x_{o}) … … 48 48 % the amplifier 49 49 self.theta = 0; 50 % the slope alpha 50 % the slope alpha 51 51 self.alpha = 0; 52 % offset in x-axis 52 % offset in x-axis 53 53 self.xoffset = 0; 54 % offset in y-axis 54 % offset in y-axis 55 55 self.yoffset = 0; 56 56 % velocity thresholds to reduce calving rate 57 vel_upperbound = 6000; % m/a58 vel_lowerbound = 0; % m/a57 self.vel_upperbound = 6000; % m/a 58 self.vel_lowerbound = 0; % m/a 59 59 end % }}} 60 60 function md = checkconsistency(self,md,solution,analyses) % {{{ -
issm/trunk-jpl/src/m/classes/calvingparameterization.py
r27458 r27460 12 12 """ 13 13 14 def __init__(self): # {{{ 15 self.stress_threshold_groundedice = 0 16 self.stress_threshold_floatingice = 0 14 def __init__(self, *args): # {{{ 17 15 self.min_thickness = 0 18 16 self.use_param = 0 19 self.scale_theta = 0 20 self.amp_alpha = 0 21 self.midp = 0 22 self.nonlinearlaw = 0 17 self.theta = 0 18 self.alpha = 0 19 self.xoffset = 0 20 self.yoffset = 0 21 self.vel_upperbound = 0 22 self.vel_threshold = 0 23 self.vel_lowerbound = 0 23 24 24 25 nargs = len(args) … … 33 34 34 35 def __repr__(self): # {{{ 35 s = ' Calving VonMises parameters:\n' 36 s += '{}\n'.format(fielddisplay(self, 'stress_threshold_groundedice', 'sigma_max applied to grounded ice only [Pa]')) 37 s += '{}\n'.format(fielddisplay(self, 'stress_threshold_floatingice', 'sigma_max applied to floating ice only [Pa]')) 36 s = ' Calving test parameters:\n' 38 37 s += '{}\n'.format(fielddisplay(self, 'min_thickness', 'minimum thickness below which no ice is allowed [m]')) 38 s += '{}\n'.format(fielddisplay(self, 'use_param', '-1 - just use frontal ablation rate, 0 - f(x) = y_{o} + \alpha (x+x_{o}), 1 - f(x)=y_{o}-\frac{\theta}{2}\tanh(\alpha(x+x_{o})), 2 - tanh(thickness), 3 - tanh(normalized vel), 4 - tanh(truncated vel), 5 - linear(truncated vel)')) 39 s += '{}\n'.format(fielddisplay(self, 'theta', 'the amplifier')) 40 s += '{}\n'.format(fielddisplay(self, 'alpha', 'the slope')) 41 s += '{}\n'.format(fielddisplay(self, 'xoffset', 'offset in x-axis')) 42 s += '{}\n'.format(fielddisplay(self, 'yoffset', 'offset in y-axis')) 43 s += '{}\n'.format(fielddisplay(self, 'vel_lowerbound', 'lowerbound of ice velocity to reduce the calving rate [m/a]')) 44 s += '{}\n'.format(fielddisplay(self, 'vel_threshold', 'threshold of ice velocity to reduce the calving rate [m/a]')) 45 s += '{}\n'.format(fielddisplay(self, 'vel_upperbound', 'upperbound of ice velocity to reduce the calving rate [m/a]')) 39 46 return s 40 47 # }}} … … 45 52 46 53 def setdefaultparameters(self): # {{{ 47 # Default sigma max 48 self.stress_threshold_groundedice = 1e6 49 self.stress_threshold_floatingice = 150e3 54 # For now we turn this off by setting the threshold to 0 55 self.min_thickness = 0. 50 56 51 # Turn off min_thickness by default 52 self.min_thickness = 0. 57 # Parameters for the spatial temporal separation 58 # The coefficient follows: gamma= f(x) 59 # 0 - f(x) = y_{o} + \alpha (x+x_{o}) 60 # 1 - f(x)=y_{o}-\frac{\theta}{2}\tanh(\alpha(x+x_{o})) 61 self.use_param = 0 62 63 # The amplifier 64 self.theta = 0 65 66 # The slope alpha 67 self.alpha = 0 68 69 # Offset in x-axis 70 self.xoffset 71 72 # Offset in y-axis 73 self.yoffset 74 75 # Velocity thresholds to reduce calving rate 76 self.vel_upperbound = 6000 # m/a 77 self.vel_lowerbound = 0 # m/a 53 78 return self 54 79 # }}} … … 56 81 def checkconsistency(self, md, solution, analyses): # {{{ 57 82 # Early return 58 if solution == 'TransientSolution' or not md.transient.ismovingfront:83 if not solution == 'TransientSolution' or not md.transient.ismovingfront: 59 84 return 60 85 61 md = checkfield(md, 'fieldname', 'calving.stress_threshold_groundedice', '>', 0, 'nan', 1, 'Inf', 1, 'size', 'universal') 62 md = checkfield(md, 'fieldname', 'calving.stress_threshold_floatingice', '>', 0, 'nan', 1, 'Inf', 1, 'size', 'universal') 63 md = checkfield(md, 'fieldname', 'calving.min_thickness', '>=', 0, 'NaN', 1, 'Inf', 1, 'numel', [1]) 86 md = checkfield(md, 'fieldname', 'calving.min_thickness', '>=', 0, 'NaN', 1, 'Inf', 1, 'numel', 1) 87 md = checkfield(md, 'fieldname', 'calving.use_param', 'values', [-1, 0, 1, 2, 3, 4, 5]) 88 md = checkfield(md, 'fieldname', 'calving.theta', 'NaN', 1, 'Inf', 1, 'numel', 1) 89 md = checkfield(md, 'fieldname', 'calving.alpha', 'NaN', 1, 'Inf', 1, 'numel', 1) 90 md = checkfield(md, 'fieldname', 'calving.xoffset', 'NaN', 1, 'Inf', 1, 'numel', 1) 91 md = checkfield(md, 'fieldname', 'calving.yoffset', 'NaN', 1, 'Inf', 1, 'numel', 1) 92 md = checkfield(md, 'fieldname', 'calving.vel_lowerbound', 'NaN', 1, 'Inf', 1, 'numel', 1) 93 md = checkfield(md, 'fieldname', 'calving.vel_threshold', 'NaN', 1, 'Inf', 1, 'numel', 1) 94 md = checkfield(md, 'fieldname', 'calving.vel_upperbound', 'NaN', 1, 'Inf', 1, 'numel', 1) 64 95 65 96 return md … … 68 99 def marshall(self, prefix, md, fid): # {{{ 69 100 yts = md.constants.yts 70 WriteData(fid, prefix, 'name', 'md.calving.law', 'data', 2, 'format', 'Integer') 71 WriteData(fid, prefix, 'object', self, 'fieldname', 'stress_threshold_groundedice', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts ) 72 WriteData(fid, prefix, 'object', self, 'fieldname', 'stress_threshold_floatingice', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 101 WriteData(fid, prefix, 'name', 'md.calving.law', 'data', 9, 'format', 'Integer') 73 102 WriteData(fid, prefix, 'object', self, 'fieldname', 'min_thickness', 'format', 'Double') 103 WriteData(fid, prefix, 'object', self, 'fieldname', 'use_param', 'format', 'Integer') 104 WriteData(fid, prefix, 'object', self, 'fieldname', 'theta', 'format', 'Double') 105 WriteData(fid, prefix, 'object', self, 'fieldname', 'alpha', 'format', 'Double') 106 WriteData(fid, prefix, 'object', self, 'fieldname', 'xoffset', 'format', 'Double') 107 WriteData(fid, prefix, 'object', self, 'fieldname', 'yoffset', 'format', 'Double') 108 WriteData(fid, prefix, 'object', self, 'fieldname', 'vel_lowerbound', 'format', 'Double', 'scale', 1. / yts) 109 WriteData(fid, prefix, 'object', self, 'fieldname', 'vel_threshold','format', 'Double', 'scale', 1. / yts) 110 WriteData(fid, prefix, 'object', self, 'fieldname', 'vel_upperbound', 'format', 'Double', 'scale', 1. / yts) 74 111 # }}}
Note:
See TracChangeset
for help on using the changeset viewer.