"""
Create a grounding line contour.
"""

from varglas.data.data_factory import DataFactory
from varglas.utilities import DataInput, MeshGenerator
from numpy import *
from mpl_toolkits.basemap import Basemap

# Get the Antarctica data sets
bedmap2 = DataFactory.get_bedmap2()
db2 = DataInput(bedmap2)

# Get the grounding line by eliminating the shelves
db2.set_data_val('mask',1,127)

# Create a grounding line countour
mg = MeshGenerator(db2, 'mesh', '')
mg.create_contour('mask', 10, skip_pts=2)
mg.eliminate_intersections(dist=20)
cont = mg.longest_cont

# Convert (x,y) coordinates to (lon,lat)
cont_lons, cont_lats = db2.p(cont[:,0], cont[:,1], inverse = True)

# Convert (x,y) coordinates to (lon,lat)
cont_lons, cont_lats = db2.p(cont[:,0], cont[:,1], inverse = True)

# Convert to basemap coordinates
lat_0  = '-90'
lat_ts = '-71'
Пример #2
0
# 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")
B = db2.get_nearest_expression("B")
M = db2.get_nearest_expression("mask")
Пример #3
0
config['log_history'] = True
config['mode'] = 'transient'
config['model_order'] = 'L1L2'
config['output_path'] = out_dir
config['t_start'] = 0.0
config['t_end'] = 35000.0
config['time_step'] = 10.0
config['periodic_boundary_conditions'] = False
config['velocity']['poly_degree'] = 2
config['enthalpy']['on'] = True
config['enthalpy']['N_T'] = 8
config['free_surface']['on'] = True
config['free_surface']['thklim'] = thklim
config['velocity']['transient_beta'] = 'stats'

bedmap2 = DataFactory.get_bedmap2()
db2 = DataInput(bedmap2, mesh=mesh)

db2.data['Sn'] = db2.data['S'] + thklim

B = db2.get_expression("B", near=True)
S = db2.get_expression("Sn", near=True)

model = Model(config)
model.set_mesh(mesh)


class Adot(Expression):
    Rel = 450000
    s = 1e-5
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")
q_geo  = db1.get_spline_expression("q_geo")
adot   = db1.get_spline_expression("adot")
Пример #5
0
""" This scripts builds a flat mesh for a rectangular region in Antarctica and 
refines it based on thickness. """

from varglas.data.data_factory import DataFactory
from varglas.utilities import DataInput, MeshGenerator, MeshRefiner
from fenics import *
from numpy import *
from pylab import *

thklm = 200.0
bm2 = DataFactory.get_bedmap2(thklm)
bedmap2 = DataInput(bm2)

# Load the domain coordinates
domain_coordinates = loadtxt('domain_coordinates1.out')

mesh_name = 'ant_mesh'

# Create a contour for the domain
#=======================================================
# Create a mesh file in the current directory 
m = MeshGenerator(bedmap2, mesh_name, '')
# Manually set the countour instead of calculating it automatically
m.set_contour(domain_coordinates)
# Write the contour points to the mesh file
m.write_gmsh_contour(100000, boundary_extend = False)
# Extrude the flat mesh 10,000 meters in the z dimension. The height of the 
# mesh can be automatically scaled to the proper height by the model object
m.extrude(10000, 14)
# We're finished with the flat mesh!
m.close_file()