LCOV - code coverage report
Current view: top level - src/meshmodifiers - CoupledVarThresholdElementSubdomainModifier.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 15 16 93.8 %
Date: 2025-08-08 20:01:16 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 "CoupledVarThresholdElementSubdomainModifier.h"
      11             : 
      12             : #include "libmesh/quadrature.h"
      13             : 
      14             : registerMooseObject("MooseApp", CoupledVarThresholdElementSubdomainModifier);
      15             : 
      16             : InputParameters
      17       15033 : CoupledVarThresholdElementSubdomainModifier::validParams()
      18             : {
      19       15033 :   InputParameters params = ThresholdElementSubdomainModifier::validParams();
      20       15033 :   params.addClassDescription("Modify the element subdomain ID if a coupled variable satisfies the "
      21             :                              "criterion for the threshold (above, equal, or below)");
      22       15033 :   params.addRequiredCoupledVar("coupled_var",
      23             :                                "Coupled variable whose value is used in the criterion");
      24       15033 :   return params;
      25           0 : }
      26             : 
      27         399 : CoupledVarThresholdElementSubdomainModifier::CoupledVarThresholdElementSubdomainModifier(
      28         399 :     const InputParameters & parameters)
      29         399 :   : ThresholdElementSubdomainModifier(parameters), _v(coupledValue("coupled_var"))
      30             : {
      31         399 : }
      32             : 
      33             : Real
      34      810290 : CoupledVarThresholdElementSubdomainModifier::computeValue()
      35             : {
      36      810290 :   Real avg_val = 0;
      37             : 
      38     2223688 :   for (unsigned int qp = 0; qp < _qrule->n_points(); ++qp)
      39     1413398 :     avg_val += _v[qp] * _JxW[qp] * _coord[qp];
      40      810290 :   avg_val /= _current_elem_volume;
      41             : 
      42      810290 :   return avg_val;
      43             : }

Generated by: LCOV version 1.14