https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ConservedAction Class Reference

#include <ConservedAction.h>

Inheritance diagram for ConservedAction:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 ConservedAction (const InputParameters &params)
 
virtual void act () override
 
void timedAct ()
 
virtual void addRelationshipManagers (Moose::RelationshipManagerType when_type)
 
MooseObjectName uniqueActionName () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
void appendTask (const std::string &task)
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string unique_action_name_param
 
static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Types

enum class  SolveType { DIRECT , REVERSE_SPLIT , FORWARD_SPLIT }
 Type of solve. More...
 

Protected Member Functions

bool addRelationshipManagers (Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
 
void associateWithParameter (const std::string &param_name, InputParameters &params) const
 
void associateWithParameter (const InputParameters &from_params, const std::string &param_name, InputParameters &params) const
 
const TgetMeshProperty (const std::string &data_name, const std::string &prefix)
 
const TgetMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

std::string _chempot_name
 Name of chemical potential variable for split solves.
 
const SolveType _solve_type
 Type of solve to use used in the action.
 
const NonlinearVariableName _var_name
 Name of the variable being created.
 
libMesh::FEType _fe_type
 FEType for the variable being created.
 
const Real _scaling
 Scaling parameter.
 
std::string _registered_identifier
 
std::string _specific_task_name
 
std::set< std::string > _all_tasks
 
ActionWarehouse_awh
 
const std::string & _current_task
 
std::shared_ptr< MooseMesh > & _mesh
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 
PerfID _act_timer
 
MooseApp_app
 
Factory_factory
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 

Private Member Functions

bool addRelationshipManager (Moose::RelationshipManagerType input_rm_type, const InputParameters &moose_object_pars, std::string rm_name, Moose::RelationshipManagerType rm_type, Moose::RelationshipManagerInputParameterCallback rm_input_parameter_func, Moose::RMSystemType sys_type=Moose::RMSystemType::NONE)
 
virtual std::string meshPropertyPrefix (const std::string &data_name) const
 
const RestartableDataValuegetMeshPropertyInternal (const std::string &data_name, const std::string &prefix) const
 
void mooseErrorInternal (Args &&... args) const
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

const ParallelParamObject_parent
 
MooseApp_meta_data_app
 
const MooseObject *const _meta_data_object
 
const MooseBase_si_moose_base
 
const FEProblemBase_si_problem
 

Detailed Description

Definition at line 16 of file ConservedAction.h.

Member Enumeration Documentation

◆ SolveType

enum class ConservedAction::SolveType
strongprotected

Type of solve.

Enumerator
DIRECT 
REVERSE_SPLIT 
FORWARD_SPLIT 

Definition at line 27 of file ConservedAction.h.

Constructor & Destructor Documentation

◆ ConservedAction()

ConservedAction::ConservedAction ( const InputParameters params)

Definition at line 65 of file ConservedAction.C.

66 : Action(params),
67 _solve_type(getParam<MooseEnum>("solve_type").getEnum<SolveType>()),
68 _var_name(name()),
69 _scaling(getParam<Real>("scaling"))
70{
71 switch (_solve_type)
72 {
74 _fe_type = FEType(Utility::string_to_enum<Order>("THIRD"),
75 Utility::string_to_enum<FEFamily>("HERMITE"));
76 if (!parameters().isParamSetByAddParam("order") &&
77 !parameters().isParamSetByAddParam("family"))
78 mooseWarning("Order and family autoset to third and hermite in ConservedAction");
79 break;
82 _fe_type = FEType(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
83 Utility::string_to_enum<FEFamily>(getParam<MooseEnum>("family")));
84 // Set name of chemical potential variable
85 _chempot_name = "chem_pot_" + _var_name;
86 break;
87 default:
88 paramError("solve_type", "Incorrect solve_type in ConservedAction");
89 }
90}
std::string _chempot_name
Name of chemical potential variable for split solves.
const NonlinearVariableName _var_name
Name of the variable being created.
const Real _scaling
Scaling parameter.
const SolveType _solve_type
Type of solve to use used in the action.
libMesh::FEType _fe_type
FEType for the variable being created.
const InputParameters & parameters() const
const std::string & name() const
void paramError(const std::string &param, Args... args) const
void mooseWarning(Args &&... args) const

Member Function Documentation

◆ act()

void ConservedAction::act ( )
overridevirtual

Implements Action.

Definition at line 93 of file ConservedAction.C.

94{
95 //
96 // Add variable(s)
97 //
98 if (_current_task == "add_variable")
99 {
101 auto var_params = _factory.getValidParams(type);
102 var_params.set<MooseEnum>("family") = Moose::stringify(_fe_type.family);
103 var_params.set<MooseEnum>("order") = _fe_type.order.get_order();
104 var_params.set<std::vector<Real>>("scaling") = {_scaling};
105 var_params.applySpecificParameters(parameters(), {"block"});
106
107 // Create conserved variable _var_name
108 _problem->addVariable(type, _var_name, var_params);
109
110 // Create chemical potential variable for split form
111 switch (_solve_type)
112 {
114 break;
117 _problem->addVariable(type, _chempot_name, var_params);
118 }
119 }
120
121 //
122 // Add Kernels
123 //
124 else if (_current_task == "add_kernel")
125 {
126 switch (_solve_type)
127 {
129 // Add time derivative kernel
130 {
131 std::string kernel_type = "TimeDerivative";
132
133 std::string kernel_name = _var_name + "_" + kernel_type;
134 InputParameters params = _factory.getValidParams(kernel_type);
135 params.set<NonlinearVariableName>("variable") = _var_name;
136 params.applyParameters(parameters());
137
138 _problem->addKernel(kernel_type, kernel_name, params);
139 }
140
141 // Add CahnHilliard kernel
142 {
143 std::string kernel_type = "CahnHilliard";
144
145 std::string kernel_name = _var_name + "_" + kernel_type;
146 InputParameters params = _factory.getValidParams(kernel_type);
147 params.set<NonlinearVariableName>("variable") = _var_name;
148 params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
149 params.set<MaterialPropertyName>("f_name") =
150 getParam<MaterialPropertyName>("free_energy");
151 params.applyParameters(parameters());
152
153 _problem->addKernel(kernel_type, kernel_name, params);
154 }
155
156 // Add ACInterface kernel
157 {
158 std::string kernel_type = "CHInterface";
159
160 std::string kernel_name = _var_name + "_" + kernel_type;
161 InputParameters params = _factory.getValidParams(kernel_type);
162 params.set<NonlinearVariableName>("variable") = _var_name;
163 params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
164 params.set<MaterialPropertyName>("kappa_name") = getParam<MaterialPropertyName>("kappa");
165 params.applyParameters(parameters());
166
167 _problem->addKernel(kernel_type, kernel_name, params);
168 }
169 break;
170
172 // Add time derivative kernel
173 {
174 std::string kernel_type = "CoupledTimeDerivative";
175
176 std::string kernel_name = _var_name + "_" + kernel_type;
177 InputParameters params = _factory.getValidParams(kernel_type);
178 params.set<NonlinearVariableName>("variable") = _chempot_name;
179 params.set<std::vector<VariableName>>("v") = {_var_name};
180 params.applyParameters(parameters());
181
182 _problem->addKernel(kernel_type, kernel_name, params);
183 }
184
185 // Add SplitCHWRes kernel
186 {
187 std::string kernel_type = "SplitCHWRes";
188
189 std::string kernel_name = _var_name + "_" + kernel_type;
190 InputParameters params = _factory.getValidParams(kernel_type);
191 params.set<NonlinearVariableName>("variable") = _chempot_name;
192 params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
193 params.applyParameters(parameters());
194
195 _problem->addKernel(kernel_type, kernel_name, params);
196 }
197
198 // Add SplitCHParsed kernel
199 {
200 std::string kernel_type = "SplitCHParsed";
201
202 std::string kernel_name = _var_name + "_" + kernel_type;
203 InputParameters params = _factory.getValidParams(kernel_type);
204 params.set<NonlinearVariableName>("variable") = _var_name;
205 params.set<std::vector<VariableName>>("w") = {_chempot_name};
206 params.set<MaterialPropertyName>("f_name") =
207 getParam<MaterialPropertyName>("free_energy");
208 params.set<MaterialPropertyName>("kappa_name") = getParam<MaterialPropertyName>("kappa");
209 params.applyParameters(parameters());
210
211 _problem->addKernel(kernel_type, kernel_name, params);
212 }
213 break;
214
216 // Add time derivative kernel
217 {
218 std::string kernel_type = "TimeDerivative";
219
220 std::string kernel_name = _var_name + "_" + kernel_type;
221 InputParameters params = _factory.getValidParams(kernel_type);
222 params.set<NonlinearVariableName>("variable") = _var_name;
223 params.applyParameters(parameters());
224
225 _problem->addKernel(kernel_type, kernel_name, params);
226 }
227
228 // Add MatDiffusion kernel for c residual
229 {
230 std::string kernel_type = "MatDiffusion";
231
232 std::string kernel_name = _var_name + "_" + kernel_type;
233 InputParameters params = _factory.getValidParams(kernel_type);
234 params.set<NonlinearVariableName>("variable") = _var_name;
235 params.set<std::vector<VariableName>>("v") = {_chempot_name};
236 params.set<MaterialPropertyName>("diffusivity") =
237 getParam<MaterialPropertyName>("mobility");
238 params.applyParameters(parameters());
239
240 _problem->addKernel(kernel_type, kernel_name, params);
241 }
242 // Add MatDiffusion kernel for chemical potential residual
243 {
244 std::string kernel_type = "MatDiffusion";
245
246 std::string kernel_name = _chempot_name + "_" + kernel_type;
247 InputParameters params = _factory.getValidParams(kernel_type);
248 params.set<NonlinearVariableName>("variable") = _chempot_name;
249 params.set<std::vector<VariableName>>("v") = {_var_name};
250 params.set<MaterialPropertyName>("diffusivity") = getParam<MaterialPropertyName>("kappa");
251 params.applyParameters(parameters());
252
253 _problem->addKernel(kernel_type, kernel_name, params);
254 }
255
256 // Add CoupledMaterialDerivative kernel
257 {
258 std::string kernel_type = "CoupledMaterialDerivative";
259
260 std::string kernel_name = _chempot_name + "_" + kernel_type;
261 InputParameters params = _factory.getValidParams(kernel_type);
262 params.set<NonlinearVariableName>("variable") = _chempot_name;
263 params.set<std::vector<VariableName>>("v") = {_var_name};
264 params.set<MaterialPropertyName>("f_name") =
265 getParam<MaterialPropertyName>("free_energy");
266 params.applyParameters(parameters());
267
268 _problem->addKernel(kernel_type, kernel_name, params);
269 }
270
271 // Add CoefReaction kernel
272 {
273 std::string kernel_type = "CoefReaction";
274
275 std::string kernel_name = _chempot_name + "_" + kernel_type;
276 InputParameters params = _factory.getValidParams(kernel_type);
277 params.set<NonlinearVariableName>("variable") = _chempot_name;
278 params.set<Real>("coefficient") = -1.0;
279 params.applyParameters(parameters());
280
281 _problem->addKernel(kernel_type, kernel_name, params);
282 }
283 }
284 }
285}
std::shared_ptr< FEProblemBase > & _problem
const std::string & _current_task
static std::string variableType(const libMesh::FEType &fe_type, const bool is_fv=false, const bool is_array=false)
T & set(const std::string &name, bool quiet_mode=false)
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
const std::string & type() const
Factory & _factory
OrderWrapper order
std::string stringify(const T &t)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ validParams()

InputParameters ConservedAction::validParams ( )
static

Definition at line 28 of file ConservedAction.C.

29{
32 "Set up the variable(s) and the kernels needed for a conserved phase field variable."
33 " Note that for a direct solve, the element family and order are overwritten with hermite "
34 "and third.");
35 MooseEnum solves("DIRECT REVERSE_SPLIT FORWARD_SPLIT");
36 params.addRequiredParam<MooseEnum>("solve_type", solves, "Split or direct solve?");
37 // Get MooseEnums for the possible order/family options for this variable
40 params.addParam<MooseEnum>("family",
41 families,
42 "Specifies the family of FE "
43 "shape functions to use for this variable");
44 params.addParam<MooseEnum>("order",
45 orders,
46 "Specifies the order of the FE "
47 "shape function to use for this variable");
48 params.addParam<Real>("scaling", 1.0, "Specifies a scaling factor to apply to this variable");
49 params.addParam<bool>("implicit", true, "Whether kernels are implicit or not");
50 params.addParam<bool>(
51 "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
52 params.addParamNamesToGroup("scaling implicit use_displaced_mesh", "Advanced");
53 params.addRequiredParam<MaterialPropertyName>("mobility", "The mobility used with the kernel");
54 params.addCoupledVar("coupled_variables",
55 "Vector of nonlinear variable arguments this kernel depends on");
56
57 params.addRequiredParam<MaterialPropertyName>(
58 "free_energy", "Base name of the free energy function F defined in a free energy material");
59 params.addRequiredParam<MaterialPropertyName>("kappa", "The kappa used with the kernel");
60 params.addParam<std::vector<SubdomainName>>(
61 "block", {}, "Block restriction for the variables and kernels");
62 return params;
63}
static InputParameters validParams()
static MooseEnum getNonlinearVariableFamilies()
static MooseEnum getNonlinearVariableOrders()
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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)
void addCoupledVar(const std::string &name, const std::string &doc_string)

Member Data Documentation

◆ _chempot_name

std::string ConservedAction::_chempot_name
protected

Name of chemical potential variable for split solves.

Definition at line 34 of file ConservedAction.h.

Referenced by act(), and ConservedAction().

◆ _fe_type

libMesh::FEType ConservedAction::_fe_type
protected

FEType for the variable being created.

Definition at line 40 of file ConservedAction.h.

Referenced by act(), and ConservedAction().

◆ _scaling

const Real ConservedAction::_scaling
protected

Scaling parameter.

Definition at line 42 of file ConservedAction.h.

Referenced by act().

◆ _solve_type

const SolveType ConservedAction::_solve_type
protected

Type of solve to use used in the action.

Definition at line 36 of file ConservedAction.h.

Referenced by act(), and ConservedAction().

◆ _var_name

const NonlinearVariableName ConservedAction::_var_name
protected

Name of the variable being created.

Definition at line 38 of file ConservedAction.h.

Referenced by act(), and ConservedAction().


The documentation for this class was generated from the following files: