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 
17 template <>
18 InputParameters
20 {
21  InputParameters params = validParams<Action>();
22  params.addRequiredParam<unsigned int>(
23  "num_L", "specifies the number of complex L variables will be solved for");
24  params.addRequiredParam<NonlinearVariableName>("n_name", "Variable name used for the n variable");
25  params.addRequiredParam<std::string>("L_name_base", "Base name for the complex L variables");
26  params.addParam<MaterialPropertyName>("mob_name", "M", "The mobility used for n in this model");
27  MooseEnum log_options("tolerance cancelation expansion");
28  params.addRequiredParam<MooseEnum>(
29  "log_approach", log_options, "Which approach will be used to handle the natural log");
30  params.addParam<Real>("tol", 1.0e-9, "Tolerance used when the tolerance approach is chosen");
31  params.addParam<Real>(
32  "n_exp_terms", 4.0, "Number of terms used in the Taylor expansion of the natural log term");
33  params.addParam<bool>(
34  "use_displaced_mesh", false, "Whether to use displaced mesh in the kernels");
35  return params;
36 }
37 
39  : Action(params),
40  _num_L(getParam<unsigned int>("num_L")),
41  _L_name_base(getParam<std::string>("L_name_base")),
42  _n_name(getParam<NonlinearVariableName>("n_name"))
43 {
44 }
45 
46 void
48 {
49  // Create the two kernels required for the n_variable, starting with the time derivative
50  InputParameters poly_params = _factory.getValidParams("TimeDerivative");
51  poly_params.set<NonlinearVariableName>("variable") = _n_name;
52  poly_params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
53  _problem->addKernel("TimeDerivative", "IE_n", poly_params);
54 
55  // First, we have to create the vector containing the names of the real L variables
56  std::vector<VariableName> real_v(_num_L);
57  for (unsigned int l = 0; l < _num_L; ++l)
58  real_v[l] = _L_name_base + Moose::stringify(l) + "_real";
59 
60  // CHPFCRFF kernel
61  poly_params = _factory.getValidParams("CHPFCRFF");
62  poly_params.applyParameters(parameters());
63  poly_params.set<NonlinearVariableName>("variable") = _n_name;
64  poly_params.set<std::vector<VariableName>>("v") = real_v;
65  _problem->addKernel("CHPFCRFF", "CH_bulk_n", poly_params);
66 }
validParams< CHPFCRFFSplitKernelAction >
InputParameters validParams< CHPFCRFFSplitKernelAction >()
Definition: CHPFCRFFSplitKernelAction.C:19
CHPFCRFFSplitKernelAction::act
virtual void act()
Definition: CHPFCRFFSplitKernelAction.C:47
CHPFCRFFSplitKernelAction.h
CHPFCRFFSplitKernelAction::_n_name
const NonlinearVariableName _n_name
Definition: CHPFCRFFSplitKernelAction.h:33
CHPFCRFFSplitKernelAction
Definition: CHPFCRFFSplitKernelAction.h:23
CHPFCRFFSplitKernelAction::_L_name_base
const std::string _L_name_base
Definition: CHPFCRFFSplitKernelAction.h:32
registerMooseAction
registerMooseAction("PhaseFieldApp", CHPFCRFFSplitKernelAction, "add_kernel")
CHPFCRFFSplitKernelAction::CHPFCRFFSplitKernelAction
CHPFCRFFSplitKernelAction(const InputParameters &params)
Definition: CHPFCRFFSplitKernelAction.C:38
CHPFCRFFSplitKernelAction::_num_L
const unsigned int _num_L
Definition: CHPFCRFFSplitKernelAction.h:31