LCOV - code coverage report
Current view: top level - src/materials - WaveSpeed.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #31405 (292dce) with base fef103 Lines: 13 14 92.9 %
Date: 2025-09-04 07:57:23 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          56 : WaveSpeed::validParams()
      22             : {
      23          56 :   InputParameters params = Material::validParams();
      24          56 :   params.addClassDescription("Calculate the wave speed as $E / \\sqrt{\\rho}$ where $E$ is the "
      25             :                              "effective stiffness, and $\\rho$ is the material density.");
      26         112 :   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          56 :   return params;
      32           0 : }
      33             : 
      34          42 : WaveSpeed::WaveSpeed(const InputParameters & parameters)
      35             :   : Material(parameters),
      36          42 :     _wave_speed(declareProperty<Real>("wave_speed")),
      37          84 :     _material_density(getMaterialPropertyByName<Real>("density")),
      38         126 :     _effective_stiffness(getMaterialPropertyByName<Real>("effective_stiffness"))
      39             : {
      40          42 : }
      41             : 
      42             : void
      43        5408 : WaveSpeed::computeQpProperties()
      44             : {
      45             :   // Effective stiffness is sqrt(equivalent_youngs_modulus)
      46        5408 :   _wave_speed[_qp] = _effective_stiffness[_qp] / std::sqrt(_material_density[_qp]);
      47        5408 : }

Generated by: LCOV version 1.14