Ignore:
Timestamp:
11/01/19 12:01:57 (5 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 24310

Location:
issm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/test

  • issm/trunk/test/NightlyRun/test244.py

    r23189 r24313  
    1919from dmeth_params_set import *
    2020
    21 md = triangle(model(),'../Exp/Square.exp',200000.)
    22 md = setmask(md,'all','')
    23 md = parameterize(md,'../Par/SquareShelf.py')
    24 md = setflowequation(md,'SSA','all')
     21md = triangle(model(), '../Exp/Square.exp', 300000.)
     22md = setmask(md, 'all', '')
     23md = parameterize(md, '../Par/SquareShelf.py')
     24md = setflowequation(md, 'SSA', 'all')
    2525md.materials.rho_ice = 910
    26 md.cluster = generic('name',gethostname(),'np',3)
     26md.cluster = generic('name', gethostname(), 'np', 3)
    2727md.geometry.bed = md.geometry.base
    2828
    2929# Use of Gemb method for SMB computation
    3030md.smb = SMBgemb()
    31 md.smb.setdefaultparameters(md.mesh,md.geometry)
     31md.smb.setdefaultparameters(md.mesh, md.geometry)
     32md.smb.dsnowIdx = 0
    3233
    3334#load hourly surface forcing date from 1979 to 2009:
    34 inputs = spio.loadmat('../Data/gemb_input.mat',squeeze_me = True)
     35inputs = spio.loadmat('../Data/gemb_input.mat', squeeze_me=True)
    3536
    36 #setup the inputs: 
    37 md.smb.Ta = np.append(np.tile(np.conjugate(inputs['Ta0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    38 md.smb.V = np.append(np.tile(np.conjugate(inputs['V0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    39 md.smb.dswrf = np.append(np.tile(np.conjugate(inputs['dsw0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    40 md.smb.dlwrf = np.append(np.tile(np.conjugate(inputs['dlw0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    41 md.smb.P = np.append(np.tile(np.conjugate(inputs['P0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    42 md.smb.eAir = np.append(np.tile(np.conjugate(inputs['eAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    43 md.smb.pAir = np.append(np.tile(np.conjugate(inputs['pAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    44 md.smb.pAir = np.append(np.tile(np.conjugate(inputs['pAir0']),(md.mesh.numberofelements,1)),np.conjugate([inputs['dateN']]),axis=0)
    45 md.smb.Vz = np.tile(np.conjugate(inputs['LP']['Vz']),(md.mesh.numberofelements,1)).flatten()
    46 md.smb.Tz = np.tile(np.conjugate(inputs['LP']['Tz']),(md.mesh.numberofelements,1)).flatten()
    47 md.smb.Tmean = np.tile(np.conjugate(inputs['LP']['Tmean']),(md.mesh.numberofelements,1)).flatten()
    48 md.smb.C = np.tile(np.conjugate(inputs['LP']['C']),(md.mesh.numberofelements,1)).flatten()
     37#setup the inputs:
     38md.smb.Ta = np.append(np.tile(np.conjugate(inputs['Ta0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     39md.smb.V = np.append(np.tile(np.conjugate(inputs['V0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     40md.smb.dswrf = np.append(np.tile(np.conjugate(inputs['dsw0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     41md.smb.dlwrf = np.append(np.tile(np.conjugate(inputs['dlw0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     42md.smb.P = np.append(np.tile(np.conjugate(inputs['P0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     43md.smb.eAir = np.append(np.tile(np.conjugate(inputs['eAir0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     44md.smb.pAir = np.append(np.tile(np.conjugate(inputs['pAir0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     45md.smb.pAir = np.append(np.tile(np.conjugate(inputs['pAir0']), (md.mesh.numberofelements, 1)), np.conjugate([inputs['dateN']]), axis=0)
     46md.smb.Vz = np.tile(np.conjugate(inputs['LP']['Vz']), (md.mesh.numberofelements, 1)).flatten()
     47md.smb.Tz = np.tile(np.conjugate(inputs['LP']['Tz']), (md.mesh.numberofelements, 1)).flatten()
     48md.smb.Tmean = np.tile(np.conjugate(inputs['LP']['Tmean']), (md.mesh.numberofelements, 1)).flatten()
     49md.smb.C = np.tile(np.conjugate(inputs['LP']['C']), (md.mesh.numberofelements, 1)).flatten()
    4950
    5051#smb settings
    51 md.smb.requested_outputs = ['SmbDz','SmbT','SmbD','SmbRe','SmbGdn','SmbGsp','SmbEC','SmbA','SmbMassBalance']
     52md.smb.requested_outputs = ['SmbDz', 'SmbT', 'SmbD', 'SmbRe', 'SmbGdn', 'SmbGsp', 'SmbEC', 'SmbA', 'SmbMassBalance']
    5253
    53 #only run smb core: 
     54#only run smb core:
    5455md.transient.isstressbalance = 0
    5556md.transient.ismasstransport = 1
    5657md.transient.isthermal = 0
    5758
    58 #time stepping: 
     59#time stepping:
    5960md.timestepping.start_time = 1965.
    6061md.timestepping.final_time = 1965.75
    61 md.timestepping.time_step = 1./365.0
     62md.timestepping.time_step = 1. / 365.0
    6263md.timestepping.interp_forcings = 0.
    6364
     
    6869#partitioning
    6970md.qmu.numberofpartitions = md.mesh.numberofelements
    70 md = partitioner(md,'package','linear')
    71 md.qmu.partition = (md.qmu.partition - 1).reshape(-1,1).T
     71md = partitioner(md, 'package', 'linear', 'type', 'element')
     72md.qmu.epartition = (md.qmu.epartition - 1)
    7273
    7374#variables
    74 md.qmu.variables.surface_mass_balanceC = normal_uncertain.normal_uncertain('scaled_SmbC',1,0.5)
     75md.qmu.variables.surface_mass_balanceC = normal_uncertain.normal_uncertain('scaled_SmbC', 1, 0.5)
    7576Tmin = 273.
    76 telms = np.atleast_2d(np.min(md.smb.Ta[0:-1,:],1))
     77telms = np.atleast_2d(np.min(md.smb.Ta[0:-1, :], 1))
    7778mint_on_partition = telms.flatten()
    7879for pa in range(np.size(mint_on_partition)):
    79         vi = np.where(md.qmu.partition == pa)
    80         mint = telms[vi]*1.05
    81         pos = np.where(mint < Tmin)
    82         mint[pos] = Tmin
    83         mint_on_partition[pa] = max(mint/telms[vi])
     80    vi = np.where(md.qmu.epartition == pa)
     81    mint = telms[0, vi] * 1.05
     82    pos = np.where(mint < Tmin)
     83    mint[pos] = Tmin
     84    mint_on_partition[pa] = max(mint / telms[0, vi])
    8485
    8586mint_on_partition[np.where(np.isnan(mint_on_partition))] = 10**-10
    86 md.qmu.variables.surface_mass_balanceTa = uniform_uncertain.uniform_uncertain('scaled_SmbTa',1,0.05)
     87md.qmu.variables.surface_mass_balanceTa = uniform_uncertain.uniform_uncertain('scaled_SmbTa', 1, 0.05)
    8788md.qmu.variables.surface_mass_balanceTa[0].lower = 0.95
    88 md.qmu.variables.surface_mass_balanceTa[0].upper = np.maximum(np.minimum(np.maximum(1.05,mint_on_partition),0.9999),0.0001)
     89md.qmu.variables.surface_mass_balanceTa[0].upper = np.maximum(np.minimum(np.maximum(1.05, mint_on_partition), 0.9999), 0.0001)
    8990
    9091#responses
    91 md.qmu.responses.IceVolume = response_function.response_function('IceVolume',[],[0.0001,0.001,0.01,0.25,0.5,0.75,0.99,0.999,0.9999])
    92 md.qmu.responses.IceMass = response_function.response_function('IceMass',[],[0.0001,0.001,0.01,0.25,0.5,0.75,0.99,0.999,0.9999])
    93 md.qmu.responses.TotalSmb = response_function.response_function('TotalSmb',[],[0.0001,0.001,0.01,0.25,0.5,0.75,0.99,0.999,0.9999])
     92md.qmu.responses.IceVolume = response_function.response_function('IceVolume', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])
     93md.qmu.responses.IceMass = response_function.response_function('IceMass', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])
     94md.qmu.responses.TotalSmb = response_function.response_function('TotalSmb', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])
    9495
    9596#  nond_sampling study
    9697md.qmu.method = dakota_method.dakota_method('nond_samp')
    97 md.qmu.method = dmeth_params_set(md.qmu.method,'seed',1234,'samples',3,'sample_type','lhs')
     98md.qmu.method = dmeth_params_set(md.qmu.method, 'seed', 1234, 'samples', 3, 'sample_type', 'lhs')
    9899dver = str(version)
    99 if ((int(dver[0]) == 4 and int(dver[2])>2) or int(dver[0])>4):
    100         md.qmu.method = dmeth_params_set(md.qmu.method,'rng','rnum2')
     100if ((int(dver[0]) == 4 and int(dver[2]) > 2) or int(dver[0]) > 4):
     101    md.qmu.method = dmeth_params_set(md.qmu.method, 'rng', 'rnum2')
    101102
    102103#parameters
     
    108109
    109110if version >= 6:
    110         md.qmu.params.analysis_driver = 'matlab'
    111         md.qmu.params.evaluation_scheduling = 'master'
    112         md.qmu.params.processors_per_evaluation = 2
     111    md.qmu.params.analysis_driver = 'matlab'
     112    md.qmu.params.evaluation_scheduling = 'master'
     113    md.qmu.params.processors_per_evaluation = 2
    113114else:
    114         md.qmu.params.analysis_driver = 'stressbalance'
    115         md.qmu.params.evaluation_concurrency = 1
     115    md.qmu.params.analysis_driver = 'stressbalance'
     116    md.qmu.params.evaluation_concurrency = 1
    116117
    117118
    118 md.stressbalance.reltol = 10**-5 #tighten for qmu analyses
    119 md.transient.requested_outputs = ['IceVolume','TotalSmb','IceMass']
     119md.stressbalance.reltol = 10**-5  #tighten for qmu analyses
     120md.transient.requested_outputs = ['IceVolume', 'TotalSmb', 'IceMass']
    120121
    121122#solve
    122 md.verbose = verbose('000000000')       # this line is recommended
    123 md = solve(md,'Transient','overwrite','y')
     123md.verbose = verbose('000000000')  # this line is recommended
     124md = solve(md, 'Transient', 'overwrite', 'y')
    124125md.qmu.results = md.results.dakota
    125126
     
    127128md.results.dakota.moments = []
    128129for i in range(3):
    129         md.results.dakota.moments.append(md.results.dakota.dresp_out[i].mean)
     130    md.results.dakota.moments.append(md.results.dakota.dresp_out[i].mean)
    130131
    131132for i in range(3):
    132         md.results.dakota.moments.append(md.results.dakota.dresp_out[i].stddev)
     133    md.results.dakota.moments.append(md.results.dakota.dresp_out[i].stddev)
    133134
    134135field_names = ['moments']
    135136field_tolerances = [1e-11]
    136137field_values = [md.results.dakota.moments]
    137 
Note: See TracChangeset for help on using the changeset viewer.