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/NightlyRun/test1108.py

    r23793 r24214  
    1313
    1414"""
    15 This test is a test from the ISMP-HOM Intercomparison project.
     15This test is a test from the ISMP - HOM Intercomparison project.
    1616Pattyn and Payne 2006
    1717"""
     
    2222
    2323for L in L_list:
    24     nx = 30    #numberof nodes in x direction
     24    nx = 30  #numberof nodes in x direction
    2525    ny = 30
    2626    md = model()
    2727    md = squaremesh(md, L, L, nx, ny)
    28     md = setmask(md, '', '')    #ice sheet test
     28    md = setmask(md, '', '')  #ice sheet test
    2929    md = parameterize(md, '../Par/ISMIPD.py')
    3030    md.extrude(10, 1.)
     
    3232    md = setflowequation(md, 'HO', 'all')
    3333
    34     #We need one grd on dirichlet: the 4 corners are set to zero
     34#We need one grd on dirichlet: the 4 corners are set to zero
    3535    md.stressbalance.spcvx = np.nan * np.ones((md.mesh.numberofvertices))
    3636    md.stressbalance.spcvy = np.nan * np.ones((md.mesh.numberofvertices))
     
    4848    md.stressbalance.spcvz[pos] = 0.
    4949
    50     #Create MPCs to have periodic boundary conditions
     50#Create MPCs to have periodic boundary conditions
    5151    posx = np.nonzero(md.mesh.x == 0.)[0]
    5252    posx2 = np.nonzero(md.mesh.x == np.max(md.mesh.x))[0]
    5353
    54     posy = np.intersect1d(np.intersect1d(np.where(md.mesh.y == 0.), np.where(md.mesh.x != 0.)), np.where(md.mesh.x != np.max(md.mesh.x)))[0]    #Don't take the same nodes two times
     54    posy = np.intersect1d(np.intersect1d(np.where(md.mesh.y == 0.), np.where(md.mesh.x != 0.)), np.where(md.mesh.x != np.max(md.mesh.x)))[0]  #Don't take the same nodes two times
    5555    posy2 = np.intersect1d(np.intersect1d(np.where(md.mesh.y == np.max(md.mesh.y)), np.where(md.mesh.x != 0.)), np.where(md.mesh.x != np.max(md.mesh.x)))[0]
    5656
    57     md.stressbalance.vertex_pairing = np.vstack((np.hstack((posx.reshape(-1, 1) + 1, posx2.reshape(-1, 1) + 1)), np.hstack((posy.reshape(-1, 1) + 1, posy2.reshape(-1, 1) + 1))))
     57    md.stressbalance.vertex_pairing = np.vstack((np.hstack((posx.reshape(- 1, 1) + 1, posx2.reshape(- 1, 1) + 1)), np.hstack((posy.reshape(- 1, 1) + 1, posy2.reshape(- 1, 1) + 1))))
    5858
    59     #Compute the stressbalance
     59#Compute the stressbalance
    6060    md.cluster = generic('name', gethostname(), 'np', 8)
    6161    md.verbose = verbose('convergence', True)
     
    6464    md.stressbalance.abstol = np.nan
    6565    md.stressbalance.vertex_pairing = np.empty((0, 2))
    66     #We need one grid on dirichlet: the 4 corners are set to zero
     66#We need one grid on dirichlet: the 4 corners are set to zero
    6767    md.stressbalance.spcvx = np.nan * np.ones((md.mesh.numberofvertices))
    6868    md.stressbalance.spcvy = np.nan * np.ones((md.mesh.numberofvertices))
    6969    md.stressbalance.spcvz = np.nan * np.ones((md.mesh.numberofvertices))
    70     pos = np.nonzero(logical_or.reduce_n(md.mesh.y == 0., md.mesh.x == 0., md.mesh.x == np.max(md.mesh.x), md.mesh.y == np.max(md.mesh.y)))    #Don't take the same nodes two times
    71     md.stressbalance.spcvx[pos] = md.results.StressbalanceSolution.Vx[pos]
    72     md.stressbalance.spcvy[pos] = md.results.StressbalanceSolution.Vy[pos]
     70    pos = np.nonzero(np.logical_or.reduce((md.mesh.y == 0., md.mesh.x == 0., md.mesh.x == np.max(md.mesh.x), md.mesh.y == np.max(md.mesh.y))))  #Don't take the same nodes two times
     71    md.stressbalance.spcvx[pos] = np.squeeze(md.results.StressbalanceSolution.Vx[pos])
     72    md.stressbalance.spcvy[pos] = np.squeeze(md.results.StressbalanceSolution.Vy[pos])
    7373    md = setflowequation(md, 'FS', 'all')
    7474    md = solve(md, 'Stressbalance')
    7575
    76     #Plot the results and save them
     76#Plot the results and save them
    7777    vx = md.results.StressbalanceSolution.Vx
    7878    vy = md.results.StressbalanceSolution.Vy
     
    8080    results.append(md.results.StressbalanceSolution)
    8181
    82 #       plotmodel(md, 'data', vx, 'data', vy, 'data', vz, 'layer#all', md.mesh.numberoflayers)
     82#       plotmodel(md, 'data', vx, 'data', vy, 'data', vz, 'layer  #all', md.mesh.numberoflayers)
    8383
    8484#Fields and tolerances to track changes
Note: See TracChangeset for help on using the changeset viewer.