LCOV - code coverage report
Current view: top level - src/ics - SmoothCircleICLinearizedInterface.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 "SmoothCircleICLinearizedInterface.h"
      11             : 
      12             : registerMooseObject("PhaseFieldApp", SmoothCircleICLinearizedInterface);
      13             : 
      14             : InputParameters
      15          92 : SmoothCircleICLinearizedInterface::validParams()
      16             : {
      17          92 :   InputParameters params = SmoothCircleIC::validParams();
      18          92 :   params.addClassDescription(
      19             :       "Circle with a smooth interface transformed using the linearized interface function");
      20         184 :   params.addRequiredParam<Real>(
      21             :       "bound_value", "Bound value used to keep variable between +/-bound. Must be positive.");
      22          92 :   return params;
      23           0 : }
      24             : 
      25          48 : SmoothCircleICLinearizedInterface::SmoothCircleICLinearizedInterface(
      26          48 :     const InputParameters & parameters)
      27          48 :   : SmoothCircleIC(parameters), _bound(parameters.get<Real>("bound_value"))
      28             : {
      29          48 : }
      30             : 
      31             : Real
      32        9600 : SmoothCircleICLinearizedInterface::value(const Point & p)
      33             : {
      34             :   // Transform bound into the order parameter space
      35        9600 :   const Real trans_bound = (1.0 + std::tanh(-_bound / std::sqrt(2.0))) / 2.0;
      36             : 
      37             :   // Get IC value for the order parameter
      38        9600 :   const Real trans_value = SmoothCircleIC::value(p);
      39             : 
      40             :   // Transform order parameter value into linearized interface variable
      41             :   Real value = 0.0;
      42             : 
      43        9600 :   if (trans_value < trans_bound)
      44        1536 :     value = -_bound;
      45        8064 :   else if (trans_value > 1.0 - trans_bound)
      46        1536 :     value = _bound;
      47             :   else
      48        6528 :     value = std::sqrt(2.0) * std::atanh(2.0 * trans_value - 1.0);
      49             : 
      50        9600 :   return value;
      51             : }

Generated by: LCOV version 1.14