www.mooseframework.org
PHAux.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "PHAux.h"
11 
12 registerMooseObject("ChemicalReactionsApp", PHAux);
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<AuxKernel>();
19  params.addRequiredCoupledVar("h_conc", "The molar concentration of free H+ ions in solution");
20  params.addCoupledVar("activity_coeff", 1.0, "Activity coefficient of H+. Default is 1");
21  params.addClassDescription("pH of solution");
22  return params;
23 }
24 
25 PHAux::PHAux(const InputParameters & parameters)
26  : AuxKernel(parameters), _hplus(coupledValue("h_conc")), _gamma(coupledValue("activity_coeff"))
27 {
28 }
29 
30 Real
32 {
33  mooseAssert(_gamma[_qp] * _hplus[_qp] > 0.0, "Negative activity in pH is not possible");
34  return -std::log10(_gamma[_qp] * _hplus[_qp]);
35 }
PHAux::PHAux
PHAux(const InputParameters &parameters)
Definition: PHAux.C:25
PHAux::_gamma
const VariableValue & _gamma
Activity coefficient of H+ ions.
Definition: PHAux.h:42
PHAux::computeValue
virtual Real computeValue() override
Definition: PHAux.C:31
validParams< PHAux >
InputParameters validParams< PHAux >()
Definition: PHAux.C:16
PHAux::_hplus
const VariableValue & _hplus
Free molar concentration of H+ ions.
Definition: PHAux.h:40
PHAux.h
PHAux
The pH of the solution is defined as.
Definition: PHAux.h:31
registerMooseObject
registerMooseObject("ChemicalReactionsApp", PHAux)