Example #1
0
model.init_mask(mask)
model.init_U(in_dir + 'u.xml', in_dir + 'v.xml', in_dir + 'w.xml')
model.init_T(in_dir + 'T.xml')
model.init_W(in_dir + 'W.xml')
model.init_E(1.0)

model.calc_eta()

us = model.vert_extrude(model.u, d='down')
vs = model.vert_extrude(model.v, d='down')
ws = model.vert_extrude(model.w, d='down')

etabar = model.calc_vert_average(model.eta)
ubar = model.calc_vert_average(model.u)
vbar = model.calc_vert_average(model.v)
wbar = model.calc_vert_average(model.w)

model.save_pvd(etabar, 'etabar')
model.save_pvd(ubar, 'ubar')
model.save_pvd(vbar, 'vbar')
model.save_pvd(wbar, 'wbar')

model.save_xml(etabar, 'etabar')
model.save_xml(ubar, 'ubar')
model.save_xml(vbar, 'vbar')
model.save_xml(wbar, 'wbar')
model.save_xml(us, 'us')
model.save_xml(vs, 'vs')
model.save_xml(ws, 'ws')
Example #2
0
model = model.Model(config)
model.set_mesh(mesh)
model.set_surface_and_bed(S, B)
model.set_subdomains(ff, cf, ff_acc)
model.initialize_variables()

model.init_viscosity_mode('full')
model.init_mask(mask)
model.init_q_geo(model.ghf)
model.init_T_surface(T_s)
model.init_adot(adot)
model.init_E(1.0)

model.init_T(in_dir + 'T.xml')  # temp
model.init_beta(in_dir + 'beta.xml')  # friction
model.init_W(in_dir + 'W.xml')  # water
model.init_E_shf(in_dir + 'E_shf.xml')  # enhancement
model.init_U(in_dir + 'u.xml', in_dir + 'v.xml', in_dir + 'w.xml')

# solve the BP model :
F = solvers.SteadySolver(model, config)
F.solve()

model.save_xml(model.T, 'T')
model.save_xml(model.W, 'W')
model.save_xml(model.u, 'u')
model.save_xml(model.v, 'v')
model.save_xml(model.w, 'w')
model.save_xml(model.Mb, 'Mb')
S      = Function(Q)
B      = Function(Q)
adot   = Function(Q)

f = HDF5File(mesh.mpi_comm(), in_dir + 'vars.h5', 'r')

f.read(S,     'S')
f.read(B,     'B')
f.read(adot,  'adot')

config = default_config()
config['output_path']               = out_dir
config['balance_velocity']['kappa'] = 10.0

model = model.Model(config)
model.set_mesh(mesh)
model.set_surface_and_bed(S, B)
model.initialize_variables()

model.init_adot(adot)

F = solvers.BalanceVelocitySolver(model, config)

F.solve()

model.save_xml(model.Ubar, 'Ubar')



Example #4
0
# use T0 and beta0 from the previous run :
model.init_T(in_dir + 'T.xml')           # temp
model.init_W(in_dir + 'W.xml')           # water
model.init_Mb(in_dir + 'Mb.xml')         # basal melt rate
model.init_U(in_dir + 'u.xml',
             in_dir + 'v.xml',
             in_dir + 'w.xml')           # velocity
model.init_beta(in_dir + 'beta.xml')     # friction
#model.init_Ubar('dump/BV/Ubar.xml')      # balance velocity
#model.init_beta_stats()                  # friction

model.save_pvd(model.beta, 'beta0')

# solve the steady state solver :
F = solvers.SteadySolver(model, config)
F.solve()

model.save_xml(model.T,    'T')
model.save_xml(model.W,    'W')
model.save_xml(model.S,    'S')
model.save_xml(model.B,    'B')
model.save_xml(model.u,    'u')
model.save_xml(model.v,    'v')
model.save_xml(model.w,    'w')
model.save_xml(model.beta, 'beta')
model.save_xml(model.Mb,   'Mb')



