https://mooseframework.inl.gov
SolutionAuxMisorientationBoundary.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 
10 #include "MooseError.h"
12 #include "SolutionUserObject.h"
13 #include "BndsCalculator.h"
14 
16 
19 {
21  params.addClassDescription(
22  "Calculate location of grain boundaries by using information from a SolutionUserObject.");
24  "v", "var_name_base", "op_num", "Array of coupled variables");
25  params.addRequiredParam<Real>("gb_type_order",
26  "The grain boundary type to calculate bnds parameter");
27  return params;
28 }
29 
31  const InputParameters & parameters)
32  : SolutionAux(parameters),
33  _gb_type_order(getParam<Real>("gb_type_order")),
34  _op_num(coupledComponents("v")),
35  _vals(coupledValues("v"))
36 {
37 }
38 
39 Real
41 {
42  // The value to output
43  Real output_gb_type;
44 
45  // _direct=true, extract the values using the dof
46  if (_direct)
47  {
48  if (isNodal())
50  else
52  }
53  // _direct=false, extract the values using time and point
54  else
55  {
56  if (isNodal())
58  else
59  output_gb_type = _solution_object.pointValue(_t, _current_elem->vertex_average(), _var_name);
60  }
61 
62  // generate different GB boundary parameters
63  auto gb_type_shift = abs(output_gb_type - _gb_type_order);
64  if (abs(output_gb_type - 0) < 1e-3)
65  return 1.0;
66  else if (gb_type_shift < 1e-3)
68  else
69  return gb_type_shift + (1 - gb_type_shift) * BndsCalculator::computeBndsVariable(_vals, _qp);
70 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
AuxKernel for reading a solution from file and visualizing the location of grain boundaries for speci...
static InputParameters validParams()
const Node *const & _current_node
virtual Real computeValue() override
Computes a value for a node or element depending on the type of kernel, it also uses the &#39;direct&#39; fla...
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::string _var_name
Real computeBndsVariable(const std::vector< T *> &var, unsigned int qp)
Real _gb_type_order
The grain boundary type to calculate bnds parameter.
const SolutionUserObjectBase & _solution_object
const std::vector< const VariableValue * > _vals
SolutionAuxMisorientationBoundary(const InputParameters &parameters)
Real directValue(const Node *node, const std::string &var_name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addRequiredCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
const Elem *const & _current_elem
unsigned int _qp
void addClassDescription(const std::string &doc_string)
registerMooseObject("PhaseFieldApp", SolutionAuxMisorientationBoundary)
Real pointValue(Real t, const Point &p, const unsigned int local_var_index, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
bool isNodal() const