https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PoroMechanicsAction.C
Go to the documentation of this file.
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 "PoroMechanicsAction.h"
11
12#include "Factory.h"
13#include "FEProblem.h"
14#include "Parser.h"
15#include "Conversion.h"
16
17registerMooseAction("SolidMechanicsApp", PoroMechanicsAction, "setup_mesh_complete");
18
19registerMooseAction("SolidMechanicsApp", PoroMechanicsAction, "validate_coordinate_systems");
20
21registerMooseAction("SolidMechanicsApp", PoroMechanicsAction, "add_kernel");
22
25{
27 params.addRequiredParam<VariableName>("porepressure", "The pore pressure variable");
28 params.addClassDescription("Adds the poro-mechanics coupling term");
29 return params;
30}
31
34{
35 if (_use_ad)
36 paramError("use_ad", "AD not setup for use with PoroMechanicsAction");
37}
38
39void
41{
43
44 if (_current_task == "add_kernel")
45 {
46 // Prepare displacements and set value for dim
47 std::vector<VariableName> displacements = getParam<std::vector<VariableName>>("displacements");
48 unsigned int dim = displacements.size();
49
50 // all the kernels added below have pore pressure as a coupled variable
51 // add this to the kernel's params
52 std::string type("PoroMechanicsCoupling");
54 VariableName pp_var(getParam<VariableName>("porepressure"));
55 params.addCoupledVar("porepressure", "");
56 params.set<std::vector<VariableName>>("porepressure") = {pp_var};
57
58 // now add the kernels
59 for (unsigned int i = 0; i < dim; ++i)
60 {
61 std::string kernel_name = "PoroMechanics" + Moose::stringify(i);
62
63 params.set<unsigned int>("component") = i;
64 params.set<NonlinearVariableName>("variable") = displacements[i];
65
66 _problem->addKernel(type, kernel_name, params);
67 }
68 }
69}
registerMooseAction("SolidMechanicsApp", PoroMechanicsAction, "setup_mesh_complete")
unsigned int dim
std::shared_ptr< FEProblemBase > & _problem
const std::string & _current_task
InputParameters getValidParams(const std::string &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void addCoupledVar(const std::string &name, const std::string &doc_string)
const std::string & type() const
void paramError(const std::string &param, Args... args) const
Factory & _factory
static InputParameters validParams()
PoroMechanicsAction(const InputParameters &params)
std::string stringify(const T &t)