LCOV - code coverage report
Current view: top level - src/auxkernels - GrainBoundaryVelocity.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 24 25 96.0 %
Date: 2025-09-04 07:55:36 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 "GrainBoundaryVelocity.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", GrainBoundaryVelocity);
      13             : 
      14             : InputParameters
      15          23 : GrainBoundaryVelocity::validParams()
      16             : {
      17          23 :   InputParameters params = AuxKernel::validParams();
      18          23 :   params.addClassDescription("Compute the velocity of grain boundaries.");
      19          46 :   params.addParam<Real>("eta_bottom", 0.20, "start point on range of eta we are interested in.");
      20          46 :   params.addParam<Real>("eta_top", 0.80, "end point on range of eta we are interested in.");
      21          46 :   params.addRequiredCoupledVarWithAutoBuild(
      22             :       "v", "var_name_base", "op_num", "Array of coupled variables");
      23          23 :   return params;
      24           0 : }
      25             : 
      26          12 : GrainBoundaryVelocity::GrainBoundaryVelocity(const InputParameters & parameters)
      27             :   : AuxKernel(parameters),
      28          12 :     _eta_bottom(getParam<Real>("eta_bottom")),
      29          24 :     _eta_top(getParam<Real>("eta_top")),
      30          12 :     _op_num(coupledComponents("v")),
      31          12 :     _eta(coupledValues("v")),
      32          12 :     _deta_dt(coupledDots("v")),
      33          24 :     _grad_eta(coupledGradients("v"))
      34             : {
      35          12 : }
      36             : 
      37             : Real
      38      563200 : GrainBoundaryVelocity::computeValue()
      39             : {
      40      563200 :   _value = 0.0;
      41      563200 :   _new_val = 0.0;
      42     2816000 :   for (unsigned int i = 0; i < _op_num; ++i)
      43             :   {
      44             :     // To make sure we are getting data from the range that we want
      45     2252800 :     if ((*_eta[i])[_qp] > _eta_bottom && (*_eta[i])[_qp] < _eta_top)
      46      184933 :       _new_val = 1.0 / (*_grad_eta[i])[_qp].norm() * (*_deta_dt[i])[_qp];
      47             :     // our calculation
      48     2252800 :     if (_new_val > _value)
      49       88420 :       _value = _new_val;
      50             :   }
      51             : 
      52      563200 :   return _value;
      53             : }

Generated by: LCOV version 1.14