TimeDependentReactionSolver
This sets up a simple time-dependent MOOSE simulation, with no spatial dependence and no "usual" solution process (with Kernels, etc). Apart from setting up a dummy Mesh, Variables, etc, this Action adds a GeochemistryTimeDependentReactor userobject, many AuxVariables corresponding to molality, free-mg, free-cm3, pH, etc using the GeochemistryQuantityAux and a console output object, the GeochemistryConsoleOutput.
Here are some simple of examples of where this Action is used in the test suite:
An simple example input file is:
# Simple example of time-dependent reaction path.
# This example involves an HCl solution that is initialized at pH=2, then the pH is controlled via controlled_activity, and finally HCl is titrated into the solution
[GlobalParams<<<{"href": "../GlobalParams/index.html"}>>>]
point = '0 0 0'
[]
[TimeDependentReactionSolver<<<{"href": "index.html"}>>>]
model_definition<<<{"description": "The name of the GeochemicalModelDefinition user object (you must create this UserObject yourself)"}>>> = definition
geochemistry_reactor_name<<<{"description": "The name that will be given to the GeochemistryReactor UserObject built by this action"}>>> = reactor
charge_balance_species<<<{"description": "Charge balance will be enforced on this basis species. This means that its bulk mole number may be changed from the initial value you provide in order to ensure charge neutrality. After the initial swaps have been performed, this must be in the basis, and it must be provided with a bulk_composition constraint_meaning."}>>> = "Cl-"
constraint_species<<<{"description": "Names of the species that have their values fixed to constraint_value with meaning constraint_meaning. All basis species (after swap_into_basis and swap_out_of_basis) must be provided with exactly one constraint. These constraints are used to compute the configuration during the initial problem setup, and in time-dependent simulations they may be modified as time progresses."}>>> = "H2O H+ Cl-"
constraint_value<<<{"description": "Numerical value of the containts on constraint_species"}>>> = " 1.0 -2 1E-2"
constraint_meaning<<<{"description": "Meanings of the numerical values given in constraint_value. kg_solvent_water: can only be applied to H2O and units must be kg. bulk_composition: can be applied to all non-gas species, and represents the total amount of the basis species contained as free species as well as the amount found in secondary species but not in kinetic species, and units must be moles or mass (kg, g, etc). bulk_composition_with_kinetic: can be applied to all non-gas species, and represents the total amount of the basis species contained as free species as well as the amount found in secondary species and in kinetic species, and units must be moles or mass (kg, g, etc). free_concentration: can be applied to all basis species that are not gas and not H2O and not mineral, and represents the total amount of the basis species existing freely (not as secondary species) within the solution, and units must be molal or mass_per_kg_solvent. free_mineral: can be applied to all mineral basis species, and represents the total amount of the mineral existing freely (precipitated) within the solution, and units must be moles, mass or cm3. activity and log10activity: can be applied to basis species that are not gas and not mineral and not sorbing sites, and represents the activity of the basis species (recall pH = -log10activity), and units must be dimensionless. fugacity and log10fugacity: can be applied to gases, and units must be dimensionless"}>>> = "kg_solvent_water log10activity bulk_composition"
constraint_unit<<<{"description": "Units of the numerical values given in constraint_value. Dimensionless: should only be used for activity or fugacity constraints. Moles: mole number. Molal: moles per kg solvent water. kg: kilograms. g: grams. mg: milligrams. ug: micrograms. kg_per_kg_solvent: kilograms per kg solvent water. g_per_kg_solvent: grams per kg solvent water. mg_per_kg_solvent: milligrams per kg solvent water. ug_per_kg_solvent: micrograms per kg solvent water. cm3: cubic centimeters"}>>> = " kg dimensionless moles"
ramp_max_ionic_strength_initial<<<{"description": "The number of iterations over which to progressively increase the maximum ionic strength (from zero to max_ionic_strength) during the initial equilibration. Increasing this can help in convergence of the Newton process, at the cost of spending more time finding the aqueous configuration."}>>> = 0 # max_ionic_strength in such a simple problem does not need ramping
execute_console_output_on<<<{"description": "When to execute the geochemistry console output"}>>> = '' # only CSV output for this example
# close the system at time = 0
close_system_at_time<<<{"description": "Time at which to 'close' the system, that is, change a kg_solvent_water constraint to moles_bulk_water, and all free_molality and free_moles_mineral_species to moles_bulk_species"}>>> = 0
# control pH. This sets pH = 2 + t (see the act_H+ AuxKernel)
controlled_activity_name<<<{"description": "The names of the species that have their activity or fugacity constrained. There should be an equal number of these names as values given in controlled_activity_value. NOTE: if these species are not in the basis, or they do not have an activity (or fugacity) constraint then their activity cannot be controlled: in this case MOOSE will ignore the value you prescribe in controlled_activity_value."}>>> = 'H+'
controlled_activity_value<<<{"description": "Values of the activity or fugacity of the species in controlled_activity_name list. These should always be positive"}>>> = 'act_H+'
# remove the constraint on H+ activity at time = 5, when, from the previous time-step, pH = 2 + 4 = 6
remove_fixed_activity_name<<<{"description": "The name of the species that should have their activity or fugacity constraint removed at time given in remove_fixed_activity_time. There should be an equal number of these names as times given in remove_fixed_activity_time. Each of these must be in the basis and have an activity or fugacity constraint"}>>> = 'H+'
remove_fixed_activity_time<<<{"description": "The times at which the species in remove_fixed_activity_name should have their activity or fugacity constraint removed."}>>> = 5
# add 1E-5 moles of HCl every second of the simulation: this has no impact before time = 5 when the fixed-activity constraint it turned off, but then, molality_H+ ~ 1E-6 + 1E-4 * (t - 4), so
# time, approx_pH
# 5, -log10(1E-4) = 4
# 10, -log10(6E-4) = 3.2
source_species_names<<<{"description": "The name of the species that are added at rates given in source_species_rates. There must be an equal number of these as source_species_rates."}>>> = 'HCl'
source_species_rates<<<{"description": "Rates, in mols/time_unit, of addition of the species with names given in source_species_names. A negative value corresponds to removing a species: be careful that you don't cause negative mass problems!"}>>> = '1E-4'
[]
[AuxVariables<<<{"href": "../AuxVariables/index.html"}>>>]
[act_H+]
[]
[]
[AuxKernels<<<{"href": "../AuxKernels/index.html"}>>>]
[act_H+]
type = FunctionAux<<<{"description": "Auxiliary Kernel that creates and updates a field variable by sampling a function through space and time.", "href": "../../source/auxkernels/FunctionAux.html"}>>>
variable<<<{"description": "The name of the variable that this object applies to"}>>> = act_H+
function<<<{"description": "The function to use as the value"}>>> = '10^(-2 - t)'
execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = timestep_begin
[]
[]
[Postprocessors<<<{"href": "../Postprocessors/index.html"}>>>]
[pH]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'pH'
[]
[solvent_mass]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'kg_solvent_H2O'
[]
[molal_Cl-]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'molal_Cl-'
[]
[mg_per_kg_HCl]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'mg_per_kg_HCl'
[]
[activity_OH-]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'activity_OH-'
[]
[bulk_H+]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'bulk_moles_H+'
[]
[temperature]
type = PointValue<<<{"description": "Compute the value of a variable at a specified location", "href": "../../source/postprocessors/PointValue.html"}>>>
variable<<<{"description": "The name of the variable that this postprocessor operates on."}>>> = 'solution_temperature'
[]
[]
[Executioner<<<{"href": "../Executioner/index.html"}>>>]
type = Transient
dt = 1
end_time = 10
[]
[UserObjects<<<{"href": "../UserObjects/index.html"}>>>]
[definition]
type = GeochemicalModelDefinition<<<{"description": "User object that parses a geochemical database file, and only retains information relevant to the current geochemical model", "href": "../../source/userobjects/GeochemicalModelDefinition.html"}>>>
database_file<<<{"description": "The name of the geochemical database file"}>>> = "../../../database/moose_geochemdb.json"
basis_species<<<{"description": "A list of basis components relevant to the aqueous-equilibrium problem. H2O must appear first in this list. These components must be chosen from the 'basis species' in the database, the sorbing sites (if any) and the decoupled redox states that are in disequilibrium (if any)."}>>> = "H2O H+ Cl-"
[]
[]
[Outputs<<<{"href": "../Outputs/index.html"}>>>]
csv<<<{"description": "Output the scalar variable and postprocessors to a *.csv file using the default CSV output."}>>> = true
[]
(modules/geochemistry/test/tests/time_dependent_reactions/simple.i)