LCOV - code coverage report
Current view: top level - src/auxkernels - TotalConcentrationAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose chemical_reactions: #31405 (292dce) with base fef103 Lines: 18 21 85.7 %
Date: 2025-09-04 07:52:33 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "TotalConcentrationAux.h"
      11             : 
      12             : registerMooseObject("ChemicalReactionsApp", TotalConcentrationAux);
      13             : 
      14             : InputParameters
      15         205 : TotalConcentrationAux::validParams()
      16             : {
      17         205 :   InputParameters params = AuxKernel::validParams();
      18         410 :   params.addCoupledVar("primary_species", "Primary species free concentration");
      19         410 :   params.addParam<std::vector<Real>>(
      20             :       "sto_v",
      21             :       {},
      22             :       "The stoichiometric coefficient of primary species in secondary equilibrium species");
      23         410 :   params.addCoupledVar("v",
      24             :                        "Secondary equilibrium species in which the primary species is involved");
      25         205 :   params.addClassDescription("Total concentration of primary species (including stoichiometric "
      26             :                              "contribution to secondary equilibrium species)");
      27         205 :   return params;
      28           0 : }
      29             : 
      30         110 : TotalConcentrationAux::TotalConcentrationAux(const InputParameters & parameters)
      31             :   : AuxKernel(parameters),
      32         110 :     _primary_species(coupledValue("primary_species")),
      33         220 :     _sto_v(getParam<std::vector<Real>>("sto_v")),
      34         330 :     _secondary_species(coupledValues("v"))
      35             : {
      36             :   // Check that the correct number of stoichiometric coefficients have been included
      37         110 :   if (_sto_v.size() != coupledComponents("v"))
      38           0 :     mooseError("The number of stoichiometric coefficients and coupled species must be equal in ",
      39           0 :                _name);
      40         110 : }
      41             : 
      42             : Real
      43         400 : TotalConcentrationAux::computeValue()
      44             : {
      45         400 :   Real total_concentration = _primary_species[_qp];
      46             : 
      47        1680 :   for (unsigned int i = 0; i < _secondary_species.size(); ++i)
      48        1280 :     total_concentration += _sto_v[i] * (*_secondary_species[i])[_qp];
      49             : 
      50         400 :   return total_concentration;
      51             : }

Generated by: LCOV version 1.14