LCOV - code coverage report
Current view: top level - src/bcs - IntegratedBCBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 37 38 97.4 %
Date: 2025-07-17 01:28:37 Functions: 4 4 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 "IntegratedBCBase.h"
      11             : #include "Assembly.h"
      12             : 
      13             : InputParameters
      14      916147 : IntegratedBCBase::validParams()
      15             : {
      16      916147 :   InputParameters params = BoundaryCondition::validParams();
      17      916147 :   params += MaterialPropertyInterface::validParams();
      18             : 
      19      916147 :   params.addParam<std::vector<AuxVariableName>>(
      20             :       "save_in",
      21             :       {},
      22             :       "The name of auxiliary variables to save this BC's residual contributions to.  "
      23             :       "Everything about that variable must match everything about this variable (the "
      24             :       "type, what blocks it's on, etc.)");
      25      916147 :   params.addParam<std::vector<AuxVariableName>>(
      26             :       "diag_save_in",
      27             :       {},
      28             :       "The name of auxiliary variables to save this BC's diagonal jacobian "
      29             :       "contributions to.  Everything about that variable must match everything "
      30             :       "about this variable (the type, what blocks it's on, etc.)");
      31             : 
      32      916147 :   params.addParamNamesToGroup("diag_save_in save_in", "Advanced");
      33             : 
      34     2748441 :   params.addParam<bool>(
      35             :       "skip_execution_outside_variable_domain",
      36     1832294 :       false,
      37             :       "Whether to skip execution of this boundary condition when the variable it "
      38             :       "applies to is not defined on the boundary. This can facilitate setups with "
      39             :       "moving variable domains and fixed boundaries. Note that the FEProblem boundary-restricted "
      40             :       "integrity checks will also need to be turned off if using this option");
      41      916147 :   params.addParamNamesToGroup("skip_execution_outside_variable_domain", "Advanced");
      42             : 
      43             :   // Integrated BCs always rely on Boundary MaterialData
      44      916147 :   params.set<Moose::MaterialDataType>("_material_data_type") = Moose::BOUNDARY_MATERIAL_DATA;
      45             : 
      46      916147 :   return params;
      47           0 : }
      48             : 
      49        8982 : IntegratedBCBase::IntegratedBCBase(const InputParameters & parameters)
      50             :   : BoundaryCondition(parameters, false), // False is because this is NOT nodal
      51             :     CoupleableMooseVariableDependencyIntermediateInterface(this, false),
      52             :     MaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, boundaryIDs()),
      53       17954 :     _current_elem(_assembly.elem()),
      54        8977 :     _current_elem_volume(_assembly.elemVolume()),
      55        8977 :     _current_side(_assembly.side()),
      56        8977 :     _current_side_elem(_assembly.sideElem()),
      57        8977 :     _current_side_volume(_assembly.sideElemVolume()),
      58        8977 :     _current_boundary_id(_assembly.currentBoundaryID()),
      59        8977 :     _qrule(_assembly.qRuleFace()),
      60        8977 :     _q_point(_assembly.qPointsFace()),
      61        8977 :     _JxW(_assembly.JxWFace()),
      62        8977 :     _coord(_assembly.coordTransformation()),
      63        8977 :     _save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
      64        8977 :     _diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in")),
      65        8977 :     _skip_execution_outside_variable_domain(
      66       35913 :         getParam<bool>("skip_execution_outside_variable_domain"))
      67             : {
      68        8977 : }
      69             : 
      70             : void
      71      473256 : IntegratedBCBase::prepareShapes(const unsigned int var_num)
      72             : {
      73      473256 :   _subproblem.prepareFaceShapes(var_num, _tid);
      74      473256 : }
      75             : 
      76             : bool
      77     3852488 : IntegratedBCBase::shouldApply() const
      78             : {
      79             : #ifdef DEBUG
      80             :   const bool check_subdomain = true;
      81             : #else
      82     3852488 :   const bool check_subdomain = false;
      83             : #endif
      84     3852488 :   if (_skip_execution_outside_variable_domain || check_subdomain)
      85             :   {
      86             :     mooseAssert(_current_elem, "Should have a current element");
      87         288 :     const auto block_id = _current_elem->subdomain_id();
      88             : #ifdef DEBUG
      89             :     if (!_skip_execution_outside_variable_domain && !variable().hasBlocks(block_id))
      90             :       mooseError("This boundary condition is being executed outside the domain of "
      91             :                  "definition of its variable, on subdomain: ",
      92             :                  block_id);
      93             : #endif
      94         288 :     if (!variable().hasBlocks(block_id))
      95          88 :       return false;
      96             :   }
      97     3852400 :   return true;
      98             : }

Generated by: LCOV version 1.14