19 #include "pism/coupler/surface/ForceThickness.hh"
20 #include "pism/util/Grid.hh"
22 #include "pism/util/ConfigInterface.hh"
23 #include "pism/util/error_handling.hh"
24 #include "pism/util/array/CellType.hh"
25 #include "pism/util/MaxTimestep.hh"
26 #include "pism/util/io/File.hh"
27 #include "pism/geometry/Geometry.hh"
28 #include "pism/util/interpolation.hh"
36 m_target_thickness(m_grid,
"thk"),
37 m_ftt_mask(m_grid,
"ftt_mask")
42 m_alpha =
m_config->get_number(
"surface.force_to_thickness.alpha",
"s-1");
48 .
long_name(
"mask specifying where to apply the force-to-thickness mechanism")
65 m_log->message(2,
"* Initializing force-to-thickness mass-balance modifier...\n");
67 std::string input_file =
m_config->get_string(
"surface.force_to_thickness.file");
69 if (input_file.empty()) {
75 " alpha = %.6f year-1 for -force_to_thickness mechanism\n"
76 " alpha = %.6f year-1 in areas with target ice thickness of less than %.3f meters\n",
85 " reading target thickness 'thk' from %s ...\n"
86 " (this field will appear in output file as 'ftt_target_thk')\n",
92 .
long_name(
"target thickness for force-to-thickness mechanism (hit this at end of run)")
105 " reading force-to-thickness mask 'ftt_mask' from %s ...\n",
229 " updating surface mass balance using -force_to_thickness mechanism ...");
231 double ice_density =
m_config->get_number(
"constants.ice.density");
236 for (
auto p =
m_grid->points(); p; p.next()) {
237 const int i = p.i(), j = p.j();
const units::System::Ptr m_sys
unit system used by this component
const Time & time() const
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
const std::shared_ptr< const Grid > m_grid
grid used by this component
High-level PISM I/O class.
array::CellType2 cell_type
array::Scalar2 ice_thickness
Combines the max. time step with the flag indicating if a restriction is active. Makes is possible to...
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void set_interpolation_type(InterpolationType type)
void define(const File &file, io::Type default_type) const
Define variables corresponding to an Array in a file opened using file.
void write(const std::string &filename) const
void set(double c)
Result: v[j] <- c for all j.
void regrid(const std::string &filename, io::Default default_value)
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
bool grounded(int i, int j) const
"Cell type" mask. Adds convenience methods to array::Scalar.
void adjust_mass_flux(double time, const array::Scalar &ice_thickness, const array::CellType &cell_type, array::Scalar &result) const
const array::Scalar & melt_impl() const
const array::Scalar & accumulation_impl() const
std::shared_ptr< array::Scalar > m_mass_flux
void write_model_state_impl(const File &output) const
The default (empty implementation).
MaxTimestep max_timestep_impl(double t) const
void define_model_state_impl(const File &output) const
The default (empty implementation).
double m_ice_free_thickness_threshold
void init_impl(const Geometry &geometry)
double m_alpha_ice_free_factor
array::Scalar m_target_thickness
const array::Scalar & runoff_impl() const
void update_impl(const Geometry &geometry, double t, double dt)
ForceThickness(std::shared_ptr< const Grid > g, std::shared_ptr< SurfaceModel > input)
const array::Scalar & mass_flux_impl() const
static std::shared_ptr< array::Scalar > allocate_runoff(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_mass_flux(std::shared_ptr< const Grid > grid)
void dummy_accumulation(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< array::Scalar > m_melt
static std::shared_ptr< array::Scalar > allocate_accumulation(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_melt(std::shared_ptr< const Grid > grid)
std::shared_ptr< array::Scalar > m_runoff
void dummy_melt(const array::Scalar &smb, array::Scalar &result)
std::shared_ptr< SurfaceModel > m_input_model
std::shared_ptr< array::Scalar > m_accumulation
void dummy_runoff(const array::Scalar &smb, array::Scalar &result)
The interface of PISM's surface models.
#define PISM_ERROR_LOCATION
double min(const array::Scalar &input)
Finds minimum over all the values in an array::Scalar object. Ignores ghosts.
@ PISM_READONLY
open an existing file for reading only
double convert(System::Ptr system, double input, const std::string &spec1, const std::string &spec2)
Convert a quantity from unit1 to unit2.