https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PressureAction.h
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#pragma once
11
12#include "Action.h"
13
19#define stringifyName(name) #name
20#define registerMoosePressureAction(appname, bc_class, action_class) \
21 action_class::action_class(const InputParameters & params) \
22 : PressureActionBase(params, stringifyName(bc_class), "AD" stringifyName(bc_class)) \
23 { \
24 } \
25 InputParameters action_class::validParams() \
26 { \
27 auto params = PressureActionBase::validParams<bc_class>(); \
28 params.addClassDescription( \
29 "Set up pressure boundary condition using the " stringifyName(bc_class) " object."); \
30 return params; \
31 } \
32 registerMooseAction(appname, action_class, "add_bc")
33
34#define declareMoosePressureAction(bc_class, action_class) \
35 class action_class : public PressureActionBase \
36 { \
37 public: \
38 action_class(const InputParameters & params); \
39 static InputParameters validParams(); \
40 }
41
48{
49public:
50 template <class T>
52
54 const std::string & non_ad_pressure_bc_type,
55 const std::string & ad_pressure_bc_type);
56
57 virtual void act() override;
58
59protected:
60 const std::string _non_ad_pressure_bc_type;
61 const std::string _ad_pressure_bc_type;
62
64 const bool _use_ad;
65
66 const std::vector<std::vector<AuxVariableName>> _save_in_vars;
67 const std::vector<bool> _has_save_in_vars;
68};
69
70template <class T>
73{
75 params += T::actionParams();
76
77 params.addParam<std::vector<BoundaryName>>(
78 "boundary", "The list of boundaries (ids or names) from the mesh where this object applies");
79
80 params.addClassDescription("Set up Pressure boundary conditions");
81 params.addParam<bool>("use_automatic_differentiation",
82 false,
83 "Flag to use automatic differentiation (AD) objects when possible");
84
85 // To make controlling the Pressure BCs easier
86 params.addParam<bool>(
87 "enable",
88 true,
89 "Set the enabled status of the BCs created by the Pressure action (defaults to true).");
90 params.declareControllable("enable");
91
92 // Residual output
93 params.addParam<std::vector<AuxVariableName>>(
94 "save_in_disp_x", {}, "The save_in variables for x displacement");
95 params.addParam<std::vector<AuxVariableName>>(
96 "save_in_disp_y", {}, "The save_in variables for y displacement");
97 params.addParam<std::vector<AuxVariableName>>(
98 "save_in_disp_z", {}, "The save_in variables for z displacement");
99 params.addParam<std::vector<TagName>>("extra_vector_tags",
100 "The extra tags for the vectors this Kernel should fill");
101 params.addParam<std::vector<TagName>>(
102 "absolute_value_vector_tags",
103 "The tags for the vectors this residual object should fill with the "
104 "absolute value of the residual contribution");
105
106 params.addParam<bool>(
107 "use_displaced_mesh",
108 "Whether or not this object should use the displaced mesh for computation. Note that in "
109 "the case this is true but no displacements are provided in the Mesh block the undisplaced "
110 "mesh will still be used. For small strain formulations pressure should be applied to the "
111 "undisplaced mesh to obtain agreement with analytical benchmark solutions.");
112
114 "save_in_disp_x save_in_disp_y save_in_disp_z extra_vector_tags absolute_value_vector_tags",
115 "Residual output");
116 return params;
117}
static InputParameters validParams()
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Pressure boundary condition action template.
const bool _use_ad
Flag to use automatic differentiation.
const std::vector< std::vector< AuxVariableName > > _save_in_vars
static InputParameters validParams()
virtual void act() override
const std::string _non_ad_pressure_bc_type
const std::string _ad_pressure_bc_type
const std::vector< bool > _has_save_in_vars