def add_rain_geners(geo, dat, config): import t2thermo if isinstance(config, str): with open(config, 'r') as f: config = json.load(f) if 'IncludeColumnsOnly' in config and len( config['IncludeColumnsOnly']) != 0: cols = config['IncludeColumnsOnly'] elif 'ExludeColumns' in config and len(config['ExludeColumns']) != 0: cols = [ c.name for c in geo.columnlist if c.name not in config['ExludeColumns'] ] elif ('ExludeColumns' not in config or len(config['ExludeColumns']) == 0) and ('IncludeColumnsOnly' not in config or len(config['IncludeColumnsOnly']) == 0): cols = [c.name for c in geo.columnlist] else: raise Exception( 'Error: Both [ExludeColumns] and [IncludeColumnsOnly] used, this is confusing.' ) rain_temp = config['Rain Temperature'] newlabel = config['NewGenerLabel'] infiltration = config['Infiltration'] annualrain = config['AnnualRainFall mm/yr'] (rain_density, u) = t2thermo.cowat(rain_temp, 100135.0) rain_enth = enthalpy(rain_temp) mmyr2kgs = rain_density / 1000.0 / 365.25 / 24.0 / 60.0 / 60.0 total_rain = 0.0 for c in cols: col = geo.column[c] layername = geo.layerlist[geo.num_layers - col.num_layers].name blockname = geo.block_name(layername, col.name) genname = modify_wellname(newlabel, blockname) rain = col.area * annualrain * infiltration * mmyr2kgs total_rain = total_rain + rain gen = t2generator(name=genname, block=blockname, type='MASS', gx=rain, ex=rain_enth) dat.add_generator(gen) return dat, total_rain
dat.parameter['option'][12] = 1 # generation table interpolation dat.parameter['option'][16] = 5 dat.parameter['option'][24] = 2 # initial output dat.multi = { 'eos': 'EW', 'num_components': 1, 'num_phases': 2, 'num_equations': 2, 'num_secondary_parameters': 6 } lay = geo.layerlist[-1] col = geo.columnlist[0] genrate = 10.0 d, u = cowat(Tinj, P0) h = u + P0 / d blkname = geo.block_name(lay.name, col.name) gen = t2generator(name=blkname, block=blkname, gx=genrate, ex=h, type='MASS') dat.add_generator(gen) # BC block at r = 1000: col = geo.columnlist[-1] blkname = geo.block_name(lay.name, col.name) blk = dat.grid.block[blkname] bcblk = t2block('bc %2d' % 0, geo.atmosphere_volume, rock, np.array([dimensions[0], 0., -0.5 * dimensions[2]])) dat.grid.add_block(bcblk) area = 2. * np.pi * dimensions[0] * gridsizes[2] con = t2connection([blk, bcblk], 1, [0.5 * gridsizes[0], geo.atmosphere_connection], area, 0.)
'timestep_reduction': 4.0, 'default_incons': [P0, T0], 'max_iterations': 8 }) dat.parameter['option'][1] = 1 dat.parameter['option'][16] = 6 dat.parameter['option'][24] = 2 dat.start = False dat.relative_permeability = {'type': 1, 'parameters': [0.,0.,1.,1.]} dat.capillarity = {'type': 1, 'parameters': [0.,0.,0.,0.]} gx = 10. # kg/s t = 240. # deg C p = sat(t) d,u = cowat(t,p) h = u + p / d gen = t2generator(name = 'gen 1', block = dat.grid.blocklist[-1].name, gx = gx, ex = h, type = 'MASS') dat.add_generator(gen) # steady state run: dat.write(model_name + '_ss.dat') inc = dat.grid.incons([P0, T0]) inc.write(model_name + '_ss.incon') dat.run(simulator = AUTOUGH2, silent = True) inc = t2incon(model_name + '_ss.save') # transient runs: ndt = 40 day = 24. * 60. * 60.
silent = True) mesh_filename = 'g' + model_name + '.msh' geo.write_mesh(mesh_filename, dimension = 2) jsondata = dat.json(geo, mesh_filename, incons = inc, bdy_incons = inc, mesh_coords = 'xy') jsondata['mesh']['thickness'] = dimensions[-1] jsondata['output']['fields'] = {'fluid': ['vapour_saturation', 'vapour_density']} json.dump(jsondata, file(model_name + 'a.json', 'w'), indent = 2) # problem 5b: genpos = np.array([162.5, 137.5]) col = geo.column_containing_point(genpos) genrate = 30.e-3 * dimensions[2] d,u = cowat(80., P0) h = u + P0 / d blkname = geo.block_name(lay.name, col.name) gen = t2generator(name = blkname, block = blkname, type = 'MASS', ex = h, ltab = 3, time = [0., yr, dat.parameter['tstop']], rate = [0., genrate, genrate]) dat.add_generator(gen) dat.write(model_name + 'b.dat') dat.run(simulator = 'AUTOUGH2_41Da', incon_filename = model_name + '.incon', silent = True) jsondata = dat.json(geo, mesh_filename, incons = inc, bdy_incons = inc, mesh_coords = 'xy')
def f(p): return p - (P[-1] + g * 0.5 * (rho + cowat(T[-1], p)[0]) * dz)
def f(p): return p - (P0 + g * 0.5 * (rho + cowat(T[-1], p)[0]) * depth[-1])
gen = t2generator(name=blkname, block=blkname, gx=genrate, type='MASS') dat.add_generator(gen) dat.write(model_name + '.dat') # incons: inc = t2incon() def temp(d): if d <= 1000.: return 10. + 280. * d / 1000. else: return 270. + 20. * d / 1000. depth, T, P = [0.], [T0], [P0] rho = cowat(T0, P0)[0] depth.append(0.5 * dz) T.append(temp(depth[-1])) def f(p): return p - (P0 + g * 0.5 * (rho + cowat(T[-1], p)[0]) * depth[-1]) P.append(fsolve(f, P0)[0]) for i in range(num_cells): rho = cowat(T[-1], P[-1])[0] depth.append(depth[-1] + dz) T.append(temp(depth[-1])) def f(p):