示例#1
0
#!/usr/bin/env python

# Copyright (C) 2012, 2013, 2014, 2015, 2017 Ricarda Winkelmann, Torsten Albrecht,
# Ed Bueler, and Constantine Khroulev

import numpy as np
import PISMNC
import piktests_utils

# command line arguments
options = piktests_utils.process_options("circular_dirichlet.nc",
                                         domain_size=1000.0)
p = piktests_utils.Parameters()

dx, dy, x, y = piktests_utils.create_grid(options)

xx, yy = np.meshgrid(x, y)
radius = np.sqrt(xx**2 + yy**2)
# remove the singularity (does not affect the result):
radius[radius == 0] = 1e-16

# Ice thickness
thk = np.zeros((options.My, options.Mx))  # sheet/shelf thickness
if options.shelf:
    thk[radius > p.r_gl] = (4.0 * p.C / p.Q0 *
                            (radius[radius > p.r_gl] - p.r_gl) +
                            1 / p.H0**4)**(-0.25)
    thk[radius >= p.r_cf] = 0.0
    # cap ice thickness
    thk[thk > p.H0] = p.H0
示例#2
0
#!/usr/bin/env python

# Copyright (C) 2012, 2013, 2014, 2015 Ricarda Winkelmann, Torsten Albrecht,
# Ed Bueler, and Constantine Khroulev

import numpy as np
import PISMNC
import piktests_utils

# command line arguments
options = piktests_utils.process_options("circular_dirichlet.nc",
                                         domain_size=1000.0)
p = piktests_utils.Parameters()

dx, dy, x, y = piktests_utils.create_grid(options)

xx, yy = np.meshgrid(x, y)
radius = np.sqrt(xx ** 2 + yy ** 2)
# remove the singularity (does not affect the result):
radius[radius == 0] = 1e-16

# Ice thickness
thk = np.zeros((options.My, options.Mx))  # sheet/shelf thickness
if options.shelf:
    thk[radius > p.r_gl] = (4.0 * p.C / p.Q0 * (radius[radius > p.r_gl] - p.r_gl) + 1 / p.H0 ** 4) ** (-0.25)
    thk[radius >= p.r_cf] = 0.0
    # cap ice thickness
    thk[thk > p.H0] = p.H0
else:
    thk[radius <= p.r_gl] = p.H0