示例#1
0
from data.data_factory   import DataFactory
from meshes.mesh_factory import MeshFactory
from src.physics         import VelocityBalance_2
from dolfin              import Mesh, set_log_active

set_log_active(True)

thklim = 50.0

bedmap1 = DataFactory.get_bedmap1(thklim=thklim)
bedmap2 = DataFactory.get_bedmap2(thklim=thklim)

# 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,
示例#2
0
from src.utilities       import DataInput
from scipy.io            import loadmat

#===============================================================================
# data preparation :

thklim = 200.0

# collect the raw data :
bamber   = DataFactory.get_bamber(thklim = thklim)
searise  = DataFactory.get_searise(thklim = thklim)
#meas_shf = DataFactory.get_shift_gre_measures()

#dbv  = DataInput("../results/", ("Ubmag_measures.mat", "Ubmag.mat"), 
#                 gen_space=False)
dsr  = DataInput(None, searise,  gen_space=False)
dbm  = DataInput(None, bamber,   gen_space=False)
#dmss = DataInput(None, meas_shf, gen_space=False)

#dbv.set_data_min('Ubmag', 0.0,   0.0)
#dbv.set_data_max('Ubmag', 500.0, 500.0)

dsr.change_projection(dbm)
dsr.set_data_min('U_ob', 0.0,   0.0)
dsr.set_data_max('U_ob', 400.0, 400.0)

# might want to refine off of thickness :
#H   = dbm.data['H'].copy().T

# ensure that there are no values less than 1 for taking log :
#vel  = dbv.data['Ubmag'].copy().T
示例#3
0
from data.data_factory import DataFactory
from meshes.mesh_factory import MeshFactory
from src.physics import VelocityBalance_2
from dolfin import Mesh, set_log_active

set_log_active(True)

thklim = 50.0

bedmap1 = DataFactory.get_bedmap1(thklim=thklim)
bedmap2 = DataFactory.get_bedmap2(thklim=thklim)

# 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,
示例#4
0
from pylab import *
from gmshpy import *
from scipy.interpolate import RectBivariateSpline
from src.utilities import DataInput

#===============================================================================
# data preparation :

thklim = 200.0

# collect the raw data :
#measures = DataFactory.get_ant_measures()
#bedmap1  = DataFactory.get_bedmap1(thklim=thklim)
#bedmap2  = DataFactory.get_bedmap2(thklim=thklim)

dbv = DataInput("../results/", ("v_mag.mat", ), gen_space=False)
dbv.set_data_min('v_mag', 0.0, 0.0)
dbv.set_data_max('v_mag', 400.0, 400.0)

#db2  = DataInput(None, bedmap2, gen_space=False)

# might want to refine off of thickness :
#H   = db2.data['H'].copy().T

# ensure that there are no values less than 1 for taking log :
#vel = dsr.data['U_ob'].copy().T
vel = dbv.data['v_mag'].copy().T
vel += 1

# invert the sections where the velocity is low to refine at divide :
data = log(vel)
示例#5
0
文件: test.py 项目: whigg/VarGlaS
measure = DataFactory.get_gre_measures()
meas_shf = DataFactory.get_shift_gre_measures()
bamber = DataFactory.get_bamber(thklim=thklim)
fm_qgeo = DataFactory.get_gre_qgeo_fox_maule()
sec_qgeo = DataFactory.get_gre_qgeo_secret()

# define the meshes :
mesh = Mesh('meshes/mesh_high_new.xml')
flat_mesh = Mesh('meshes/mesh_high_new.xml')
#mesh      = Mesh('meshes/mesh_low.xml')
#flat_mesh = Mesh('meshes/mesh_low.xml')
mesh.coordinates()[:, 2] /= 100000.0
flat_mesh.coordinates()[:, 2] /= 100000.0

# create data objects to use with varglas :
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)
dfm = DataInput(None, fm_qgeo, mesh=mesh)
dsq = DataInput(None, sec_qgeo, mesh=mesh)
#dbv     = DataInput("results/", ("Ubmag_measures.mat", "Ubmag.mat"), mesh=mesh)

