LCOV - code coverage report
Current view: top level - src/actions - MaterialVectorBodyForceAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose tensor_mechanics: d6b47a Lines: 23 24 95.8 %
Date: 2024-02-27 11:53:14 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://www.mooseframework.org
       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 "MaterialVectorBodyForceAction.h"
      11             : #include "Factory.h"
      12             : #include "FEProblem.h"
      13             : #include "Conversion.h"
      14             : 
      15             : registerMooseAction("TensorMechanicsApp", MaterialVectorBodyForceAction, "add_kernel");
      16             : 
      17             : InputParameters
      18           6 : MaterialVectorBodyForceAction::validParams()
      19             : {
      20           6 :   InputParameters params = Action::validParams();
      21           6 :   params.addClassDescription("Set up volumetric body force kernels");
      22             : 
      23          12 :   params.addParam<std::vector<SubdomainName>>("block",
      24             :                                               "The block ids where the body force will be applied");
      25             : 
      26          12 :   params.addParam<std::vector<VariableName>>(
      27             :       "displacements",
      28             :       {},
      29             :       "The displacements appropriate for the simulation geometry and coordinate system");
      30             : 
      31          12 :   params.addParam<FunctionName>(
      32             :       "function", "1", "Function to scale the coupled body force vector property");
      33          12 :   params.addParam<Real>(
      34          12 :       "hht_alpha", 0.0, "alpha parameter required for HHT time integration scheme");
      35          12 :   params.addRequiredParam<MaterialPropertyName>("body_force", "Force per unit volume vector");
      36           6 :   return params;
      37           0 : }
      38             : 
      39           6 : MaterialVectorBodyForceAction::MaterialVectorBodyForceAction(const InputParameters & params)
      40           6 :   : Action(params)
      41             : {
      42           6 : }
      43             : 
      44             : void
      45           6 : MaterialVectorBodyForceAction::act()
      46             : {
      47           6 :   std::string kernel_type = "MaterialVectorBodyForce";
      48             : 
      49          18 :   auto displacements = getParam<std::vector<VariableName>>("displacements");
      50          21 :   for (const auto & disp : displacements)
      51             :   {
      52          15 :     InputParameters params = _factory.getValidParams(kernel_type);
      53          15 :     params.applyParameters(parameters());
      54          30 :     params.set<NonlinearVariableName>("variable") = disp;
      55          15 :     _problem->addKernel(kernel_type, _name + "_" + disp, params);
      56          15 :   }
      57          12 : }

Generated by: LCOV version 1.14