LCOV - code coverage report
Current view: top level - src/materials - WaveSpeed.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 13 14 92.9 %
Date: 2025-07-25 05:00:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* This file is part of the MOOSE framework
       3             : //* https://mooseframework.inl.gov
       4             : //*
       5             : //* All rights reserved, see COPYRIGHT for full restrictions
       6             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       7             : //*
       8             : //* Licensed under LGPL 2.1, please see LICENSE for details
       9             : //* https://www.gnu.org/licenses/lgpl-2.1.html
      10             : 
      11             : #include "WaveSpeed.h"
      12             : #include "libmesh/utility.h"
      13             : #include "RankTwoTensor.h"
      14             : #include "RankFourTensor.h"
      15             : #include "SymmetricRankTwoTensor.h"
      16             : #include "SymmetricRankFourTensor.h"
      17             : 
      18             : registerMooseObject("SolidMechanicsApp", WaveSpeed);
      19             : 
      20             : InputParameters
      21          48 : WaveSpeed::validParams()
      22             : {
      23          48 :   InputParameters params = Material::validParams();
      24          48 :   params.addClassDescription("Calculate the wave speed as $E / \\sqrt{\\rho}$ where $E$ is the "
      25             :                              "effective stiffness, and $\\rho$ is the material density.");
      26          96 :   params.addParam<std::string>("base_name",
      27             :                                "Optional parameter that allows the user to define "
      28             :                                "multiple mechanics material systems on the same "
      29             :                                "block, i.e. for multiple phases");
      30             : 
      31          48 :   return params;
      32           0 : }
      33             : 
      34          36 : WaveSpeed::WaveSpeed(const InputParameters & parameters)
      35             :   : Material(parameters),
      36          36 :     _wave_speed(declareProperty<Real>("wave_speed")),
      37          72 :     _material_density(getMaterialPropertyByName<Real>("density")),
      38         108 :     _effective_stiffness(getMaterialPropertyByName<Real>("effective_stiffness"))
      39             : {
      40          36 : }
      41             : 
      42             : void
      43        4288 : WaveSpeed::computeQpProperties()
      44             : {
      45             :   // Effective stiffness is sqrt(equivalent_youngs_modulus)
      46        4288 :   _wave_speed[_qp] = _effective_stiffness[_qp] / std::sqrt(_material_density[_qp]);
      47        4288 : }

Generated by: LCOV version 1.14