# 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')
示例#6
0
import os

set_log_active(True)

# collect the raw data :
searise = DataFactory.get_searise()
measure = DataFactory.get_gre_measures()
bamber  = DataFactory.get_bamber()

direc = os.path.dirname(os.path.realpath(__file__))

# load a mesh :
mesh    = Mesh("./mesh_5km.xml")

# create data objects to use with varglas :
dsr     = DataInput(None, searise, mesh=mesh)
dbam    = DataInput(None, bamber, mesh=mesh)
dms     = DataInput(None, measure, mesh=mesh, flip=True)
dms.change_projection(dsr)

# Bound data to managable values
MAX_V_ERR = 500
NO_DATA = -99
MAX_V = 1e5
dbam.set_data_min('H', 200.0, 200.0)
dbam.set_data_min('h', 1.0, 1.0)
dms.set_data_min('sp',0.0,-1.0)
dms.set_data_min('ex',-MAX_V_ERR,NO_DATA)
dms.set_data_max('ex',MAX_V_ERR,NO_DATA)
dms.set_data_min('ey',-MAX_V_ERR,NO_DATA)
dms.set_data_max('ey',MAX_V_ERR,NO_DATA)
示例#7
0
import os

set_log_active(True)

# collect the raw data :
searise = DataFactory.get_searise()
measure = DataFactory.get_gre_measures()
#bamber  = DataFactory.get_bamber()

direc = os.path.dirname(os.path.realpath(__file__))

# load a mesh :
mesh    = Mesh("../meshes/mesh.xml")

# create data objects to use with varglas :
dsr     = DataInput(None, searise, mesh=mesh, create_proj=True)
#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
import os

set_log_active(True)

# collect the raw data :
searise = DataFactory.get_searise()
measure = DataFactory.get_gre_measures()
bamber  = DataFactory.get_bamber()

direc = os.path.dirname(os.path.realpath(__file__))

# load a mesh :
mesh    = Mesh("./mesh.xml")

# create data objects to use with varglas :
dsr     = DataInput(None, searise, mesh=mesh, create_proj=True)
dbam    = DataInput(None, bamber,  mesh=mesh)
dms     = DataInput(None, measure, mesh=mesh, create_proj=True, flip=True)

dms.change_projection(dsr)

dbam.set_data_min('H', 200.0, 200.0)
dbam.set_data_min('h', 1.0, 1.0)
dms.set_data_min('sp',0.0,-2e9)

H     = dbam.get_projection("H")
H0     = dbam.get_projection("H")
S     = dbam.get_projection("h")
adot  = dsr.get_projection("adot")

Uobs  = dms.get_projection("sp")
示例#9
0
from pylab import *
from gmshpy import *
from scipy.interpolate import RectBivariateSpline
from src.utilities import DataInput

# ===============================================================================
# data preparation :

thklim = 200.0

# collect the raw data :
# measures = DataFactory.get_ant_measures()
# bedmap1  = DataFactory.get_bedmap1(thklim=thklim)
# bedmap2  = DataFactory.get_bedmap2(thklim=thklim)

dbv = DataInput("../results/", ("v_mag.mat",), gen_space=False)
dbv.set_data_min("v_mag", 0.0, 0.0)
dbv.set_data_max("v_mag", 400.0, 400.0)

# db2  = DataInput(None, bedmap2, gen_space=False)

# might want to refine off of thickness :
# H   = db2.data['H'].copy().T

# ensure that there are no values less than 1 for taking log :
# vel = dsr.data['U_ob'].copy().T
vel = dbv.data["v_mag"].copy().T
vel += 1

# invert the sections where the velocity is low to refine at divide :
data = log(vel)
示例#10
0
from src.solvers            import SteadySolver, TransientSolver
from src.physical_constants import IceParameters
from src.helper             import default_nonlin_solver_params
from pylb                   import *
from dolfin                 import set_log_active
from scipy.io               import *

set_log_active(True)

vara = DataFactory.get_searise(thklim = 50.0)

mesh                    = MeshFactory.get_greenland_coarse()
flat_mesh               = MeshFactory.get_greenland_coarse() 
mesh.coordinates()[:,2] = mesh.coordinates()[:,2]/1000.0

dd                 = DataInput(None, vara, mesh=mesh)

Surface            = dd.get_spline_expression('h')
Bed                = dd.get_spline_expression('b')
SMB                = dd.get_spline_expression('adot')
SurfaceTemperature = dd.get_spline_expression('T')
BasalHeatFlux      = dd.get_spline_expression('q_geo')
U_observed         = dd.get_spline_expression('U_ob')
Tn                 = vara['Tn']['map_data']
           
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']      = 20
nonlin_solver_params['newton_solver']['error_on_nonconvergence'] = False
nonlin_solver_params['newton_solver']['linear_solver']           = 'gmres'
示例#11
0
from src.physics            import VelocityBalance_2
from plot.plothelp.plotting import plotIce
from data.data_factory      import DataFactory
from meshes.mesh_factory    import MeshFactory

set_log_level(PROGRESS)

bm1 = DataFactory.get_lebrocq()
bm2 = DataFactory.get_bedmap2()

direc = os.path.dirname(os.path.realpath(__file__)) 

mesh   = Mesh("../meshes/mesh.xml")

# Import data :
d1     = DataInput(None, bm1, mesh=mesh)
d3     = DataInput(None, bm2, mesh=mesh, flip=True)

# 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)
示例#12
0
from src.physics            import VelocityBalance_2
from plot.plothelp.plotting import plotIce
from data.data_factory      import DataFactory
from meshes.mesh_factory    import MeshFactory

set_log_level(PROGRESS)

bm1 = DataFactory.get_bedmap1()
bm2 = DataFactory.get_bedmap2()

direc = os.path.dirname(os.path.realpath(__file__)) 

mesh   = Mesh("../meshes/mesh.xml")

# Import data :
d1     = DataInput(None, bm1, mesh=mesh)
d3     = DataInput(None, bm2, mesh=mesh, flip=True)

# 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)
示例#13
0
#set_log_level(PROGRESS)

thklim = 200.0

# collect the raw data :
searise  = DataFactory.get_searise(thklim = thklim)
bamber   = DataFactory.get_bamber(thklim = thklim)
fm_qgeo  = DataFactory.get_gre_qgeo_fox_maule()
#measure  = DataFactory.get_gre_measures()
rignot   = DataFactory.get_gre_rignot()

# define the mesh :
mesh = MeshFactory.get_greenland_coarse()

# create data objects to use with varglas :
dsr     = DataInput(None, searise,  mesh=mesh)
dbm     = DataInput(None, bamber,   mesh=mesh)
#dms     = DataInput(None, measure,  mesh=mesh)
dfm     = DataInput(None, fm_qgeo,  mesh=mesh)
drg     = DataInput(None, rignot,   mesh=mesh)

# change the projection of the measures data to fit with other data :
#dms.change_projection(dsr)
drg.change_projection(dsr)

# get the expressions used by varglas :
Thickness          = dbm.get_spline_expression('H')
Surface            = dbm.get_spline_expression('S')
Bed                = dbm.get_spline_expression('B')
SurfaceTemperature = dsr.get_spline_expression('T')
#BasalHeatFlux      = dsr.get_spline_expression('q_geo')
示例#14
0
in_dir = './results_stokes_5H/03/'

set_log_active(True)
#set_log_level(PROGRESS)

thklim = 200.0

# collect the raw data :
bamber = DataFactory.get_bamber(thklim=thklim)

# define the meshes :
mesh = Mesh('meshes/greenland_3D_5H.xml')
mesh.coordinates()[:, 2] /= 100000.0

# create data objects to use with varglas :
dbm = DataInput(None, bamber, mesh=mesh)

# get the expressions used by varglas :
Surface = dbm.get_spline_expression('h')
Bed = dbm.get_spline_expression('b')

model = model.Model(out_dir=out_dir)
model.set_geometry(Surface, Bed)
model.set_mesh(mesh, deform=True)
model.set_parameters(pc.IceParameters())
model.initialize_variables()
parameters['form_compiler']['quadrature_degree'] = 2

