LCOV - code coverage report
Current view: top level - models/solid_mechanics - OlevskySinteringStress.cxx (source / functions) Coverage Total Hit
Test: coverage.info Lines: 96.8 % 31 30
Test Date: 2025-06-29 01:25:44 Functions: 100.0 % 3 3

            Line data    Source code
       1              : // Copyright 2024, UChicago Argonne, LLC
       2              : // All Rights Reserved
       3              : // Software Name: NEML2 -- the New Engineering material Model Library, version 2
       4              : // By: Argonne National Laboratory
       5              : // OPEN SOURCE LICENSE (MIT)
       6              : //
       7              : // Permission is hereby granted, free of charge, to any person obtaining a copy
       8              : // of this software and associated documentation files (the "Software"), to deal
       9              : // in the Software without restriction, including without limitation the rights
      10              : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      11              : // copies of the Software, and to permit persons to whom the Software is
      12              : // furnished to do so, subject to the following conditions:
      13              : //
      14              : // The above copyright notice and this permission notice shall be included in
      15              : // all copies or substantial portions of the Software.
      16              : //
      17              : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      18              : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      19              : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      20              : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      21              : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      22              : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      23              : // THE SOFTWARE.
      24              : 
      25              : #include "neml2/models/solid_mechanics/OlevskySinteringStress.h"
      26              : #include "neml2/tensors/Scalar.h"
      27              : 
      28              : namespace neml2
      29              : {
      30              : register_NEML2_object(OlevskySinteringStress);
      31              : 
      32              : OptionSet
      33            2 : OlevskySinteringStress::expected_options()
      34              : {
      35            2 :   OptionSet options = Model::expected_options();
      36            2 :   options.doc() = "Define the Olevsky-Skorohod sintering stress to be used in conjunction with "
      37              :                   "poroplasticity yield functions such as the GTNYieldFunction. The sintering "
      38              :                   "stress is defined as \\f$ \\sigma_s = 3 \\dfrac{\\gamma}{r} \\phi^2 \\f$, where "
      39              :                   "\\f$ \\gamma \\f$ is the surface tension, \\f$ r \\f$ is the size of the "
      40            2 :                   "particles/powders, and \\f$ \\phi \\f$ is the void fraction.";
      41              : 
      42            2 :   options.set<bool>("define_second_derivatives") = true;
      43              : 
      44            6 :   options.set_output("sintering_stress") = VariableName(STATE, "internal", "ss");
      45            2 :   options.set("sintering_stress").doc() = "Sintering stress";
      46              : 
      47            6 :   options.set_input("void_fraction") = VariableName(STATE, "internal", "f");
      48            4 :   options.set("void_fraction").doc() = "Void fraction";
      49              : 
      50            4 :   options.set_parameter<TensorName<Scalar>>("surface_tension");
      51            4 :   options.set("surface_tension").doc() = "Surface tension";
      52              : 
      53            4 :   options.set_parameter<TensorName<Scalar>>("particle_radius");
      54            2 :   options.set("particle_radius").doc() = "Particle radius";
      55              : 
      56            2 :   return options;
      57            0 : }
      58              : 
      59            1 : OlevskySinteringStress::OlevskySinteringStress(const OptionSet & options)
      60              :   : Model(options),
      61            1 :     _s(declare_output_variable<Scalar>("sintering_stress")),
      62            1 :     _phi(declare_input_variable<Scalar>("void_fraction")),
      63            4 :     _gamma(declare_parameter<Scalar>("gamma", "surface_tension")),
      64            5 :     _r(declare_parameter<Scalar>("r", "particle_radius"))
      65              : {
      66            1 : }
      67              : 
      68              : void
      69            3 : OlevskySinteringStress::set_value(bool out, bool dout_din, bool d2out_din2)
      70              : {
      71            3 :   if (out)
      72            1 :     _s = 3 * _gamma * _phi * _phi / _r;
      73              : 
      74            3 :   if (dout_din)
      75            1 :     if (_phi.is_dependent())
      76            1 :       _s.d(_phi) = 6 * _gamma * _phi / _r;
      77              : 
      78            3 :   if (d2out_din2)
      79            1 :     if (_phi.is_dependent())
      80            1 :       _s.d(_phi, _phi) = 6 * _gamma / _r;
      81            3 : }
      82              : } // namespace neml2
        

Generated by: LCOV version 2.0-1