https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
NonconservedAction Class Reference

#include <NonconservedAction.h>

Inheritance diagram for NonconservedAction:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 NonconservedAction (const InputParameters &params)
 
virtual void act ()
 
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
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (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
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) 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 ()
 

Public Attributes

const ConsoleStream _console
 

Static Public Attributes

static constexpr auto SYSTEM
 
static constexpr auto NAME
 

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 T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (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
 

Static Protected Member Functions

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

Protected Attributes

const NonlinearVariableName _var_name
 Name of the variable being created. More...
 
const libMesh::FEType _fe_type
 FEType for the variable being created. More...
 
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
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 

Detailed Description

Definition at line 18 of file NonconservedAction.h.

Constructor & Destructor Documentation

◆ NonconservedAction()

NonconservedAction::NonconservedAction ( const InputParameters params)

Definition at line 65 of file NonconservedAction.C.

66  : Action(params),
67  _var_name(name()),
68  _fe_type(Utility::string_to_enum<Order>(getParam<MooseEnum>("order")),
69  Utility::string_to_enum<libMesh::FEFamily>(getParam<MooseEnum>("family")))
70 {
71 }
Action(const InputParameters &parameters)
virtual const std::string & name() const
const libMesh::FEType _fe_type
FEType for the variable being created.
const NonlinearVariableName _var_name
Name of the variable being created.

Member Function Documentation

◆ act()

void NonconservedAction::act ( )
virtual

Implements Action.

Definition at line 74 of file NonconservedAction.C.

75 {
76  //
77  // Add variable
78  //
79  if (_current_task == "add_variable")
80  {
82  auto var_params = _factory.getValidParams(type);
83 
84  var_params.applySpecificParameters(_pars, {"family", "order", "block"});
85  var_params.set<std::vector<Real>>("scaling") = {getParam<Real>("scaling")};
86 
87  // Create nonconserved variable
88  _problem->addVariable(type, _var_name, var_params);
89  }
90 
91  //
92  // Add Kernels
93  //
94  else if (_current_task == "add_kernel")
95  {
96  // Add time derivative kernel
97  std::string kernel_type = "TimeDerivative";
98 
99  std::string kernel_name = _var_name + "_" + kernel_type;
100  InputParameters params1 = _factory.getValidParams(kernel_type);
101  params1.set<NonlinearVariableName>("variable") = _var_name;
102  params1.applyParameters(parameters());
103 
104  _problem->addKernel(kernel_type, kernel_name, params1);
105 
106  // Add AllenCahn kernel
107  kernel_type = "AllenCahn";
108 
109  kernel_name = _var_name + "_" + kernel_type;
110  InputParameters params2 = _factory.getValidParams(kernel_type);
111  params2.set<NonlinearVariableName>("variable") = _var_name;
112  params2.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
113  params2.set<MaterialPropertyName>("f_name") = getParam<MaterialPropertyName>("free_energy");
114  params2.applyParameters(parameters());
115 
116  _problem->addKernel(kernel_type, kernel_name, params2);
117 
118  // Add ACInterface kernel
119  kernel_type = "ACInterface";
120 
121  kernel_name = _var_name + "_" + kernel_type;
122  InputParameters params3 = _factory.getValidParams(kernel_type);
123  params3.set<NonlinearVariableName>("variable") = _var_name;
124  params3.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mobility");
125  params3.set<MaterialPropertyName>("kappa_name") = getParam<MaterialPropertyName>("kappa");
126  params3.set<bool>("variable_L") = getParam<bool>("variable_mobility");
127  params3.applyParameters(parameters());
128 
129  _problem->addKernel(kernel_type, kernel_name, params3);
130  }
131 }
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)
Factory & _factory
const std::string & type() const
const std::string & _current_task
static std::string variableType(const libMesh::FEType &fe_type, const bool is_fv=false, const bool is_array=false)
const libMesh::FEType _fe_type
FEType for the variable being created.
const InputParameters & _pars
std::shared_ptr< FEProblemBase > & _problem
const InputParameters & parameters() const
const NonlinearVariableName _var_name
Name of the variable being created.

◆ validParams()

InputParameters NonconservedAction::validParams ( )
static

Definition at line 28 of file NonconservedAction.C.

29 {
31  params.addClassDescription(
32  "Set up the variable and the kernels needed for a non-conserved phase field variable");
33  // Get MooseEnums for the possible order/family options for this variable
36  params.addParam<MooseEnum>("family",
37  families,
38  "Specifies the family of FE "
39  "shape functions to use for this variable");
40  params.addParam<MooseEnum>("order",
41  orders,
42  "Specifies the order of the FE "
43  "shape function to use for this variable");
44  params.addParam<Real>("scaling", 1.0, "Specifies a scaling factor to apply to this variable");
45  params.addParam<bool>("implicit", true, "Whether kernels are implicit or not");
46  params.addParam<bool>(
47  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
48  params.addParamNamesToGroup("scaling implicit use_displaced_mesh", "Advanced");
49  params.addParam<MaterialPropertyName>("mobility", "L", "The mobility used with the kernel");
50  params.addCoupledVar("args", "Vector of nonlinear variable arguments this kernel depends on");
51  params.deprecateCoupledVar("args", "coupled_variables", "02/27/2024");
52  params.addRequiredParam<MaterialPropertyName>(
53  "free_energy", "Base name of the free energy function F defined in a free energy material");
54  params.addParam<MaterialPropertyName>("kappa", "kappa_op", "The kappa used with the kernel");
55  params.addParam<bool>("variable_mobility",
56  true,
57  "The mobility is a function of any MOOSE variable (if "
58  "this is set to false, L must be constant over the "
59  "entire domain!)");
60  params.addParam<std::vector<SubdomainName>>(
61  "block", {}, "Block restriction for the variables and kernels");
62  return params;
63 }
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static MooseEnum getNonlinearVariableFamilies()
static InputParameters validParams()
static MooseEnum getNonlinearVariableOrders()
void deprecateCoupledVar(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)

Member Data Documentation

◆ _fe_type

const libMesh::FEType NonconservedAction::_fe_type
protected

FEType for the variable being created.

Definition at line 31 of file NonconservedAction.h.

Referenced by act().

◆ _var_name

const NonlinearVariableName NonconservedAction::_var_name
protected

Name of the variable being created.

Definition at line 29 of file NonconservedAction.h.

Referenced by act().


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