Example #5
0
lg.interpolate(etabar_s, model.etabar)
lg.interpolate(ubar_s, model.ubar)
lg.interpolate(vbar_s, model.vbar)
lg.interpolate(tau_id_s, tau_id)
lg.interpolate(tau_jd_s, tau_jd)
lg.interpolate(tau_ii_s, tau_ii)
lg.interpolate(tau_ij_s, tau_ij)
lg.interpolate(tau_iz_s, tau_iz)
lg.interpolate(tau_ji_s, tau_ji)
lg.interpolate(tau_jj_s, tau_jj)
lg.interpolate(tau_jz_s, tau_jz)
lg.interpolate(mask_s, mask)

XDMFFile(submesh.mpi_comm(), out_dir + 'submesh.xdmf') << submesh

model.save_xml(beta_s, 'beta_s')
model.save_xml(Tb_s, 'Tb_s')
model.save_xml(Ts_s, 'Ts_s')
model.save_xml(S_s, 'S_s')
model.save_xml(B_s, 'B_s')
model.save_xml(ub_s, 'ub_s')
model.save_xml(vb_s, 'vb_s')
model.save_xml(wb_s, 'wb_s')
model.save_xml(us_s, 'us_s')
model.save_xml(vs_s, 'vs_s')
model.save_xml(ws_s, 'ws_s')
model.save_xml(Mb_s, 'Mb_s')
model.save_xml(W_s, 'W_s')
model.save_xml(adot_s, 'adot_s')
model.save_xml(qgeo_s, 'qgeo_s')
model.save_xml(U_ob_s, 'U_ob_s')
Example #6
0
model.init_viscosity_mode('full')

model.init_mask(mask)
model.init_beta(in_dir + 'beta.xml')
model.init_U(in_dir + 'u.xml', in_dir + 'v.xml', in_dir + 'w.xml')
model.init_T(in_dir + 'T.xml')
model.init_W(in_dir + 'W.xml')
model.init_E_shf(in_dir + 'E_shf.xml')
model.init_E_gnd(in_dir + 'E_gnd.xml')

E_shf_v = model.E_shf.vector().array()
E_shf_v[E_shf_v < 1e-2] = 1e-2
model.assign_variable(model.E_shf, E_shf_v)

T = solvers.StokesBalanceSolver(model, config)
T.solve()

model.save_pvd(model.eta, 'eta')
model.save_xml(model.tau_id, 'tau_id')
model.save_xml(model.tau_jd, 'tau_jd')
model.save_xml(model.tau_ib, 'tau_ib')
model.save_xml(model.tau_jb, 'tau_jb')
model.save_xml(model.tau_ip, 'tau_ip')
model.save_xml(model.tau_jp, 'tau_jp')
model.save_xml(model.tau_ii, 'tau_ii')
model.save_xml(model.tau_ij, 'tau_ij')
model.save_xml(model.tau_iz, 'tau_iz')
model.save_xml(model.tau_ji, 'tau_ji')
model.save_xml(model.tau_jj, 'tau_jj')
model.save_xml(model.tau_jz, 'tau_jz')
Example #7
0
File(in_dir + 'B_s.xml') >> B

config = default_config()
config['output_path'] = out_dir
config['model_order'] = 'SSA'

model = model.Model(config)
model.set_mesh(mesh)
model.set_surface_and_bed(S, B)
model.initialize_variables()

model.init_adot(in_dir + 'adot_s.xml')
model.init_Mb(in_dir + 'Mb_s.xml')
model.init_component_Ubar(in_dir + 'ubar_s.xml', in_dir + 'vbar_s.xml',
                          in_dir + 'wbar_s.xml')

model.save_pvd(model.adot, 'adot')

F = physics.SurfaceMassBalance(model, config)

F.solve()

model.save_pvd(model.adot, 'smb')
model.save_xml(model.adot, 'smb')

bamber = DataFactory.get_bamber(thklim=0.0)
dbm = DataInput(bamber, mesh=mesh)

do = DataOutput(out_dir)
do.write_matlab(dbm, model.adot, 'smb', val=0.0)