Ignore:
Timestamp:
10/11/19 00:27:00 (5 years ago)
Author:
bdef
Message:

CHG: syntax cahnge to meet most of Pep8 requirement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/test/Par/SquareThermal.py

    r23707 r24214  
    1 import numpy
     1import numpy as np
    22from paterson import paterson
    33from SetMarineIceSheetBC import SetMarineIceSheetBC
     
    55#Ok, start defining model parameters here
    66
    7 md.timestepping.time_step=0
    8 md.groundingline.migration='None'
     7md.timestepping.time_step = 0
     8md.groundingline.migration = 'None'
    99
    1010print("      creating thickness")
    11 h=1000.
    12 md.geometry.thickness=h*numpy.ones((md.mesh.numberofvertices))
    13 md.geometry.base=-1000.*numpy.ones((md.mesh.numberofvertices))
    14 md.geometry.surface=md.geometry.base+md.geometry.thickness;
     11h = 1000.
     12md.geometry.thickness = h * np.ones((md.mesh.numberofvertices))
     13md.geometry.base = - 1000. * np.ones((md.mesh.numberofvertices))
     14md.geometry.surface = md.geometry.base + md.geometry.thickness
    1515
    1616print("      creating velocities")
    17 md.initialization.vx=numpy.zeros((md.mesh.numberofvertices))
    18 md.initialization.vy=numpy.zeros((md.mesh.numberofvertices))
    19 md.initialization.vz=numpy.zeros((md.mesh.numberofvertices))
     17md.initialization.vx = np.zeros((md.mesh.numberofvertices))
     18md.initialization.vy = np.zeros((md.mesh.numberofvertices))
     19md.initialization.vz = np.zeros((md.mesh.numberofvertices))
    2020
    2121print("      creating drag")
    22 md.friction.coefficient=200.*numpy.ones((md.mesh.numberofvertices))
    23 md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
    24 md.friction.p=numpy.ones((md.mesh.numberofelements))
    25 md.friction.q=numpy.ones((md.mesh.numberofelements))
     22md.friction.coefficient = 200. * np.ones((md.mesh.numberofvertices))
     23md.friction.coefficient[np.nonzero(md.mask.groundedice_levelset < 0.)[0]] = 0.
     24md.friction.p = np.ones((md.mesh.numberofelements))
     25md.friction.q = np.ones((md.mesh.numberofelements))
    2626
    2727print("      creating temperatures")
    28 md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices))
    29 md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices,))
    30 md.initialization.waterfraction=numpy.zeros((md.mesh.numberofvertices,))
    31 md.initialization.watercolumn=numpy.zeros((md.mesh.numberofvertices,))
     28md.initialization.temperature = (273. - 20.) * np.ones((md.mesh.numberofvertices))
     29md.initialization.pressure = np.zeros((md.mesh.numberofvertices, ))
     30md.initialization.waterfraction = np.zeros((md.mesh.numberofvertices, ))
     31md.initialization.watercolumn = np.zeros((md.mesh.numberofvertices, ))
    3232
    3333print("      creating flow law parameter")
    34 md.materials.rheology_B=paterson(md.initialization.temperature)
    35 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
     34md.materials.rheology_B = paterson(md.initialization.temperature)
     35md.materials.rheology_n = 3. * np.ones((md.mesh.numberofelements))
    3636
    3737print("      creating surface mass balance")
    38 md.smb.mass_balance=numpy.ones((md.mesh.numberofvertices))/md.constants.yts    #1m/a
    39 #md.basalforcings.melting_rate=0.*numpy.ones((md.mesh.numberofvertices))/md.constants.yts    #1m/a
    40 md.basalforcings.groundedice_melting_rate=0.*numpy.ones((md.mesh.numberofvertices))/md.constants.yts    #1m/a
    41 md.basalforcings.floatingice_melting_rate=0.*numpy.ones((md.mesh.numberofvertices))/md.constants.yts    #1m/a
     38md.smb.mass_balance = np.ones((md.mesh.numberofvertices)) / md.constants.yts  #1m / a
     39#md.basalforcings.melting_rate = 0. * np.ones((md.mesh.numberofvertices)) / md.constants.yts  #1m / a
     40md.basalforcings.groundedice_melting_rate = 0. * np.ones((md.mesh.numberofvertices)) / md.constants.yts  #1m / a
     41md.basalforcings.floatingice_melting_rate = 0. * np.ones((md.mesh.numberofvertices)) / md.constants.yts  #1m / a
    4242
    4343#Deal with boundary conditions:
    4444
    4545print("      boundary conditions for stressbalance model")
    46 md=SetMarineIceSheetBC(md,'../Exp/SquareFront.exp')
     46md = SetMarineIceSheetBC(md, '../Exp/SquareFront.exp')
    4747
    4848print("      boundary conditions for thermal model")
    49 md.thermal.spctemperature[:]=md.initialization.temperature
    50 md.basalforcings.geothermalflux=numpy.zeros((md.mesh.numberofvertices))
    51 md.basalforcings.geothermalflux[numpy.nonzero(md.mask.groundedice_levelset>0.)[0]]=1.*10**-3    #1 mW/m^2
     49md.thermal.spctemperature[:] = md.initialization.temperature
     50md.basalforcings.geothermalflux = np.zeros((md.mesh.numberofvertices))
     51md.basalforcings.geothermalflux[np.nonzero(md.mask.groundedice_levelset > 0.)[0]] = 1. * 10**- 3  #1 mW / m^2
Note: See TracChangeset for help on using the changeset viewer.