from varglas.helper import default_nonlin_solver_params from varglas.utilities import DataInput from fenics import * import varglas.model as model # Output directory out_dir = 'results_dir3/' #set_log_active(True) parameters["allow_extrapolation"] = True mesh = Mesh('data/meshes/ant_mesh.xml') # Get a bunch of data to use in the simulation thklim = 100.0 measures = DataFactory.get_ant_measures(res=900) bedmap1 = DataFactory.get_bedmap1(thklim=thklim) bedmap2 = DataFactory.get_bedmap2(thklim=thklim) dm = DataInput(measures, mesh=mesh) db1 = DataInput(bedmap1, mesh=mesh) db2 = DataInput(bedmap2, mesh=mesh) # Fix some stuff? db2.data['B'] = db2.data['S'] - db2.data['H'] db2.set_data_val('H', 32767, thklim) db2.data['S'] = db2.data['B'] + db2.data['H'] S = db2.get_spline_expression("S") B = db2.get_spline_expression("B") T_s = db1.get_spline_expression("srfTemp")
from varglas.io import DataInput, DataOutput from fenics import * # get the input args : i = int(sys.argv[2]) # assimilation number dir_b = sys.argv[1] + '/0' # directory to save # set the output directory : out_dir = dir_b + str(i) + '/' in_dir = 'vars/' set_log_active(True) thklim = 1.0 measures = DataFactory.get_ant_measures(res=450) bedmap1 = DataFactory.get_bedmap1(thklim=thklim) bedmap2 = DataFactory.get_bedmap2(thklim=thklim) mesh = MeshFactory.get_ronne_3D_50H() dm = DataInput(measures, mesh=mesh) db1 = DataInput(bedmap1, mesh=mesh) db2 = DataInput(bedmap2, mesh=mesh) db2.data['B'] = db2.data['S'] - db2.data['H'] db2.set_data_val('H', 32767, thklim) db2.data['S'] = db2.data['B'] + db2.data['H'] H = db2.get_nearest_expression("H") S = db2.get_nearest_expression("S")
from varglas.meshing import MeshGenerator, MeshRefiner from varglas.data.data_factory import DataFactory from varglas.io import DataInput, print_min_max from pylab import * from scipy.interpolate import interp2d #=============================================================================== # data preparation : out_dir = 'dump/meshes/' # get the data : measure = DataFactory.get_ant_measures() bedmap2 = DataFactory.get_bedmap2() # process the data : dbm = DataInput(measure, gen_space=False) db2 = DataInput(bedmap2, gen_space=False) dbm.set_data_min('U_ob', boundary=0.0, val=0.0) db2.set_data_val("H", 32767, 0.0) db2.set_data_val('S', 32767, 0.0) # calculate surface gradient : gradS = gradient(db2.data['S']) gS_n = sqrt(gradS[0]**2 + gradS[1]**2 + 1e-16) # create interpolation object to convert measures to bedmap2 coordinates : interp = interp2d(db2.x, db2.y, gS_n) gS_n = interp(dbm.x, dbm.y) interp = interp2d(db2.x, db2.y, db2.data['mask']) mask = interp(dbm.x, dbm.y)