Exemplo n.º 1
0
H = db2.get_nearest_expression("H")
S = db2.get_nearest_expression("S")
B = db2.get_nearest_expression("B")
M = db2.get_nearest_expression("mask")
T_s = db1.get_nearest_expression("srfTemp")
q_geo = db1.get_nearest_expression("q_geo")
adot = db1.get_nearest_expression("adot")
U_ob = dm.get_projection("U_ob", near=True)
u = dm.get_nearest_expression("vx")
v = dm.get_nearest_expression("vy")

model = model.Model()
model.set_mesh(mesh)
model.set_geometry(S, B, deform=True)
model.calculate_boundaries(mask=M, adot=adot)
model.set_parameters(pc.IceParameters())
model.initialize_variables()


# constraints on optimization for beta :
class Bounds_max(Expression):
    def eval(self, values, x):
        if M(x[0], x[1], x[2]) > 0:
            values[0] = 2 * DOLFIN_EPS
        else:
            values[0] = 100000.0


# initial friction coef :
class Beta_0(Expression):
Exemplo n.º 2
0
print_min_max(bedmap2['S'], 'S')

mesh = Mesh('dump/meshes/byrd_basin_mesh_low.xml')

#d2 = DataInput(bedmap2, gen_space=False)
d2 = DataInput(bedmap2, mesh=mesh)

#plotIce(d2, 'S', '.', 'gist_yarg', scale='lin', name=r'$S$',
#        numLvls=12, tp=False, tpAlpha=0.5)
#
#plotIce(d2, 'B', '.', 'gist_yarg', scale='lin', name=r'$B$',
#        numLvls=12, tp=False, tpAlpha=0.5)
#
#plotIce(d2, 'H', '.', 'gist_yarg', scale='lin', name=r'$H$',
#        numLvls=12, tp=False, tpAlpha=0.5)
#
#plotIce(d2, 'mask', '.', 'gist_yarg', scale='lin', name='mask',
#        numLvls=12, tp=False, tpAlpha=0.5)

S = d2.get_expression("S", )  #     near=True)
B = d2.get_expression("B", )  #     near=True)
M = d2.get_expression("mask", near=True)

model = model.Model()
model.set_mesh(mesh)
model.calculate_boundaries(mask=M)
model.set_geometry(S, B, deform=True)

File('crap/S.pvd') << model.S
File('crap/ff.pvd') << model.ff
# In order to view adot in paraview, I'll just output it manually
adot_out = project(adot,model.Q)
File(out_dir + '/adot.pvd') << adot_out

print("Doing some stuff")
u_out = project(UExpression(),model.Q)
v_out = project(VExpression(),model.Q)
w_out = project(WExpression(),model.Q)
File('data/u_out.xml') << u_out
File('data/v_out.xml') << v_out
File('data/w_out.xml') << w_out

quit()

model.set_parameters(pc.IceParameters())
model.calculate_boundaries(adot = adot)
model.initialize_variables()

# Specifify non-linear solver parameters :
nonlin_solver_params = default_nonlin_solver_params()
nonlin_solver_params['newton_solver']['relaxation_parameter']    = 0.7
nonlin_solver_params['newton_solver']['relative_tolerance']      = 1e-3
nonlin_solver_params['newton_solver']['maximum_iterations']      = 15
nonlin_solver_params['newton_solver']['error_on_nonconvergence'] = False
nonlin_solver_params['newton_solver']['linear_solver']           = 'mumps'
nonlin_solver_params['newton_solver']['preconditioner']          = 'default'
parameters['form_compiler']['quadrature_degree']                 = 2

config = { 'mode'                         : 'steady',
           't_start'                      : None,
           't_end'                        : None,
Exemplo n.º 4
0
nz    = 10

model = model.Model()
model.generate_uniform_mesh(nx, ny, nz, xmin=0, xmax=L, ymin=0, ymax=L) 

surface = Expression('1300 - x[0] * tan(alpha)', alpha=alpha, 
                     element=model.Q.ufl_element())
bed     = Expression(  '1300 - x[0] * tan(alpha) - 1000.0 + 500.0 * ' \
                     + ' sin(2*pi*x[0]/L) * sin(2*pi*x[1]/L)',
                     alpha=alpha, L=L, element=model.Q.ufl_element())
beta    = Expression(  '10 + 10 * sin(2*pi*x[0]/L) * sin(2*pi*x[1]/L)',
                     alpha=alpha, L=L, element=model.Q.ufl_element())

model.set_geometry(surface, bed, deform=True)
model.set_parameters(pc.IceParameters())
model.calculate_boundaries()
model.initialize_variables()

File('output/beta.pvd') << interpolate(beta, model.Q)

# specifify non-linear solver parameters :
nonlin_solver_params = default_nonlin_solver_params()
nonlin_solver_params['newton_solver']['relaxation_parameter']    = 0.9
nonlin_solver_params['newton_solver']['relative_tolerance']      = 1e-14
nonlin_solver_params['newton_solver']['maximum_iterations']      = 25
nonlin_solver_params['newton_solver']['error_on_nonconvergence'] = False
nonlin_solver_params['newton_solver']['linear_solver']           = 'mumps'
nonlin_solver_params['newton_solver']['preconditioner']          = 'default'
parameters['form_compiler']['quadrature_degree']                 = 2

config = default_config()