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/RoundSheetEISMINT.py

    r23707 r24214  
    44#Ok, start defining model parameters here
    55print("      creating thickness")
    6 md.geometry.thickness=10.*numpy.ones((md.mesh.numberofvertices))
    7 md.geometry.base=numpy.zeros((md.mesh.numberofvertices))
    8 md.geometry.surface=md.geometry.base+md.geometry.thickness
     6md.geometry.thickness = 10. * numpy.ones((md.mesh.numberofvertices))
     7md.geometry.base = numpy.zeros((md.mesh.numberofvertices))
     8md.geometry.surface = md.geometry.base + md.geometry.thickness
    99
    1010print("      creating drag")
    11 md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices))
    12 md.friction.p=numpy.ones((md.mesh.numberofelements))
    13 md.friction.q=numpy.ones((md.mesh.numberofelements))
     11md.friction.coefficient = 20. * numpy.ones((md.mesh.numberofvertices))
     12md.friction.p = numpy.ones((md.mesh.numberofelements))
     13md.friction.q = numpy.ones((md.mesh.numberofelements))
    1414
    1515print("      creating temperatures")
    16 tmin=238.15    #K
    17 st=1.67*10**-2/1000.    #k/m
    18 radius=numpy.sqrt((md.mesh.x)**2+(md.mesh.y)**2)
    19 md.initialization.temperature=tmin+st*radius
    20 md.basalforcings.geothermalflux=4.2*10**-2*numpy.ones((md.mesh.numberofvertices))
     16tmin = 238.15  #K
     17st = 1.67 * 10**- 2 / 1000.  #k / m
     18radius = numpy.sqrt((md.mesh.x)**2 + (md.mesh.y)**2)
     19md.initialization.temperature = tmin + st * radius
     20md.basalforcings.geothermalflux = 4.2 * 10**- 2 * numpy.ones((md.mesh.numberofvertices))
    2121
    2222print("      creating flow law parameter")
    23 md.materials.rheology_B=6.81*10**7*numpy.ones((md.mesh.numberofvertices))    #to have the same B as the analytical solution
    24 md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements))
     23md.materials.rheology_B = 6.81 * 10**7 * numpy.ones((md.mesh.numberofvertices))  #to have the same B as the analytical solution
     24md.materials.rheology_n = 3. * numpy.ones((md.mesh.numberofelements))
    2525
    2626print("      creating surface mass balance")
    27 smb_max=0.5    #m/yr
    28 sb=10**-2/1000.    #m/yr/m
    29 rel=450.*1000.    #m
    30 md.smb.mass_balance=numpy.minimum(smb_max*numpy.ones_like(radius),sb*(rel-radius))
     27smb_max = 0.5  #m / yr
     28sb = 10**- 2 / 1000.  #m / yr / m
     29rel = 450. * 1000.  #m
     30md.smb.mass_balance = numpy.minimum(smb_max * numpy.ones_like(radius), sb * (rel - radius))
    3131
    3232print("      creating velocities")
    33 constant=0.3
    34 md.inversion.vx_obs=constant/2.*md.mesh.x*(md.geometry.thickness)**-1
    35 md.inversion.vy_obs=constant/2.*md.mesh.y*(md.geometry.thickness)**-1
    36 md.inversion.vel_obs=numpy.sqrt((md.inversion.vx_obs)**2+(md.inversion.vy_obs)**2)
    37 md.initialization.vx=numpy.zeros((md.mesh.numberofvertices))
    38 md.initialization.vy=numpy.zeros((md.mesh.numberofvertices))
    39 md.initialization.vz=numpy.zeros((md.mesh.numberofvertices))
    40 md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices))
     33constant = 0.3
     34md.inversion.vx_obs = constant / 2. * md.mesh.x * (md.geometry.thickness)**- 1
     35md.inversion.vy_obs = constant / 2. * md.mesh.y * (md.geometry.thickness)**- 1
     36md.inversion.vel_obs = numpy.sqrt((md.inversion.vx_obs)**2 + (md.inversion.vy_obs)**2)
     37md.initialization.vx = numpy.zeros((md.mesh.numberofvertices))
     38md.initialization.vy = numpy.zeros((md.mesh.numberofvertices))
     39md.initialization.vz = numpy.zeros((md.mesh.numberofvertices))
     40md.initialization.pressure = numpy.zeros((md.mesh.numberofvertices))
    4141
    4242#Deal with boundary conditions:
    4343print("      boundary conditions for stressbalance model:")
    44 md=SetMarineIceSheetBC(md,'../Exp/RoundFrontEISMINT.exp')
     44md = SetMarineIceSheetBC(md, '../Exp/RoundFrontEISMINT.exp')
    4545
    46 radius=numpy.sqrt((md.mesh.x)**2+(md.mesh.y)**2)
    47 pos=numpy.nonzero(radius==numpy.min(radius))[0]
    48 md.mesh.x[pos]=0.
    49 md.mesh.y[pos]=0.    #the closest node to the center is changed to be exactly at the center
     46radius = numpy.sqrt((md.mesh.x)**2 + (md.mesh.y)**2)
     47pos = numpy.nonzero(radius == numpy.min(radius))[0]
     48md.mesh.x[pos] = 0.
     49md.mesh.y[pos] = 0.  #the closest node to the center is changed to be exactly at the center
    5050
    51 md.stressbalance.spcvx[pos]=0.
    52 md.stressbalance.spcvy[pos]=0.
    53 md.stressbalance.spcvz[pos]=0.
     51md.stressbalance.spcvx[pos] = 0.
     52md.stressbalance.spcvy[pos] = 0.
     53md.stressbalance.spcvz[pos] = 0.
    5454
    5555#parallel options
    56 md.timestepping.final_time=50000.
     56md.timestepping.final_time = 50000.
    5757
    5858#Constants
    59 md.materials.rho_ice=910.
    60 md.materials.thermalconductivity=2.1
    61 md.materials.latentheat=3.35*10**5
    62 md.materials.beta=8.66*10**-4/(md.materials.rho_ice*md.constants.g)    #conversion from K/m to K/Pa
    63 md.constants.yts=31556926.
     59md.materials.rho_ice = 910.
     60md.materials.thermalconductivity = 2.1
     61md.materials.latentheat = 3.35 * 10**5
     62md.materials.beta = 8.66 * 10**- 4 / (md.materials.rho_ice * md.constants.g)  #conversion from K / m to K / Pa
     63md.constants.yts = 31556926.
Note: See TracChangeset for help on using the changeset viewer.