Skip to content

Commit

Permalink
Merge pull request #207 from jtwhite79/hotfix_winftx
Browse files Browse the repository at this point in the history
Hotfix winftx
  • Loading branch information
jtwhite79 committed Sep 25, 2022
2 parents c8af2b1 + d93488e commit f2245f9
Show file tree
Hide file tree
Showing 21 changed files with 688 additions and 150 deletions.
10 changes: 8 additions & 2 deletions benchmarks/basic_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,7 @@ def fr_fail_test():
os.remove(oe_file)
pst.control_data.noptmax = 1
pst.pestpp_options["panther_transfer_on_fail"] = "10par_xsec.list"
pst.pestpp_options["ies_num_reals"] = 10
#pst.pestpp_options["panther_agent_freeze_on_fail"] = True
pst.write(os.path.join(new_d, "pest.pst"))
try:
Expand All @@ -1138,6 +1139,11 @@ def fr_fail_test():
oe_file = os.path.join(m_d, "pest.0.obs.csv")
assert not os.path.exists(oe_file)

trx_files = [f for f in os.listdir(m_d) if f.endswith(".list")]
print(trx_files)
assert len(trx_files) == 11,len(trx_files)





Expand Down Expand Up @@ -1299,6 +1305,6 @@ def ins_missing_e_test():
#cmdline_test()
#basic_sqp_test()
#mf6_v5_ies_test()
fr_timeout_test()
#fr_fail_test()
#fr_timeout_test()
fr_fail_test()
#tplins1_test()
Binary file not shown.
29 changes: 22 additions & 7 deletions documentation/pestpp_users_manual.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions references.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# A Brief Compendium of Use Cases for PEST++


## Published Papers on Theory and Background

* White, Jeremy T. "A model-independent iterative ensemble smoother for efficient history-matching and uncertainty quantification in very high dimensions." Environmental Modelling & Software 109 (2018): 191-201. [https://www.sciencedirect.com/science/article/abs/pii/S1364815218302676?via%3Dihub](https://www.sciencedirect.com/science/article/abs/pii/S1364815218302676?via%3Dihub)
* White, J.T., Hunt, R.J., Fienen, M.N., and Doherty, J.E., 2020, Approaches to Highly Parameterized Inversion: PEST++ Version 5, a Software Suite for Parameter Estimation, Uncertainty Analysis, Management Optimization and Sensitivity Analysis: U.S. Geological Survey Techniques and Methods 7C26, 52 p., [https://doi.org/10.3133/tm7C26](https://doi.org/10.3133/tm7C26).
* White, J.T., Fienen, M.N., Barlow, P.M. and Welter, D.E., 2018. A tool for efficient, model-independent management optimization under uncertainty. Environmental modelling & software, 100, pp.213-221. [https://doi.org/10.1016/j.envsoft.2017.11.019](https://doi.org/10.1016/j.envsoft.2017.11.019)
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.1.21";
#define PESTPP_VERSION "5.1.23";

#if defined(_WIN32) || defined(_WIN64)
#define OS_WIN
Expand Down
39 changes: 32 additions & 7 deletions src/libs/common/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,17 @@ map<string, double> read_twocol_ascii_to_map(string filename, int header_lines,
map<string, double> result;
ifstream fin(filename);
if (!fin.good())
throw runtime_error("could not open file " + filename + " for reading");
string line;
{
cout << "ERROR: could not open file " + filename + " for reading" << endl;
cerr << "ERROR: could not open file " + filename + " for reading" << endl;

throw runtime_error("could not open file " + filename + " for reading");

}

string line, dtoken;
double value;
size_t idx;
vector<string> tokens;
for (int i = 0; i < header_lines; i++)
getline(fin, line);
Expand All @@ -394,8 +402,21 @@ map<string, double> read_twocol_ascii_to_map(string filename, int header_lines,
tokenize(line, tokens,"\t\r, ");
//only use the first two columns of file
if (tokens.size() < data_col + 1)
throw runtime_error("not enough entries on line :" + line);
convert_ip(tokens[data_col], value);
{
cout << "ERROR: not enough entries on line :"<< line << " of file " << filename << endl;
cerr << "ERROR: not enough entries on line :"<< line << " of file " << filename << endl;
throw runtime_error("not enough entries on line :" + line);
}

value = stod(tokens[data_col],&idx);
//convert_ip(tokens[data_col], value);
if (idx != tokens[data_col].size())
{
cout << "WARNING: left over chars after data for token " << tokens[data_col] << " on line " << line << " of file " << filename << endl;
cerr << "WARNING: left over chars after data for token " << tokens[data_col] << " on line " << line << " of file " << filename << endl;
throw runtime_error("WARNING: left over chars after data for token "+tokens[data_col]+" on line "+line+" of file "+filename);
}

result[tokens[0]] = value;
}
fin.close();
Expand Down Expand Up @@ -785,7 +806,9 @@ void read_dense_binary(const string& filename, vector<string>& row_names, vector
double data = -1.;
// record current position in file
streampos begin_rows = in.tellg();

in.seekg(0,std::ios::end);
streampos end = in.tellg();
in.seekg(begin_rows,std::ios::beg);
//read the row names so we can dimension the matrix
while (true)
{
Expand All @@ -795,8 +818,10 @@ void read_dense_binary(const string& filename, vector<string>& row_names, vector
{
break;
}

in.read((char*)&(name_size), sizeof(name_size));
if (in.tellg() == end) {
break;
}
in.read((char*)&(name_size), sizeof(name_size));
if (!in.good())
{
ss.str("");
Expand Down
10 changes: 9 additions & 1 deletion src/libs/pestpp_common/Ensemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ void Ensemble::draw(int num_reals, Covariance cov, Transformable &tran, const ve
//make sure the cov is aligned
if (cov.get_col_names() != draw_names)
cov = cov.get(draw_names);

if (level > 3)
cout << "cov:" << cov << endl;
//make standard normal draws
plog->log_event("making standard normal draws");
//RedSVD::sample_gaussian(draws);
Expand All @@ -231,6 +232,10 @@ void Ensemble::draw(int num_reals, Covariance cov, Transformable &tran, const ve
ofstream f("standard_normal_draws.dat");
f << draws << endl;
f.close();
if (level > 3)
{
cout << "standard normal draws: " << draws << endl;
}
}
//Eigen::MatrixXd draws_temp = draws;

Expand Down Expand Up @@ -328,12 +333,15 @@ void Ensemble::draw(int num_reals, Covariance cov, Transformable &tran, const ve
{
found_invalid = true;
iv++;
if (level>3)
cout << "invalid: " << draw_names[j] << ": " << draws(i,j) << endl;
}

}
if ((level>2) && (iv > 0))
{
cout << iv+1 << " invalid values found for " << draw_names[j] << endl;

}
}

Expand Down
Loading

0 comments on commit f2245f9

Please sign in to comment.