19 #include "pism/icemodel/IceModel.hh"
21 #include "pism/util/ConfigInterface.hh"
22 #include "pism/util/Grid.hh"
24 #include "pism/frontretreat/FrontRetreat.hh"
25 #include "pism/frontretreat/calving/CalvingAtThickness.hh"
26 #include "pism/frontretreat/calving/EigenCalving.hh"
27 #include "pism/frontretreat/calving/FloatKill.hh"
28 #include "pism/frontretreat/calving/HayhurstCalving.hh"
29 #include "pism/frontretreat/calving/vonMisesCalving.hh"
31 #include "pism/energy/EnergyModel.hh"
32 #include "pism/coupler/FrontalMelt.hh"
33 #include "pism/stressbalance/ShallowStressBalance.hh"
34 #include "pism/hydrology/Hydrology.hh"
35 #include "pism/frontretreat/util/remove_narrow_tongues.hh"
36 #include "pism/frontretreat/PrescribedRetreat.hh"
37 #include "pism/util/ScalarForcing.hh"
38 #include "pism/util/label_components.hh"
52 for (
auto p =
grid->points(); p; p.next()) {
53 const int i = p.i(), j = p.j();
73 for (
auto p =
grid->points(); p; p.next()) {
74 const int i = p.i(), j = p.j();
89 bool calving_is_active =
91 bool frontal_melt_only_open_ocean =
m_config->get_flag(
"frontal_melt.open_ocean_margins_only");
93 auto &open_ocean_mask = *
m_work2d[3];
94 if (calving_is_active or (
m_frontal_melt and frontal_melt_only_open_ocean)) {
97 open_ocean_mask.set(1.0);
153 if (frontal_melt_only_open_ocean) {
157 const int i = p.i(), j = p.j();
159 if (open_ocean_mask(i, j) < 0.5) {
160 retreat_rate(i, j) = 0.0;
170 bool add_values =
false;
181 if (calving_is_active) {
187 if (retreat_rate_based_calving) {
191 retreat_rate.
set(0.0);
216 const int i = p.i(), j = p.j();
218 if (open_ocean_mask(i, j) < 0.5) {
219 retreat_rate(i, j) = 0.0;
229 auto thickness_threshold =
m_config->get_number(
"stress_balance.ice_free_thickness_standard");
242 auto &modified_cell_type = *
m_work2d[2];
252 const int i = p.i(), j = p.j();
254 if (cell_type.ice_free_ocean(i, j) and open_ocean_mask(i, j) < 0.5) {
260 modified_cell_type(i, j) = cell_type(i, j);
275 bool add_values =
false;
295 bool add_values =
false;
314 bool add_values =
true;
344 &Href, &Href_old, &output};
346 for (
auto p =
m_grid->points(); p; p.next()) {
347 const int i = p.i(), j = p.j();
350 H_old = thickness_old(i, j) + Href_old(i, j),
351 H_new = thickness(i, j) + Href(i, j),
352 change = H_new - H_old;
355 output(i, j) += change;
357 output(i, j) = change;
array::Scalar1 sea_level_elevation
void ensure_consistency(double ice_free_thickness_threshold)
array::Scalar1 ice_area_specific_volume
array::CellType2 cell_type
array::Scalar2 ice_thickness
array::Scalar2 bed_elevation
void enforce_consistency_of_geometry(ConsistencyFlag flag)
Update the surface elevation and the flow-type mask when the geometry has changed.
void compute_geometry_change(const array::Scalar &thickness, const array::Scalar &Href, const array::Scalar &thickness_old, const array::Scalar &Href_old, bool add_values, array::Scalar &output)
std::shared_ptr< stressbalance::StressBalance > m_stress_balance
std::shared_ptr< petsc::Vec > m_work2d_proc0
const Config::Ptr m_config
Configuration flags and parameters.
ThicknessChanges m_thickness_change
const Time::Ptr m_time
Time manager.
std::shared_ptr< frontalmelt::FrontalMelt > m_frontal_melt
std::shared_ptr< Grid > grid() const
Return the grid used by this model.
virtual void front_retreat_step()
std::shared_ptr< calving::EigenCalving > m_eigen_calving
std::unique_ptr< ScalarForcing > m_calving_rate_factor
std::vector< std::shared_ptr< array::Scalar2 > > m_work2d
std::shared_ptr< calving::CalvingAtThickness > m_thickness_threshold_calving
std::shared_ptr< calving::FloatKill > m_float_kill_calving
void identify_open_ocean(const array::CellType &cell_type, array::Scalar &result)
std::shared_ptr< PrescribedRetreat > m_prescribed_retreat
std::shared_ptr< calving::HayhurstCalving > m_hayhurst_calving
array::Scalar1 m_ice_thickness_bc_mask
Mask prescribing locations where ice thickness is held constant.
std::unique_ptr< hydrology::Hydrology > m_subglacial_hydrology
std::shared_ptr< calving::vonMisesCalving > m_vonmises_calving
double m_dt
mass continuity time step, s
std::shared_ptr< energy::EnergyModel > m_energy_model
const std::shared_ptr< Grid > m_grid
Computational grid.
std::shared_ptr< FrontRetreat > m_front_retreat
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
void copy_from(const Array2D< T > &source)
void add(double alpha, const Array2D< T > &x)
void scale(double alpha)
Result: v <- v * alpha. Calls VecScale.
std::shared_ptr< const Grid > grid() const
void set(double c)
Result: v[j] <- c for all j.
void update_ghosts()
Updates ghost points.
bool ice_free_ocean(int i, int j) const
"Cell type" mask. Adds convenience methods to array::Scalar.
void compute_magnitude(const array::Vector &input, array::Scalar &result)
bool domain_edge(const Grid &grid, int i, int j)
void remove_narrow_tongues(const Geometry &geometry, array::Scalar &ice_thickness)
void label_components(array::Scalar &mask, petsc::Vec &mask_p0, bool identify_icebergs, double mask_grounded)
array::Scalar forced_retreat
array::Scalar frontal_melt