File(in_dir + 'u.xml') >> model.u
File(in_dir + 'v.xml') >> model.v
File(in_dir + 'w.xml') >> model.w
示例#15
0
import sys
import os
src_directory = '../../../../'
sys.path.append(src_directory)

from src.utilities     import DataInput, MeshGenerator
from data.data_factory import DataFactory

# create meshgrid for contour :
vara = DataFactory.get_bamber()

# process the data :
dd = DataInput(None, vara, gen_space=False)
dd.set_data_max('mask', 2, 0)

m = MeshGenerator(dd, 'mesh', '')

m.create_contour('H', 200.0, 4)
#m.plot_contour()

m.eliminate_intersections(dist=10)
#m.plot_contour()

m.write_gmsh_contour(100000, boundary_extend=False)
m.extrude(100000, 10)
#m.add_edge_attractor(1)
#field, ifield, lcMin, lcMax, distMin, distMax
#m.add_threshold(2, 1, 20000, 100000, 1, 400000)
#m.finish(4)

#m.create_2D_mesh('mesh') #FIXME: fails
import os

set_log_active(True)

# collect the raw data :
searise = DataFactory.get_searise()
measure = DataFactory.get_gre_measures()
bamber = DataFactory.get_bamber()

direc = os.path.dirname(os.path.realpath(__file__))

# load a mesh :
mesh = Mesh("./mesh.xml")

# create data objects to use with varglas :
dsr = DataInput(None, searise, mesh=mesh, create_proj=True)
dbam = DataInput(None, bamber, mesh=mesh)
dms = DataInput(None, measure, mesh=mesh, create_proj=True, flip=True)

dms.change_projection(dsr)

dbam.set_data_min('H', 10.0, 10.0)
dsr.set_data_min('U_ob',0.0,0.0)
dms.set_data_val('sp',-0.1,-2e9)

H = dbam.get_interpolation("H")
S = dbam.get_interpolation("h")
adot = dsr.get_interpolation("adot")
#Uobs = dms.get_interpolation("sp",kx=1,ky=1)
Uobs = dsr.get_interpolation("U_ob",kx=1,ky=1)
Uobs.vector()[Uobs.vector().array()<0] = 0.0
示例#17
0
thklim = 10.0

# collect the raw data :
searise  = DataFactory.get_searise(thklim = thklim)
bamber   = DataFactory.get_bamber(thklim = thklim)
fm_qgeo  = DataFactory.get_gre_qgeo_fox_maule()

# define the meshes :
mesh      = Mesh('../../../meshes/greenland/greenland_coarse_mesh.xml')
flat_mesh = Mesh('../../../meshes/greenland/greenland_coarse_mesh.xml')
mesh.coordinates()[:,2]      /= 1000.0
flat_mesh.coordinates()[:,2] /= 1000.0


# create data objects to use with varglas :
dsr     = DataInput(None, searise,  mesh=mesh)
dbm     = DataInput(None, bamber,   mesh=mesh)
dfm     = DataInput(None, fm_qgeo,  mesh=mesh)

# 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      = dfm.get_spline_expression('q_geo')
adot               = dsr.get_spline_expression('adot')

model = model.Model()
model.set_geometry(Surface, Bed)
model.set_mesh(mesh, flat_mesh=flat_mesh, deform=True)
model.set_parameters(pc.IceParameters())
示例#18
0
set_log_active(True)

thklim = 20.0

# collect the raw data :
searise  = DataFactory.get_searise()
measure  = DataFactory.get_gre_measures()
meas_shf = DataFactory.get_shift_gre_measures()
bamber   = DataFactory.get_bamber(thklim = thklim)

# load a mesh :
mesh    = Mesh("results/meshes/refined_mesh.xml")

# create data objects to use with varglas :
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/')
示例#19
0
set_log_active(True)

thklim = 20.0

# collect the raw data :
searise = DataFactory.get_searise()
measure = DataFactory.get_gre_measures()
meas_shf = DataFactory.get_shift_gre_measures()
bamber = DataFactory.get_bamber(thklim=thklim)

# load a mesh :
mesh = Mesh("results/meshes/refined_mesh.xml")

