LCOV - code coverage report
Current view: top level - src/materials - ComputeSurfaceTensionKKS.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 0 33 0.0 %
Date: 2025-07-25 05:00:39 Functions: 0 3 0.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 "ComputeSurfaceTensionKKS.h"
      11             : #include "RankTwoTensor.h"
      12             : 
      13             : registerMooseObject("SolidMechanicsApp", ComputeSurfaceTensionKKS);
      14             : 
      15             : InputParameters
      16           0 : ComputeSurfaceTensionKKS::validParams()
      17             : {
      18           0 :   InputParameters params = Material::validParams();
      19           0 :   params.addClassDescription(
      20             :       "Surface tension of an interface defined by the gradient of an order parameter");
      21           0 :   params.addCoupledVar("v",
      22             :                        "Order parameter that defines the interface, assumed to vary from 0 to 1.");
      23           0 :   params.addParam<MaterialPropertyName>("kappa_name", "kappa_op", "Gradient energy coefficient");
      24           0 :   params.addParam<MaterialPropertyName>("g", "g", "Barrier Function Material that provides g(eta)");
      25           0 :   params.addRequiredParam<Real>("w", "Double well height parameter");
      26           0 :   params.addParam<MaterialPropertyName>("planar_stress_name",
      27             :                                         "extra_stress",
      28             :                                         "Material property name for the interfacial planar stress");
      29           0 :   return params;
      30           0 : }
      31             : 
      32           0 : ComputeSurfaceTensionKKS::ComputeSurfaceTensionKKS(const InputParameters & parameters)
      33             :   : Material(parameters),
      34           0 :     _v(coupledValue("v")),
      35           0 :     _grad_v(coupledGradient("v")),
      36           0 :     _kappa(getMaterialProperty<Real>("kappa_name")),
      37           0 :     _g(getMaterialProperty<Real>("g")),
      38           0 :     _w(getParam<Real>("w")),
      39           0 :     _planar_stress(
      40           0 :         declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("planar_stress_name")))
      41             : {
      42           0 : }
      43             : 
      44             : void
      45           0 : ComputeSurfaceTensionKKS::computeQpProperties()
      46             : {
      47           0 :   auto & S = _planar_stress[_qp];
      48             :   S.zero();
      49             : 
      50             :   // compute norm square of the order parameter gradient
      51           0 :   const Real grad_norm_sq = _grad_v[_qp].norm_sq();
      52             : 
      53             :   const Real nx = _grad_v[_qp](0);
      54             :   const Real ny = _grad_v[_qp](1);
      55             :   const Real nz = _grad_v[_qp](2);
      56           0 :   Real fsum = _w * _g[_qp] + 0.5 * _kappa[_qp] * grad_norm_sq;
      57             : 
      58           0 :   S(0, 0) += fsum - _kappa[_qp] * nx * nx;
      59           0 :   S(0, 1) += -_kappa[_qp] * nx * ny;
      60           0 :   S(1, 1) += fsum - _kappa[_qp] * ny * ny;
      61           0 :   S(0, 2) += -_kappa[_qp] * nx * nz;
      62           0 :   S(1, 2) += -_kappa[_qp] * ny * nz;
      63           0 :   S(2, 2) += fsum - _kappa[_qp] * nz * nz;
      64             : 
      65             :   // fill in symmetrically
      66           0 :   S(1, 0) = S(0, 1);
      67           0 :   S(2, 0) = S(0, 2);
      68           0 :   S(2, 1) = S(1, 2);
      69           0 : }

Generated by: LCOV version 1.14