Have version working that formats an input file for Orchestra, runs Orchestra with a system call to a batch file, reads results from Orchestra, stores results in global phreeqc storage, and prints results.

Works only for initial solution calculation.

Still some problems with the solver. Ex1 fails.

Cleaned up organization a little. Ready to start on "reaction" calculation.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@2176 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2007-08-07 15:04:13 +00:00
parent 0f2ef116f2
commit c78dd87daf
4 changed files with 35 additions and 32 deletions

View File

@ -731,6 +731,8 @@ void cxxISolution::ORCH_write_chemistry_minerals(std::ostream &chemistry_dat)
}
}
}
//chemistry_dat << "@mineral(Quartz)" << std::endl;
//chemistry_dat << "@sreaction(Quartz, 10139.1138573668, -2.0, H2O, 1.0, H4SiO4)" << std::endl;
}
void cxxISolution::ORCH_write_input(std::ostream &input_dat)
{
@ -854,7 +856,7 @@ void cxxISolution::ORCH_write_input(std::ostream &input_dat)
return;
}
void cxxISolution::ORCH_write_output(std::ostream &outstream)
void cxxISolution::ORCH_write_output_vars(std::ostream &outstream)
{
outstream << "Var:";
outstream << "\tnr_iter";
@ -928,31 +930,3 @@ void cxxISolution::ORCH_write_output(std::ostream &outstream)
outstream << std::endl;
return;
}
void cxxISolution::ORCH_store_global(std::map < std::string, double > output_map)
{
int i;
tc_x = this->tc;
mass_water_aq_x = this->mass_water;
mu_x = this->mu;
s_h2o->moles = output_map["H2O.con"];
s_h2o->la = log10(output_map["H2O.act"]);
s_h2o->lm = s_h2o->la;
s_h2o->lg = 0;
for (i = 0; i < count_unknowns; i++)
{
residual[i] = 0;
// MB, ALK, CB, SOLUTION_PHASE_BOUNDARY, MU, AH2O
switch (x[i]->type)
{
case MB:
case CB:
case SOLUTION_PHASE_BOUNDARY:
x[i]->sum = this->totals[x[i]->description]*mass_water_aq_x;
break;
case ALK:
x[i]->f = this->total_alkalinity*mass_water_aq_x;
break;
}
}
}

View File

@ -43,8 +43,7 @@ public:
void ConvertUnits();
void ORCH_write_chemistry(std::ostream &chemistry_dat);
void ORCH_write_input(std::ostream &input_dat);
void ORCH_write_output(std::ostream &input_dat);
void ORCH_store_global(std::map < std::string, double > output_map);
void ORCH_write_output_vars(std::ostream &input_dat);
protected:
friend class cxxISolutionComp; // for this->pe access

View File

@ -964,6 +964,7 @@ double cxxSolution::get_master_activity(char *string)const
return(it->second);
}
}
void cxxSolution::ORCH_read(std::vector <std::pair <std::string, double> > output_vector, std::vector < std::pair < std::string, double > >::iterator &it)
{
this->tc = it->second; it++;
@ -1038,6 +1039,35 @@ void cxxSolution::ORCH_read(std::vector <std::pair <std::string, double> > outpu
s_ptr->lg = s_ptr->la - s_ptr->lm;
}
}
void cxxSolution::ORCH_store_global(std::map < std::string, double > output_map)
{
int i;
tc_x = this->tc;
mass_water_aq_x = this->mass_water;
mu_x = this->mu;
s_h2o->moles = output_map["H2O.con"];
s_h2o->la = log10(output_map["H2O.act"]);
s_h2o->lm = s_h2o->la;
s_h2o->lg = 0;
for (i = 0; i < count_unknowns; i++)
{
residual[i] = 0;
// MB, ALK, CB, SOLUTION_PHASE_BOUNDARY, MU, AH2O
switch (x[i]->type)
{
case MB:
case CB:
case SOLUTION_PHASE_BOUNDARY:
x[i]->sum = this->totals[x[i]->description]*mass_water_aq_x;
break;
case ALK:
x[i]->f = this->total_alkalinity*mass_water_aq_x;
break;
}
}
}
#ifdef USE_MPI
#include <mpi.h>
/* ---------------------------------------------------------------------- */

View File

@ -85,7 +85,7 @@ public:
void multiply(double extensive);
void ORCH_write(std::ostream& headings, std::ostream& input_data)const;
void ORCH_read(std::vector <std::pair <std::string, double> > output_vector, std::vector < std::pair < std::string, double > >::iterator &it);
void ORCH_store_global(std::map < std::string, double > output_map);
#ifdef USE_MPI
void mpi_pack(std::vector<int>& ints, std::vector<double>& doubles);