4
#if !defined(PHREEQCRM_H_INCLUDED)
5
#define PHREEQCRM_H_INCLUDED
8
#define MP_TYPE MPI_Comm
16
#include "NameDouble.h"
26
#define IRM_DLL_EXPORT __declspec(dllexport)
28
#define IRM_DLL_EXPORT
42
const
char
*what()
const
throw
() {
return
"Failure in PhreeqcRM\n"
;}
51
METHOD_FINDCOMPONENTS,
52
METHOD_GETCONCENTRATIONS,
54
METHOD_GETERRORSTRING,
55
METHOD_GETGASCOMPMOLES,
56
METHOD_GETGASCOMPPRESSURES,
58
METHOD_GETGASPHASEVOLUME,
61
METHOD_GETSELECTEDOUTPUT,
62
METHOD_GETSOLUTIONVOLUME,
63
METHOD_GETSPECIESCONCENTRATIONS,
64
METHOD_GETSPECIESLOG10GAMMAS,
65
METHOD_GETSPECIESLOG10MOLALITIES,
66
METHOD_GETTEMPERATURE,
67
METHOD_INITIALPHREEQC2MODULE,
68
METHOD_INITIALPHREEQCCELL2MODULE,
70
METHOD_MPIWORKERBREAK,
74
METHOD_SETCOMPONENTH2O,
75
METHOD_SETCONCENTRATIONS,
77
METHOD_SETERRORHANDLERMODE,
79
METHOD_SETGASCOMPMOLES,
80
METHOD_SETGASPHASEVOLUME,
81
METHOD_SETPARTITIONUZSOLIDS,
84
METHOD_SETPRINTCHEMISTRYON,
85
METHOD_SETPRINTCHEMISTRYMASK,
86
METHOD_SETREBALANCEBYCELL,
87
METHOD_SETREBALANCEFRACTION,
88
METHOD_SETREPRESENTATIVEVOLUME,
90
METHOD_SETSELECTEDOUTPUTON,
91
METHOD_SETSPECIESSAVEON,
92
METHOD_SETTEMPERATURE,
94
METHOD_SETTIMECONVERSION,
96
METHOD_SETUNITSEXCHANGE,
97
METHOD_SETUNITSGASPHASE,
98
METHOD_SETUNITSKINETICS,
99
METHOD_SETUNITSPPASSEMBLAGE,
100
METHOD_SETUNITSSOLUTION,
101
METHOD_SETUNITSSSASSEMBLAGE,
102
METHOD_SETUNITSSURFACE,
103
METHOD_SPECIESCONCENTRATIONS2MODULE,
107
METHOD_USESOLUTIONDENSITYVOLUME
133
static
void
CleanupReactionModuleInstances(
void
);
134
static
int
CreateReactionModule(
int
nxyz, MP_TYPE nthreads);
135
static
IRM_RESULT
DestroyReactionModule(
int
n);
178
PhreeqcRM
(
int
nxyz, MP_TYPE thread_count_or_communicator, PHRQ_io * io=NULL);
242
IPhreeqc * Concentrations2Utility(std::vector<double> &c,
243
std::vector<double> tc, std::vector<double> p_atm);
279
IRM_RESULT
CreateMapping(std::vector<int> &grid2chem);
313
void
DecodeError(
int
result);
335
IRM_RESULT
DumpModule(
bool
dump_on,
bool
append =
false
);
358
void
ErrorHandler(
int
result,
const
std::string &e_string);
375
void
ErrorMessage(
const
std::string &error_string,
bool
prepend =
true
);
455
int
FindComponents();
481
const
std::vector < std::vector <int> > &
GetBackwardMapping
(
void
) {
return
this->backward_mapping;}
549
const
std::vector<std::string> &
GetComponents
(
void
)
const
{
return
this->components;}
589
IRM_RESULT
GetConcentrations(std::vector<double> &c);
632
IRM_RESULT
GetDensity(std::vector<double> & density);
668
const
std::vector < int> &
GetEndCell
(
void
)
const
{
return
this->end_cell;}
768
std::string GetErrorString(
void
);
805
const
std::vector<std::string> &
GetExchangeNames
(
void
)
const
{
return
this->ExchangeNamesList; }
840
const
std::vector<std::string> &
GetExchangeSpecies
(
void
)
const
{
return
this->ExchangeSpeciesNamesList; }
944
const
std::vector<std::string> &
GetGasComponents
(
void
)
const
{
return
this->GasComponentsList; }
1006
IRM_RESULT
GetGasCompMoles(std::vector<double>& gas_moles);
1040
IRM_RESULT
GetGasCompPressures(std::vector<double>& gas_pressure);
1075
IRM_RESULT
GetGasCompPhi(std::vector<double>& gas_phi);
1108
IRM_RESULT
GetGasPhaseVolume(std::vector<double>& gas_volume);
1136
const
std::vector < double > &
GetGfw
(
void
) {
return
this->gfw;}
1185
IPhreeqc * GetIPhreeqcPointer(
int
i);
1334
int
GetNthSelectedOutputUserNumber(
int
n);
1389
std::vector<double> & GetPoreVolume(
void
) {
return
this->pore_volume;}
1412
const
std::vector<double> & GetPressure(
void
);
1542
IRM_RESULT
GetSaturation(std::vector<double> & sat);
1574
IRM_RESULT
GetSelectedOutput(std::vector<double> &so);
1613
int
GetSelectedOutputColumnCount(
void
);
1640
int
GetSelectedOutputCount(
void
);
1677
IRM_RESULT
GetSelectedOutputHeading(
int
icol, std::string &heading);
1736
int
GetSelectedOutputRowCount(
void
);
1764
int
GetSICount
(
void
)
const
{
return
(
int
) this->SINamesList.size(); }
1798
const
std::vector<std::string> &
GetSINames
(
void
)
const
{
return
this->SINamesList; }
1928
const
std::vector<double> & GetSolutionVolume(
void
);
1974
IRM_RESULT
GetSpeciesConcentrations(std::vector<double> & species_conc);
2041
const
std::vector<double> &
GetSpeciesD25
(
void
) {
return
this->species_d_25;}
2083
IRM_RESULT
GetSpeciesLog10Gammas(std::vector<double> & species_log10gammas);
2125
IRM_RESULT
GetSpeciesLog10Molalities(std::vector<double>& species_log10molalities);
2281
const
std::vector<double> &
GetSpeciesZ
(
void
) {
return
this->species_z;}
2316
const
std::vector < int> &
GetStartCell
(
void
)
const
{
return
this->start_cell;}
2354
const
std::vector<std::string> &
GetSurfaceNames
(
void
)
const
{
return
this->SurfaceNamesList; }
2391
const
std::vector<std::string> &
GetSurfaceSpecies
(
void
)
const
{
return
this->SurfaceSpeciesNamesList; }
2465
const
std::vector<std::string> &
GetSurfaceTypes
(
void
)
const
{
return
this->SurfaceTypesList; }
2488
const
std::vector<double> & GetTemperature(
void
);
2532
double
GetTime
(
void
)
const
{
return
this->time;}
2808
const
std::vector<IPhreeqcPhast *> &
GetWorkers
() {
return
this->workers;}
2837
std::vector < double > & destination_c,
2838
std::vector < int > & boundary_solution1);
2878
std::vector < double > & destination_c,
2879
std::vector < int > & boundary_solution1,
2880
std::vector < int > & boundary_solution2,
2881
std::vector < double > & fraction1);
2922
IRM_RESULT
InitialPhreeqc2Module(std::vector < int > & initial_conditions1);
2986
std::vector < int > & initial_conditions1,
2987
std::vector < int > & initial_conditions2,
2988
std::vector < double > & fraction1);
3018
IRM_RESULT
InitialPhreeqc2SpeciesConcentrations(
3019
std::vector < double > & destination_c,
3020
std::vector < int > & boundary_solution1);
3060
IRM_RESULT
InitialPhreeqc2SpeciesConcentrations(
3061
std::vector < double > & destination_c,
3062
std::vector < int > & boundary_solution1,
3063
std::vector < int > & boundary_solution2,
3064
std::vector < double > & fraction1);
3091
IRM_RESULT
InitialPhreeqcCell2Module(
int
n,
const
std::vector<int> &cell_numbers);
3108
IRM_RESULT
LoadDatabase(
const
std::string &database);
3127
void
LogMessage(
const
std::string &str);
3255
void
OutputMessage(
const
std::string &str);
3334
IRM_RESULT
RunFile(
bool
workers,
bool
initial_phreeqc,
bool
utility,
const
std::string & chemistry_name);
3361
IRM_RESULT
RunString(
bool
workers,
bool
initial_phreeqc,
bool
utility,
const
std::string & input_string);
3384
void
ScreenMessage(
const
std::string &str);
3451
IRM_RESULT
SetConcentrations(
const
std::vector<double> &c);
3483
IRM_RESULT
SetCurrentSelectedOutputUserNumber(
int
n_user);
3508
IRM_RESULT
SetDensity(
const
std::vector<double> &density);
3528
IRM_RESULT
SetDumpFileName(
const
std::string & dump_name);
3588
IRM_RESULT
SetFilePrefix(
const
std::string & prefix);
3625
IRM_RESULT
SetGasCompMoles(
const
std::vector<double>& gas_moles);
3664
IRM_RESULT
SetGasPhaseVolume(
const
std::vector<double>& gas_volume);
3761
IRM_RESULT
SetMpiWorkerCallbackC(
int
(*fcn)(
int
*method,
void
* cookie));
3832
IRM_RESULT
SetMpiWorkerCallbackCookie(
void
* cookie);
3837
IRM_RESULT
SetMpiWorkerCallbackFortran(
int
(*fcn)(
int
*method));
3896
IRM_RESULT
SetPorosity(
const
std::vector<double> &por);
3918
IRM_RESULT
SetPressure(
const
std::vector<double> &p);
3945
IRM_RESULT
SetPrintChemistryMask(std::vector<int> & cell_mask);
3980
IRM_RESULT
SetPrintChemistryOn(
bool
workers,
bool
initial_phreeqc,
bool
utility);
4066
IRM_RESULT
SetRepresentativeVolume(
const
std::vector<double> &rv);
4095
IRM_RESULT
SetSaturation(
const
std::vector<double> &sat);
4199
IRM_RESULT
SetTemperature(
const
std::vector<double> &t);
4236
IRM_RESULT
SetTimeConversion(
double
conv_factor);
4404
IRM_RESULT
SetUnitsPPassemblage(
int
option);
4489
IRM_RESULT
SetUnitsSSassemblage(
int
option);
4570
IRM_RESULT
SpeciesConcentrations2Module(std::vector<double> & species_conc);
4689
void
UseSolutionDensityVolume(
bool
tf);
4706
void
WarningMessage(
const
std::string &warnstr);
4709
static
std::string Char2TrimString(
const
char
* str,
size_t
l = 0);
4710
static
bool
FileExists(
const
std::string &name);
4711
static
void
FileRename(
const
std::string &temp_name,
const
std::string &name,
4712
const
std::string &backup_name);
4713
static
IRM_RESULT
Int2IrmResult(
int
r,
bool
positive_ok);
4718
int
*initial_conditions1,
4719
int
*initial_conditions2,
4721
std::set<std::string> &error_set);
4723
int
CheckSelectedOutput();
4726
IPhreeqc * Concentrations2UtilityH2O(std::vector<double> &c_in,
4727
std::vector<double> &t_in, std::vector<double> &p_in);
4728
IPhreeqc * Concentrations2UtilityNoH2O(std::vector<double> &c_in,
4729
std::vector<double> &t_in, std::vector<double> &p_in);
4730
void
Concentrations2Solutions(
int
n, std::vector<double> &c);
4731
void
Concentrations2SolutionsH2O(
int
n, std::vector<double> &c);
4732
void
Concentrations2SolutionsNoH2O(
int
n, std::vector<double> &c);
4733
void
cxxSolution2concentration(cxxSolution * cxxsoln_ptr, std::vector<double> & d,
double
v,
double
dens);
4734
void
cxxSolution2concentrationH2O(cxxSolution * cxxsoln_ptr, std::vector<double> & d,
double
v,
double
dens);
4735
void
cxxSolution2concentrationNoH2O(cxxSolution * cxxsoln_ptr, std::vector<double> & d,
double
v,
double
dens);
4736
void
GatherNchem(std::vector<double> &source, std::vector<double> &destination);
4737
cxxStorageBin & Get_phreeqc_bin(
void
) {
return
*this->phreeqc_bin;}
4738
IRM_RESULT
HandleErrorsInternal(std::vector< int > & r);
4739
void
PartitionUZ(
int
n,
int
iphrq,
int
ihst,
double
new_frac);
4740
void
RebalanceLoad(
void
);
4741
void
RebalanceLoadPerCell(
void
);
4744
IRM_RESULT
RunStringThread(
int
n, std::string & input);
4746
void
Scale_solids(
int
n,
int
iphrq,
double
frac);
4747
void
ScatterNchem(
double
*d_array);
4748
void
ScatterNchem(
int
*i_array);
4749
void
ScatterNchem(std::vector<double> &source, std::vector<double> &destination);
4750
void
ScatterNchem(std::vector<int> &source, std::vector<int> &destination);
4751
IRM_RESULT
SetChemistryFileName(
const
char
* prefix = NULL);
4752
IRM_RESULT
SetDatabaseFileName(
const
char
* db = NULL);
4753
void
SetEndCells(
void
);
4754
void
SetEndCellsHeterogeneous(
void
);
4755
double
TimeStandardTask(
void
);
4756
IRM_RESULT
TransferCells(cxxStorageBin &t_bin,
int
old,
int
nnew);
4757
IRM_RESULT
TransferCellsUZ(std::ostringstream &raw_stream,
int
old,
int
nnew);
4761
IRM_RESULT
SetGeneric(
const
std::vector<double> &source, std::vector<double> &destination_root, std::vector<double> &destination_worker,
int
mpiMethod,
const
std::string &name);
4764
#if defined(_MSC_VER)
4766
#pragma warning(disable:4251)
4771
std::string database_file_name;
4772
std::string chemistry_file_name;
4773
std::string dump_file_name;
4774
std::string file_prefix;
4775
cxxStorageBin * phreeqc_bin;
4778
std::vector <std::string> components;
4779
std::vector <double> gfw;
4781
bool
partition_uz_solids;
4783
int
count_chemistry;
4786
double
time_conversion;
4787
std::vector <double> old_saturation_root;
4788
std::vector <double> old_saturation_worker;
4789
std::vector<double> saturation_root;
4790
std::vector<double> saturation_worker;
4791
std::vector<double> pressure_root;
4792
std::vector<double> pressure_worker;
4793
std::vector<double> rv_root;
4794
std::vector<double> rv_worker;
4795
std::vector<double> porosity_root;
4796
std::vector<double> porosity_worker;
4797
std::vector<double> tempc_root;
4798
std::vector<double> tempc_worker;
4799
std::vector<double> density_root;
4800
std::vector<double> density_worker;
4801
std::vector<double> solution_volume_root;
4802
std::vector<double> solution_volume_worker;
4803
std::vector<int> print_chem_mask_root;
4804
std::vector<int> print_chem_mask_worker;
4805
bool
rebalance_by_cell;
4806
double
rebalance_fraction;
4808
int
units_PPassemblage;
4812
int
units_SSassemblage;
4814
std::vector <int> forward_mapping_root;
4815
std::vector <std::vector <int> > backward_mapping;
4816
bool
use_solution_density_volume;
4819
std::vector<bool> print_chemistry_on;
4820
bool
selected_output_on;
4823
int
error_handler_mode;
4824
bool
need_error_check;
4825
std::string phreeqcrm_error_string;
4829
std::vector<IPhreeqcPhast *> workers;
4830
std::vector<int> start_cell;
4831
std::vector<int> end_cell;
4832
PHRQ_io *phreeqcrm_io;
4833
bool
delete_phreeqcrm_io;
4837
MPI_Comm phreeqcrm_comm;
4839
int (*mpi_worker_callback_fortran) (
int
*method);
4840
int (*mpi_worker_callback_c) (
int
*method,
void
*cookie);
4841
void
*mpi_worker_callback_cookie;
4844
bool
species_save_on;
4845
std::vector <std::string> species_names;
4846
std::vector <double> species_z;
4847
std::vector <double> species_d_25;
4848
std::vector <cxxNameDouble> species_stoichiometry;
4849
std::map<int, int> s_num2rm_species_num;
4850
std::vector<double> standard_task_vector;
4853
std::vector <std::string> ExchangeSpeciesNamesList;
4854
std::vector <std::string> ExchangeNamesList;
4855
std::vector <std::string> SurfaceSpeciesNamesList;
4856
std::vector <std::string> SurfaceTypesList;
4857
std::vector <std::string> SurfaceNamesList;
4859
std::vector <std::string> EquilibriumPhasesList;
4860
std::vector <std::string> GasComponentsList;
4861
std::vector <std::string> KineticReactionsList;
4862
std::vector <std::string> SolidSolutionComponentsList;
4863
std::vector <std::string> SolidSolutionNamesList;
4864
std::vector <std::string> SINamesList;
4868
static
std::map<size_t, PhreeqcRM*> Instances;
4869
static
size_t
InstancesIndex;
4871
#if defined(_MSC_VER)
4873
#pragma warning(default:4251)
4877
#endif // !defined(PHREEQCRM_H_INCLUDED)
int GetUnitsExchange(void)
Definition:
PhreeqcRM.h:2606
const std::vector< std::vector< int > > & GetBackwardMapping(void)
Definition:
PhreeqcRM.h:481
int GetUnitsGasPhase(void)
Definition:
PhreeqcRM.h:2631
int GetUnitsSurface(void)
Definition:
PhreeqcRM.h:2785
int GetSICount(void) const
Definition:
PhreeqcRM.h:1764
int GetGridCellCount(void)
Definition:
PhreeqcRM.h:1158
std::string GetFilePrefix(void)
Definition:
PhreeqcRM.h:892
int GetChemistryCellCount(void) const
Definition:
PhreeqcRM.h:504
int GetUnitsSolution(void)
Definition:
PhreeqcRM.h:2735
int GetSurfaceSpeciesCount(void) const
Definition:
PhreeqcRM.h:2425
const std::vector< double > & GetSpeciesZ(void)
Definition:
PhreeqcRM.h:2281
const std::vector< std::string > & GetSurfaceSpecies(void) const
Definition:
PhreeqcRM.h:2391
bool GetSelectedOutputOn(void)
Definition:
PhreeqcRM.h:1696
const std::vector< std::string > & GetSpeciesNames(void)
Definition:
PhreeqcRM.h:2160
const std::vector< std::string > & GetSurfaceNames(void) const
Definition:
PhreeqcRM.h:2354
Geochemical reaction module.
Definition:
PhreeqcRM.h:130
std::string GetDatabaseFileName(void)
Definition:
PhreeqcRM.h:607
const std::vector< std::string > & GetSolidSolutionComponents(void) const
Definition:
PhreeqcRM.h:1835
int GetUnitsSSassemblage(void)
Definition:
PhreeqcRM.h:2760
double GetTimeStep(void)
Definition:
PhreeqcRM.h:2581
int GetErrorHandlerMode(void)
Definition:
PhreeqcRM.h:749
int GetSpeciesCount(void)
Definition:
PhreeqcRM.h:2006
const std::vector< int > & GetForwardMapping(void)
Definition:
PhreeqcRM.h:913
const std::vector< std::string > & GetSolidSolutionNames(void) const
Definition:
PhreeqcRM.h:1906
const std::vector< int > & GetStartCell(void) const
Definition:
PhreeqcRM.h:2316
const std::vector< std::string > & GetKineticReactions(void) const
Definition:
PhreeqcRM.h:1216
const std::vector< std::string > & GetEquilibriumPhases(void) const
Definition:
PhreeqcRM.h:698
double GetRebalanceFraction(void) const
Definition:
PhreeqcRM.h:1511
This class is derived from std::exception and is thrown when an unrecoverable error has occurred...
Definition:
PhreeqcRM.h:39
int GetKineticReactionsCount(void) const
Definition:
PhreeqcRM.h:1244
const std::vector< double > & GetSpeciesD25(void)
Definition:
PhreeqcRM.h:2041
int GetGasComponentsCount(void) const
Definition:
PhreeqcRM.h:972
const std::vector< int > & GetPrintChemistryMask(void)
Definition:
PhreeqcRM.h:1433
const std::vector< std::string > & GetExchangeSpecies(void) const
Definition:
PhreeqcRM.h:840
int GetSolidSolutionComponentsCount(void) const
Definition:
PhreeqcRM.h:1868
int GetMpiMyself(void) const
Definition:
PhreeqcRM.h:1270
int GetEquilibriumPhasesCount(void) const
Definition:
PhreeqcRM.h:726
bool GetSpeciesSaveOn(void)
Definition:
PhreeqcRM.h:2198
const std::vector< double > & GetGfw(void)
Definition:
PhreeqcRM.h:1136
double GetTime(void) const
Definition:
PhreeqcRM.h:2532
IRM_RESULT
Enumeration for PhreeqcRM function return codes.
Definition:
IrmResult.h:8
const std::vector< int > & GetEndCell(void) const
Definition:
PhreeqcRM.h:668
const std::vector< std::string > & GetSurfaceTypes(void) const
Definition:
PhreeqcRM.h:2465
const std::vector< std::string > & GetGasComponents(void) const
Definition:
PhreeqcRM.h:944
const std::vector< std::string > & GetComponents(void) const
Definition:
PhreeqcRM.h:549
int GetExchangeSpeciesCount(void) const
Definition:
PhreeqcRM.h:872
int GetComponentCount(void) const
Definition:
PhreeqcRM.h:524
int GetUnitsPPassemblage(void)
Definition:
PhreeqcRM.h:2681
const std::vector< std::string > & GetSINames(void) const
Definition:
PhreeqcRM.h:1798
double GetTimeConversion(void)
Definition:
PhreeqcRM.h:2557
Enumeration used to return error codes.
bool GetRebalanceByCell(void) const
Definition:
PhreeqcRM.h:1486
const std::vector< bool > & GetPrintChemistryOn(void) const
Definition:
PhreeqcRM.h:1462
const std::vector< IPhreeqcPhast * > & GetWorkers()
Definition:
PhreeqcRM.h:2808
int GetThreadCount()
Definition:
PhreeqcRM.h:2509
const std::vector< cxxNameDouble > & GetSpeciesStoichiometry(void)
Definition:
PhreeqcRM.h:2249
int GetMpiTasks(void) const
Definition:
PhreeqcRM.h:1296
const std::vector< std::string > & GetExchangeNames(void) const
Definition:
PhreeqcRM.h:805
int GetUnitsKinetics(void)
Definition:
PhreeqcRM.h:2656
bool GetPartitionUZSolids(void) const
Definition:
PhreeqcRM.h:1367