# load a mesh : mesh = Mesh("meshes/2dmesh.xml") db1 = DataInput(None, bedmap1, mesh=mesh) db2 = DataInput(None, bedmap2, mesh=mesh) h = db2.get_projection("h_n") H = db2.get_projection("H_n") adot = db1.get_projection("adot") prb = VelocityBalance_2(mesh, H, h, adot, 12.0) prb.solve_forward() # File ouput do = DataOutput('results/antartica_bv/') d_out = { 'U_bal_mag': prb.Ubmag, 'H': prb.H, 'adot': prb.adot, 'S': prb.S, 'slope': prb.slope, 'residual': prb.residual } do.write_dict_of_files(d_out) do.write_dict_of_files(d_out, extension='.xml') do.write_matlab(db2, prb.Ubmag, 'results/Ubmag.mat')
# change the projection of the measures data to fit with other data : #dms.change_projection(dsr) # get the expressions used by varglas : Thickness = dbm.get_spline_expression('H') Surface = dbm.get_spline_expression('h') Bed = dbm.get_spline_expression('b') SurfaceTemperature = dsr.get_spline_expression('T') #BasalHeatFlux = dsr.get_spline_expression('q_geo') BasalHeatFlux = dsq.get_spline_expression('q_geo') #BasalHeatFlux = dfm.get_spline_expression('q_geo') adot = dsr.get_spline_expression('adot') U_observed = dsr.get_spline_expression('U_ob') # inspect the data values : do = DataOutput('results_pre/') model = model.Model() model.set_geometry(Surface, Bed) model.set_mesh(mesh, flat_mesh=flat_mesh, deform=True) model.set_parameters(pc.IceParameters()) model.initialize_variables() #do.write_one_file('ff', model.ff) #do.write_one_file('h', dbm.get_projection('h')) #do.write_one_file('Ubmag_measures', dbv.get_projection('Ubmag_measures')) #do.write_one_file('sq_qgeo', dsq.get_projection('q_geo')) #do.write_one_file('sr_qgeo', dsr.get_projection('q_geo')) #exit(0) # specifify non-linear solver parameters : nonlin_solver_params = default_nonlin_solver_params() nonlin_solver_params['newton_solver']['relaxation_parameter'] = 0.7
#dbm = DataInput(None, bamber, mesh=mesh) dms = DataInput(None, measure, mesh=mesh, create_proj=True, flip=True) dms.change_projection(dsr) dsr.set_data_min('H', 10.0, 10.0) H = dsr.get_projection("H") S = dsr.get_projection("h") adot = dsr.get_projection("adot") prb = VelocityBalance_2(mesh, H, S, adot, 12.0) prb.solve_forward() # File ouput do = DataOutput('results/greenland_balance_velocity_v2/') d_out = {'Ubmag' : prb.Ubmag, 'H' : prb.H, 'adot' : prb.adot, 'S' : prb.S, 'slope' : prb.slope, 'residual' : prb.residual} do.write_dict_of_files(d_out) do.write_dict_of_files(d_out, extension='.xml') #Plotting not quite working with Greenland. #plotIce(prb.Ubmag, direc, 'jet', scale='log', name='BVmag', units='m/a', # numLvls=100, plot_type='tripcolor')
dsr = DataInput(None, searise, mesh=mesh) dbm = DataInput(None, bamber, mesh=mesh) dms = DataInput(None, measure, mesh=mesh) dmss = DataInput(None, meas_shf, mesh=mesh) dms.change_projection(dsr) H = dbm.get_projection("H_n") S = dbm.get_projection("h_n") adot = dsr.get_projection("adot") prb = VelocityBalance_2(mesh, H, S, adot, 12.0) prb.solve_forward() # File ouput do = DataOutput('results/greenland_balance_velocity_v2/') d_out = {'U_bal_mag' : prb.Ubmag, 'H' : prb.H, 'adot' : prb.adot, 'S' : prb.S, 'slope' : prb.slope, 'residual' : prb.residual} do.write_dict_of_files(d_out) do.write_dict_of_files(d_out, extension='.xml') do.write_one_file('sp', dms.get_projection('sp')) #do.write_matlab(dbm, prb.Ubmag, 'results/Ubmag.mat') dbv = DataInput('results/', ('Ubmag.mat',), mesh=mesh)
dsr = DataInput(None, searise, mesh=mesh) dbm = DataInput(None, bamber, mesh=mesh) dms = DataInput(None, measure, mesh=mesh) dmss = DataInput(None, meas_shf, mesh=mesh) dms.change_projection(dsr) H = dbm.get_projection("H_n") S = dbm.get_projection("h_n") adot = dsr.get_projection("adot") prb = VelocityBalance_2(mesh, H, S, adot, 12.0) prb.solve_forward() # File ouput do = DataOutput('results/greenland_balance_velocity_v2/') d_out = { 'U_bal_mag': prb.Ubmag, 'H': prb.H, 'adot': prb.adot, 'S': prb.S, 'slope': prb.slope, 'residual': prb.residual } do.write_dict_of_files(d_out) do.write_dict_of_files(d_out, extension='.xml') do.write_one_file('sp', dms.get_projection('sp')) #do.write_matlab(dbm, prb.Ubmag, 'results/Ubmag.mat')
# set minimum values for data : d3.set_data_val("H", 32767, 10.0) d3.set_data_val("h", 32767, 0.0) d3.set_data_val("mask", 127, 1.0) # get projections for use with FEniCS : adot = d1.get_projection("adot") H = d3.get_projection("H") h = d3.get_projection("h") b = d3.get_projection("b") prb = VelocityBalance_2(mesh,H,h,adot,12.0) do = DataOutput('results/antarctia_balance_velocity/') data_out = {'Ubmag' : prb.Ubmag, 'H' : prb.H, 'adot' : prb.adot, 'S' : prb.S, 'slope' : prb.slope, 'residual' : prb.residual} do.write_dict_of_files(data_out) do.write_dict_of_files(data_out,extension='.xml') plotIce(prb.Ubmag, direc, 'jet', scale='log', name='BVmag', units='m/a', proj_in='ant', numLvls=100, plot_type='tripcolor')
# load a mesh : mesh = Mesh("meshes/2dmesh.xml") db1 = DataInput(None, bedmap1, mesh=mesh) db2 = DataInput(None, bedmap2, mesh=mesh) h = db2.get_projection("h_n") H = db2.get_projection("H_n") adot = db1.get_projection("adot") prb = VelocityBalance_2(mesh, H, h, adot, 12.0) prb.solve_forward() # File ouput do = DataOutput('results/antartica_bv/') d_out = {'U_bal_mag' : prb.Ubmag, 'H' : prb.H, 'adot' : prb.adot, 'S' : prb.S, 'slope' : prb.slope, 'residual' : prb.residual} do.write_dict_of_files(d_out) do.write_dict_of_files(d_out, extension='.xml') do.write_matlab(db2, prb.Ubmag, 'results/Ubmag.mat')