PhreeqcRM
|
Public Member Functions | |
BMIPhreeqcRM () | |
BMIPhreeqcRM (int ngrid, int nthreads) | |
~BMIPhreeqcRM () override | |
void | Initialize (std::string config_file="") override |
void | Update () override |
void | UpdateUntil (double end_time) override |
void | Finalize () override |
std::string | GetComponentName () override |
int | GetInputItemCount () override |
int | GetOutputItemCount () override |
int | GetPointableItemCount () |
std::vector< std::string > | GetInputVarNames () override |
std::vector< std::string > | GetOutputVarNames () override |
std::vector< std::string > | GetPointableVarNames () |
std::vector< std::string > | GetReadOnlyVarNames () |
int | GetVarGrid (const std::string name) override |
std::string | GetVarType (const std::string name) override |
std::string | GetVarUnits (const std::string name) override |
int | GetVarItemsize (const std::string name) override |
int | GetVarNbytes (const std::string name) override |
std::string | GetVarLocation (const std::string name) override |
double | GetCurrentTime () override |
double | GetStartTime () override |
double | GetEndTime () override |
std::string | GetTimeUnits () override |
double | GetTimeStep () override |
void | GetValue (const std::string name, void *dest) override |
void | GetValue (const std::string name, bool &OUTPUT) |
void | GetValue (const std::string name, bool *OUTPUT) |
void | GetValue (const std::string name, double &OUTPUT) |
void | GetValue (const std::string name, double *OUTPUT) |
void | GetValue (const std::string name, int &OUTPUT) |
void | GetValue (const std::string name, int *OUTPUT) |
void | GetValue (const std::string name, std::string &OUTPUT) |
void | GetValue (const std::string name, std::vector< double > &OUTPUT) |
void | GetValue (const std::string name, std::vector< int > &OUTPUT) |
void | GetValue (const std::string name, std::vector< std::string > &OUTPUT) |
void * | GetValuePtr (std::string name) override |
void | GetValueAtIndices (std::string name, void *dest, int *inds, int count) override |
void | SetValue (const std::string name, void *src) override |
void | SetValue (const std::string name, bool src) |
void | SetValue (const std::string name, const char *src) |
void | SetValue (const std::string name, double src) |
void | SetValue (const std::string name, int src) |
void | SetValue (const std::string name, const std::string src) |
void | SetValue (const std::string name, std::vector< double > src) |
void | SetValue (const std::string name, std::vector< int > src) |
void | SetValue (const std::string name, std::vector< std::string > src) |
void | SetValueAtIndices (std::string name, int *inds, int count, void *src) override |
int | GetGridRank (const int grid) override |
int | GetGridSize (const int grid) override |
std::string | GetGridType (const int grid) override |
void | GetGridShape (const int grid, int *shape) override |
void | GetGridSpacing (const int grid, double *spacing) override |
void | GetGridOrigin (const int grid, double *origin) override |
void | GetGridX (const int grid, double *x) override |
void | GetGridY (const int grid, double *y) override |
void | GetGridZ (const int grid, double *z) override |
int | GetGridNodeCount (const int grid) override |
int | GetGridEdgeCount (const int grid) override |
int | GetGridFaceCount (const int grid) override |
void | GetGridEdgeNodes (const int grid, int *edge_nodes) override |
void | GetGridFaceEdges (const int grid, int *face_edges) override |
void | GetGridFaceNodes (const int grid, int *face_nodes) override |
void | GetGridNodesPerFace (const int grid, int *nodes_per_face) override |
void | AddOutputVars (std::string option, std::string def) override |
IRM_RESULT | SetLanguage (const char *string) |
Public Member Functions inherited from PhreeqcRM | |
PhreeqcRM (int nxyz, int thread_count_or_communicator, PHRQ_io *io=NULL, bool delay_construct=false) | |
virtual | ~PhreeqcRM (void) |
IRM_RESULT | CloseFiles (void) |
IPhreeqc * | Concentrations2Utility (const std::vector< double > &c, const std::vector< double > &tc, const std::vector< double > &p_atm) |
IRM_RESULT | CreateMapping (const std::vector< int > &grid2chem) |
void | DecodeError (int result) |
IRM_RESULT | DumpModule (bool dump_on, bool append=false) |
void | ErrorHandler (int result, const std::string &e_string) |
void | ErrorMessage (const std::string &error_string, bool prepend=true) |
int | FindComponents () |
const std::vector< std::vector< int > > & | GetBackwardMapping (void) |
int | GetChemistryCellCount (void) const |
int | GetComponentCount (void) const |
const std::vector< std::string > & | GetComponents (void) const |
IRM_RESULT | GetConcentrations (std::vector< double > &c_output) |
int | GetCurrentSelectedOutputUserNumber (void) |
std::string | GetDatabaseFileName (void) |
IRM_RESULT | GetDensityCalculated (std::vector< double > &d_output) |
IRM_RESULT | GetDensity (std::vector< double > &d_output) |
const std::vector< int > & | GetEndCell (void) |
const std::vector< std::string > & | GetEquilibriumPhases (void) const |
int | GetEquilibriumPhasesCount (void) const |
int | GetErrorHandlerMode (void) |
std::string | GetErrorString (void) |
const std::vector< std::string > & | GetExchangeNames (void) const |
const std::vector< std::string > & | GetExchangeSpecies (void) const |
int | GetExchangeSpeciesCount (void) const |
std::string | GetFilePrefix (void) |
const std::vector< int > & | GetForwardMapping (void) |
const std::vector< std::string > & | GetGasComponents (void) const |
int | GetGasComponentsCount (void) const |
IRM_RESULT | GetGasCompMoles (std::vector< double > &gas_moles_output) |
IRM_RESULT | GetGasCompPhi (std::vector< double > &gas_phi) |
IRM_RESULT | GetGasCompPressures (std::vector< double > &gas_pressure) |
IRM_RESULT | GetGasPhaseVolume (std::vector< double > &gas_volume_output) |
const std::vector< double > & | GetGfw (void) |
int | GetGridCellCount (void) |
IPhreeqc * | GetIPhreeqcPointer (int i) |
IRM_RESULT | GetIthConcentration (int i, std::vector< double > &c_output) |
IRM_RESULT | GetIthSpeciesConcentration (int i, std::vector< double > &c_output) |
const std::vector< std::string > & | GetKineticReactions (void) const |
int | GetKineticReactionsCount (void) const |
int | GetMpiMyself (void) const |
int | GetMpiTasks (void) const |
int | GetNthSelectedOutputUserNumber (int n) |
bool | GetPartitionUZSolids (void) const |
const std::vector< double > & | GetPorosity (void) |
const std::vector< double > & | GetPressure (void) |
const std::vector< int > & | GetPrintChemistryMask (void) |
const std::vector< bool > & | GetPrintChemistryOn (void) |
bool | GetRebalanceByCell (void) const |
double | GetRebalanceFraction (void) const |
IRM_RESULT | GetSaturationCalculated (std::vector< double > &sat_output) |
IRM_RESULT | GetSaturation (std::vector< double > &sat_output) |
IRM_RESULT | GetSelectedOutput (std::vector< double > &s_output) |
int | GetSelectedOutputColumnCount (void) |
int | GetSelectedOutputCount (void) |
IRM_RESULT | GetSelectedOutputHeading (int icol, std::string &heading) |
IRM_RESULT | GetSelectedOutputHeadings (std::vector< std::string > &headings) |
bool | GetSelectedOutputOn (void) |
int | GetSelectedOutputRowCount (void) |
int | GetSICount (void) const |
const std::vector< std::string > & | GetSINames (void) const |
const std::vector< std::string > & | GetSolidSolutionComponents (void) const |
int | GetSolidSolutionComponentsCount (void) const |
const std::vector< std::string > & | GetSolidSolutionNames (void) const |
const std::vector< double > & | GetSolutionVolume (void) |
IRM_RESULT | GetSpeciesConcentrations (std::vector< double > &species_conc_output) |
int | GetSpeciesCount (void) |
const std::vector< double > & | GetSpeciesD25 (void) |
IRM_RESULT | GetSpeciesLog10Gammas (std::vector< double > &species_log10gammas) |
IRM_RESULT | GetSpeciesLog10Molalities (std::vector< double > &species_log10molalities) |
const std::vector< std::string > & | GetSpeciesNames (void) |
bool | GetSpeciesSaveOn (void) |
const std::vector< cxxNameDouble > & | GetSpeciesStoichiometry (void) |
const std::vector< double > & | GetSpeciesZ (void) |
const std::vector< int > & | GetStartCell (void) |
const std::vector< std::string > & | GetSurfaceNames (void) const |
const std::vector< std::string > & | GetSurfaceSpecies (void) const |
int | GetSurfaceSpeciesCount (void) const |
const std::vector< std::string > & | GetSurfaceTypes (void) const |
const std::vector< double > & | GetTemperature (void) |
int | GetThreadCount () |
double | GetTime (void) const |
double | GetTimeConversion (void) |
double | GetTimeStep (void) |
int | GetUnitsExchange (void) |
int | GetUnitsGasPhase (void) |
int | GetUnitsKinetics (void) |
int | GetUnitsPPassemblage (void) |
int | GetUnitsSolution (void) |
int | GetUnitsSSassemblage (void) |
int | GetUnitsSurface (void) |
const std::vector< double > & | GetViscosity () |
const std::vector< IPhreeqcPhast * > & | GetWorkers () |
IRM_RESULT | InitializeYAML (std::string yamlfile) |
IRM_RESULT | InitialPhreeqc2Concentrations (std::vector< double > &destination_c, const std::vector< int > &boundary_solution1) |
IRM_RESULT | InitialPhreeqc2Concentrations (std::vector< double > &destination_c, const std::vector< int > &boundary_solution1, const std::vector< int > &boundary_solution2, const std::vector< double > &fraction1) |
IRM_RESULT | InitialEquilibriumPhases2Module (const std::vector< int > &equilibrium_phases) |
IRM_RESULT | InitialExchanges2Module (const std::vector< int > &exchanges) |
IRM_RESULT | InitialGasPhases2Module (const std::vector< int > &gas_phases) |
IRM_RESULT | InitialKinetics2Module (const std::vector< int > &kinetics) |
IRM_RESULT | InitialPhreeqc2Module (const std::vector< int > &initial_conditions1) |
IRM_RESULT | InitialPhreeqc2Module (const std::vector< int > &initial_conditions1, const std::vector< int > &initial_conditions2, const std::vector< double > &fraction1) |
IRM_RESULT | InitialPhreeqc2SpeciesConcentrations (std::vector< double > &destination_c, const std::vector< int > &boundary_solution1) |
IRM_RESULT | InitialPhreeqc2SpeciesConcentrations (std::vector< double > &destination_c, const std::vector< int > &boundary_solution1, const std::vector< int > &boundary_solution2, const std::vector< double > &fraction1) |
IRM_RESULT | InitialPhreeqcCell2Module (int n, const std::vector< int > &cell_numbers) |
IRM_RESULT | InitialSolidSolutions2Module (const std::vector< int > &solid_solutions) |
IRM_RESULT | InitialSolutions2Module (const std::vector< int > &solutions) |
IRM_RESULT | InitialSurfaces2Module (const std::vector< int > &surfaces) |
IRM_RESULT | LoadDatabase (const std::string &database) |
void | LogMessage (const std::string &str) |
int | MpiAbort () |
IRM_RESULT | MpiWorker () |
IRM_RESULT | MpiWorkerBreak () |
IRM_RESULT | OpenFiles (void) |
void | OutputMessage (const std::string &str) |
IRM_RESULT | ReturnHandler (IRM_RESULT result, const std::string &e_string) |
IRM_RESULT | RunCells (void) |
IRM_RESULT | RunFile (bool workers, bool initial_phreeqc, bool utility, const std::string &chemistry_name) |
IRM_RESULT | RunString (bool workers, bool initial_phreeqc, bool utility, const std::string &input_string) |
void | ScreenMessage (const std::string &str) |
IRM_RESULT | SetComponentH2O (bool tf) |
IRM_RESULT | SetConcentrations (const std::vector< double > &c) |
IRM_RESULT | SetCurrentSelectedOutputUserNumber (int n_user) |
IRM_RESULT | SetDensityUser (const std::vector< double > &density) |
IRM_RESULT | SetDensity (const std::vector< double > &density) |
IRM_RESULT | SetDumpFileName (const std::string &dump_name) |
IRM_RESULT | SetErrorHandlerMode (int mode) |
IRM_RESULT | SetErrorOn (bool tf) |
IRM_RESULT | SetFilePrefix (const std::string &prefix) |
IRM_RESULT | SetGasCompMoles (const std::vector< double > &gas_moles) |
IRM_RESULT | SetGasPhaseVolume (const std::vector< double > &gas_volume) |
IRM_RESULT | SetIthConcentration (int i, std::vector< double > &c) |
IRM_RESULT | SetIthSpeciesConcentration (int i, std::vector< double > &c) |
IRM_RESULT | SetMpiWorkerCallbackC (int(*fcn)(int *method, void *cookie)) |
IRM_RESULT | SetMpiWorkerCallbackCookie (void *cookie) |
IRM_RESULT | SetMpiWorkerCallbackFortran (int(*fcn)(int *method)) |
IRM_RESULT | SetNthSelectedOutput (int n) |
IRM_RESULT | SetPartitionUZSolids (bool tf) |
IRM_RESULT | SetPorosity (const std::vector< double > &por) |
IRM_RESULT | SetPressure (const std::vector< double > &p) |
IRM_RESULT | SetPrintChemistryMask (const std::vector< int > &cell_mask) |
IRM_RESULT | SetPrintChemistryOn (bool workers, bool initial_phreeqc, bool utility) |
IRM_RESULT | SetRebalanceByCell (bool tf) |
IRM_RESULT | SetRebalanceFraction (double f) |
IRM_RESULT | SetRepresentativeVolume (const std::vector< double > &rv) |
IRM_RESULT | SetSaturationUser (const std::vector< double > &sat) |
IRM_RESULT | SetSaturation (const std::vector< double > &sat) |
IRM_RESULT | SetScreenOn (bool tf) |
IRM_RESULT | SetSelectedOutputOn (bool tf) |
IRM_RESULT | SetSpeciesSaveOn (bool save_on) |
IRM_RESULT | SetTemperature (const std::vector< double > &t) |
IRM_RESULT | SetTime (double time) |
IRM_RESULT | SetTimeConversion (double conv_factor) |
IRM_RESULT | SetTimeStep (double time_step) |
IRM_RESULT | SetUnitsExchange (int option) |
IRM_RESULT | SetUnitsGasPhase (int option) |
IRM_RESULT | SetUnitsKinetics (int option) |
IRM_RESULT | SetUnitsPPassemblage (int option) |
IRM_RESULT | SetUnitsSolution (int option) |
IRM_RESULT | SetUnitsSSassemblage (int option) |
IRM_RESULT | SetUnitsSurface (int option) |
IRM_RESULT | SpeciesConcentrations2Module (const std::vector< double > &species_conc) |
IRM_RESULT | StateSave (int istate) |
IRM_RESULT | StateApply (int istate) |
IRM_RESULT | StateDelete (int istate) |
void | UseSolutionDensityVolume (bool tf) |
void | WarningMessage (const std::string &warnstr) |
Public Member Functions inherited from StaticIndexer< PhreeqcRM > | |
StaticIndexer (PhreeqcRM *self) | |
~StaticIndexer () | |
int | GetIndex () |
Static Public Member Functions | |
static void | CleanupBMIModuleInstances (void) |
static int | CreateBMIModule () |
static int | CreateBMIModule (int nxyz, int nthreads) |
static IRM_RESULT | DestroyBMIModule (int n) |
static BMIPhreeqcRM * | GetInstance (int n) |
Static Public Member Functions inherited from PhreeqcRM | |
static void | CleanupReactionModuleInstances (void) |
static int | CreateReactionModule (int nxyz, int nthreads) |
static IRM_RESULT | DestroyReactionModule (int n) |
static int | GetGridCellCountYAML (const char *YAML_file) |
static std::string | Char2TrimString (const char *str, size_t l=0) |
static bool | FileExists (const std::string &name) |
static void | FileRename (const std::string &temp_name, const std::string &name, const std::string &backup_name) |
static IRM_RESULT | Int2IrmResult (int r, bool positive_ok) |
Static Public Member Functions inherited from StaticIndexer< PhreeqcRM > | |
static PhreeqcRM * | GetInstance (int id) |
static Derived * | GetInstance (int id) |
static IRM_RESULT | Destroy (int id) |
static void | DestroyAll () |
Public Attributes | |
std::string | language |
Protected Member Functions | |
void | Construct (Initializer initializer) override |
Additional Inherited Members | |
Protected Attributes inherited from StaticIndexer< PhreeqcRM > | |
size_t | _Index |
Static Protected Attributes inherited from StaticIndexer< PhreeqcRM > | |
static std::mutex | _InstancesLock |
static std::map< size_t, PhreeqcRM * > | _Instances |
static size_t | _InstancesIndex |
Basic Model Interface implementation of the geochemical reaction module PhreeqcRM.
BMIPhreeqcRM::BMIPhreeqcRM | ( | ) |
Default constructor for the BMIPhreeqcRM subclass of PhreeqcRM. Definition of the number of cells and threads (or MPI communicator) is deferred. Initialize must be called to initialize the BMIPhreeqcRM instance.
BMIPhreeqcRM::BMIPhreeqcRM | ( | int | ngrid, |
int | nthreads | ||
) |
Constructor for the BMIPhreeqcRM subclass of PhreeqcRM. A BMIPhreeqcRM instance has the BMI methods plus all of the PhreeqcRM methods. The constructor requires two arguments: the number of cells in the user's model, and either (a) the number of threads for OpenMP parallelization, or (b) an MPI communicator.
ngrid | Number of cells in the user's model. |
nthreads | Number of threads for parallelization with OpenMP or an MPI communicator if PhreeqcRM is compiled with MPI. With OpenMP, a value of zero causes the program to set nthreads to the number of logical processors of the computer. |
int nthreads = 0;
std::string yaml_file = "myfile.yaml";
int nxyz = GetGridCellCountYAML(yaml_file);
BMIPhreeqcRM brm(nxyz, nthreads);
brm.Initialize(yaml_file);
|
override |
|
overridevirtual |
AddOutputVars allows selection of sets of variables that can be retieved by the GetValue method. Sets of variables can be included or excluded with multiple calls to this method. All calls must precede the final call to FindComponents. FindComponents generates SELECTED_OUTPUT 333 and USER_PUNCH 333 data blocks that make the variables accessible. Variables will only be accessible if the system includes the given reactant; for example, no gas variables will be created if there are no GAS_PHASEs in the model.
option | A string value, among those listed below, that includes or excludes variables from GetOutputVarNames, GetValue, and other BMI methods. |
def | A string value that can be "false", "true", or a list of items to be included as accessible variables. A value of "false", excludes all variables of the given type; a value of "true" includes all variables of the given type for the current system; a list specifies a subset of items of the given type. |
Values for the the parameter option:
AddOutputVars: False excludes all variables; True causes the settings for each variable group to determine the variables that will be defined. Default True;
SolutionProperties: False excludes all solution property variables; True includes variables pH, pe, alkalinity, ionic strength, water mass, charge balance, percent error, and specific conductance. Default True.
SolutionTotalMolalities: False excludes all total element and element redox state variables; True includes all elements and element redox state variables for the system defined for the calculation; list restricts variables to the specified elements and redox states. Default True.
ExchangeMolalities: False excludes all variables related to exchange; True includes all variables related to exchange; list includes variables for the specified exchange species. Default True.
SurfaceMolalities: False excludes all variables related to surfaces; True includes all variables related to surfaces; list includes variables for the specified surface species. Default True.
EquilibriumPhases: False excludes all variables related to equilibrium phases; True includes all variables related to equilibrium phases; list includes variables for the specified equilibiurm phases. Default True.
Gases: False excludes all variables related to gases; True includes all variables related to gases; list includes variables for the specified gas components. Default True.
KineticReactants: False excludes all variables related to kinetic reactants; True includes all variables related to kinetic reactants; list includes variables for the specified kinetic reactants. Default True.
SolidSolutions: False excludes all variables related to solid solutions; True includes all variables related to solid solutions; list includes variables for the specified solid solutions components. Default True.
CalculateValues: False excludes all calculate values; True includes all calculate values; list includes the specified calculate values. CALCLUATE_VALUES can be used to calculate geochemical quantities not available in the other sets of variables. Default True.
SolutionActivities: False excludes all aqueous species; True includes all aqueous species; list includes only the specified aqueous species. Default False.
SolutionMolalities: False excludes all aqueous species; True includes all aqueous species; list includes only the specified aqueous species. Default False.
SaturationIndices: False excludes all saturation indices; True includes all saturation indices; list includes only the specified saturation indices. Default False.
Reimplemented from PhreeqcRM.
|
static |
|
overrideprotected |
|
static |
|
static |
|
static |
|
override |
Finalize closes any files open in the BMIPhreeqcRM instance.
brm.Finalize();
|
inlineoverride |
GetComponentName returns the component name–"BMI PhreeqcRM". BMI PhreeqcRM is a partial interface to PhreeqcRM, and provides the methods to implement chemical reactions in a multicomponent transport model. All of the native PhreeqcRM methods (non BMI methods) are also available, which provides a complete interface to PhreeqcRM.
The | string "BMI PhreeqcRM". |
std::string comp_name = brm.GetComponentName();
|
override |
GetCurrentTime returns the current simulation time, in seconds. (Same as GetTime.)
The | current simulation time, in seconds. |
std::cout << "Current time: " << GetCurrentTime() << " seconds\n";
|
override |
GetEndTime returns GetCurrentTime plus GetTimeStep, in seconds.
The | end of the time step, in seconds. |
std::cout << "End of time step " << GetEndTime() << " seconds\n";
|
inlineoverride |
GetGridEdgeCount is not implemented.
|
inlineoverride |
GetGridEdgeNodes is not implemented.
|
inlineoverride |
GetGridFaceCount is not implemented.
|
inlineoverride |
GetGridFaceEdges is not implemented.
|
inlineoverride |
GetGridFaceNodes is not implemented.
|
inlineoverride |
GetGridNodeCount is not implemented.
|
inlineoverride |
GetGridNodesPerFace is not implemented.
|
inlineoverride |
GetGridOrigin is not implemented.
|
override |
GetGridRank returns a rank of 1 for grid 0. BMIPhreeqcRM only has a 1D series of cells; any grid or spatial information must be found in the user's model.
grid | Grid number, only grid 0 is considered. |
Rank | of 1 is returned for grid 0; 0 for all other values of grid. |
|
inlineoverride |
GetGridShape is not implemented.
|
override |
GetGridSize returns the number of cells specified at creation of the BMIPhreeqcRM instance.
grid | Grid number, only grid 0 is considered. |
Number | of cells in the user's modle (same value as GetGridCellCount) is returned for grid 0; 0 for all other values of grid. |
|
inlineoverride |
GetGridSpacing is not implemented.
|
override |
GetGridType is considered to be points. No grid information is available in BMIPhreeqcRM; all grid information must be found in the user's model.
grid | Grid number, only grid 0 is considered. |
Points | is returned for grid 0; "Undefined grid identifier" is returned for all other values of grid. |
|
inlineoverride |
GetGridX is not implemented.
|
inlineoverride |
GetGridY is not implemented.
|
inlineoverride |
GetGridZ is not implemented.
|
override |
GetInputVarNames returns the count of input variables that can be set with SetValue.
Count | of input variables that can be set with SetValue. |
int count = brm.GetInputItemCount();
std::vector< std::string > InputVarNames = brm.GetInputVarNames();
oss << "SetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << InputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(InputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(InputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(InputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(InputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(InputVarNames[i]) /
brm.GetVarItemsize(InputVarNames[i]) << "\n";
}
|
override |
GetInputVarNames returns a list of the variable names that can be set with SetValue.
A | std::vector of the names of variables that can be set with SetValue. |
std::vector< std::string > InputVarNames = brm.GetInputVarNames();
int count = brm.GetInputItemCount();
oss << "SetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << InputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(InputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(InputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(InputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(InputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(InputVarNames[i]) /
brm.GetVarItemsize(InputVarNames[i]) << "\n";
}
|
static |
|
override |
GetOutputItemCount returns the count of output variables that can be retrieved with GetValue.
Count | of output variables that can be retrieved with GetValue. |
int count = brm.GetOutputItemCount();
std::vector< std::string > OutputVarNames = brm.GetOutputVarNames();
oss << "GetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << OutputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(OutputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(OutputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(OutputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(OutputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(OutputVarNames[i]) /
brm.GetVarItemsize(OutputVarNames[i]) << "\n";
}
|
override |
GetOutputVarNames returns a list of the variable names that can be retrieved with GetValue.
A | list of the names of variable that can be retrieved with GetValue. |
std::vector< std::string > OutputVarNames = brm.GetOutputVarNames();
int count = brm.GetOutputItemCount();
oss << "GetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << OutputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(OutputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(OutputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(OutputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(OutputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(OutputVarNames[i]) /
brm.GetVarItemsize(OutputVarNames[i]) << "\n";
}
int BMIPhreeqcRM::GetPointableItemCount | ( | ) |
GetPointableItemCount returns the count of variables for which pointers can be obtained with GetValuePtr. The pointers point to current copies of the variables. Setting a value with one of the pointers will have no effect on the simulation, but will corrupt the copy of the variable.
Count | of pointers to variables that can be accessed with GetValuePtr. |
int count = brm.GetPointableItemCount();
std::vector< std::string > PointableVarNames = brm.GetPointableVarNames();
oss << "GetValuePtr variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << PointableVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(PointableVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(PointableVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(PointableVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(PointableVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(PointableVarNames[i]) /
brm.GetVarItemsize(PointableVarNames[i]) << "\n";
}
std::vector< std::string > BMIPhreeqcRM::GetPointableVarNames | ( | ) |
GetPointableVarNames returns a list of the names of variables for which pointers can be retrieved with GetValuePtr.
A | list of the names of variables for which pointers can be retieved with GetValuePtr. |
std::vector< std::string > PointableVarNames = brm.GetPointableVarNames();
int count = brm.GetPointableItemCount();
oss << "GetValuePtr variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << PointableVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(PointableVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(PointableVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(PointableVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(PointableVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(PointableVarNames[i]) /
brm.GetVarItemsize(PointableVarNames[i]) << "\n";
}
std::vector< std::string > BMIPhreeqcRM::GetReadOnlyVarNames | ( | ) |
|
override |
GetStartTime returns the current simulation time, in seconds. (Same as GetCurrentTime or GetTime.)
The | current simulation time, in seconds. |
|
inlineoverride |
|
inlineoverride |
GetTimeUnits returns the time units of PhreeqcRM. All time units are seconds.
Returns | the string "seconds". |
std::cout << "BMIPhreeqcRM time units are " << GetTimeUnits() << ".\n";
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
bool & | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
bool * | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
double & | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
double * | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
int & | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
int * | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
std::string & | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
std::vector< double > & | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
std::vector< int > & | OUTPUT | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::GetValue | ( | const std::string | name, |
std::vector< std::string > & | OUTPUT | ||
) |
|
override |
GetValue retrieves model variables. Only variables in the list provided by GetOutputVarNames can be retrieved.
name | Name of the variable to retrieve. |
dest | Variable in which to place results. The dest variable can be of different types depending on the variable retrieved. The following list gives the name in the first argument and the corresponding data type of the dest argument: |
"ComponentCount", dest: int;
"Components", dest: std::vector< std::string >;
"Concentrations", dest: std::vector< double >;
"CurrentSelectedOutputUserNumber", dest: int;
"DensityCalculated", dest: std::vector< double >;
"ErrorString", dest: std::string;
"FilePrefix", dest: std::string;
"Gfw", dest: std::vector< double >;
"GridCellCount", dest: int;
"Porosity", dest: std::vector< double >;
"Pressure", dest: std::vector< double >;
"SaturationCalculated", dest: std::vector< double >;
"SelectedOutput", dest: std::vector< double >;
"SelectedOutputColumnCount", dest: int;
"SelectedOutputCount", dest: int;
"SelectedOutputHeadings", dest: std::vector< std::string >;
"SelectedOutputOn", dest: bool;
"SelectedOutputRowCount", dest: int;
"SolutionVolume", dest: std::vector< double >;
"Temperature", dest: std::vector< double >;
"Time", dest: double;
"TimeStep", dest: double,
"Viscosity", dest: std::vector< double >.
std::vector< double > density;
phreeqc_rm.GetValue("DensityCalculated", density);
std::vector< std::string > comps;
phreeqc_rm.GetValue("Components", comps);
|
inlineoverride |
GetValueAtIndices is not implemented
|
override |
GetValuePtr takes a variable name and returns a pointer to a current copy of the variable values. Unlike the buffer returned from GetValue, the reference always points to the current values of the variable, even if the model's state has changed.
name | Name of the variable to retrieve. |
Void | pointer to data. The following list gives the name in the argument and the data type the void pointer should be cast to: "ComponentCount": int*; "Concentrations": double*; "DensityCalculated": double*; "Gfw": double*; "GridCellCount": int*; "Porosity": double*; "Pressure": double*; "SaturationCalculated": double*; "SelectedOutputOn": bool*; "SolutionVolume": double*; "Temperature": double*; "Time": double*; "TimeStep": double*; "Viscosity": double*; |
|
inlineoverride |
GetVarGrid returns a value of 1, indicating points. BMIPhreeqcRM does not have a grid of its own. The cells of BMIPhreeqcRM are associated with the user's model grid, and all spatial characterists are assigned by the user's model.
name | Varaiable name. (Return value is the same regardless of name.) |
1 | BMIPhreeqcRM cells derive meaning from the user's model. |
|
override |
GetVarItemsize retrieves size of an individual item that can be set or retrived. Sizes may be sizeof(int), sizeof(double), or a character length for string variables.
name | Name of the variable to retrieve size. |
Size | of one element of the variable. |
std::vector< std::string > OutputVarNames = brm.GetOutputVarNames();
int count = brm.GetOutputItemCount();
oss << "GetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << OutputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(OutputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(OutputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(OutputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(OutputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(OutputVarNames[i]) /
brm.GetVarItemsize(OutputVarNames[i]) << "\n";
}
|
inlineoverride |
GetVarLocation has no explicit meaning in BMIPhreeqcRM. All grid-related information derives from the user's model.
name | Name of the variable, but not used. |
The | string "Unknown" is returned. |
|
override |
GetVarNbytes retrieves the total number of bytes that are set for a variable with SetValue, retrieved for a variable with GetValue, or pointed to by GetValuePtr.
name | Name of the variable to retrieve total bytes. |
Total | number of bytes set, retrieved, or pointed to for variable. |
std::vector< std::string > OutputVarNames = brm.GetOutputVarNames();
int count = brm.GetOutputItemCount();
oss << "GetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << OutputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(OutputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(OutputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(OutputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(OutputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(OutputVarNames[i]) /
brm.GetVarItemsize(OutputVarNames[i]) << "\n";
}
|
override |
GetVarType retrieves the type of a variable that can be set with SetValue, retrieved with GetValue, or pointed to by GetValuePtr. Types are "int", "double", "std::string", or "std::vector<std::string>".
name | Name of the variable to retrieve type. |
Character | string of variable type. |
std::vector< std::string > OutputVarNames = brm.GetOutputVarNames();
int count = brm.GetOutputItemCount();
oss << "GetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << OutputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(OutputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(OutputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(OutputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(OutputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(OutputVarNames[i]) /
brm.GetVarItemsize(OutputVarNames[i]) << "\n";
}
|
override |
GetVarUnits retrieves the units of a variable that can be set with SetValue, retrieved with GetValue, or pointed to by GetValuePtr.
name | Name of the variable to retrieve units. |
Character | string of units for variable. |
std::vector< std::string > OutputVarNames = brm.GetOutputVarNames();
int count = brm.GetOutputItemCount();
oss << "GetValue variables:\n";
for (size_t i = 0; i < count; i++)
{
oss << " " << i << " " << OutputVarNames[i] << "\n";
oss << " Type: " << brm.GetVarType(OutputVarNames[i]) << "\n";
oss << " Units: " << brm.GetVarUnits(OutputVarNames[i]) << "\n";
oss << " Total bytes: " << brm.GetVarNbytes(OutputVarNames[i]) << "\n";
oss << " Item bytes: " << brm.GetVarItemsize(OutputVarNames[i]) << "\n";
oss << " Dim: " << brm.GetVarNbytes(OutputVarNames[i]) /
brm.GetVarItemsize(OutputVarNames[i]) << "\n";
}
|
override |
Initialize must be called to initialize a BMIPhreeqcRM instance. A YAML file is normally used for initialization; however, an empty string can be used for the file name when initializing without use of a YAML file.
The YAML file contains a YAML map of PhreeqcRM methods and data corresponding to each PhreeqcRM method. For example,
- key: LoadDatabase
database: phreeqc.dat
- key: RunFile
workers: true
initial_phreeqc: true
utility: true
chemistry_name: advect.pqi
Initialize will read the YAML file and execute the specified methods with the specified arguments. Using YAML terminology, the argument(s) for a method may be a scalar, a sequence, or a map, depending if the argument is a single item, a single vector, or there are multiple arguments. In the case of a map, the name associated with each argument (for example "chemistry_name" above) is arbitrary. The names of the map keys for map arguments are not used in parsing the YAML file; only the order of the arguments is important.
The PhreeqcRM methods that can be specified in a YAML file include:
CloseFiles();
CreateMapping(std::vector< int >& grid2chem);
DumpModule();
FindComponents();
InitialEquilibriumPhases2Module(std::vector< int > equilibrium_phases);
InitialExchanges2Module(std::vector< int > exchanges);
InitialGasPhases2Module(std::vector< int > gas_phases);
InitialKineticss2Module(std::vector< int > kinetics);
InitialSolidSolutions2Module(std::vector< int > solid_solutions);
InitialSolutions2Module(std::vector< int > solutions);
InitialSurfaces2Module(std::vector< int > surfaces);
InitialPhreeqc2Module(std::vector< int > initial_conditions1);
InitialPhreeqc2Module(std::vector< int > initial_conditions1,
std::vector< int > initial_conditions2, std::vector< double > fraction1);
InitialPhreeqcCell2Module(int n, std::vector< int > cell_numbers);
LoadDatabase(std::string database);
OpenFiles();
OutputMessage(std::string str);
RunCells();
RunFile(bool workers, bool initial_phreeqc,
bool utility, std::string chemistry_name);
RunString(bool workers, bool initial_phreeqc, bool utility, std::string input_string);
ScreenMessage(std::string str);
SetComponentH2O(bool tf);
SetConcentrations(std::vector< double > c);
SetCurrentSelectedOutputUserNumber(int n_user);
SetDensityUser(std::vector< double > density);
SetDumpFileName(std::string dump_name);
SetErrorHandlerMode(int mode);
SetErrorOn(bool tf);
SetFilePrefix(std::string prefix);
SetGasCompMoles(std::vector< double > gas_moles);
SetGasPhaseVolume(std::vector< double > gas_volume);
SetPartitionUZSolids(bool tf);
SetPorosity(std::vector< double > por);
SetPressure(std::vector< double > p);
SetPrintChemistryMask(std::vector< int > cell_mask);
SetPrintChemistryOn(bool workers, bool initial_phreeqc, bool utility);
SetRebalanceByCell(bool tf);
SetRebalanceFraction(double f);
SetRepresentativeVolume(std::vector< double > rv);
SetSaturationUser(std::vector< double > sat);
SetScreenOn(bool tf);
SetSelectedOutputOn(bool tf);
SetSpeciesSaveOn(bool save_on);
SetTemperature(std::vector< double > t);
SetTime(double time);
SetTimeConversion(double conv_factor);
SetTimeStep(double time_step);
SetUnitsExchange(int option);
SetUnitsGasPhase(int option);
SetUnitsKinetics(int option);
SetUnitsPPassemblage(int option);
SetUnitsSolution(int option);
SetUnitsSSassemblage(int option);
SetUnitsSurface(int option);
SpeciesConcentrations2Module(std::vector< double > species_conc);
StateSave(int istate);
StateApply(int istate);
StateDelete(int istate);
UseSolutionDensityVolume(bool tf);
WarningMessage(std::string warnstr);
int nthreads = 0;
std::string yaml_file = "myfile.yaml";
int nxyz = GetGridCellCountYAML(yaml_file);
BMIPhreeqcRM brm(nxyz, nthreads);
brm.Initialize(yaml_file);
int ncomps;
brm.GetValue("ComponentCount", &ncomps);
int ngrid;
brm.GetValue("GridCellCount", &ngrid);
std::vector< double > c;
brm.GetValue("Concentrations", c);
brm.SetValue("TimeStep", 86400);
for(double time = 0; time < 864000; time+=86400)
{
// Take a transport time step here and update the vector c.
brm.SetValue("Time", time);
brm.SetValue("Concentrations", c);
brm.Update();
brm.GetValue("Concentrations", c);
}
|
inline |
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
bool | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
const char * | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
const std::string | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
double | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
int | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
std::vector< double > | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
std::vector< int > | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void BMIPhreeqcRM::SetValue | ( | const std::string | name, |
std::vector< std::string > | src | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
override |
SetValue sets model variables. Only variables in the list provided by GetInputVarNames can be set.
name | Name of the variable to retrieve. |
src | Data used to set the variable. The src data type can vary depending on the variable retrieved. The following list gives the name in the first argument and the corresponding data type and size of the src argument: |
"Concentrations", std::vector
std::vector< double > temperature(ngrid, 28.0);
phreeqc_rm.SetValue("Temperature", temperature);
|
inlineoverride |
SetValueAtIndices is not implemented.
|
override |
Update runs PhreeqcRM for one time step. PhreeqcRM will equilibrate the solutions with all equilibrium reactants (EQUILIBRIUM_PHASES, EXCHANGE, GAS_PHASE, SOLID_SOLUTIONS, and SURFACE) and integrate KINETICS reactions for the specified time step (TimeStep or SetTimeStep).
BMIPhreeqcRM brm(nxyz, nthreads);
brm.Initialize("myfile.yaml");
int ncomps;
brm.GetValue("ComponentCount", &ncomps);
int ngrid;
brm.GetValue("GridCellCount", &ngrid);
std::vector< double > c;
brm.GetValue("Concentrations", c);
brm.SetValue("TimeStep", 86400);
for(double time = 0; time < 864000; time+=86400)
{
// Take a transport time step here and update the vector c.
brm.SetValue("Time", time);
brm.SetValue("Concentrations", c);
brm.Update();
brm.GetValue("Concentrations", c);
}
|
override |
UpdateUntil is the same as Update, except the time step is calculated from the argument end_time. The time step is calculated to be end_time minus the current time (GetCurrentTime).
end_time | Time at the end of the time step. |
BMIPhreeqcRM brm(nxyz, nthreads);
brm.Initialize("myfile.yaml");
int ncomps;
brm.GetValue("ComponentCount", &ncomps);
int ngrid;
brm.GetValue("GridCellCount", &ngrid);
std::vector< double > c;
brm.GetValue("Concentrations", c);
for(double time = 0; time < 864000; time+=86400)
{
// Take a transport time step here and update the vector c.
brm.SetValue("Time", time);
brm.SetValue("Concentrations", c);
brm.UpdateUntil(time + 86400.0);
brm.GetValue("Concentrations", c);
}
std::string BMIPhreeqcRM::language |