Changeset 25519


Ignore:
Timestamp:
09/02/20 19:30:52 (5 years ago)
Author:
jdquinn
Message:

CHG: MATLAB -> Python; formatting

Location:
issm/trunk-jpl/src/m/classes
Files:
2 edited

Legend:

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

    r25514 r25519  
    143143                        disp(sprintf('   flow equation parameters:'));
    144144
    145                         fielddisplay(self,'isSIA','is the Shallow Ice Approximation (SIA) used ?');
    146                         fielddisplay(self,'isSSA','is the Shelfy-Stream Approximation (SSA) used ?');
    147                         fielddisplay(self,'isL1L2','is the L1L2 approximation used ?');
    148                         fielddisplay(self,'isHO','is the Higher-Order (HO) approximation used ?');
    149                         fielddisplay(self,'isFS','are the Full-FS (FS) equations used ?');
     145                        fielddisplay(self,'isSIA','is the Shallow Ice Approximation (SIA) used?');
     146                        fielddisplay(self,'isSSA','is the Shelfy-Stream Approximation (SSA) used?');
     147                        fielddisplay(self,'isL1L2','is the L1L2 approximation used?');
     148                        fielddisplay(self,'isHO','is the Higher-Order (HO) approximation used?');
     149                        fielddisplay(self,'isFS','are the Full-FS (FS) equations used?');
    150150                        fielddisplay(self,'isNitscheBC','is weakly imposed condition used?');
    151                         fielddisplay(self,'FSNitscheGamma','Gamma value for the Nitsche term, by default gamma=1e6?');
     151                        fielddisplay(self,'FSNitscheGamma','Gamma value for the Nitsche term (default: 1e6)');
    152152                        fielddisplay(self,'fe_SSA','Finite Element for SSA  ''P1'', ''P1bubble'' ''P1bubblecondensed'' ''P2''');
    153153                        fielddisplay(self,'fe_HO', 'Finite Element for HO   ''P1'' ''P1bubble'' ''P1bubblecondensed'' ''P1xP2'' ''P2xP1'' ''P2''');
  • issm/trunk-jpl/src/m/classes/flowequation.py

    r24861 r25519  
    11import numpy as np
     2
     3from checkfield import checkfield
     4from fielddisplay import fielddisplay
     5import MatlabFuncs as m
    26from project3d import project3d
    3 from fielddisplay import fielddisplay
    4 from checkfield import checkfield
    57from WriteData import WriteData
    6 import MatlabFuncs as m
    78
    89
    910class flowequation(object):
    10     """
    11     FLOWEQUATION class definition
     11    """FLOWEQUATION class definition
    1212
    13        Usage:
    14           flowequation = flowequation()
     13    Usage:
     14        flowequation = flowequation()
    1515    """
    1616
    1717    def __init__(self):  # {{{
    18 
    1918        self.isSIA = 0
    2019        self.isSSA = 0
     
    2221        self.isHO = 0
    2322        self.isFS = 0
     23        self.isNitscheBC = 0
     24        self.FSNitscheGamma = 1e-6
    2425        self.fe_SSA = ''
    2526        self.fe_HO = ''
     
    4243
    4344    def __repr__(self):  # {{{
    44         string = '   flow equation parameters:'
     45        s = '   flow equation parameters:\n'
     46        s += "{}\n".format(fielddisplay(self, 'isSIA', "is the Shallow Ice Approximation (SIA) used?"))
     47        s += "{}\n".format(fielddisplay(self, 'isSSA', "is the Shelfy-Stream Approximation (SSA) used?"))
     48        s += "{}\n".format(fielddisplay(self, 'isL1L2', "are L1L2 equations used?"))
     49        s += "{}\n".format(fielddisplay(self, 'isHO', "is the Higher-Order (HO) approximation used?"))
     50        s += "{}\n".format(fielddisplay(self, 'isFS', "are the Full-FS (FS) equations used?"))
     51        s += "{}\n".format(fielddisplay(self, 'isNitscheBC', "is weakly imposed condition used?"))
     52        s += "{}\n".format(fielddisplay(self, 'FSNitscheGamma', "Gamma value for the Nitsche term (default: 1e6)"))
     53        s += "{}\n".format(fielddisplay(self, 'fe_SSA', "Finite Element for SSA: 'P1', 'P1bubble' 'P1bubblecondensed' 'P2'"))
     54        s += "{}\n".format(fielddisplay(self, 'fe_HO', "Finite Element for HO:  'P1', 'P1bubble', 'P1bubblecondensed', 'P1xP2', 'P2xP1', 'P2', 'P2bubble', 'P1xP3', 'P2xP4'"))
     55        s += "{}\n".format(fielddisplay(self, 'fe_FS', "Finite Element for FS:  'P1P1' (debugging only) 'P1P1GLS' 'MINIcondensed' 'MINI' 'TaylorHood' 'LATaylorHood' 'XTaylorHood'"))
     56        s += "{}\n".format(fielddisplay(self, 'vertex_equation', "flow equation for each vertex"))
     57        s += "{}\n".format(fielddisplay(self, 'element_equation', "flow equation for each element"))
     58        s += "{}\n".format(fielddisplay(self, 'borderSSA', "vertices on SSA's border (for tiling)"))
     59        s += "{}\n".format(fielddisplay(self, 'borderHO', "vertices on HO's border (for tiling)"))
     60        s += "{}".format(fielddisplay(self, 'borderFS', "vertices on FS' border (for tiling)"))
    4561
    46         string = "%s\n%s" % (string, fielddisplay(self, 'isSIA', "is the Shallow Ice Approximation (SIA) used ?"))
    47         string = "%s\n%s" % (string, fielddisplay(self, 'isSSA', "is the Shelfy - Stream Approximation (SSA) used ?"))
    48         string = "%s\n%s" % (string, fielddisplay(self, 'isL1L2', "are L1L2 equations used ?"))
    49         string = "%s\n%s" % (string, fielddisplay(self, 'isHO', "is the Higher - Order (HO) approximation used ?"))
    50         string = "%s\n%s" % (string, fielddisplay(self, 'isFS', "are the Full - FS (FS) equations used ?"))
    51         string = "%s\n%s" % (string, fielddisplay(self, 'fe_SSA', "Finite Element for SSA: 'P1', 'P1bubble' 'P1bubblecondensed' 'P2'"))
    52         string = "%s\n%s" % (string, fielddisplay(self, 'fe_HO', "Finite Element for HO:  'P1', 'P1bubble', 'P1bubblecondensed', 'P1xP2', 'P2xP1', 'P2', 'P2bubble', 'P1xP3', 'P2xP4'"))
    53         string = "%s\n%s" % (string, fielddisplay(self, 'fe_FS', "Finite Element for FS:  'P1P1' (debugging only) 'P1P1GLS' 'MINIcondensed' 'MINI' 'TaylorHood' 'LATaylorHood' 'XTaylorHood'"))
    54         string = "%s\n%s" % (string, fielddisplay(self, 'vertex_equation', "flow equation for each vertex"))
    55         string = "%s\n%s" % (string, fielddisplay(self, 'element_equation', "flow equation for each element"))
    56         string = "%s\n%s" % (string, fielddisplay(self, 'borderSSA', "vertices on SSA's border (for tiling)"))
    57         string = "%s\n%s" % (string, fielddisplay(self, 'borderHO', "vertices on HO's border (for tiling)"))
    58         string = "%s\n%s" % (string, fielddisplay(self, 'borderFS', "vertices on FS' border (for tiling)"))
    59         return string
     62        return s
    6063    #}}}
    6164
     
    9396        md = checkfield(md, 'fieldname', 'flowequation.isHO', 'numel', [1], 'values', [0, 1])
    9497        md = checkfield(md, 'fieldname', 'flowequation.isFS', 'numel', [1], 'values', [0, 1])
     98        md = checkfield(md, 'fieldname', 'flowequation.isNitscheBC', 'numel', [1], 'values', [0, 1])
     99        md = checkfield(md, 'fieldname', 'flowequation.FSNitscheGamma', 'numel', [1], '>=', 0.)
    95100        md = checkfield(md, 'fieldname', 'flowequation.fe_SSA', 'values', ['P1', 'P1bubble', 'P1bubblecondensed', 'P2', 'P2bubble'])
    96101        md = checkfield(md, 'fieldname', 'flowequation.fe_HO', 'values', ['P1', 'P1bubble', 'P1bubblecondensed', 'P1xP2', 'P2xP1', 'P2', 'P2bubble', 'P1xP3', 'P2xP4'])
     
    132137        WriteData(fid, prefix, 'object', self, 'fieldname', 'isHO', 'format', 'Boolean')
    133138        WriteData(fid, prefix, 'object', self, 'fieldname', 'isFS', 'format', 'Boolean')
    134         WriteData(fid, prefix, 'object', self, 'fieldname', 'fe_SSA', 'data', self.fe_SSA, 'format', 'String')
    135         WriteData(fid, prefix, 'object', self, 'fieldname', 'fe_HO', 'data', self.fe_HO, 'format', 'String')
    136         WriteData(fid, prefix, 'object', self, 'fieldname', 'fe_FS', 'data', self.fe_FS, 'format', 'String')
     139        WriteData(fid, prefix, 'object', self, 'fieldname', 'isNitscheBC', 'format', 'Boolean')
     140        WriteData(fid, prefix, 'object', self, 'fieldname', 'FSNitscheGamma', 'format', 'Double')
     141        WriteData(fid, prefix, 'object', self, 'fieldname', 'fe_SSA', 'data', self.fe_SSA, 'format', 's')
     142        WriteData(fid, prefix, 'object', self, 'fieldname', 'fe_HO', 'data', self.fe_HO, 'format', 's')
     143        WriteData(fid, prefix, 'object', self, 'fieldname', 'fe_FS', 'data', self.fe_FS, 'format', 's')
    137144        WriteData(fid, prefix, 'object', self, 'fieldname', 'augmented_lagrangian_r', 'format', 'Double')
    138145        WriteData(fid, prefix, 'object', self, 'fieldname', 'augmented_lagrangian_rhop', 'format', 'Double')
Note: See TracChangeset for help on using the changeset viewer.