LCOV - code coverage report
Current view: top level - src/ics - ThumbIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 29 30 96.7 %
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 "ThumbIC.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", ThumbIC);
      13             : 
      14             : InputParameters
      15          46 : ThumbIC::validParams()
      16             : {
      17          46 :   InputParameters params = InitialCondition::validParams();
      18          46 :   params.addClassDescription("Thumb shaped bicrystal for grain boundary mobility tests");
      19          92 :   params.addRequiredParam<Real>("xcoord", "The x coordinate of the circle center");
      20          92 :   params.addRequiredParam<Real>("width", "The y coordinate of the circle center");
      21          92 :   params.addRequiredParam<Real>("height", "The z coordinate of the circle center");
      22          92 :   params.addRequiredParam<Real>("invalue", "The variable value inside the circle");
      23          92 :   params.addRequiredParam<Real>("outvalue", "The variable value outside the circle");
      24          46 :   return params;
      25           0 : }
      26             : 
      27          24 : ThumbIC::ThumbIC(const InputParameters & parameters)
      28             :   : InitialCondition(parameters),
      29          24 :     _xcoord(parameters.get<Real>("xcoord")),
      30          24 :     _width(parameters.get<Real>("width")),
      31          24 :     _height(parameters.get<Real>("height")),
      32          24 :     _invalue(parameters.get<Real>("invalue")),
      33          48 :     _outvalue(parameters.get<Real>("outvalue"))
      34             : {
      35          24 : }
      36             : 
      37             : Real
      38      128448 : ThumbIC::value(const Point & p)
      39             : {
      40             :   Real value = 0.0;
      41             : 
      42      128448 :   if (p(1) > _height)
      43             :   {
      44             :     Real rad = 0.0;
      45       48672 :     Point center(_xcoord, _height, 0.0);
      46      146016 :     for (unsigned int i = 0; i < 2; ++i)
      47       97344 :       rad += (p(i) - center(i)) * (p(i) - center(i));
      48             : 
      49       48672 :     rad = sqrt(rad);
      50             : 
      51       48672 :     if (rad <= _width / 2.0)
      52        9792 :       value = _invalue;
      53             :     else
      54       38880 :       value = _outvalue;
      55             :   }
      56             :   else
      57             :   {
      58       79776 :     if (p(0) > _xcoord - _width / 2.0 && p(0) < _xcoord + _width / 2.0)
      59       30168 :       value = _invalue;
      60             :     else
      61       49608 :       value = _outvalue;
      62             :   }
      63             : 
      64      128448 :   return value;
      65             : }

Generated by: LCOV version 1.14