# create data objects to use with varglas :
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/')
示例#20
0
from data.data_factory   import DataFactory
from meshes.mesh_factory import MeshFactory
from src.helper          import default_nonlin_solver_params
from src.utilities       import DataInput
from dolfin              import *

set_log_active(True)

var_measures = DataFactory.get_ant_measures()
var_bedmap1  = DataFactory.get_lebrocq()
var_bedmap2  = DataFactory.get_bedmap2()

mesh         = MeshFactory.get_antarctica_coarse()
flat_mesh    = MeshFactory.get_antarctica_coarse()

dm  = DataInput(None, var_measures, mesh=mesh,flip=True)
db1 = DataInput(None, var_bedmap1,  mesh=mesh)
db2 = DataInput(None, var_bedmap2,  mesh=mesh, flip=True)

thklim = 50.0

db2.set_data_min("H", thklim, thklim)
db2.set_data_min("h", 0.0,0.0)

db2.set_data_max("H",30000.,thklim)
db2.set_data_max("h",30000.,0.0)

db2.data['b'] = db2.data['h']-db2.data['H']

db1.data['srfTemp'] += 273.15
db1.data['q_geo'] *= 60**2*24*365
示例#21
0
文件: gen_mesh.py 项目: whigg/VarGlaS
from src.utilities       import DataInput, MeshGenerator, MeshRefiner
from data.data_factory   import DataFactory
from pylab               import *


#===============================================================================
# data preparation :

thklim = 0.0

# collect the raw data :
bamber   = DataFactory.get_bamber(thklim = thklim)
searise  = DataFactory.get_searise(thklim = thklim)

dsr  = DataInput(None, searise, gen_space=False)
dbm  = DataInput(None, bamber,  gen_space=False)


#===============================================================================
# generate the contour :
m = MeshGenerator(dbm, 'mesh', '')

m.create_contour('H', zero_cntr=200.0, skip_pts=2)
m.eliminate_intersections(dist=40)
#m.plot_contour()
m.write_gmsh_contour(boundary_extend=False)
m.extrude(h=100000, n_layers=10)
m.close_file()

示例#22
0
import os

set_log_active(True)

# collect the raw data :
searise = DataFactory.get_searise()
measure = DataFactory.get_gre_measures()
#bamber  = DataFactory.get_bamber()

direc = os.path.dirname(os.path.realpath(__file__))

# load a mesh :
mesh    = Mesh("../meshes/mesh.xml")

# create data objects to use with varglas :
dsr     = DataInput(None, searise, mesh=mesh, create_proj=True)
#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
示例#23
0
  os.makedirs(d)


thklim = 200.0

measures  = DataFactory.get_ant_measures(res=900)
bedmap1   = DataFactory.get_bedmap1(thklim=thklim)
bedmap2   = DataFactory.get_bedmap2(thklim=thklim)

mesh      = Mesh('meshes/mesh_low.xml')
flat_mesh = Mesh('meshes/mesh_low.xml')
#mesh.coordinates()[:,2]      /= 100000.0
#flat_mesh.coordinates()[:,2] /= 100000.0


dm  = DataInput(None, measures, mesh=mesh)
db1 = DataInput(None, bedmap1,  mesh=mesh)
db2 = DataInput(None, bedmap2,  mesh=mesh)

db2.set_data_val('H', 32767, thklim)
db2.set_data_val('h', 32767, 0.0)
dm.set_data_min('v_mag', 0.0, 0.0)

#h        = db2.get_projection('h')
#H        = db2.get_projection('H')
#v_mag    = dm.get_projection('v_mag')
#surfTemp = db1.get_projection("srfTemp")
#q_geo    = db1.get_projection("q_geo")

#File('tests/q_geo.pvd')     << q_geo
#File('tests/srfTemp.pvd')  << surfTemp
示例#24
0
measure  = DataFactory.get_gre_measures()
#meas_shf = DataFactory.get_shift_gre_measures()
bamber   = DataFactory.get_bamber(thklim = thklim)
fm_qgeo  = DataFactory.get_gre_qgeo_fox_maule()
#sec_qgeo = DataFactory.get_gre_qgeo_secret()
merged   = DataFactory.get_gre_merged()

