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