Ignore:
Timestamp:
08/31/20 14:54:17 (5 years ago)
Author:
jdquinn
Message:

CHG: Committing changes in support of test2004.py (no longer failing, but still need to track down sources of large errors)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/frictionwaterlayer.py

    r24213 r25499  
     1import numpy as np
     2
     3from checkfield import checkfield
     4from fielddisplay import fielddisplay
    15from project3d import project3d
    2 from fielddisplay import fielddisplay
    3 from checkfield import checkfield
    46from WriteData import WriteData
    57
    68
    79class frictionwaterlayer(object):
    8     """
    9     frictionwaterlayer class definition
     10    """FRICTIONWATERLAYER class definition
    1011
    1112    Usage:
    1213        friction = frictionwaterlayer(md)
    1314    """
     15
    1416    def __init__(self, md):  # {{{
    15         self.coefficient = md.friction.coefficient
    16         self.f = float('NaN')
    17         self.p = md.friction.p
    18         self.q = md.friction.q
    19         self.water_layer = float('NaN')
     17        self.coefficient = np.nan
     18        self.f = np.nan
     19        self.p = np.nan
     20        self.q = np.nan
     21        self.water_layer = np.nan
     22    #}}}
     23
     24    def __repr__(self):  # {{{
     25        s = 'Basal shear stress parameters: tau_b = coefficient^2 * Neff ^r * |u_b|^(s - 1) * u_b * 1 / f(T)\n(effective stress Neff = rho_ice * g * thickness + rho_water * g * (bed + water_layer), r = q / p and s = 1 / p)\n'
     26        s = "{}\n".format(fielddisplay(self, 'coefficient', 'frictiontemp coefficient [SI]'))
     27        s = "{}\n".format(fielddisplay(self, 'f', 'f variable for effective pressure'))
     28        s = "{}\n".format(fielddisplay(self, 'p', 'p exponent'))
     29        s = "{}\n".format(fielddisplay(self, 'q', 'q exponent'))
     30        s = "{}\n".format(fielddisplay(self, 'water_layer', 'water thickness at the base of the ice (m)'))
     31
     32        return s
     33    #}}}
     34
     35    def setdefaultparameters(self):  # {{{
     36        return self
    2037    #}}}
    2138
     
    3754        self.q = project3d(md, 'vector', self.q, 'type', 'element')
    3855        self.water_layer = project3d(md, 'vector', self.water_layer, 'type', 'node', 'layer', 1)
     56
    3957        return self
    4058    # }}}
    4159
    42     def __repr__(self):  # {{{
    43         string = 'Basal shear stress parameters: tau_b = coefficient^2 * Neff ^r * |u_b|^(s - 1) * u_b * 1 / f(T)\n(effective stress Neff = rho_ice * g * thickness + rho_water * g * (bed + water_layer), r = q / p and s = 1 / p)'
    44         string = "%s\n%s" % (string, fielddisplay(self, 'coefficient', 'frictiontemp coefficient [SI]'))
    45         string = "%s\n%s" % (string, fielddisplay(self, 'f', 'f variable for effective pressure'))
    46         string = "%s\n%s" % (string, fielddisplay(self, 'p', 'p exponent'))
    47         string = "%s\n%s" % (string, fielddisplay(self, 'q', 'q exponent'))
    48         string = "%s\n%s" % (string, fielddisplay(self, 'water_layer', 'water thickness at the base of the ice (m)'))
    49 
    50         return string
    51     #}}}
    52 
    5360    def marshall(self, prefix, md, fid):  #{{{
    54         yts = md.constants.yts
    5561        WriteData(fid, prefix, 'name', 'md.friction.law', 'data', 5, 'format', 'Integer')
    56         WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     62        WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'coefficient', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
    5763        WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'f', 'format', 'Double')
    5864        WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'p', 'format', 'DoubleMat', 'mattype', 2)
    5965        WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'q', 'format', 'DoubleMat', 'mattype', 2)
    60         WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'water_layer', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)
     66        WriteData(fid, prefix, 'class', 'friction', 'object', self, 'fieldname', 'water_layer', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)
    6167    #}}}
Note: See TracChangeset for help on using the changeset viewer.