www.mooseframework.org
CHPFCRFFSplitKernelAction.C
Go to the documentation of this file.
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 
11 #include "Factory.h"
12 #include "Conversion.h"
13 #include "FEProblem.h"
14 
15 registerMooseAction("PhaseFieldApp", CHPFCRFFSplitKernelAction, "add_kernel");
16 
19 {
21  params.addRequiredParam<unsigned int>(
22  "num_L", "specifies the number of complex L variables will be solved for");
23  params.addRequiredParam<NonlinearVariableName>("n_name", "Variable name used for the n variable");
24  params.addRequiredParam<std::string>("L_name_base", "Base name for the complex L variables");
25  params.addParam<MaterialPropertyName>("mob_name", "M", "The mobility used for n in this model");
26  MooseEnum log_options("tolerance cancelation expansion");
28  "log_approach", log_options, "Which approach will be used to handle the natural log");
29  params.addParam<Real>("tol", 1.0e-9, "Tolerance used when the tolerance approach is chosen");
30  params.addParam<Real>(
31  "n_exp_terms", 4.0, "Number of terms used in the Taylor expansion of the natural log term");
32  params.addParam<bool>(
33  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
34  return params;
35 }
36 
38  : Action(params),
39  _num_L(getParam<unsigned int>("num_L")),
40  _L_name_base(getParam<std::string>("L_name_base")),
41  _n_name(getParam<NonlinearVariableName>("n_name"))
42 {
43 }
44 
45 void
47 {
48  // Create the two kernels required for the n_variable, starting with the time derivative
49  InputParameters poly_params = _factory.getValidParams("TimeDerivative");
50  poly_params.set<NonlinearVariableName>("variable") = _n_name;
51  poly_params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
52  _problem->addKernel("TimeDerivative", "IE_n", poly_params);
53 
54  // First, we have to create the vector containing the names of the real L variables
55  std::vector<VariableName> real_v(_num_L);
56  for (unsigned int l = 0; l < _num_L; ++l)
57  real_v[l] = _L_name_base + Moose::stringify(l) + "_real";
58 
59  // CHPFCRFF kernel
60  poly_params = _factory.getValidParams("CHPFCRFF");
61  poly_params.applyParameters(parameters());
62  poly_params.set<NonlinearVariableName>("variable") = _n_name;
63  poly_params.set<std::vector<VariableName>>("v") = real_v;
64  _problem->addKernel("CHPFCRFF", "CH_bulk_n", poly_params);
65 }
const NonlinearVariableName _n_name
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
void applyParameters(const InputParameters &common, const std::vector< std::string > &exclude={}, const bool allow_private=false)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Factory & _factory
registerMooseAction("PhaseFieldApp", CHPFCRFFSplitKernelAction, "add_kernel")
static InputParameters validParams()
CHPFCRFFSplitKernelAction(const InputParameters &params)
std::string stringify(const T &t)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::shared_ptr< FEProblemBase > & _problem
const InputParameters & parameters() const
void ErrorVector unsigned int
static InputParameters validParams()