LCOV - code coverage report
Current view: top level - src/bcs - SinNeumannBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 18 94.4 %
Date: 2025-07-17 01:28:37 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 "SinNeumannBC.h"
      11             : 
      12             : registerMooseObject("MooseApp", SinNeumannBC);
      13             : 
      14             : InputParameters
      15       14290 : SinNeumannBC::validParams()
      16             : {
      17       14290 :   InputParameters params = IntegratedBC::validParams();
      18       14290 :   params.addParam<Real>("initial", 0.0, "The initial value of the gradient on the boundary");
      19       14290 :   params.addParam<Real>("final", 0.0, "The final value of the gradient on the boundary");
      20       14290 :   params.addParam<Real>("duration", 0.0, "The duration of the ramp");
      21       14290 :   params.addClassDescription("Imposes a time-varying flux boundary condition $\\frac{\\partial "
      22             :                              "u}{\\partial n}=g(t)$, where $g(t)$ "
      23             :                              "varies from an given initial value at time $t=0$ to a given final "
      24             :                              "value over a specified duration.");
      25       14290 :   return params;
      26           0 : }
      27             : 
      28          13 : SinNeumannBC::SinNeumannBC(const InputParameters & parameters)
      29             :   : IntegratedBC(parameters),
      30          13 :     _initial(getParam<Real>("initial")),
      31          13 :     _final(getParam<Real>("final")),
      32          26 :     _duration(getParam<Real>("duration"))
      33             : {
      34          13 : }
      35             : 
      36             : Real
      37      182640 : SinNeumannBC::computeQpResidual()
      38             : {
      39             :   Real value;
      40             : 
      41      182640 :   if (_t < _duration)
      42      164400 :     value = _initial + (_final - _initial) * std::sin((0.5 / _duration) * libMesh::pi * _t);
      43             :   else
      44       18240 :     value = _final;
      45             : 
      46      182640 :   return -_test[_i][_qp] * value;
      47             : }

Generated by: LCOV version 1.14