# define the meshes :
mesh      = Mesh('../../../meshes/greenland/greenland_coarse_mesh.xml')
flat_mesh = Mesh('../../../meshes/greenland/greenland_coarse_mesh.xml')
mesh.coordinates()[:,2]      /= 1000.0
flat_mesh.coordinates()[:,2] /= 1000.0


# create data objects to use with varglas :
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)
dfm     = DataInput(None, fm_qgeo,  mesh=mesh)
#dsq     = DataInput(None, sec_qgeo, mesh=mesh)
dmg     = DataInput(None, merged,   mesh=mesh)
#dbv     = DataInput("results/", ("Ubmag_measures.mat", "Ubmag.mat"), mesh=mesh)

# change the projection of the measures data to fit with other data :
#dms.change_projection(dsr)
dmg.change_projection(dsr)

# get the expressions used by varglas :
Thickness          = dbm.get_spline_expression('H')
Surface            = dbm.get_spline_expression('h')
示例#25
0
from data.data_factory   import DataFactory
from meshes.mesh_factory import MeshFactory
from src.helper          import default_nonlin_solver_params
from src.utilities       import DataInput
from dolfin              import *

set_log_active(True)
parameters['form_compiler']['quadrature_degree'] = 1

vara = DataFactory.get_searise()

mesh                    = MeshFactory.get_greenland_medium()
#mesh.coordinates()[:,2] = mesh.coordinates()[:,2]/1000.0
flat_mesh               = MeshFactory.get_greenland_medium()

dd                 = DataInput(None, vara, mesh=mesh)

Surface            = dd.get_spline_expression('h')
Bed                = dd.get_spline_expression('b')
Smb                = dd.get_spline_expression('adot')
SurfaceTemperature = dd.get_spline_expression('T')
BasalHeatFlux      = dd.get_spline_expression('q_geo')
U_observed         = dd.get_spline_expression('U_ob')

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'] = 20
nonlin_solver_params['newton_solver']['error_on_nonconvergence'] = False
nonlin_solver_params['linear_solver']                            = 'mumps'
nonlin_solver_params['preconditioner']                           = 'default'
示例#26
0
src_directory = '../../../'
sys.path.append(src_directory)

from src.utilities import DataInput, MeshGenerator
from data.data_factory import DataFactory

# create meshgrid for contour :
vara = DataFactory.get_bamber()
H = vara['H']['map_data']
S = vara['h']['map_data']
B = vara['b']['map_data']
H[S <= 0] = 0.0
vara['H']['map_data'] = H

# process the data :
dd = DataInput(None, vara, flip=False, gen_space=False)
#dd.set_data_max('mask', 2, 0)

m = MeshGenerator(dd, 'mesh', './')

# 20 works well for the last arg. below
m.create_contour('H', 200.0, 3)
m.plot_contour()

m.eliminate_intersections()
m.plot_contour()

# 10000 works well on the following line
m.write_gmsh_contour(1000)
m.finish(None)
in_dir  = './results_stokes_5H/03/'

set_log_active(True)
#set_log_level(PROGRESS)

thklim = 200.0

# collect the raw data :
bamber   = DataFactory.get_bamber(thklim = thklim)

# define the meshes :
mesh     = Mesh('meshes/greenland_3D_5H.xml')
mesh.coordinates()[:,2] /= 100000.0

# create data objects to use with varglas :
dbm     = DataInput(None, bamber, mesh=mesh)

# get the expressions used by varglas :
Surface = dbm.get_spline_expression('h')
Bed     = dbm.get_spline_expression('b')

model = model.Model(out_dir = out_dir)
model.set_geometry(Surface, Bed)
model.set_mesh(mesh, deform=True)
model.set_parameters(pc.IceParameters())
model.initialize_variables()
parameters['form_compiler']['quadrature_degree'] = 2

File(in_dir + 'u.xml')     >>  model.u
File(in_dir + 'v.xml')     >>  model.v
File(in_dir + 'w.xml')     >>  model.w