Skip to content

Commit

Permalink
Merge branch 'upstream/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Jan 19, 2024
2 parents d4730a7 + ab3f6a8 commit 83fdf25
Show file tree
Hide file tree
Showing 10 changed files with 399 additions and 199 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
229 changes: 125 additions & 104 deletions documentation/pestpp_users_manual.md

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions documentation/tocgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def clean_4_toc(docx_file,inFile,outFile,run_pandoc=True):
math_str_pre = "<img src=\"https://latex.codecogs.com/svg.latex?\Large&space;{0}".format(eq_str)
math_str_post = "\" title=\"\Large {0}\" /> {1} <br>".format(eq_str,label)
lines[i] = math_str_pre + " " + math_str_post
if lines[i].strip().startswith("<table>"): # and "pcf" in lines[i].lower():
lines[i] = "<div style=\"text-align: left\">" + lines[i] + "</div>"
if "comment" in lines[i].lower():
lines[i] = lines[i].replace("~","#")
# elif "bmatrix" in lines[i].lower():
# eq_str = lines[i]
# lines.pop(i)
Expand Down
2 changes: 1 addition & 1 deletion src/libs/common/config_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_OS_H_


#define PESTPP_VERSION "5.2.7";
#define PESTPP_VERSION "5.2.8";

#if defined(_WIN32) || defined(_WIN64)
#define OS_WIN
Expand Down
308 changes: 224 additions & 84 deletions src/libs/pestpp_common/EnsembleMethodUtils.cpp

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/libs/pestpp_common/EnsembleMethodUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ class L2PhiHandler

map<string,double> get_meas_phi(ObservationEnsemble& oe, Eigen::VectorXd& q_vec);

map<string,map<string,double>> get_meas_swr_real_map(ObservationEnsemble& oe, ObservationEnsemble& weights);
map<string,map<string,double>> get_swr_real_map(ObservationEnsemble& oe, ObservationEnsemble& weights,phiType ptype=phiType::MEAS);

map<string,double> get_actual_swr_map(ObservationEnsemble& oe, string real_name="");
map<string,double> get_swr_map(ObservationEnsemble& oe, string real_name= "",phiType ptype=phiType::MEAS);
map<string,map<string,double>> get_meas_phi_weight_ensemble(ObservationEnsemble& oe, ObservationEnsemble& weights);

vector<string> get_violating_realizations(ObservationEnsemble& oe, const vector<string>& viol_obs_names);
Expand Down Expand Up @@ -178,9 +178,9 @@ class ParChangeSummarizer
map<string, double> init_cv;
map<string, double> curr_cv;
map<string, int> num_at_ubound;
map<string, int> percent_at_ubound;
map<string, double> percent_at_ubound;
map<string, int> num_at_lbound;
map<string, int> percent_at_lbound;
map<string, double> percent_at_lbound;

void update(ParameterEnsemble& pe);
void write_to_csv(string& filename);
Expand Down Expand Up @@ -499,5 +499,9 @@ class EnsembleMethod

void prep_drop_violations();

void remove_external_pe_filenames(vector<string>& pe_filenames);

double get_lambda();

};
#endif
23 changes: 22 additions & 1 deletion src/libs/pestpp_common/EnsembleSmoother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ void IterEnsembleSmoother::iterate_2_solution()
ofstream &frec = file_manager.rec_ofstream();

bool accept;
int n_iter_mean = pest_scenario.get_pestpp_options().get_ies_n_iter_mean();

for (int i = 0; i < pest_scenario.get_control_info().noptmax; i++)
{
iter++;
Expand Down Expand Up @@ -68,8 +70,27 @@ void IterEnsembleSmoother::iterate_2_solution()
else
consec_bad_lambda_cycles++;

if (iter == n_iter_mean)
{
double phi_lam = get_lambda();
//if (phi_lam > last_best_lam)
//{
last_best_lam = phi_lam;
message(1,"iter = ies_n_iter_mean, resetting lambda to ",last_best_lam);
//}
consec_bad_lambda_cycles = 0;
}

if (should_terminate())
break;
{
if (iter > pest_scenario.get_pestpp_options().get_ies_n_iter_mean()) {
break;
}
else{
message(1,"continuing iterations to satisfy ies_n_iter_mean");
}
}

}
}

Expand Down
14 changes: 10 additions & 4 deletions src/libs/pestpp_common/pest_data_structs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,12 @@ bool PestppOptions::assign_ies_value_by_key(const string& key, const string& val
ies_phi_factors_by_real = pest_utils::parse_string_arg_to_bool(value);
return true;
}

return false;
else if (key == "IES_N_ITER_MEAN")
{
convert_ip(value,ies_n_iter_mean);
return true;
}
return false;
}

bool PestppOptions::assign_da_value_by_key(const string& key, const string& value, const string& org_value)
Expand Down Expand Up @@ -1805,6 +1809,7 @@ void PestppOptions::summary(ostream& os) const
os << "ies_localizer_forgive_extra: " << ies_localizer_forgive_missing << endl;
os << "ies_phi_factors_file: " << ies_phi_fractions_file << endl;
os << "ies_phi_factors_by_real: " << ies_phi_factors_by_real << endl;
os << "ies_n_iter_mean: " << ies_n_iter_mean << endl;


os << endl << "pestpp-sen options: " << endl;
Expand Down Expand Up @@ -1945,8 +1950,8 @@ void PestppOptions::set_defaults()
set_ies_verbose_level(1);
set_ies_use_prior_scaling(false);
set_ies_num_reals(50);
set_ies_bad_phi(1.0e+300);
set_ies_bad_phi_sigma(1.0e+300);
set_ies_bad_phi(std::numeric_limits<double>::max());
set_ies_bad_phi_sigma(std::numeric_limits<double>::max());
set_ies_include_base(true);
set_ies_use_empirical_prior(false);
set_ies_group_draws(true);
Expand Down Expand Up @@ -1988,6 +1993,7 @@ void PestppOptions::set_defaults()
set_ies_localizer_forgive_missing(false);
set_ies_phi_fractions_files("");
set_ies_phi_factors_by_real(false);
set_ies_n_iter_mean(0);

// DA parameters
//set_da_use_ies(false);
Expand Down
6 changes: 5 additions & 1 deletion src/libs/pestpp_common/pest_data_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,11 @@ class PestppOptions {
void set_ies_multimodal_alpha(double _flag) { ies_multimodal_alpha = _flag; }
void set_ensemble_output_precision(int prec) { ensemble_output_precision = prec;}
int get_ensemble_output_precision() const {return ensemble_output_precision;}
void set_ies_n_iter_mean(int _n_iter_mean) {ies_n_iter_mean = _n_iter_mean;}
int get_ies_n_iter_mean() const {return ies_n_iter_mean;}

string get_gsa_method() const { return gsa_method; }

string get_gsa_method() const { return gsa_method; }
void set_gsa_method(string _m) { gsa_method = _m; }
bool get_gsa_morris_pooled_obs() const { return gsa_morris_pooled_obs; }
void set_gsa_morris_pooled_obs(bool _flag) {gsa_morris_pooled_obs = _flag; }
Expand Down Expand Up @@ -812,6 +815,7 @@ class PestppOptions {
bool ies_localizer_forgive_missing;
string ies_phi_fractions_file;
bool ies_phi_factors_by_real;
int ies_n_iter_mean;


// Data Assimilation parameters
Expand Down

0 comments on commit 83fdf25

Please sign in to comment.