19#include "pism/earth/LingleClark.hh"
22#include "pism/util/io/File.hh"
23#include "pism/util/Grid.hh"
24#include "pism/util/Config.hh"
25#include "pism/util/error_handling.hh"
26#include "pism/util/pism_utilities.hh"
27#include "pism/util/fftw_utilities.hh"
28#include "pism/earth/LingleClarkSerial.hh"
29#include "pism/util/Context.hh"
36 :
BedDef(grid,
"Lingle-Clark"),
37 m_total_displacement(m_grid,
"bed_displacement"),
38 m_relief(m_grid,
"bed_relief"),
39 m_elastic_displacement(grid,
"elastic_bed_displacement") {
45 "total (viscous and elastic) displacement in the Lingle-Clark bed deformation model")
51 .
long_name(
"bed relief relative to the modeled bed displacement")
54 bool use_elastic_model =
m_config->get_flag(
"bed_deformation.lc.elastic_model");
58 "elastic part of the displacement in the Lingle-Clark bed deformation model; see :cite:`BLKfastearth`")
65 Z =
m_config->get_number(
"bed_deformation.lc.grid_size_factor"),
77 std::make_shared<array::Scalar>(
m_extended_grid,
"viscous_bed_displacement");
80 "bed displacement in the viscous half-space bed deformation model; see BuelerLingleBrown")
140 if (
m_grid->rank() == 0) {
141 PetscErrorCode ierr = 0;
182 auto lrm0 = result->allocate_proc0_copy();
187 if (
m_grid->rank() == 0) {
188 std::vector<std::complex<double> > array(Nx * Ny);
190 m_serial_model->compute_load_response_matrix((fftw_complex*)array.data());
192 get_real_part((fftw_complex*)array.data(), 1.0, Nx, Ny, Nx, Ny, 0, 0, *lrm0);
200 result->get_from_proc0(*lrm0);
228 regrid(
"Lingle-Clark bed deformation model",
230 regrid(
"Lingle-Clark bed deformation model",
241 if (
m_grid->rank() == 0) {
242 PetscErrorCode ierr = 0;
287 if (
m_grid->rank() == 0) {
288 PetscErrorCode ierr = 0;
std::shared_ptr< const Config > m_config
configuration database used by this component
@ REGRID_WITHOUT_REGRID_VARS
const std::shared_ptr< const Grid > m_grid
grid used by this component
void regrid(const std::string &module_name, array::Array &variable, RegriddingFlag flag=NO_REGRID_WITHOUT_REGRID_VARS)
std::shared_ptr< const Logger > m_log
logger (for easy access)
static Ptr wrap(const T &input)
static std::shared_ptr< Grid > Shallow(std::shared_ptr< const Context > ctx, double Lx, double Ly, double x0, double y0, unsigned int Mx, unsigned int My, grid::Registration r, grid::Periodicity p)
Initialize a uniform, shallow (3 z-levels) grid with half-widths (Lx,Ly) and Mx by My nodes.
void failed()
Indicates a failure of a parallel section.
void add(double alpha, const Array2D< T > &x)
void read(const std::string &filename, unsigned int time)
void write(const OutputFile &file) const
void get_from_proc0(petsc::Vec &onp0)
Gets a local Array2 from processor 0.
void set(double c)
Result: v[j] <- c for all j.
void inc_state_counter()
Increment the object state counter.
std::shared_ptr< petsc::Vec > allocate_proc0_copy() const
void put_on_proc0(petsc::Vec &onp0) const
Puts a local array::Scalar on processor 0.
VariableMetadata & metadata(unsigned int N=0)
Returns a reference to the VariableMetadata object containing metadata for the compoment N.
virtual DiagnosticList spatial_diagnostics_impl() const
virtual void write_state_impl(const OutputFile &output) const
The default (empty implementation).
void bootstrap(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
Initialize using provided bed elevation and uplift.
array::Scalar2 m_topg
current bed elevation
array::Scalar m_uplift
bed uplift rate
const array::Scalar & bed_elevation() const
virtual std::set< VariableMetadata > state_impl() const
PISM bed deformation model (base class).
Class implementing the bed deformation model described in [BLKfastearth].
std::shared_ptr< petsc::Vec > m_elastic_displacement0
rank 0 storage for the elastic displacement
void bootstrap_impl(const array::Scalar &bed_elevation, const array::Scalar &bed_uplift, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
void init_impl(const InputOptions &opts, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation)
std::shared_ptr< petsc::Vec > m_work0
array::Scalar m_elastic_displacement
Elastic bed displacement (part of the model state)
const array::Scalar & elastic_displacement() const
std::shared_ptr< Grid > m_extended_grid
extended grid for the viscous plate displacement
virtual std::set< VariableMetadata > state_impl() const
void update_impl(const array::Scalar &load, double t, double dt)
Update the Lingle-Clark bed deformation model.
std::shared_ptr< array::Scalar > m_viscous_displacement
Viscous displacement on the extended grid (part of the model state).
array::Scalar m_relief
Bed relief relative to the bed displacement.
std::shared_ptr< petsc::Vec > m_viscous_displacement0
rank 0 storage using the extended grid
const array::Scalar & relief() const
void step(const array::Scalar &load_thickness, double dt)
LingleClark(std::shared_ptr< const Grid > g)
DiagnosticList spatial_diagnostics_impl() const
std::unique_ptr< LingleClarkSerial > m_serial_model
Serial viscoelastic bed deformation model.
const array::Scalar & total_displacement() const
array::Scalar m_total_displacement
Total (viscous and elastic) bed displacement.
const array::Scalar & viscous_displacement() const
std::shared_ptr< array::Scalar > elastic_load_response_matrix() const
virtual void write_state_impl(const OutputFile &output) const
The default (empty implementation).
#define PISM_CHK(errcode, name)
std::set< VariableMetadata > metadata(std::initializer_list< const Array * > vecs)
void accumulate_load(const array::Scalar &bed_elevation, const array::Scalar &ice_thickness, const array::Scalar &sea_level_elevation, double C, array::Scalar &result)
std::map< std::string, Diagnostic::Ptr > DiagnosticList
T combine(const T &a, const T &b)
void get_real_part(fftw_complex *input, double normalization, int Mx, int My, int Nx, int Ny, int i0, int j0, petsc::Vec &output)
Get the real part of input and put it in output.