22 #include "pism/util/array/Scalar.hh"
23 #include "pism/inverse/IPDesignVariableParameterization.hh"
24 #include "pism/util/ConfigInterface.hh"
25 #include "pism/util/Grid.hh"
26 #include "pism/util/error_handling.hh"
27 #include "pism/util/pism_utilities.hh"
42 const std::string &design_var_name) {
43 std::string key(
"inverse.design.param_");
44 key += design_var_name;
62 const int i = p.i(), j = p.j();
65 if (std::isnan(d(i, j))) {
66 ierr = PetscPrintf(PETSC_COMM_WORLD,
67 "made a d nan zeta = %g d = %g\n",
94 const int i = p.i(), j = p.j();
97 if (std::isnan(zeta(i, j))) {
98 ierr = PetscPrintf(PETSC_COMM_WORLD,
99 "made a zeta nan d = %g zeta = %g\n",
100 d(i, j), zeta(i, j));
115 double *derivative) {
119 if (derivative != NULL) {
130 double *derivative) {
134 if (derivative != NULL) {
149 std::string key(
"inverse.design.param_");
150 key += design_var_name;
156 double *derivative) {
161 if (derivative != NULL) {
175 const std::string &design_var_name) {
178 auto key =
pism::printf(
"inverse.design.param_trunc_%s0", design_var_name.c_str());
183 key =
pism::printf(
"inverse.design.param_%s_eps", design_var_name.c_str());
189 double *derivative) {
190 double alpha = sqrt(p*p + 4*
m_d0_sq);
194 if (derivative != NULL) {
195 *derivative =
m_d_scale*(1 + p / alpha)*0.5;
205 *OUTPUT = d_dimensionless -
m_d0_sq / d_dimensionless;
double get_number(const std::string &name, UseFlag flag=REMEMBER_THIS_USE) const
A class for storing and accessing PISM configuration flags and parameters.
PointsWithGhosts points(unsigned int stencil_width=0) const
Describes the PISM grid and the distribution of data across processors.
void failed()
Indicates a failure of a parallel section.
Makes sure that we call begin_access() and end_access() for all accessed array::Arrays.
std::shared_ptr< const Grid > grid() const
void update_ghosts()
Updates ghost points.
virtual void set_scales(const Config &config, const std::string &design_var_name)
Initializes the scale parameters of the parameterization.
virtual void toDesignVariable(double p, double *value, double *derivative)
Converts from parameterization value to .
virtual void fromDesignVariable(double tauc, double *OUTPUT)
Converts from to a parameterization value such that .
virtual void toDesignVariable(double p, double *value, double *derivative)
Converts from parameterization value to .
virtual void fromDesignVariable(double tauc, double *OUTPUT)
Converts from to a parameterization value such that .
virtual void toDesignVariable(double p, double *value, double *derivative)
Converts from parameterization value to .
virtual void fromDesignVariable(double tauc, double *OUTPUT)
Converts from to a parameterization value such that .
virtual void toDesignVariable(double p, double *value, double *derivative)
Converts from parameterization value to .
virtual void set_scales(const Config &config, const std::string &design_var_name)
Initializes the scale parameters of the parameterization.
virtual void fromDesignVariable(double d, double *OUTPUT)
Converts from to a parameterization value such that .
double m_d_scale
Value of in PISM units that equals 1 for IPDesignVariableParameterization's units.
virtual void convertToDesignVariable(array::Scalar &zeta, array::Scalar &d, bool communicate=true)
Transforms a vector of values to a vector of values.
virtual void convertFromDesignVariable(array::Scalar &d, array::Scalar &zeta, bool communicate=true)
Transforms a vector of values to a vector of values.
virtual void fromDesignVariable(double d, double *OUTPUT)=0
Converts from to a parameterization value such that .
virtual void toDesignVariable(double zeta, double *value, double *derivative)=0
Converts from parameterization value to .
virtual void set_scales(const Config &config, const std::string &design_var_name)
Initializes the scale parameters of the parameterization.
#define PISM_CHK(errcode, name)
std::string printf(const char *format,...)