https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GeochemicalSystem.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "MultiMooseEnum.h"
18
40{
41public:
57
71
116 const std::vector<std::string> & swap_out_of_basis,
117 const std::vector<std::string> & swap_into_basis,
118 const std::string & charge_balance_species,
119 const std::vector<std::string> & constrained_species,
120 const std::vector<Real> & constraint_value,
121 const MultiMooseEnum & constraint_unit,
122 const MultiMooseEnum & constraint_user_meaning,
123 Real initial_temperature,
124 unsigned iters_to_make_consistent,
125 Real min_initial_molality,
126 const std::vector<std::string> & kin_name,
127 const std::vector<Real> & kin_initial_moles,
128 const MultiMooseEnum & kin_unit);
129
135 const std::vector<std::string> & swap_out_of_basis,
136 const std::vector<std::string> & swap_into_basis,
137 const std::string & charge_balance_species,
138 const std::vector<std::string> & constrained_species,
139 const std::vector<Real> & constraint_value,
140 const std::vector<GeochemistryUnitConverter::GeochemistryUnit> & constraint_unit,
141 const std::vector<ConstraintUserMeaningEnum> & constraint_user_meaning,
142 Real initial_temperature,
143 unsigned iters_to_make_consistent,
144 Real min_initial_molality,
145 const std::vector<std::string> & kin_name,
146 const std::vector<Real> & kin_initial,
147 const std::vector<GeochemistryUnitConverter::GeochemistryUnit> & kin_unit);
148
158 {
159 if (this == &src) // trivial a=a situation
160 return *this;
161 // check for bad assignment situations. Other "const" things that
162 // needn't be the same (but probably actually are) include: _swap_out and _swap_in
163 if (_num_basis != src._num_basis || _num_eqm != src._num_eqm || _num_redox != src._num_redox ||
166 mooseError("GeochemicalSystem: copy assigment operator called with inconsistent fundamental "
167 "properties");
168 // actually do the copying
169 _mgd = src._mgd;
170 _swapper = src._swapper;
171 _gac = src._gac;
172 _is = src._is;
205 return *this;
206 };
207
211 GeochemicalSystem(const GeochemicalSystem & src) = default;
212
213 bool operator==(const GeochemicalSystem & rhs) const
214 {
215 return (_mgd == rhs._mgd) && (_num_basis == rhs._num_basis) && (_num_eqm == rhs._num_eqm) &&
217 (_num_kin == rhs._num_kin) && (_swapper == rhs._swapper) &&
218 (_swap_out == rhs._swap_out) && (_swap_in == rhs._swap_in) && (_gac == rhs._gac) &&
228 (_redox_log10K == rhs._redox_log10K) && (_kin_log10K == rhs._kin_log10K) &&
242 (_temperature == rhs._temperature) &&
245 }
246
248 unsigned getNumInBasis() const;
249
251 unsigned getNumInEquilibrium() const;
252
254 unsigned getNumKinetic() const;
255
257 void initialize();
258
260 unsigned getChargeBalanceBasisIndex() const;
261
270 bool alterChargeBalanceSpecies(Real threshold_molality);
271
276 Real getLog10K(unsigned j) const;
277
281 unsigned getNumRedox() const;
282
287 Real getRedoxLog10K(unsigned red) const;
288
293 Real log10RedoxActivityProduct(unsigned red) const;
294
299 Real getKineticLog10K(unsigned kin) const;
300
304 const std::vector<Real> & getKineticLog10K() const;
305
310 Real log10KineticActivityProduct(unsigned kin) const;
311
316 Real getKineticMoles(unsigned kin) const;
317
325 void setKineticMoles(unsigned kin, Real moles);
326
330 const std::vector<Real> & getKineticMoles() const;
331
347 void updateOldWithCurrent(const DenseVector<Real> & mole_additions);
348
353 unsigned getNumInAlgebraicSystem() const;
354
356 unsigned getNumBasisInAlgebraicSystem() const;
357
359 unsigned getNumSurfacePotentials() const;
360
365 const std::vector<bool> & getInAlgebraicSystem() const;
366
372 const std::vector<unsigned> & getBasisIndexOfAlgebraicSystem() const;
373
379 const std::vector<unsigned> & getAlgebraicIndexOfBasisSystem() const;
380
385 std::vector<Real> getAlgebraicVariableValues() const;
386
392 std::vector<Real> getAlgebraicBasisValues() const;
393
398 DenseVector<Real> getAlgebraicVariableDenseValues() const;
399
401 Real getSolventWaterMass() const;
402
409 const std::vector<Real> & getBulkMolesOld() const;
410
417 DenseVector<Real> getBulkOldInOriginalBasis() const;
418
425 DenseVector<Real> getTransportedBulkInOriginalBasis() const;
426
433 void computeTransportedBulkFromMolalities(std::vector<Real> & transported_bulk) const;
434
439 const std::vector<Real> & getSolventMassAndFreeMolalityAndMineralMoles() const;
440
446 const std::vector<bool> & getBasisActivityKnown() const;
447
451 Real getBasisActivity(unsigned i) const;
452
456 const std::vector<Real> & getBasisActivity() const;
457
462 Real getEquilibriumMolality(unsigned j) const;
463
468 const std::vector<Real> & getEquilibriumMolality() const;
469
474 Real getBasisActivityCoefficient(unsigned i) const;
475
480 const std::vector<Real> & getBasisActivityCoefficient() const;
481
486 Real getEquilibriumActivityCoefficient(unsigned j) const;
487
492 const std::vector<Real> & getEquilibriumActivityCoefficient() const;
493
499 Real getTotalChargeOld() const;
500
513 Real getResidualComponent(unsigned algebraic_ind, const DenseVector<Real> & mole_additions) const;
514
519
525
534 void computeJacobian(const DenseVector<Real> & res,
535 DenseMatrix<Real> & jac,
536 const DenseVector<Real> & mole_additions,
537 const DenseMatrix<Real> & dmole_additions) const;
538
545 void setAlgebraicVariables(const DenseVector<Real> & algebraic_var);
546
554
561
566 std::vector<Real> getSaturationIndices() const;
567
577 void performSwap(unsigned swap_out_of_basis, unsigned swap_into_basis);
578
580 Real getIonicStrength() const;
581
584
589 Real getSurfacePotential(unsigned sp) const;
590
595 Real getSurfaceCharge(unsigned sp) const;
596
600 const std::vector<Real> & getSorbingSurfaceArea() const;
601
605 Real getTemperature() const;
606
619 void setTemperature(Real temperature);
620
672 const std::vector<std::string> & names,
673 const std::vector<Real> & values,
674 const std::vector<bool> & constraints_from_molalities);
675
679 const std::vector<GeochemicalSystem::ConstraintMeaningEnum> & getConstraintMeaning() const;
680
688 void closeSystem();
689
700 void changeConstraintToBulk(unsigned basis_ind);
701
714 void changeConstraintToBulk(unsigned basis_ind, Real value);
715
724 void addToBulkMoles(unsigned basis_ind, Real value);
725
734 void setConstraintValue(unsigned basis_ind, Real value);
735
771
775 const std::string & getOriginalRedoxLHS() const;
776
788 void performSwapNoCheck(unsigned swap_out_of_basis, unsigned swap_into_basis);
789
794
806 void setMineralRelatedFreeMoles(Real value);
807
815 const std::vector<Real> & computeAndGetEquilibriumActivity();
816
821 Real getEquilibriumActivity(unsigned eqm_ind) const;
822
833 void
834 addKineticRates(Real dt, DenseVector<Real> & mole_additions, DenseMatrix<Real> & dmole_additions);
835
836private:
840 const unsigned _num_basis;
842 const unsigned _num_eqm;
844 const unsigned _num_redox;
846 const unsigned _num_surface_pot;
848 const unsigned _num_kin;
852 const std::vector<std::string> _swap_out;
854 const std::vector<std::string> _swap_in;
866 std::vector<std::string> _constrained_species;
868 std::vector<Real> _constraint_value;
870 std::vector<Real> _original_constraint_value;
872 std::vector<GeochemistryUnitConverter::GeochemistryUnit> _constraint_unit;
874 std::vector<ConstraintUserMeaningEnum> _constraint_user_meaning;
876 std::vector<ConstraintMeaningEnum> _constraint_meaning;
878 std::vector<Real> _eqm_log10K;
880 std::vector<Real> _redox_log10K;
882 std::vector<Real> _kin_log10K;
888 std::vector<bool> _in_algebraic_system;
890 std::vector<unsigned> _algebraic_index;
892 std::vector<unsigned> _basis_index;
894 std::vector<Real> _bulk_moles_old;
901 std::vector<Real> _basis_molality;
903 std::vector<bool> _basis_activity_known;
905 std::vector<Real> _basis_activity;
907 std::vector<Real> _eqm_molality;
909 std::vector<Real> _basis_activity_coef;
911 std::vector<Real> _eqm_activity_coef;
917 std::vector<Real> _eqm_activity;
924 std::vector<Real> _surface_pot_expr;
926 std::vector<Real> _sorbing_surface_area;
928 std::vector<Real> _kin_moles;
930 std::vector<Real> _kin_moles_old;
947
952 void buildTemperatureDependentQuantities(Real temperature);
953
955 void buildAlgebraicInfo(std::vector<bool> & in_algebraic_system,
956 unsigned & num_basis_in_algebraic_system,
957 unsigned & num_in_algebraic_system,
958 std::vector<unsigned> & algebraic_index,
959 std::vector<unsigned> & basis_index) const;
960
970 void initBulkAndFree(std::vector<Real> & bulk_moles_old,
971 std::vector<Real> & basis_molality) const;
972
978 void buildKnownBasisActivities(std::vector<bool> & basis_activity_known,
979 std::vector<Real> & basis_activity) const;
980
986 void computeRemainingBasisActivities(std::vector<Real> & basis_activity) const;
987
992 void updateBasisMolalityForKnownActivity(std::vector<Real> & basis_molality) const;
993
997 Real log10ActivityProduct(unsigned eqm_j) const;
998
1002 void computeEqmMolalities(std::vector<Real> & eqm_molality) const;
1003
1010 void enforceChargeBalanceIfSimple(std::vector<Real> & constraint_value,
1011 std::vector<Real> & bulk_moles_old) const;
1012
1018 void computeBulk(std::vector<Real> & bulk_moles_old) const;
1019
1025 void enforceChargeBalance(std::vector<Real> & constraint_value,
1026 std::vector<Real> & bulk_moles_old) const;
1027
1033 void computeFreeMineralMoles(std::vector<Real> & basis_molality) const;
1034
1043 void
1044 checkAndInitialize(const std::vector<std::string> & kin_name,
1045 const std::vector<Real> & kin_initial,
1046 const std::vector<GeochemistryUnitConverter::GeochemistryUnit> & kin_unit);
1047
1054 void setChargeBalanceSpecies(unsigned new_charge_balance_index);
1055
1064 Real surfaceSorptionModifier(unsigned eqm_j) const;
1065
1071 Real surfacePotPrefactor(unsigned sp) const;
1072
1074 void computeSorbingSurfaceArea(std::vector<Real> & sorbing_surface_area) const;
1075
1083 Real computeBulkFromMolalities(unsigned basis_ind) const;
1084
1093};
const ModelGeochemicalDatabase mgd
void mooseError(Args &&... args)
This class holds information about bulk composition, molalities, activities, activity coefficients,...
Real log10KineticActivityProduct(unsigned kin) const
Real computeBulkFromMolalities(unsigned basis_ind) const
std::vector< Real > getSaturationIndices() const
GeochemicalSystem & operator=(const GeochemicalSystem &src)
Copy assignment operator.
Real getResidualComponent(unsigned algebraic_ind, const DenseVector< Real > &mole_additions) const
Return the residual of the algebraic system for the given algebraic index.
std::string _original_redox_lhs
The left-hand-side of the redox equations in _mgd after initial swaps.
std::vector< Real > getAlgebraicBasisValues() const
Real getEquilibriumActivity(unsigned eqm_ind) const
Returns the value of activity for the equilibrium species with index eqm_index.
std::vector< Real > _eqm_activity_coef
equilibrium activity coefficients
const std::vector< unsigned > & getAlgebraicIndexOfBasisSystem() const
const std::vector< GeochemicalSystem::ConstraintMeaningEnum > & getConstraintMeaning() const
std::vector< Real > _bulk_moles_old
Number of bulk moles of basis species (this includes contributions from kinetic species,...
void enforceChargeBalance()
Enforces charge balance by altering the constraint_value and bulk_moles_old of the charge-balance spe...
std::vector< Real > _sorbing_surface_area
surface areas of the sorbing minerals
Real _temperature
The temperature in degC.
void setAlgebraicVariables(const DenseVector< Real > &algebraic_var)
Set the variables in the algebraic system (molalities and potentially the mass of solvent water,...
Real surfacePotPrefactor(unsigned sp) const
const std::vector< std::string > _swap_out
Species to immediately remove from the basis in favor of _swap_in.
unsigned getNumBasisInAlgebraicSystem() const
return the number of basis species in the algebraic system
std::vector< unsigned > _algebraic_index
_algebraic_index[i] = index in the algebraic system of the basis species i. _basis_index[_algebraic_i...
unsigned getNumKinetic() const
returns the number of kinetic species
std::vector< Real > _constraint_value
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to ha...
DenseVector< Real > getAlgebraicVariableDenseValues() const
Real getLog10K(unsigned j) const
void addKineticRates(Real dt, DenseVector< Real > &mole_additions, DenseMatrix< Real > &dmole_additions)
Computes the kinetic rates and their derivatives based on the current values of molality,...
const GeochemistrySpeciesSwapper & getSwapper() const
GeochemicalSystem(const GeochemicalSystem &src)=default
Copy constructor.
bool operator==(const GeochemicalSystem &rhs) const
const unsigned _num_kin
number of kinetic species
const unsigned _num_surface_pot
number of surface potentials
void computeEqmMolalities(std::vector< Real > &eqm_molality) const
compute the equilibrium molalities (not for minerals or gases)
void setChargeBalanceSpecies(unsigned new_charge_balance_index)
Set the charge-balance species to the basis index provided.
std::vector< bool > _in_algebraic_system
if _in_algebraic_system[i] == true then we need to solve for the i^th basis-species molality
unsigned _iters_to_make_consistent
Iterations to make the initial configuration consistent.
unsigned _num_basis_in_algebraic_system
number of unknown molalities in the algebraic system. Note: surface potentials (if any) are extra qua...
bool revertToOriginalChargeBalanceSpecies()
Changes the charge-balance species to the original that is specified in the constructor (this might n...
GeochemistryActivityCoefficients & _gac
Object to compute the activity coefficients and activity of water.
Real log10ActivityProduct(unsigned eqm_j) const
const std::vector< Real > & getSorbingSurfaceArea() const
const std::string & getOriginalRedoxLHS() const
void setMineralRelatedFreeMoles(Real value)
Set the free mole number of mineral-related species to the value provided.
void initBulkAndFree(std::vector< Real > &bulk_moles_old, std::vector< Real > &basis_molality) const
based on _constrained_value and _constraint_meaning, populate nw, bulk_moles_old and basis_molality w...
std::vector< ConstraintMeaningEnum > _constraint_meaning
The meaning of the values in _constraint_value. In the constructor, this is ordered to have the same ...
void updateOldWithCurrent(const DenseVector< Real > &mole_additions)
Usually used at the end of a solve, to provide correct initial conditions to the next time-step,...
Real log10RedoxActivityProduct(unsigned red) const
Real getRedoxLog10K(unsigned red) const
const unsigned _num_redox
number of redox species
void setKineticMoles(unsigned kin, Real moles)
Sets the current AND old mole number for a kinetic species.
void computeSorbingSurfaceArea(std::vector< Real > &sorbing_surface_area) const
Compute sorbing_surface_area depending on the current molality of the sorbing minerals.
void alterSystemBecauseBulkChanged()
Alter the GeochemicalSystem to reflect changes in bulk composition constraints that occur through,...
void computeConsistentConfiguration()
Compute a reasonably consistent configuration that can be used as an initial condition in a Newton pr...
std::vector< std::string > _constrained_species
Names of the species in that have their values fixed to _constraint_value with meanings _constraint_m...
const std::vector< Real > & getEquilibriumMolality() const
const std::vector< Real > & getBasisActivityCoefficient() const
const std::vector< Real > & computeAndGetEquilibriumActivity()
Computes activity for all equilibrium species (_eqm_activity) and returns a reference to the vector.
std::vector< Real > _eqm_log10K
equilibrium constant of the equilibrium species
Real _min_initial_molality
Minimum molality ever used in an initial guess.
const unsigned _num_eqm
number of equilibrium species
unsigned _num_in_algebraic_system
number of unknowns in the algebraic system (includes molalities and surface potentials)
void changeConstraintToBulk(unsigned basis_ind)
Changes the constraint to MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis ind...
std::vector< Real > _original_constraint_value
Numerical values of the constraints on _constraint_species. In the constructor, this is ordered to ha...
Real getSurfacePotential(unsigned sp) const
std::vector< Real > _surface_pot_expr
surface potential expressions.
void performSwap(unsigned swap_out_of_basis, unsigned swap_into_basis)
Perform the basis swap, and ensure that the resulting system is consistent.
unsigned getNumSurfacePotentials() const
return the number of surface potentials
unsigned getNumInBasis() const
returns the number of species in the basis
void computeTransportedBulkFromMolalities(std::vector< Real > &transported_bulk) const
Computes the value of transported bulk moles for all basis species using the existing molalities.
void buildTemperatureDependentQuantities(Real temperature)
Using the provided value of temperature, build _eqm_log10K for each eqm species and redox species.
std::vector< ConstraintUserMeaningEnum > _constraint_user_meaning
The user-defined meaning of the values in _constraint_value. In the constructor, this is ordered to h...
void checkAndInitialize(const std::vector< std::string > &kin_name, const std::vector< Real > &kin_initial, const std::vector< GeochemistryUnitConverter::GeochemistryUnit > &kin_unit)
Used during construction: checks for sane inputs and initializes molalities, etc, using the initializ...
unsigned getNumInEquilibrium() const
returns the number of species in equilibrium with the basis components
const std::vector< bool > & getBasisActivityKnown() const
unsigned getChargeBalanceBasisIndex() const
return the index of the charge-balance species in the basis list
Real getTotalChargeOld() const
std::vector< GeochemistryUnitConverter::GeochemistryUnit > _constraint_unit
Units of the _constraint_value when the GeochemicalSystem is constructed. This is used during the con...
void computeRemainingBasisActivities(std::vector< Real > &basis_activity) const
Compute the activity of water and put in basis_activity[0], and use the _basis_activity_coef and _bas...
void setSolventMassAndFreeMolalityAndMineralMolesAndSurfacePotsAndKineticMoles(const std::vector< std::string > &names, const std::vector< Real > &values, const std::vector< bool > &constraints_from_molalities)
Sets:
const std::string _original_charge_balance_species
The species used to enforce charge balance, as provided in the constructor.
GeochemistryIonicStrength & _is
Object that provides the ionic strengths.
const std::vector< bool > & getInAlgebraicSystem() const
DenseVector< Real > getTransportedBulkInOriginalBasis() const
const std::vector< Real > & getEquilibriumActivityCoefficient() const
Real getSolventWaterMass() const
Returns the mass of solvent water.
void enforceChargeBalanceIfSimple(std::vector< Real > &constraint_value, std::vector< Real > &bulk_moles_old) const
If all non-charged basis species are provided with a bulk number of moles, alter the bulk number of m...
GeochemistrySpeciesSwapper & _swapper
swapper that can swap species into and out of the basis
const std::vector< Real > & getKineticLog10K() const
unsigned getNumRedox() const
const std::vector< unsigned > & getBasisIndexOfAlgebraicSystem() const
std::vector< Real > _eqm_molality
molality of equilibrium species
Real getStoichiometricIonicStrength() const
Get the stoichiometric ionic strength.
void addToBulkMoles(unsigned basis_ind, Real value)
Add to the MOLES_BULK_SPECIES (or MOLES_BULK_WATER if basis_ind = 0) for the basis species.
void setConstraintValue(unsigned basis_ind, Real value)
Set the constraint value for the basis species.
ConstraintUserMeaningEnum
Each basis species must be provided with a constraint, that is chosen by the user from the following ...
const std::vector< Real > & getBulkMolesOld() const
bool alterChargeBalanceSpecies(Real threshold_molality)
If the molality of the charge-balance basis species is less than threshold molality,...
std::vector< Real > _basis_molality
IMPORTANT: this is.
const ModelGeochemicalDatabase & getModelGeochemicalDatabase() const
const std::vector< std::string > _swap_in
Species to immediately add to the basis in favor of _swap_out.
std::vector< bool > _basis_activity_known
whether basis_activity[i] is fixed by the user
Real getIonicStrength() const
Get the ionic strength.
std::string _charge_balance_species
The species used to enforce charge balance.
const std::vector< Real > & getSolventMassAndFreeMolalityAndMineralMoles() const
void updateBasisMolalityForKnownActivity(std::vector< Real > &basis_molality) const
For basis aqueous species (not water, minerals or gases) with activity set by the user,...
unsigned getNumInAlgebraicSystem() const
std::vector< unsigned > _basis_index
_basis_index[i] = index in the basis of the algebraic system species i, for i<num_basis_in_algebraic_...
void performSwapNoCheck(unsigned swap_out_of_basis, unsigned swap_into_basis)
Perform the basis swap, and ensure that the resulting system is consistent.
void initialize()
initialize all variables, ready for a Newton solve of the algebraic system
std::vector< Real > _redox_log10K
equilibrium constant of the redox species
std::vector< Real > getAlgebraicVariableValues() const
std::vector< Real > _kin_log10K
equilibrium constant of the kinetic species
DenseVector< Real > getBulkOldInOriginalBasis() const
Real getSurfaceCharge(unsigned sp) const
void computeJacobian(const DenseVector< Real > &res, DenseMatrix< Real > &jac, const DenseVector< Real > &mole_additions, const DenseMatrix< Real > &dmole_additions) const
Compute the Jacobian for the algebraic system and put it in jac.
std::vector< Real > _eqm_activity
equilibrium activities.
const unsigned _num_basis
number of basis species
unsigned _charge_balance_basis_index
The index in the list of basis species corresponding to the charge-balance species....
const std::vector< Real > & getKineticMoles() const
const std::vector< Real > & getBasisActivity() const
std::vector< Real > _basis_activity_coef
basis activity coefficients
void computeFreeMineralMoles(std::vector< Real > &basis_molality) const
Compute the free mineral moles (ie, basis_molality for basis species that are minerals),...
std::vector< Real > _kin_moles
mole number of kinetic species
void computeBulk(std::vector< Real > &bulk_moles_old) const
Computes the value of bulk_moles_old for all basis species.
ModelGeochemicalDatabase & _mgd
The minimal geochemical database.
ConstraintMeaningEnum
Each basis species has one of the following constraints.
void buildAlgebraicInfo(std::vector< bool > &in_algebraic_system, unsigned &num_basis_in_algebraic_system, unsigned &num_in_algebraic_system, std::vector< unsigned > &algebraic_index, std::vector< unsigned > &basis_index) const
Builds in_algebraic_system, algebraic_index and basis_index, and sets num_basis_in_algebraic_system a...
void closeSystem()
Changes a KG_SOLVENT_WATER constraint to MOLES_BULK_WATER (if there is such a constraint) and all FRE...
Real surfaceSorptionModifier(unsigned eqm_j) const
void buildKnownBasisActivities(std::vector< bool > &basis_activity_known, std::vector< Real > &basis_activity) const
Fully populates basis_activity_known, which is true if activity has been set by the user,...
std::vector< Real > _kin_moles_old
old mole number of kinetic species
void setTemperature(Real temperature)
Sets the temperature to the given quantity.
void setModelGeochemicalDatabase(const ModelGeochemicalDatabase &mgd)
Copies a ModelGeochemicalDatabase into our _mgd structure.
Real getTemperature() const
std::vector< Real > _basis_activity
values of activity (for water, minerals and aqueous basis species) or fugacity (for gases)
Base class to compute activity coefficients for non-minerals and non-gases (since these species do no...
Calculators to compute ionic strength and stoichiometric ionic strength.
Class to swap basis species with equilibrium species.
Data structure to hold all relevant information from the database file.