Line data Source code
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 : #include "PHAux.h" 11 : 12 : registerMooseObject("ChemicalReactionsApp", PHAux); 13 : 14 : InputParameters 15 205 : PHAux::validParams() 16 : { 17 205 : InputParameters params = AuxKernel::validParams(); 18 410 : params.addRequiredCoupledVar("h_conc", "The molar concentration of free H+ ions in solution"); 19 410 : params.addCoupledVar("activity_coeff", 1.0, "Activity coefficient of H+. Default is 1"); 20 205 : params.addClassDescription("pH of solution"); 21 205 : return params; 22 0 : } 23 : 24 110 : PHAux::PHAux(const InputParameters & parameters) 25 110 : : AuxKernel(parameters), _hplus(coupledValue("h_conc")), _gamma(coupledValue("activity_coeff")) 26 : { 27 110 : } 28 : 29 : Real 30 11456 : PHAux::computeValue() 31 : { 32 : mooseAssert(_gamma[_qp] * _hplus[_qp] > 0.0, "Negative activity in pH is not possible"); 33 11456 : return -std::log10(_gamma[_qp] * _hplus[_qp]); 34 : }