Closed WilkAndy closed 4 years ago
Maybe I'm being nitpicky, but what exactly do you mean by "database"? Do you mean just an online volatile data structure? Database to me implies something stateful.
Geochemistry codes always use a "database". This is actually just a text file with a bunch of strings and numbers in it that describe the geochemical reactions.
I guess Cody means that we have a database file, but that this is a collection of information extracted from that database rather than a (minimal) database itself.
This data describes the complete geochemical system for a given set of basis species (I think), so perhaps a better name would be something like GeochemicalSystem or CompleteGeochemicalSystem or something else?
OK, actually i must have decided a similar thing myself at some stage. The class i've created is called MinimalGeochemicalSystem. I used "Minimal" rather than "Complete" because the latter suggests the use of the entire goechem database, but we're only using a subset of it.
👍
Reason
The GeochemicalDatabaseReader reads everything in the database. But geochemistry models always use a subset of this data. Create a structure or class that holds this "actually-used" data in suitable data structures that can be rapidly accessed and manipulated.
Design
Two important aspects are:
the MinimalGeochemistryDatabase's constructor should perform suitable checks that the user has requested sensible information from the entire database. For example, one of the basis species must always be H2O. I have a long list of requirements, but will not write them all here. All the equilibrium species should be extracted from the DatabaseReader automatically.
the data structures used in MinimalGeochemistryDatabase must be rapidly accessible. Almost definitely, that means DenseMatrix and std::vector, rather than the std::maps that DatabaseReader uses. These data structures will be queried many times per node per timestep.
Impact
MinimalGeochemistryDatabase will act as the main interface between "normal" MOOSE code (Kernels, etc) and the database.
I've actually already coded this and am just waiting for #14911 to be merged. Tagging @cpgr.