3 #include "pism/icebin/MassEnergyBudget.hh"
4 #include "pism/util/VariableMetadata.hh"
10 : mass(grid, name +
".mass"), enth(grid, name +
".enth") {
19 std::string
const &prefix)
20 : total(grid, prefix +
"total"),
21 basal_frictional_heating(grid, prefix +
"basal_frictional_heating"),
22 strain_heating(grid, prefix +
"strain_heating"),
23 geothermal_flux(grid, prefix +
"geothermal_flux"),
24 upward_geothermal_flux(grid, prefix +
"upward_geothermal_flux"),
25 calving(grid, prefix +
"calving"),
26 smb(grid, prefix +
"smb"),
27 deltah(grid, prefix +
"deltah"),
28 pism_smb(grid, prefix +
"pism_smb"),
29 href_to_h(grid, prefix +
"href_to_h"),
30 nonneg_rule(grid, prefix +
"nonneg_rule"),
31 melt_grounded(grid, prefix +
"melt_grounded"),
32 melt_floating(grid, prefix +
"melt_floating"),
33 internal_advection(grid, prefix +
"internal_advection"),
34 epsilon(grid, prefix +
"epsilon") {
38 total.
set_attrs(
"State of the ice sheet (NOT a difference between time steps)",
"m-2");
51 .
long_name(
"Geothermal energy through (compare to upward_geothermal_flux?)")
56 .
long_name(
"Geothermal energy through (compare to geothermal_flux?)")
105 out <<
"epsilon.mass = total.mass -" << std::endl;
112 sprintf(str,
"%p", (
void *)&ii->vec);
113 out << ii->vec.get_name() <<
" + ";
115 out <<
")" << std::endl;
118 out <<
"epsilon.enth = total.enth -" << std::endl;
125 sprintf(str,
"%p", (
void *)&ii->vec);
126 out << ii->vec.get_name() <<
" + ";
128 out <<
")" << std::endl;
141 for (
int i = grid->xs(); i < grid->xs() + grid->xm(); ++i) {
142 for (
int j = grid->ys(); j < grid->ys() + grid->ym(); ++j) {
156 ii.vec.begin_access();
157 for (
int i = grid->xs(); i < grid->xs() + grid->xm(); ++i) {
158 for (
int j = grid->ys(); j < grid->ys() + grid->ym(); ++j) {
169 for (
int i = grid->xs(); i < grid->xs() + grid->xm(); ++i) {
170 for (
int j = grid->ys(); j < grid->ys() + grid->ym(); ++j) {
182 printf(
"epsilon.energy: %s\n", ii.vec.get_name().c_str());
184 ii.vec.begin_access();
185 for (
int i = grid->xs(); i < grid->xs() + grid->xm(); ++i) {
186 for (
int j = grid->ys(); j < grid->ys() + grid->ym(); ++j) {
virtual void end_access() const
Checks if an Array is allocated and calls DAVecRestoreArray.
virtual void begin_access() const
Checks if an Array is allocated and calls DAVecGetArray.
std::shared_ptr< const Grid > grid() const
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
pism::array::Scalar href_to_h
SMB as seen by PISM in iMgeometry.cc massContExplicitSte(). Used to check icebin_smb....
MassEnergyBudget(std::shared_ptr< const pism::Grid > grid, std::string const &prefix)
pism::array::Scalar nonneg_rule
std::ostream & print_formulas(std::ostream &out)
MassEnthVec2S calving
Equal to IceModel::discharge_flux_2D_cumulative.
pism::array::Scalar geothermal_flux
Total amount of geothermal energy [J/m^2].
MassEnthVec2S internal_advection
MassEnthVec2S smb
accumulation / ablation, as provided by Icebin
pism::array::Scalar basal_frictional_heating
Total amount of basal friction heating [J/m^2].
std::vector< VecWithFlags > all_vecs
void add_enth(pism::array::Scalar &vec, int flags, std::string const &contract_name)
pism::array::Scalar strain_heating
Total amount of strain heating [J/m^2].
MassEnthVec2S melt_grounded
basal melt (grounded) (from summing meltrate_grounded)
pism::array::Scalar upward_geothermal_flux
Total amount of geothermal energy [J/m^2].
MassEnthVec2S melt_floating
sub-shelf melt (from summing meltrate_floating)
void add_massenth(MassEnthVec2S &massenth, int flags, std::string const &contract_name_mass, std::string const &contract_name_enth)
void add_mass(pism::array::Scalar &vec, int flags, std::string const &contract_name)
pism::array::Scalar deltah
Change in enthalpy of top layer.
std::string printf(const char *format,...)
void set_attrs(const std::string &long_name, const std::string &units)
MassEnthVec2S(std::shared_ptr< const pism::Grid > grid, const std::string &name)