LCOV - code coverage report
Current view: top level - src/ics - PolycrystalColoringICLinearizedInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 18 19 94.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 "PolycrystalColoringICLinearizedInterface.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", PolycrystalColoringICLinearizedInterface);
      13             : 
      14             : InputParameters
      15         299 : PolycrystalColoringICLinearizedInterface::validParams()
      16             : {
      17         299 :   InputParameters params = PolycrystalColoringIC::validParams();
      18         299 :   params.addClassDescription("Sets up polycrystal initial conditions from user objects for "
      19             :                              "transformed linearized interface");
      20         598 :   params.addRequiredParam<Real>(
      21             :       "bound_value", "Bound value used to keep variable between +/-bound. Must be positive.");
      22             : 
      23         299 :   return params;
      24           0 : }
      25             : 
      26         156 : PolycrystalColoringICLinearizedInterface::PolycrystalColoringICLinearizedInterface(
      27         156 :     const InputParameters & parameters)
      28         156 :   : PolycrystalColoringIC(parameters), _bound(parameters.get<Real>("bound_value"))
      29             : {
      30         156 : }
      31             : 
      32             : Real
      33      168000 : PolycrystalColoringICLinearizedInterface::value(const Point & p)
      34             : {
      35             :   // Transform bound into the order parameter space
      36      168000 :   const Real trans_bound = (1.0 + std::tanh(-_bound / std::sqrt(2.0))) / 2.0;
      37             : 
      38             :   // Get IC value for the order parameter
      39      168000 :   const Real trans_value = PolycrystalColoringIC::value(p);
      40             : 
      41             :   Real value = 0.0;
      42      168000 :   if (trans_value < trans_bound)
      43      121278 :     value = -_bound;
      44       46722 :   else if (trans_value > 1.0 - trans_bound)
      45        8958 :     value = _bound;
      46             :   else
      47       37764 :     value = std::sqrt(2.0) * std::atanh(2.0 * trans_value - 1.0);
      48             : 
      49      168000 :   return value;
      50             : }

Generated by: LCOV version 1.14